X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameTick.cpp;h=1212558afa37c9454ef105934f354653b8592872;hb=05bb66bd0e8da7c6d4ace54a6af58ce625bac2f6;hp=73b815b13347470d79770d83d2ad737d84df4fa0;hpb=36cc3af3e5074215817ddee16defde754e2ad67f;p=lugaru.git diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 73b815b..1212558 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1,4 +1,32 @@ +/* +Copyright (C) 2003, 2010 - Wolfire Games + +This file is part of Lugaru. + +Lugaru is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#if PLATFORM_UNIX +#include +#include +#include +#else #include +#endif + #include #include "Game.h" @@ -196,8 +224,8 @@ extern float accountcampaigntime[10]; extern int accountcampaignchoicesmade[10]; extern int accountcampaignchoices[10][5000]; /********************> Tick() <*****/ -extern FSOUND_STREAM * strm[10]; -extern "C" void PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); +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 void ScreenShot(const char * fname); @@ -208,17 +236,22 @@ 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; - GraphicsExportComponent QT_exporter; + /*FSSpec MAC_file; + GraphicsExportComponent QT_exporter; OSErr MAC_error_code; CGrafPtr MAC_currentPort; GDHandle MAC_currentDevice; unsigned char* MAC_pixels; Rect MAC_picture_rectangle; - GWorldPtr MAC_offscreen_graphics_port; + GWorldPtr MAC_offscreen_graphics_port; static int numscreenshots=0; @@ -279,7 +312,7 @@ void Screenshot (void) // Get the GWorld - GWorldPtr MAC_gWorld = (CGrafPtr) FrontWindow(); + GWorldPtr MAC_gWorld = (CGrafPtr) FrontWindow(); //assert(MAC_gWorld != NULL); // Allocate memory for loading image @@ -290,18 +323,18 @@ void Screenshot (void) } // Get GWorld - ::GetGWorld(&MAC_currentPort, &MAC_currentDevice); + ::GetGWorld(&MAC_currentPort, &MAC_currentDevice); // Make a picture Rectangle MAC_picture_rectangle.left = 0; MAC_picture_rectangle.right = screenwidth; MAC_picture_rectangle.top = 0; - MAC_picture_rectangle.bottom = screenheight; + MAC_picture_rectangle.bottom = screenheight; // Create new offscreen GWorld MAC_error_code = ::QTNewGWorldFromPtr (&MAC_offscreen_graphics_port, k32ARGBPixelFormat, &MAC_picture_rectangle, NULL, NULL, 0, (char *) MAC_pixels, screenwidth * 4); if (MAC_error_code) { - ::SetGWorld(MAC_currentPort, MAC_currentDevice); + ::SetGWorld(MAC_currentPort, MAC_currentDevice); delete MAC_pixels; //UTIL_Error("Could not create offscreen GWorld. "); return; @@ -309,7 +342,7 @@ void Screenshot (void) } // Copy OpenGL Context to new GWorld - glReadBuffer(GL_FRONT); + glReadBuffer(GL_FRONT); glReadPixels(0,0,screenwidth,screenheight,GL_RGBA,GL_UNSIGNED_BYTE,MAC_pixels); // Swizzle texture @@ -327,7 +360,7 @@ void Screenshot (void) int dst_index; unsigned char temp; for (int horz = 0; horz < screenwidth; ++horz) - for (vert = 0; vert < screenheight / 2; ++vert) { + for (vert = 0; vert < screenheight / 2; ++vert) { src_index = (screenwidth * vert + horz) * 4; dst_index = (screenwidth * (screenheight - vert - 1) + horz) * 4; @@ -353,12 +386,12 @@ void Screenshot (void) // Export the Gworld MAC_error_code = OpenADefaultComponent(GraphicsExporterComponentType, kQTFileTypeBMP, &QT_exporter); if (MAC_error_code) { - //UTIL_Warning("Unable to export screenshot."); - ::SetGWorld(MAC_currentPort, MAC_currentDevice); + //UTIL_Warning("Unable to export screenshot."); + ::SetGWorld(MAC_currentPort, MAC_currentDevice); ::DisposeGWorld(MAC_offscreen_graphics_port); delete MAC_pixels; return; - } + } MAC_error_code = GraphicsExportSetInputGWorld(QT_exporter,MAC_offscreen_graphics_port); if (MAC_error_code) { @@ -368,27 +401,27 @@ void Screenshot (void) delete MAC_pixels; //UTIL_Warning("Unable to export screenshot."); return; - } + } MAC_error_code = GraphicsExportSetOutputFile(QT_exporter,&MAC_file); if (MAC_error_code) { ::CloseComponent(QT_exporter); - ::SetGWorld(MAC_currentPort, MAC_currentDevice); + ::SetGWorld(MAC_currentPort, MAC_currentDevice); ::DisposeGWorld(MAC_offscreen_graphics_port); delete MAC_pixels; //UTIL_Warning("Unable to export screenshot."); return; - } + } MAC_error_code = GraphicsExportDoExport(QT_exporter,NULL); if (MAC_error_code) { ::CloseComponent(QT_exporter); - ::SetGWorld(MAC_currentPort, MAC_currentDevice); + ::SetGWorld(MAC_currentPort, MAC_currentDevice); ::DisposeGWorld(MAC_offscreen_graphics_port); delete MAC_pixels; //UTIL_Warning("Unable to export screenshot."); return; - } + } ::CloseComponent(QT_exporter); ::SetGWorld(MAC_currentPort, MAC_currentDevice); @@ -399,14 +432,14 @@ void Screenshot (void) -void Game::SetUpLighting(){ +void Game::SetUpLighting(){ if(environment==snowyenvironment){ light.color[0]=.65; light.color[1]=.65; light.color[2]=.7; light.ambient[0]=.4; light.ambient[1]=.4; - light.ambient[2]=.44; + light.ambient[2]=.44; } if(environment==desertenvironment){ light.color[0]=.95; @@ -414,7 +447,7 @@ void Game::SetUpLighting(){ light.color[2]=.95; light.ambient[0]=.4; light.ambient[1]=.35; - light.ambient[2]=.3; + light.ambient[2]=.3; } if(environment==grassyenvironment){ @@ -423,7 +456,7 @@ void Game::SetUpLighting(){ light.color[2]=1; light.ambient[0]=.4; light.ambient[1]=.4; - light.ambient[2]=.44; + light.ambient[2]=.44; } if(!skyboxtexture){ light.color[0]=1; @@ -431,7 +464,7 @@ void Game::SetUpLighting(){ light.color[2]=1; light.ambient[0]=.4; light.ambient[1]=.4; - light.ambient[2]=.4; + light.ambient[2]=.4; } float average; average=(skyboxlightr+skyboxlightg+skyboxlightb)/3; @@ -440,7 +473,7 @@ void Game::SetUpLighting(){ light.color[2]*=(skyboxlightb+average)/2; light.ambient[0]=light.ambient[0]*(skyboxlightr+average)/2*1; light.ambient[1]=light.ambient[1]*(skyboxlightg+average)/2*1; - light.ambient[2]=light.ambient[2]*(skyboxlightb+average)/2*1; + light.ambient[2]=light.ambient[2]*(skyboxlightb+average)/2*1; /* light.ambient[0]=0; light.ambient[1]=0; @@ -527,7 +560,7 @@ int Game::checkcollide(XYZ startpoint,XYZ endpoint){ if(objects.type[i]!=treeleavestype&&objects.type[i]!=bushtype&&objects.type[i]!=firetype){ colviewer=startpoint; coltarget=endpoint; - if(objects.model[i].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[i],&objects.rotation[i])!=-1)return i; + if(objects.model[i].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[i],&objects.rotation[i])!=-1)return i; } } } @@ -573,7 +606,7 @@ int Game::checkcollide(XYZ startpoint,XYZ endpoint,int what){ if(objects.type[what]!=treeleavestype&&objects.type[what]!=bushtype&&objects.type[what]!=firetype){ colviewer=startpoint; coltarget=endpoint; - if(objects.model[what].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[what],&objects.rotation[what])!=-1)return i; + if(objects.model[what].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[what],&objects.rotation[what])!=-1)return i; } } } @@ -583,7 +616,7 @@ int Game::checkcollide(XYZ startpoint,XYZ endpoint,int what){ return -1; } -void Game::Setenvironment(int which) +void Game::Setenvironment(int which) { LOGFUNC; @@ -592,26 +625,26 @@ 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); + 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); */ - 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); + 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); if(environment==snowyenvironment){ windvector=0; windvector.z=3; if(ambientsound){ - //PlaySoundEx( wind, samp[wind], NULL, TRUE); - PlayStreamEx(stream_wind, strm[stream_wind], 0, TRUE); - FSOUND_SetPaused(channels[stream_wind], FALSE); + //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); } @@ -624,14 +657,14 @@ void Game::Setenvironment(int which) 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); - samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0); - samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0); - samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 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); + 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); LoadTexture(":Data:Textures:snow.jpg",&terraintexture,1,0); @@ -668,9 +701,9 @@ 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); + //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); } @@ -678,14 +711,14 @@ void Game::Setenvironment(int which) 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); - samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 0); - samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow1.ogg", FSOUND_HW3D, 0); - samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepsnow2.ogg", FSOUND_HW3D, 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); + 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); LoadTexture(":Data:Textures:sand.jpg",&terraintexture,1,0); @@ -720,8 +753,8 @@ void Game::Setenvironment(int which) LoadTexture(":Data:Textures:grassbox.jpg",&objects.boxtextureptr,1,0); if(ambientsound){ - PlayStreamEx( stream_wind, strm[stream_wind], NULL, TRUE); - FSOUND_SetPaused(channels[stream_wind], FALSE); + PlayStreamEx( stream_wind, strm[stream_wind], NULL, true); + FSOUND_SetPaused(channels[stream_wind], false); FSOUND_SetVolume(channels[stream_wind], 100); } @@ -729,14 +762,14 @@ void Game::Setenvironment(int which) 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); - samp[footstepsound2] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepgrass2.ogg", FSOUND_HW3D, 0); - samp[footstepsound3] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone1.ogg", FSOUND_HW3D, 0); - samp[footstepsound4] = FSOUND_Sample_Load(FSOUND_FREE, ":Data:Sounds:footstepstone2.ogg", FSOUND_HW3D, 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); + 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); LoadTexture(":Data:Textures:grassdirt.jpg",&terraintexture,1,0); @@ -769,7 +802,7 @@ void Game::Setenvironment(int which) } -void Game::Loadlevel(int which){ +void Game::Loadlevel(int which){ stealthloading=0; if(which==0)Loadlevel((char *)":Data:Maps:map1"); @@ -799,9 +832,9 @@ char temp[50]; char temp2[100]; strcpy(temp2,(const char *)string); -strcat((char *)temp2,(const char *)"Lugaru"); +strcat((char *)temp2,(const char *)"Lugaru"); sprintf (temp, "%d",strlen((char *)temp2)); -strcat((char *)temp2,temp); +strcat((char *)temp2,temp); MD5 context; unsigned int len = strlen ( (char *)temp2); @@ -814,7 +847,7 @@ return context.hex_digest(); -void Game::Loadlevel(char *name){ +void Game::Loadlevel(char *name){ int i,j,k,l,m; static int oldlevel; int templength; @@ -848,15 +881,15 @@ void Game::Loadlevel(char *name){ if(!firstload){ oldlevel=50; } - FSOUND_SetPaused(channels[whooshsound], TRUE); - FSOUND_SetPaused(channels[stream_firesound], TRUE); + FSOUND_SetPaused(channels[whooshsound], true); + FSOUND_SetPaused(channels[stream_firesound], true); int mapvers; FILE *tfile; tfile=fopen( name, "rb" ); if(tfile) { - FSOUND_SetPaused(channels[stream_firesound], TRUE); + FSOUND_SetPaused(channels[stream_firesound], true); scoreadded=0; @@ -927,9 +960,9 @@ void Game::Loadlevel(char *name){ changedelay=0; if(console) { - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); freeze=0; console=0; } @@ -1080,7 +1113,7 @@ void Game::Loadlevel(char *name){ for(m=0;m20) + //if(i<16||i>20) FSOUND_StopSound(i); } */ @@ -1584,8 +1617,8 @@ void Game::Loadlevel(char *name){ { if(ambientsound) { - PlayStreamEx(stream_wind, strm[stream_wind], NULL, TRUE); - FSOUND_SetPaused(channels[stream_wind], FALSE); + PlayStreamEx(stream_wind, strm[stream_wind], NULL, true); + FSOUND_SetPaused(channels[stream_wind], false); FSOUND_SetVolume(channels[stream_wind], 256); } } @@ -1594,10 +1627,10 @@ void Game::Loadlevel(char *name){ if(ambientsound) { //PlaySoundEx(desertambient, - // samp[desertambient], NULL, TRUE); + // samp[desertambient], NULL, true); PlayStreamEx(stream_desertambient, - strm[stream_desertambient], NULL, TRUE); - FSOUND_SetPaused(channels[stream_desertambient], FALSE); + strm[stream_desertambient], NULL, true); + FSOUND_SetPaused(channels[stream_desertambient], false); FSOUND_SetVolume(channels[stream_desertambient], 256); } } @@ -1605,9 +1638,9 @@ void Game::Loadlevel(char *name){ { if(ambientsound) { - //PlaySoundEx(wind, samp[wind], NULL, TRUE); - PlayStreamEx(stream_wind, strm[stream_wind], NULL, TRUE); - FSOUND_SetPaused(channels[stream_wind], FALSE); + //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); } } @@ -1637,7 +1670,7 @@ void Game::Loadlevel(char *name){ visibleloading=0; } -void Game::Tick() +void Game::Tick() { static int i,k,j,l,m; static XYZ facing,flatfacing,absflatfacing; @@ -1659,9 +1692,9 @@ void Game::Tick() if(newnetmessages){ newnetmessages=0; - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); for(k=14;k>=2;k--){ for(j=0;j<255;j++){ @@ -1722,12 +1755,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -1800,7 +1833,7 @@ void Game::Tick() campaign=1; mainmenu=0; gameon=1; - FSOUND_SetPaused(channels[music3], TRUE); + FSOUND_SetPaused(channels[music3], true); stealthloading=0;*/ } @@ -1808,26 +1841,26 @@ void Game::Tick() if(mainmenu&&musictoggle){ if(mainmenu==1||mainmenu==2||mainmenu==100){ FSOUND_SetFrequency(FSOUND_ALL, 0.001); - PlayStreamEx( stream_music3, strm[stream_music3], NULL, TRUE); - FSOUND_SetPaused(channels[stream_music3], FALSE); + 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); + FSOUND_SetPaused(channels[music1], true); } } if(!mainmenu){ - FSOUND_SetPaused(channels[stream_music3], TRUE); - FSOUND_SetPaused(channels[music1], FALSE); + FSOUND_SetPaused(channels[stream_music3], true); + FSOUND_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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -1837,13 +1870,14 @@ 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(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight>3000)newscreenheight=screenheight; +#endif + if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight<0)newscreenheight=screenheight; - //ofstream opstream(":Data:config.txt"); - ofstream opstream("./Data/config.txt"); + ofstream opstream(ConvertFileName(":Data:config.txt", "w")); opstream << "Screenwidth:\n"; opstream << newscreenwidth; opstream << "\nScreenheight:\n"; @@ -1918,23 +1952,23 @@ void Game::Tick() opstream << "\nChat key:\n"; opstream << KeyToChar(chatkey); 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){ 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_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); + 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==3&&gameon)mainmenu=2; if(mainmenu==3&&!gameon)mainmenu=1; if(mainmenu==5&&gameon)mainmenu=2; @@ -1974,9 +2008,9 @@ void Game::Tick() if(IsKeyDown(theKeyMap, MAC_TAB_KEY)&&!minimaptogglekeydown&&tutoriallevel){ if(tutorialstage!=51) tutorialstagetime=tutorialmaxtime; - PlaySoundEx( consolefailsound, samp[consolefailsound], NULL, TRUE); + PlaySoundEx( consolefailsound, samp[consolefailsound], NULL, true); FSOUND_SetVolume(channels[consolefailsound], 128); - FSOUND_SetPaused(channels[consolefailsound], FALSE); + FSOUND_SetPaused(channels[consolefailsound], false); minimaptogglekeydown=1; } if(!IsKeyDown(theKeyMap, MAC_TAB_KEY)){ @@ -1990,12 +2024,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2018,26 +2052,26 @@ void Game::Tick() } mainmenu=0; gameon=1; - FSOUND_SetPaused(channels[music3], TRUE); */ + FSOUND_SetPaused(channels[music3], true); */ } else { //resume mainmenu=0; - FSOUND_SetPaused(channels[stream_music3], TRUE); - FSOUND_SetPaused(channels[music1], FALSE); + FSOUND_SetPaused(channels[stream_music3], true); + FSOUND_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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2047,25 +2081,25 @@ void Game::Tick() //options - mainmenu=3; + mainmenu=3; if(newdetail>2)newdetail=detail; if(newdetail<0)newdetail=detail; if(newscreenwidth>3000)newscreenwidth=screenwidth; if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight>3000)newscreenheight=screenheight; - if(newscreenheight<0)newscreenheight=screenheight; + if(newscreenheight<0)newscreenheight=screenheight; } 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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2076,7 +2110,7 @@ void Game::Tick() if(!gameon){ //quit tryquit=1; - if(registered)FSOUND_SetPaused(channels[stream_music3], TRUE); + if(registered)FSOUND_SetPaused(channels[stream_music3], true); } else{ //end game @@ -2092,14 +2126,60 @@ 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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_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; + for (int i = 0; (!found) && (resolutions[i]); i++) + { + if ((resolutions[i]->w == screenwidth) && (resolutions[i]->h == screenwidth)) + isCustomResolution = false; + + if ((resolutions[i]->w == newscreenwidth) && (resolutions[i]->h == newscreenheight)) + { + i++; + if (resolutions[i] != NULL) + { + newscreenwidth = (int) resolutions[i]->w; + newscreenheight = (int) resolutions[i]->h; + } + else if (isCustomResolution) + { + if ((screenwidth == newscreenwidth) && (screenheight == newscreenheight)) + { + newscreenwidth = (int) resolutions[0]->w; + newscreenheight = (int) resolutions[0]->h; + } + else + { + newscreenwidth = screenwidth; + newscreenheight = screenheight; + } + } + else + { + newscreenwidth = (int) resolutions[0]->w; + newscreenheight = (int) resolutions[0]->h; + } + found = true; + } + } + + if (!found) + { + newscreenwidth = (int) resolutions[0]->w; + newscreenheight = (int) resolutions[0]->h; + } + + #else int whichres; whichres=-1; if(newscreenwidth==640&&newscreenheight==480)whichres=0; @@ -2110,8 +2190,9 @@ void Game::Tick() 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==7){ + if(whichres==-1||whichres==8){ newscreenwidth=640; newscreenheight=480; } @@ -2143,6 +2224,11 @@ void Game::Tick() newscreenwidth=1344; newscreenheight=840; } + if(whichres==7){ + newscreenwidth=1920; + newscreenheight=1200; + } + #endif } if(Button()&&!oldbutton&&selected==1){ newdetail++; @@ -2166,9 +2252,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); + FSOUND_SetPaused(channels[music1], true); + FSOUND_SetPaused(channels[stream_music2], true); + FSOUND_SetPaused(channels[stream_music3], true); for(i=0;i<4;i++){ oldmusicvolume[i]=0; @@ -2177,9 +2263,9 @@ 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); + PlayStreamEx( stream_music3, strm[stream_music3], NULL, true); + FSOUND_SetPaused(channels[stream_music3], false); + FSOUND_SetVolume(channels[stream_music3], 256); } } if(Button()&&!oldbutton&&selected==9){ @@ -2197,12 +2283,12 @@ void Game::Tick() 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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); */ flashr=1; flashg=0; @@ -2212,18 +2298,18 @@ void Game::Tick() //options - mainmenu=4; + mainmenu=4; keyselect=-1; } 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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2233,14 +2319,15 @@ 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(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight>3000)newscreenheight=screenheight; +#endif + if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight<0)newscreenheight=screenheight; - //ofstream opstream(":Data:config.txt"); - ofstream opstream("./Data/config.txt"); + ofstream opstream(ConvertFileName(":Data:config.txt", "w")); opstream << "Screenwidth:\n"; opstream << newscreenwidth; opstream << "\nScreenheight:\n"; @@ -2326,12 +2413,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); } if(Button()&&!oldbutton&&selected<9&&keyselect==-1){ keyselect=selected; @@ -2347,12 +2434,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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); int keynum; keynum=i; @@ -2377,12 +2464,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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2403,9 +2490,9 @@ 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_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; @@ -2416,12 +2503,12 @@ void Game::Tick() 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_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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2437,15 +2524,15 @@ void Game::Tick() endgame=0; } - if(Button()&&!oldbutton&&selected==1){ + 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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2466,17 +2553,17 @@ void Game::Tick() mainmenu=0; gameon=1; - FSOUND_SetPaused(channels[stream_music3], TRUE); + FSOUND_SetPaused(channels[stream_music3], true); } - if(Button()&&!oldbutton&&selected-7>=accountcampaignchoicesmade[accountactive]){//selected>=7&&(selected-7<=campaignnumchoices)){ + 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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2516,17 +2603,17 @@ void Game::Tick() campaign=1; mainmenu=0; gameon=1; - FSOUND_SetPaused(channels[stream_music3], TRUE); + FSOUND_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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2540,12 +2627,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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2558,12 +2645,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2576,12 +2663,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2595,15 +2682,15 @@ void Game::Tick() else oldbutton=0; } if(mainmenu==9){ - if(Button()&&!oldbutton&&selected=0&&selected<=accountprogress[accountactive]){ + if(Button()&&!oldbutton&&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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2625,17 +2712,17 @@ void Game::Tick() mainmenu=0; gameon=1; - FSOUND_SetPaused(channels[stream_music3], TRUE); + FSOUND_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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2649,15 +2736,15 @@ void Game::Tick() else oldbutton=0; } if(mainmenu==11){ - if(Button()&&!oldbutton&&selected=0&&selected<=accountprogress[accountactive]){ + if(Button()&&!oldbutton&&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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2679,17 +2766,17 @@ void Game::Tick() mainmenu=0; gameon=1; - FSOUND_SetPaused(channels[stream_music3], TRUE); + FSOUND_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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2707,12 +2794,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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2730,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[fireendsound], 9999.0f, 99999.0f); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2756,12 +2843,12 @@ void Game::Tick() 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_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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2777,12 +2864,12 @@ void Game::Tick() 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_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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2796,12 +2883,12 @@ void Game::Tick() 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_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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2818,22 +2905,22 @@ 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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2874,12 +2961,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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2896,12 +2983,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); } if(Button()&&!oldbutton&&selected==0&&numaccounts<8){ entername=1; @@ -2918,12 +3005,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); - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -2947,18 +3034,18 @@ 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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); if(selected==0)accountdifficulty[accountactive]=0; if(selected==1)accountdifficulty[accountactive]=1; if(selected==2)accountdifficulty[accountactive]=2; - mainmenu=5; + mainmenu=5; flashr=1; flashg=0; @@ -2980,13 +3067,14 @@ 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(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight>3000)newscreenheight=screenheight; +#endif + if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight<0)newscreenheight=screenheight; - //ofstream opstream(":Data:config.txt"); - ofstream opstream("./Data/config.txt"); + ofstream opstream(ConvertFileName(":Data:config.txt", "w")); opstream << "Screenwidth:\n"; opstream << newscreenwidth; opstream << "\nScreenheight:\n"; @@ -3073,7 +3161,7 @@ void Game::Tick() loaddistrib=0; } } - FSOUND_SetFrequency(channels[stream_music3], 22050); + FSOUND_SetFrequency(channels[stream_music3], 22050); if(entername||mainmenu==13||mainmenu==14){ for(i=0;i<140;i++){ @@ -3145,12 +3233,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); for(j=0;j<255;j++){ displaytext[0][j]=' '; @@ -3165,7 +3253,13 @@ void Game::Tick() if(displaychars[0]){ char serialstring[256]; char tempstring[256]; + #if defined(__APPLE__) + sprintf (tempstring, "%s", registrationname); + #elif defined(_WIN32) || 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; @@ -3202,7 +3296,7 @@ void Game::Tick() if(displaytext[0][j]!=tempstring[j]&&tempstring[j]!=' '&&tempstring[j]!='\0')goodcode--; } - if(longnum==5077041556214789)goodcode=-1; + if(longnum==LONGLONGCONST(5077041556214789))goodcode=-1; if(goodcode<0)goodcode=0; @@ -3242,12 +3336,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); for(j=0;j<255;j++){ displaytext[0][j]=' '; @@ -3271,12 +3365,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); for(j=0;j<255;j++){ displaytext[0][j]=' '; @@ -3316,7 +3410,7 @@ void Game::Tick() } } - if(!mainmenu){ + if(!mainmenu){ if(hostile==1)hostiletime+=multiplier; else hostiletime=0; if(!winfreeze)leveltime+=multiplier; @@ -3492,9 +3586,9 @@ void Game::Tick() archiveselected=0; donesomething=0; if(Compare(consoletext[0],"quit ",0,4)||Compare(consoletext[0],"exit ",0,4)){ - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); donesomething=1; tryquit=1; } @@ -3578,12 +3672,12 @@ void Game::Tick() consoleselected=0; } } - else + else { donesomething=1; - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); if(consolechars[0]>0){ for(k=14;k>=1;k--){ @@ -3640,9 +3734,9 @@ void Game::Tick() else { donesomething=1; - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); if(consolechars[0]>0){ for(k=14;k>=1;k--){ @@ -3679,9 +3773,9 @@ void Game::Tick() } mapname[consolechars[0]-5+11]='\0'; - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); int mapvers; mapvers=12; @@ -3739,7 +3833,7 @@ void Game::Tick() fpackf(tfile, "Bi",templength); for(m=0;m> numdialogueboxes[numdialogues]; for(i=0;i> numdialogueboxes[whichdi]; for(i=0;i2)newdetail=detail; if(newdetail<0)newdetail=detail; +#if !USE_SDL // we'll take anything that works. if(newscreenwidth>3000)newscreenwidth=screenwidth; - if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight>3000)newscreenheight=screenheight; +#endif + if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight<0)newscreenheight=screenheight; - //ofstream opstream(":Data:config.txt"); - ofstream opstream("./Data/config.txt"); + ofstream opstream(ConvertFileName(":Data:config.txt", "w")); opstream << "Screenwidth:\n"; opstream << newscreenwidth; opstream << "\nScreenheight:\n"; @@ -5706,9 +5801,9 @@ void Game::Tick() static int oldwinfreeze; if(winfreeze&&!oldwinfreeze){ FSOUND_SetFrequency(FSOUND_ALL, 0.001); - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, TRUE); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); } if(winfreeze==0)oldwinfreeze=winfreeze; else oldwinfreeze++; @@ -5741,23 +5836,23 @@ void Game::Tick() int realdialoguetype; bool special; if(dialoguetype[i]>49){ - realdialoguetype=dialoguetype[i]-50; + realdialoguetype=dialoguetype[i]-50; special=1; } else if(dialoguetype[i]>39){ - realdialoguetype=dialoguetype[i]-40; + realdialoguetype=dialoguetype[i]-40; special=1; } else if(dialoguetype[i]>29){ - realdialoguetype=dialoguetype[i]-30; + realdialoguetype=dialoguetype[i]-30; special=1; } else if(dialoguetype[i]>19){ - realdialoguetype=dialoguetype[i]-20; + realdialoguetype=dialoguetype[i]-20; special=1; } else if(dialoguetype[i]>9){ - realdialoguetype=dialoguetype[i]-10; + realdialoguetype=dialoguetype[i]-10; special=1; } else { @@ -5814,10 +5909,10 @@ void Game::Tick() if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound; if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound; if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound; - PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, TRUE); + PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true); FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel); FSOUND_SetVolume(channels[whichsoundplay], 256); - FSOUND_SetPaused(channels[whichsoundplay], FALSE); + FSOUND_SetPaused(channels[whichsoundplay], false); } if(IsKeyDown(theKeyMap, attackkey))oldbuttondialogue=1; } @@ -5845,7 +5940,7 @@ void Game::Tick() hotspotsprite+=hotspot[i]; sprites.MakeSprite(breathsprite, hotspotsprite, hotspotsprite*0, 1,0.5,0, 7, 0.4); hotspotvisual[i]+=0.1/hotspotsize[i]/hotspotsize[i]/hotspotsize[i]; - } + } } for(i=0;i=1){ @@ -6382,16 +6477,16 @@ 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); + PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); FSOUND_SetVolume(channels[consolesuccesssound], 256); - FSOUND_SetPaused(channels[consolesuccesssound], FALSE); + FSOUND_SetPaused(channels[consolesuccesssound], false); } } else if(bonustime==0){ - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + PlaySoundEx( fireendsound, samp[fireendsound], NULL, true); FSOUND_SetVolume(channels[fireendsound], 256); - FSOUND_SetPaused(channels[fireendsound], FALSE); + FSOUND_SetPaused(channels[fireendsound], false); } if(bonustime==0){ if(bonus!=solidhit&&bonus!=twoxcombo&&bonus!=threexcombo&&bonus!=fourxcombo&&bonus!=megacombo)bonusnum[bonus]++; @@ -6505,11 +6600,11 @@ void Game::Tick() vel[0]=0; vel[1]=0; vel[2]=0; - PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[movewhooshsound], false); + if(k==0)FSOUND_SetPaused(channels[whooshsound], true); lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0); player[k].rotation=-asin(0-lowpointtarget.x); @@ -6536,11 +6631,11 @@ void Game::Tick() vel[0]=0; vel[1]=0; vel[2]=0; - PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[movewhooshsound], false); + if(k==0)FSOUND_SetPaused(channels[whooshsound], true); lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0); player[k].rotation=-asin(0-lowpointtarget.x); @@ -6567,11 +6662,11 @@ void Game::Tick() vel[0]=0; vel[1]=0; vel[2]=0; - PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[movewhooshsound], false); + if(k==0)FSOUND_SetPaused(channels[whooshsound], true); lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0); player[k].rotation=-asin(0-lowpointtarget.x); @@ -6598,11 +6693,11 @@ void Game::Tick() vel[0]=0; vel[1]=0; vel[2]=0; - PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[movewhooshsound], false); + if(k==0)FSOUND_SetPaused(channels[whooshsound], true); lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0); player[k].rotation=-asin(0-lowpointtarget.x); @@ -6633,11 +6728,11 @@ void Game::Tick() if(player[k].targetanimation==jumpupanim){player[k].jumppower=-4;player[k].targetanimation=player[k].getIdle();} player[k].target=0; - player[k].targetframe=0; + player[k].targetframe=0; player[k].onterrain=1; if(player[k].id==0){ - FSOUND_SetPaused(channels[whooshsound], TRUE); + FSOUND_SetPaused(channels[whooshsound], true); FSOUND_SetVolume(channels[whooshsound], 0); } @@ -6652,10 +6747,10 @@ void Game::Tick() vel[0]=player[k].velocity.x; vel[1]=player[k].velocity.y; vel[2]=player[k].velocity.z; - PlaySoundEx( landsound, samp[landsound], NULL, TRUE); + PlaySoundEx( landsound, samp[landsound], NULL, true); FSOUND_3D_SetAttributes(channels[landsound], gLoc, vel); FSOUND_SetVolume(channels[landsound], 128); - FSOUND_SetPaused(channels[landsound], FALSE); + FSOUND_SetPaused(channels[landsound], false); if(k==0){ envsound[numenvsounds]=player[k].coords; envsoundvol[numenvsounds]=16; @@ -6665,7 +6760,7 @@ void Game::Tick() } } - } + } } } if(tempcollide&&terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz]&&(/*player[k].jumptogglekeydown*/1==1||player[k].aitype!=playercontrolled)) @@ -6675,10 +6770,10 @@ void Game::Tick() lowpoint.y+=1.35; if(objects.type[i]!=rocktype) if(player[k].SphereCheck(&lowpoint, 1.33, &colpoint, &objects.position[i], &objects.rotation[i], &objects.model[i])!=-1){ - if(player[k].targetanimation!=jumpupanim&&player[k].targetanimation!=jumpdownanim&&player[k].onterrain)player[k].avoidcollided=1; + if(player[k].targetanimation!=jumpupanim&&player[k].targetanimation!=jumpdownanim&&player[k].onterrain)player[k].avoidcollided=1; player[k].coords=lowpoint; player[k].coords.y-=1.35; - player[k].collide=1; + player[k].collide=1; if((player[k].grabdelay<=0||player[k].aitype!=playercontrolled)&&((/*(player[k].isRun()||player[k].targetanimation==sneakanim||player[k].targetanimation==walkanim)&&*/player[k].currentanimation!=climbanim&&player[k].currentanimation!=hanganim&&!player[k].isWallJump())||player[k].targetanimation==jumpupanim||player[k].targetanimation==jumpdownanim)){ lowpoint=player[k].coords; @@ -6751,9 +6846,9 @@ void Game::Tick() player[k].coords.y=lowpointtarget.y-.07; player[k].currentoffset=(flatfacing-player[k].coords)/player[k].scale; - if(j>10||!player[k].isRun()){ + 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)FSOUND_SetPaused(channels[whooshsound], true); } float gLoc[3]; float vel[3]; @@ -6763,10 +6858,10 @@ void Game::Tick() vel[0]=player[k].velocity.x; vel[1]=player[k].velocity.y; vel[2]=player[k].velocity.z; - PlaySoundEx( jumpsound, samp[jumpsound], NULL, TRUE); + PlaySoundEx( jumpsound, samp[jumpsound], NULL, true); FSOUND_3D_SetAttributes(channels[jumpsound], gLoc, vel); FSOUND_SetVolume(channels[jumpsound], 128); - FSOUND_SetPaused(channels[jumpsound], FALSE); + FSOUND_SetPaused(channels[jumpsound], false); lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0); player[k].rotation=-asin(0-lowpointtarget.x); @@ -6795,7 +6890,7 @@ void Game::Tick() //player[k].currentanimation=hanganim; player[k].targetanimation=hanganim; player[k].jumppower=0; - } + } } j=100; } @@ -6825,10 +6920,10 @@ void Game::Tick() vel[1]=player[k].velocity.y; vel[2]=player[k].velocity.z; if(k==0){ - PlaySoundEx( whooshsound, samp[whooshsound], NULL, TRUE); + 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], false); } } player[k].velocity.y+=gravity; @@ -6869,7 +6964,7 @@ void Game::Tick() static bool endkeydown; if(indialogue!=-1){ cameramode=1; - if(directing){ + if(directing){ facing=0; facing.z=-1; @@ -6955,10 +7050,10 @@ void Game::Tick() if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound; if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound; if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound; - PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, TRUE); + PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true); FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel); FSOUND_SetVolume(channels[whichsoundplay], 256); - FSOUND_SetPaused(channels[whichsoundplay], FALSE); + FSOUND_SetPaused(channels[whichsoundplay], false); } } @@ -6995,12 +7090,12 @@ void Game::Tick() cameramode=0; } } - if(!directing){ - FSOUND_SetPaused(channels[whooshsound], TRUE); + if(!directing){ + FSOUND_SetPaused(channels[whooshsound], true); viewer=dialoguecamera[whichdialogue][indialogue]; if(viewer.y0.5) @@ -7047,10 +7142,10 @@ void Game::Tick() if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound; if(dialogueboxsound[whichdialogue][indialogue]==-6)whichsoundplay=alarmsound; if(dialogueboxsound[whichdialogue][indialogue]!=-5){ - PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, TRUE); + PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true); FSOUND_3D_SetAttributes(channels[whichsoundplay], gLoc, vel); FSOUND_SetVolume(channels[whichsoundplay], 256); - FSOUND_SetPaused(channels[whichsoundplay], FALSE); + FSOUND_SetPaused(channels[whichsoundplay], false); } if(dialogueboxsound[whichdialogue][indialogue]==-5){ hotspot[numhotspots]=player[0].coords; @@ -7234,10 +7329,10 @@ void Game::Tick() vel[0]=0; vel[1]=0; vel[2]=0; - PlaySoundEx( hawksound, samp[hawksound], NULL, TRUE); + PlaySoundEx( hawksound, samp[hawksound], NULL, true); FSOUND_3D_SetAttributes(channels[hawksound], gLoc, vel); FSOUND_SetVolume(channels[hawksound], 128); - FSOUND_SetPaused(channels[hawksound], FALSE); + FSOUND_SetPaused(channels[hawksound], false); hawkcalldelay=16+abs(Random()%8); } @@ -7307,7 +7402,7 @@ void Game::Tick() for(j=0;j2)drawmode=0; - if(objects.numobjects0&&closest>=0)objects.DeleteObject(closest); + if(closestdist>0&&closest>=0)objects.DeleteObject(closest); drawmodetogglekeydown=1; } @@ -8245,11 +8340,11 @@ void Game::Tick() vel[0]=player[0].velocity.x; vel[1]=player[0].velocity.y; vel[2]=player[0].velocity.z; - PlaySoundEx( whooshsound, samp[whooshsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[whooshsound], false); + //FSOUND_SetPaused(channels[whooshsound], true); texturesizetogglekeydown=1; } @@ -8329,7 +8424,7 @@ void Game::Tick() for(i=0;i1) for(i=0;i1000||player[k].isRun()||(hasstaff)||(player[k].weaponactive!=-1&&player[i].skeleton.free&&(player[i].skeleton.longdead>2000||player[i].damage>player[i].damagetolerance/8||player[i].bloodloss>player[i].damagetolerance/2)&&findDistancefast(&player[k].coords,&player[i].coords)<1.5*(player[k].scale*5)*(player[k].scale*5)))){ @@ -8618,7 +8713,7 @@ void Game::Tick() if(player[i].onfire||player[k].onfire){ if(!player[i].onfire)player[i].CatchFire(); if(!player[k].onfire)player[k].CatchFire(); - } + } } tempcoords1=player[i].coords; @@ -8628,7 +8723,7 @@ void Game::Tick() collisionradius=1.2*((player[i].scale+player[k].scale)*2.5)*((player[i].scale+player[k].scale)*2.5); if(player[0].hasvictim) if(player[0].targetanimation==rabbitkickanim&&(k==0||i==0)&&!player[0].victim->skeleton.free)collisionradius=3; - if((!player[i].skeleton.oldfree||!player[k].skeleton.oldfree)&&(findDistancefast(&tempcoords1,&tempcoords2)1)||(player[k].skeleton.oldfree==1&&findLengthfast(&player[k].velocity)>1)||(player[i].skeleton.oldfree==0&&player[k].skeleton.oldfree==0)){ + if((player[i].skeleton.oldfree==1&&findLengthfast(&player[i].velocity)>1)||(player[k].skeleton.oldfree==1&&findLengthfast(&player[k].velocity)>1)||(player[i].skeleton.oldfree==0&&player[k].skeleton.oldfree==0)){ rotatetarget=player[k].velocity-player[i].velocity; if(((player[i].targetanimation!=getupfrombackanim&&player[i].targetanimation!=getupfromfrontanim)||player[i].skeleton.free)&&((player[k].targetanimation!=getupfrombackanim&&player[k].targetanimation!=getupfromfrontanim)||player[k].skeleton.free)) if(((((findLengthfast(&rotatetarget)>150&&(i!=0&&k!=0))||(findLengthfast(&rotatetarget)>50&&player[0].rabbitkickragdoll/*currentanimation==rabbitkickanim*/&&(i==0||k==0)))&&normaldotproduct(rotatetarget,player[k].coords-player[i].coords)>0)&&((i==0||k==0)||((player[i].skeleton.oldfree==1&&k!=0&&animation[player[k].currentanimation].attack==neutral)||(player[k].skeleton.oldfree==1&&i!=0&&animation[player[i].currentanimation].attack==neutral)||(player[i].isFlip()&&!player[i].skeleton.oldfree&&(i==0||k==0))||(player[k].isFlip()&&!player[k].skeleton.oldfree&&(i==0||k==0))||(i==0||k==0))))||((player[i].targetanimation==jumpupanim||player[i].targetanimation==jumpdownanim||player[i].isFlip())&&(player[k].targetanimation==jumpupanim||player[k].targetanimation==jumpdownanim||player[k].isFlip())&&(i==0||k==0)&&(!player[i].skeleton.oldfree&&!player[k].skeleton.oldfree))){ @@ -8669,10 +8764,10 @@ void Game::Tick() vel[1]=player[i].velocity.y; vel[2]=player[i].velocity.z; if(tutoriallevel!=1){ - PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, TRUE); + PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true); FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel); FSOUND_SetVolume(channels[heavyimpactsound], 256); - FSOUND_SetPaused(channels[heavyimpactsound], FALSE); + FSOUND_SetPaused(channels[heavyimpactsound], false); } //player[i].velocity=player[k].velocity; //player[k].velocity=player[i].velocity; @@ -8753,7 +8848,7 @@ void Game::Tick() player[k].velocity.y=player[i].velocity.y; player[i].DoDamage(20); player[i].RagDoll(0); - player[k].lastcollide=1; + player[k].lastcollide=1; if(k==0){ bonus=AboveBonus; bonustime=0; @@ -8766,8 +8861,8 @@ void Game::Tick() //player[k].velocity.y-=10; player[i].velocity.y=player[k].velocity.y; player[k].DoDamage(20); - player[k].RagDoll(0); - player[i].lastcollide=1; + player[k].RagDoll(0); + player[i].lastcollide=1; if(i==0){ bonus=AboveBonus; bonustime=0; @@ -8970,7 +9065,7 @@ void Game::Tick() /* if(IsKeyDown(theKeyMap, MAC_Z_KEY)){ //Respawn - FSOUND_SetPaused(channels[whooshsound], TRUE); + FSOUND_SetPaused(channels[whooshsound], true); changedelay=0; for(k=0;kplayer[i].numwaypoints-1)player[i].waypoint=0; } - } + } if(player[i].numwaypoints>1&&player[i].howactive==typeactive&&player[i].pausetime<=0)player[i].forwardkeydown=1; else player[i].forwardkeydown=0; @@ -9316,7 +9411,7 @@ void Game::Tick() else player[i].targetrotation-=90; } } - } + } if(player[i].collided<1||player[i].targetanimation!=jumpupanim)player[i].jumpkeydown=0; if((player[i].collided>.8&&player[i].jumppower>=5))player[i].jumpkeydown=1; @@ -9348,7 +9443,7 @@ void Game::Tick() player[i].howactive=typeactive; } - } + } if(player[i].howactive=0){ if(weapons.owner[player[i].ally]!=-1||findDistancefast(&player[i].coords,&weapons.position[player[i].ally])>16){ @@ -9668,7 +9763,7 @@ void Game::Tick() if(rotatetarget.z<0)player[i].targetrotation=180-player[i].targetrotation; player[i].lookrotation=player[i].targetrotation; player[i].aiupdatedelay=.05; - player[i].forwardkeydown=1; + player[i].forwardkeydown=1; if(player[i].avoidcollided>.8&&!player[i].jumpkeydown&&player[i].collided<.8){ @@ -9706,7 +9801,7 @@ void Game::Tick() player[i].rightkeydown=0; player[i].attackkeydown=0; player[i].throwkeydown=1; - player[i].crouchkeydown=0; + player[i].crouchkeydown=0; if(player[i].targetanimation!=crouchremoveknifeanim&&player[i].targetanimation!=removeknifeanim)player[i].throwtogglekeydown=0; player[i].drawkeydown=0; } @@ -9798,7 +9893,7 @@ void Game::Tick() player[i].lastpathfindpoint2=-1; player[i].lastpathfindpoint3=-1; player[i].lastpathfindpoint4=-1; - } + } if(player[i].aiupdatedelay<0&&!animation[player[i].targetanimation].attack&&player[i].targetanimation!=staggerbackhighanim&&player[i].targetanimation!=staggerbackhardanim&&player[i].targetanimation!=backhandspringanim&&player[i].targetanimation!=dodgebackanim){ if(player[i].weaponactive==-1&&player[i].num_weapons>0)player[i].drawkeydown=Random()%2; else player[i].drawkeydown=0; @@ -10043,10 +10138,10 @@ void Game::Tick() vel[1]=player[i].velocity.y; vel[2]=player[i].velocity.z; if(weapons.type[j]!=staff){ - PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, TRUE); + PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true); FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel); FSOUND_SetVolume(channels[knifedrawsound], 128); - FSOUND_SetPaused(channels[knifedrawsound], FALSE); + FSOUND_SetPaused(channels[knifedrawsound], false); } player[i].weaponactive=0; @@ -10090,10 +10185,10 @@ void Game::Tick() vel[1]=player[i].velocity.y; vel[2]=player[i].velocity.z; if(weapons.type[k]!=staff){ - PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, TRUE); + PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true); FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel); FSOUND_SetVolume(channels[knifedrawsound], 128); - FSOUND_SetPaused(channels[knifedrawsound], FALSE); + FSOUND_SetPaused(channels[knifedrawsound], false); } player[i].weaponactive=0; @@ -10151,17 +10246,17 @@ void Game::Tick() } if(!fleshstuck){ if(weapons.type[k]!=staff){ - PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, TRUE); + PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true); FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel); FSOUND_SetVolume(channels[knifedrawsound], 128); - FSOUND_SetPaused(channels[knifedrawsound], FALSE); + FSOUND_SetPaused(channels[knifedrawsound], false); } } if(fleshstuck){ - PlaySoundEx( fleshstabremovesound, samp[fleshstabremovesound], NULL, TRUE); + PlaySoundEx( fleshstabremovesound, samp[fleshstabremovesound], NULL, true); FSOUND_3D_SetAttributes(channels[fleshstabremovesound], gLoc, vel); FSOUND_SetVolume(channels[fleshstabremovesound], 128); - FSOUND_SetPaused(channels[fleshstabremovesound], FALSE); + FSOUND_SetPaused(channels[fleshstabremovesound], false); } player[i].weaponactive=0; @@ -10249,7 +10344,7 @@ void Game::Tick() player[i].victim=&player[j]; XYZ aim; weapons.owner[player[i].weaponids[0]]=-1; - aim=player[i].victim->coords+DoRotation(player[i].victim->skeleton.joints[player[i].victim->skeleton.jointlabels[abdomen]].position,0,player[i].victim->rotation,0)*player[i].victim->scale+player[i].victim->velocity*findDistance(&player[i].victim->coords,&player[i].coords)/50-(player[i].coords+DoRotation(player[i].skeleton.joints[player[i].skeleton.jointlabels[righthand]].position,0,player[i].rotation,0)*player[i].scale); + aim=player[i].victim->coords+DoRotation(player[i].victim->skeleton.joints[player[i].victim->skeleton.jointlabels[abdomen]].position,0,player[i].victim->rotation,0)*player[i].victim->scale+player[i].victim->velocity*findDistance(&player[i].victim->coords,&player[i].coords)/50-(player[i].coords+DoRotation(player[i].skeleton.joints[player[i].skeleton.jointlabels[righthand]].position,0,player[i].rotation,0)*player[i].scale); Normalise(&aim); aim=DoRotation(aim,(float)abs(Random()%30)-15,(float)abs(Random()%30)-15,0); @@ -10265,7 +10360,7 @@ void Game::Tick() player[i].weaponids[0]=player[i].weaponids[player[i].num_weapons]; } player[i].weaponactive=-1; - } + } } } } @@ -10325,7 +10420,7 @@ void Game::Tick() player[i].target=0; player[i].drawtogglekeydown=1; } - } + } } if(player[i].isCrouch()&&weapons.bloody[player[i].weaponids[player[i].weaponactive]]&&bloodtoggle&&player[i].onterrain&&player[i].num_weapons&&player[i].weaponactive!=-1&&player[i].attackkeydown){ if(weapons.bloody[player[i].weaponids[player[i].weaponactive]]&&player[i].onterrain&&bloodtoggle&&musictype!=stream_music2){ @@ -10423,7 +10518,7 @@ void Game::Tick() if(target>=0)player[target].Reverse(); player[i].highreversaldelay=.5; - if(player[i].isCrouch()){ + if(player[i].isCrouch()){ if(!player[i].wasCrouch()){ player[i].currentanimation=player[i].getCrouch(); player[i].currentframe=0; @@ -10586,17 +10681,17 @@ void Game::Tick() vel[2]=player[i].velocity.z; if(i==0){ - PlaySoundEx( whooshsound, samp[whooshsound], NULL, TRUE); + 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], false); } - PlaySoundEx( jumpsound, samp[jumpsound], NULL, TRUE); + PlaySoundEx( jumpsound, samp[jumpsound], NULL, true); FSOUND_3D_SetAttributes(channels[jumpsound], gLoc, vel); FSOUND_SetVolume(channels[jumpsound], 128); - FSOUND_SetPaused(channels[jumpsound], FALSE); - } + FSOUND_SetPaused(channels[jumpsound], false); + } if((player[i].isIdle())&&player[i].jumppower>1){ player[i].targetanimation=player[i].getLanding(); player[i].landhard=0; @@ -10604,7 +10699,7 @@ void Game::Tick() player[i].targetframe=2; player[i].jumpstart=1; player[i].tempdeltav=deltav; - } + } if(player[i].targetanimation==jumpupanim&&(((!floatjump&&!editorenabled)||!debugmode)||player[i].aitype!=playercontrolled)){ if(player[i].jumppower>multiplier*6){ player[i].velocity.y+=multiplier*6; @@ -10615,7 +10710,7 @@ void Game::Tick() player[i].jumppower=0; } } - if(((floatjump||editorenabled)&&debugmode)&&i==0)player[i].velocity.y+=multiplier*30; + if(((floatjump||editorenabled)&&debugmode)&&i==0)player[i].velocity.y+=multiplier*30; } if(!movekey){ @@ -10759,10 +10854,11 @@ 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); - PlayStreamEx( stream_music3, strm[stream_music3], NULL, TRUE); - FSOUND_SetPaused(channels[stream_music3], FALSE); + PlayStreamEx( stream_music3, strm[stream_music3], NULL, true); + FSOUND_SetPaused(channels[stream_music3], false); FSOUND_SetVolume(channels[stream_music3], 256); gameon=0; @@ -10770,12 +10866,12 @@ void Game::Tick() 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_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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -10793,10 +10889,10 @@ void Game::Tick() vel[0]=0; vel[1]=0; vel[2]=0; - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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[fireendsound], false); player[0].coords=(oldtemp+oldtemp2)/2; @@ -10816,10 +10912,10 @@ void Game::Tick() vel[0]=0; vel[1]=0; vel[2]=0; - PlaySoundEx( fireendsound, samp[fireendsound], NULL, TRUE); + 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[fireendsound], false); for(int i=0;i128&&!loading&&!mainmenu)musicvolume[2]=128; - if(musictoggle){ + if(musictoggle){ if(musicvolume[0]>0&&oldmusicvolume[0]<=0){ - PlayStreamEx( music1, strm[music1], NULL, TRUE); - FSOUND_SetPaused(channels[music1], FALSE); + PlayStreamEx( music1, strm[music1], NULL, true); + FSOUND_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); + PlayStreamEx( stream_music2, strm[stream_music2], NULL, true); + FSOUND_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); + PlayStreamEx( stream_music3, strm[stream_music3], NULL, true); + FSOUND_SetPaused(channels[stream_music3], false); } } - if(!musictoggle){ - FSOUND_SetPaused(channels[music1], TRUE); - FSOUND_SetPaused(channels[stream_music2], TRUE); - FSOUND_SetPaused(channels[stream_music3], TRUE); + if(!musictoggle){ + FSOUND_SetPaused(channels[music1], true); + FSOUND_SetPaused(channels[stream_music2], true); + FSOUND_SetPaused(channels[stream_music3], true); for(i=0;i<4;i++){ oldmusicvolume[i]=0; @@ -11072,15 +11168,15 @@ void Game::TickOnceAfter(){ } } - if(musictoggle){ + if(musictoggle){ if(musicvolume[0]<=0&&oldmusicvolume[0]>0){ - FSOUND_SetPaused(channels[music1], TRUE); + FSOUND_SetPaused(channels[music1], true); } if(musicvolume[1]<=0&&oldmusicvolume[1]>0){ - FSOUND_SetPaused(channels[stream_music2], TRUE); + FSOUND_SetPaused(channels[stream_music2], true); } if(musicvolume[2]<=0&&oldmusicvolume[2]>0){ - FSOUND_SetPaused(channels[stream_music3], TRUE); + FSOUND_SetPaused(channels[stream_music3], true); } if(musicvolume[0]!=oldmusicvolume[0]){ @@ -11123,19 +11219,19 @@ void Game::TickOnceAfter(){ int numalarmed=0; if(numplayers>1) - for(i=1;imaxalarmed)maxalarmed=numalarmed; - if(changedelay<=0&&!loading&&!editorenabled&&gameon&&!tutoriallevel&&changedelay!=-999&&!won){ + if(changedelay<=0&&!loading&&!editorenabled&&gameon&&!tutoriallevel&&changedelay!=-999&&!won){ if(player[0].dead&&changedelay<=0){ changedelay=1; targetlevel=whichlevel; } alldead=1; if(numplayers>1) - for(i=1;iaccounthighscore[accountactive][whichlevel])accounthighscore[accountactive][whichlevel]=bonustotal-startbonustotal; - if(accountfasttime[accountactive][whichlevel]==0||leveltime3&&!registered){ - FSOUND_SetFrequency(FSOUND_ALL, 0.001); - PlayStreamEx( stream_music3, strm[stream_music3], NULL, TRUE); - FSOUND_SetPaused(channels[stream_music3], FALSE); + 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; @@ -11286,12 +11382,12 @@ void Game::TickOnceAfter(){ 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_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); + FSOUND_SetPaused(channels[fireendsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[fireendsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -11323,12 +11419,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); - PlaySoundEx( firestartsound, samp[firestartsound], NULL, TRUE); + 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); + FSOUND_SetPaused(channels[firestartsound], false); + FSOUND_Sample_SetMinMaxDistance(samp[firestartsound], 8.0f, 2000.0f); flashr=1; flashg=0; @@ -11339,8 +11435,7 @@ void Game::TickOnceAfter(){ startbonustotal=0; - // ifstream ipstream(":Data:Campaigns:main.txt"); - ifstream ipstream("./Data/Campaigns/main.txt"); + ifstream ipstream(ConvertFileName(":Data:Campaigns:main.txt")); //campaignnumlevels=0; //accountcampaignchoicesmade[accountactive]=0; ipstream.ignore(256,':'); @@ -11440,7 +11535,7 @@ void Game::TickOnceAfter(){ campaign=1; mainmenu=0; gameon=1; - FSOUND_SetPaused(channels[stream_music3], TRUE); + FSOUND_SetPaused(channels[stream_music3], true); stealthloading=0; } @@ -11466,7 +11561,7 @@ void Game::TickOnceAfter(){ target.y+=.1; if(player[0].skeleton.free){ for(i=0;itarget.y) + if(player[0].skeleton.joints[i].position.y*player[0].scale+player[0].coords.y>target.y) target.y=player[0].skeleton.joints[i].position.y*player[0].scale+player[0].coords.y; } target.y+=.1; @@ -11496,7 +11591,7 @@ void Game::TickOnceAfter(){ i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j]; colviewer=viewer; coltarget=cameraloc; - if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.rotation[i])!=-1)viewer=col; + if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.rotation[i])!=-1)viewer=col; } if(terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz]) for(j=0;j