X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameTick.cpp;h=4d7af69750c0b09c06585d07d0d4ffdab0e29ef1;hb=37aebc9e3fe24a45f04b35ff27e9d767014f3247;hp=19876ad62baea9096743c477d905ea61e5984bf5;hpb=eecffd77acac5500bad32cde2c56e18ee00f6cf7;p=lugaru.git diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 19876ad..4d7af69 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include "Game.h" #include "openal_wrapper.h" +#include "Settings.h" using namespace std; @@ -253,18 +254,938 @@ static bool stripfx(const char *str, const char *pfx) return !strncasecmp(str, pfx, strlen(pfx)); } -/********************> Tick() <*****/ extern OPENAL_STREAM * strm[20]; extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused); extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused); + +static const char *cmd_names[] = { +#define DECLARE_COMMAND(cmd) #cmd " ", +#include "ConsoleCmds.h" +#undef DECLARE_COMMAND +}; + +typedef void (*console_handler)(Game *game, const char *args); + +#define DECLARE_COMMAND(cmd) static void ch_##cmd(Game *game, const char *args); +#include "ConsoleCmds.h" +#undef DECLARE_COMMAND + +static console_handler cmd_handlers[] = { +#define DECLARE_COMMAND(cmd) ch_##cmd, +#include "ConsoleCmds.h" +#undef DECLARE_COMMAND +}; + +static void ch_quit(Game *game, const char *args) +{ + game->tryquit = 1; +} + +static void ch_map(Game *game, const char *args) +{ + char buf[64]; + snprintf(buf, 63, ":Data:Maps:%s", args); + game->Loadlevel(buf); + game->whichlevel = -2; + campaign = 0; +} + +static void ch_save(Game *game, const char *args) +{ + char buf[64]; + int i, j, k, l, m, templength; + float headprop, bodyprop, armprop, legprop; + snprintf(buf, 63, ":Data:Maps:%s", args); + + + int mapvers = 12;; + + FILE *tfile; + tfile=fopen( ConvertFileName(buf), "wb" ); + fpackf(tfile, "Bi", mapvers); + fpackf(tfile, "Bi", maptype); + fpackf(tfile, "Bi", hostile); + fpackf(tfile, "Bf Bf", viewdistance, fadestart); + fpackf(tfile, "Bb Bf Bf Bf", skyboxtexture, skyboxr, skyboxg, skyboxb); + fpackf(tfile, "Bf Bf Bf", skyboxlightr, skyboxlightg, skyboxlightb); + fpackf(tfile, "Bf Bf Bf Bf Bf Bi", player[0].coords.x, player[0].coords.y, player[0].coords.z, player[0].rotation, player[0].targetrotation, player[0].num_weapons); + if(player[0].num_weapons>0&&player[0].num_weapons<5) + for(j=0;j1&&numplayers0&&player[j].num_weapons<5) + for(k=0;knumpathpoints); + if(game->numpathpoints) + for(j=0;jnumpathpoints;j++){ + fpackf(tfile, "Bf Bf Bf Bi", game->pathpoint[j].x, game->pathpoint[j].y, game->pathpoint[j].z, game->numpathpointconnect[j]); + for(k=0;knumpathpointconnect[j];k++){ + fpackf(tfile, "Bi", game->pathpointconnect[j][k]); + } + } + + fpackf(tfile, "Bf Bf Bf Bf", game->mapcenter.x, game->mapcenter.y, game->mapcenter.z, game->mapradius); + + fclose(tfile); +} + +static void ch_cellar(Game *game, const char *args) +{ + game->LoadTextureSave(":Data:Textures:Furdarko.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); +} + +static void ch_tint(Game *game, const char *args) +{ + sscanf(args, "%f%f%f", &tintr, &tintg, &tintb); +} + +static void ch_tintr(Game *game, const char *args) +{ + tintr = atof(args); +} + +static void ch_tintg(Game *game, const char *args) +{ + tintg = atof(args); +} + +static void ch_tintb(Game *game, const char *args) +{ + tintb = atof(args); +} + +static void ch_speed(Game *game, const char *args) +{ + player[0].speedmult = atof(args); +} + +static void ch_strength(Game *game, const char *args) +{ + player[0].power = atof(args); +} + +static void ch_power(Game *game, const char *args) +{ + player[0].power = atof(args); +} + +static void ch_size(Game *game, const char *args) +{ + player[0].scale = atof(args) * .2; +} + +static int find_closest() +{ + int closest = 0; + float closestdist = 1.0/0.0; + + for (int i = 1; i < numplayers; i++) { + float distance; + distance = findDistancefast(&player[i].coords,&player[0].coords); + if (distance < closestdist) { + closestdist = distance; + closest = i; + } + } + return closest; +} + +static void ch_sizenear(Game *game, const char *args) +{ + int closest = find_closest(); + + if (closest) + player[closest].scale = atof(args) * .2; +} + +static void set_proportion(int pnum, const char *args) +{ + float headprop,bodyprop,armprop,legprop; + + sscanf(args, "%f%f%f%f", &headprop, &bodyprop, &armprop, &legprop); + + if(player[pnum].creature==wolftype){ + player[pnum].proportionhead=1.1*headprop; + player[pnum].proportionbody=1.1*bodyprop; + player[pnum].proportionarms=1.1*armprop; + player[pnum].proportionlegs=1.1*legprop; + } + + if(player[pnum].creature==rabbittype){ + player[pnum].proportionhead=1.2*headprop; + player[pnum].proportionbody=1.05*bodyprop; + player[pnum].proportionarms=1.00*armprop; + player[pnum].proportionlegs=1.1*legprop; + player[pnum].proportionlegs.y=1.05*legprop; + } +} + +static void ch_proportion(Game *game, const char *args) +{ + set_proportion(0, args); +} + +static void ch_proportionnear(Game *game, const char *args) +{ + int closest = find_closest(); + if (closest) + set_proportion(closest, args); +} + +static void set_protection(int pnum, const char *args) +{ + float head, high, low; + sscanf(args, "%f%f%f", &head, &high, &low); + + player[pnum].protectionhead = head; + player[pnum].protectionhigh = high; + player[pnum].protectionlow = low; +} + +static void ch_protection(Game *game, const char *args) +{ + set_protection(0, args); +} + +static void ch_protectionnear(Game *game, const char *args) +{ + int closest = find_closest(); + if (closest) + set_protection(closest, args); +} + +static void set_armor(int pnum, const char *args) +{ + float head, high, low; + sscanf(args, "%f%f%f", &head, &high, &low); + + player[pnum].armorhead = head; + player[pnum].armorhigh = high; + player[pnum].armorlow = low; +} + +static void ch_armor(Game *game, const char *args) +{ + set_armor(0, args); +} + +static void ch_armornear(Game *game, const char *args) +{ + int closest = find_closest(); + if (closest) + set_armor(closest, args); +} + +static void ch_protectionreset(Game *game, const char *args) +{ + set_protection(0, "1 1 1"); + set_armor(0, "1 1 1"); +} + +static void set_metal(int pnum, const char *args) +{ + float head, high, low; + sscanf(args, "%f%f%f", &head, &high, &low); + + player[pnum].metalhead = head; + player[pnum].metalhigh = high; + player[pnum].metallow = low; +} + +static void ch_metal(Game *game, const char *args) +{ + set_metal(0, args); +} + +static void set_noclothes(int pnum, Game *game, const char *args) +{ + player[pnum].numclothes = 0; + game->LoadTextureSave(creatureskin[player[pnum].creature][player[pnum].whichskin], + &player[pnum].skeleton.drawmodel.textureptr,1, + &player[pnum].skeleton.skinText[0],&player[pnum].skeleton.skinsize); +} + +static void ch_noclothes(Game *game, const char *args) +{ + set_noclothes(0, game, args); +} + +static void ch_noclothesnear(Game *game, const char *args) +{ + int closest = find_closest(); + if (closest) + set_noclothes(closest, game, args); +} + + +static void set_clothes(int pnum, Game *game, const char *args) +{ + char buf[64]; + snprintf(buf, 63, ":Data:Textures:%s.png", args); + + if (!game->AddClothes(buf,0,1,&player[pnum].skeleton.skinText[pnum],&player[pnum].skeleton.skinsize)) + return; + + player[pnum].DoMipmaps(5,0,0,player[pnum].skeleton.skinsize,player[pnum].skeleton.skinsize); + strcpy(player[pnum].clothes[player[pnum].numclothes],buf); + player[pnum].clothestintr[player[pnum].numclothes]=tintr; + player[pnum].clothestintg[player[pnum].numclothes]=tintg; + player[pnum].clothestintb[player[pnum].numclothes]=tintb; + player[pnum].numclothes++; +} + +static void ch_clothes(Game *game, const char *args) +{ + set_clothes(0, game, args); +} + +static void ch_clothesnear(Game *game, const char *args) +{ + int closest = find_closest(); + if (closest) + set_clothes(closest, game, args); +} + +static void ch_belt(Game *game, const char *args) +{ + player[0].skeleton.clothes = !player[0].skeleton.clothes; +} + + +static void ch_cellophane(Game *game, const char *args) +{ + cellophane = !cellophane; + float mul = cellophane ? 0 : 1; + + for (int i = 0; i < numplayers; i++) { + player[i].proportionhead.z = player[i].proportionhead.x * mul; + player[i].proportionbody.z = player[i].proportionbody.x * mul; + player[i].proportionarms.z = player[i].proportionarms.x * mul; + player[i].proportionlegs.z = player[i].proportionlegs.x * mul; + } +} + +static void ch_funnybunny(Game *game, const char *args) +{ + player[0].skeleton.id=0; + player[0].skeleton.Load(":Data:Skeleton:Basic Figure",":Data:Skeleton:Basic Figurelow", + ":Data:Skeleton:Rabbitbelt",":Data:Models:Body.solid", + ":Data:Models:Body2.solid",":Data:Models:Body3.solid", + ":Data:Models:Body4.solid",":Data:Models:Body5.solid", + ":Data:Models:Body6.solid",":Data:Models:Body7.solid", + ":Data:Models:Bodylow.solid",":Data:Models:Belt.solid",1); + game->LoadTextureSave(":Data:Textures:fur3.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); + player[0].creature=rabbittype; + player[0].scale=.2; + player[0].headless=0; + player[0].damagetolerance=200; + set_proportion(0, "1 1 1 1"); +} + +static void ch_wolfie(Game *game, const char *args) +{ + player[0].skeleton.id=0; + player[0].skeleton.Load(":Data:Skeleton:Basic Figure Wolf",":Data:Skeleton:Basic Figure Wolf Low", + ":Data:Skeleton:Rabbitbelt",":Data:Models:Wolf.solid", + ":Data:Models:Wolf2.solid",":Data:Models:Wolf3.solid", + ":Data:Models:Wolf4.solid",":Data:Models:Wolf5.solid", + ":Data:Models:Wolf6.solid",":Data:Models:Wolf7.solid", + ":Data:Models:Wolflow.solid",":Data:Models:Belt.solid",0); + game->LoadTextureSave(":Data:Textures:Wolf.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); + player[0].creature=wolftype; + player[0].damagetolerance=300; + set_proportion(0, "1 1 1 1"); +} + +static void ch_wolf(Game *game, const char *args) +{ + game->LoadTextureSave(":Data:Textures:Wolf.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); +} + +static void ch_snowwolf(Game *game, const char *args) +{ + game->LoadTextureSave(":Data:Textures:SnowWolf.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); +} + +static void ch_darkwolf(Game *game, const char *args) +{ + game->LoadTextureSave(":Data:Textures:DarkWolf.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); +} + +static void ch_white(Game *game, const char *args) +{ + game->LoadTextureSave(":Data:Textures:fur.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); +} + +static void ch_brown(Game *game, const char *args) +{ + game->LoadTextureSave(":Data:Textures:fur3.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); +} + +static void ch_black(Game *game, const char *args) +{ + game->LoadTextureSave(":Data:Textures:fur2.jpg",&player[0].skeleton.drawmodel.textureptr,1, + &player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); +} + +static void ch_sizemin(Game *game, const char *args) +{ + int i; + for (i = 1; i < numplayers; i++) + if (player[i].scale < 0.8 * 0.2) + player[i].scale = 0.8 * 0.2; +} + +static void ch_tutorial(Game *game, const char *args) +{ + tutoriallevel = atoi(args); +} + +static void ch_hostile(Game *game, const char *args) +{ + hostile = atoi(args); +} + +static void ch_indemo(Game *game, const char *args) +{ + game->indemo=1; + hotspot[numhotspots]=player[0].coords; + hotspotsize[numhotspots]=0; + hotspottype[numhotspots]=-111; + strcpy(hotspottext[numhotspots],"mapname"); + numhotspots++; +} + +static void ch_notindemo(Game *game, const char *args) +{ + game->indemo=0; + numhotspots--; +} + +static void ch_type(Game *game, const char *args) +{ + int i, n = sizeof(editortypenames) / sizeof(editortypenames[0]); + for (i = 0; i < n; i++) + if (stripfx(args, editortypenames[i])) + { + editoractive = i; + break; + } +} + +static void ch_path(Game *game, const char *args) +{ + int i, n = sizeof(pathtypenames) / sizeof(pathtypenames[0]); + for (i = 0; i < n; i++) + if (stripfx(args, pathtypenames[i])) + { + editorpathtype = i; + break; + } +} + +static void ch_hs(Game *game, const char *args) +{ + hotspot[numhotspots]=player[0].coords; + + float size; + int type, shift; + sscanf(args, "%f%d %n", &size, &type, &shift); + + hotspotsize[numhotspots] = size; + hotspottype[numhotspots] = type; + + strcpy(hotspottext[numhotspots], args + shift); + strcat(hotspottext[numhotspots], "\n"); + + numhotspots++; +} + +static void ch_dialogue(Game *game, const char *args) +{ + int dlg, i, j; + char buf1[32], buf2[64]; + + sscanf(args, "%d %31s", &dlg, buf1); + snprintf(buf2, 63, ":Data:Dialogues:%s.txt", buf1); + + dialoguetype[numdialogues] = dlg; + + memset(dialoguetext[numdialogues], 0, sizeof(dialoguetext[numdialogues])); + memset(dialoguename[numdialogues], 0, sizeof(dialoguename[numdialogues])); + + ifstream ipstream(ConvertFileName(buf2)); + ipstream.ignore(256,':'); + ipstream >> numdialogueboxes[numdialogues]; + for(i=0;i> dialogueboxlocation[numdialogues][i]; + ipstream.ignore(256,':'); + ipstream >> dialogueboxcolor[numdialogues][i][0]; + ipstream >> dialogueboxcolor[numdialogues][i][1]; + ipstream >> dialogueboxcolor[numdialogues][i][2]; + ipstream.ignore(256,':'); + ipstream.getline(dialoguename[numdialogues][i],64); + ipstream.ignore(256,':'); + ipstream.ignore(256,' '); + ipstream.getline(dialoguetext[numdialogues][i],128); + for(j=0;j<128;j++){ + if(dialoguetext[numdialogues][i][j]=='\\')dialoguetext[numdialogues][i][j]='\n'; + } + ipstream.ignore(256,':'); + ipstream >> dialogueboxsound[numdialogues][i]; + } + + for(i=0;i> numdialogueboxes[whichdi]; + for(i=0;i> dialogueboxlocation[whichdi][i]; + ipstream.ignore(256,':'); + ipstream >> dialogueboxcolor[whichdi][i][0]; + ipstream >> dialogueboxcolor[whichdi][i][1]; + ipstream >> dialogueboxcolor[whichdi][i][2]; + ipstream.ignore(256,':'); + ipstream.getline(dialoguename[whichdi][i],64); + ipstream.ignore(256,':'); + ipstream.ignore(256,' '); + ipstream.getline(dialoguetext[whichdi][i],128); + for(j=0;j<128;j++){ + if(dialoguetext[whichdi][i][j]=='\\')dialoguetext[whichdi][i][j]='\n'; + } + ipstream.ignore(256,':'); + ipstream >> dialogueboxsound[whichdi][i]; + } + + ipstream.close(); +} + +static void ch_fixtype(Game *game, const char *args) +{ + int dlg; + sscanf(args, "%d", &dlg); + dialoguetype[0] = dlg; +} + +static void ch_fixrotation(Game *game, const char *args) +{ + participantrotation[whichdialogue][participantfocus[whichdialogue][indialogue]]=player[participantfocus[whichdialogue][indialogue]].rotation; +} + +static void ch_ddialogue(Game *game, const char *args) +{ + if (numdialogues) + numdialogues--; +} + +static void ch_dhs(Game *game, const char *args) +{ + if (numhotspots) + numhotspots--; +} + +static void ch_immobile(Game *game, const char *args) +{ + player[0].immobile = 1; +} + +static void ch_allimmobile(Game *game, const char *args) +{ + for (int i = 1; i < numplayers; i++) + player[i].immobile = 1; +} + +static void ch_mobile(Game *game, const char *args) +{ + player[0].immobile = 0; +} + +static void ch_default(Game *game, const char *args) +{ + player[0].armorhead=1; + player[0].armorhigh=1; + player[0].armorlow=1; + player[0].protectionhead=1; + player[0].protectionhigh=1; + player[0].protectionlow=1; + player[0].metalhead=1; + player[0].metalhigh=1; + player[0].metallow=1; + player[0].power=1; + player[0].speedmult=1; + player[0].scale=1; + + if(player[0].creature==wolftype){ + player[0].proportionhead=1.1; + player[0].proportionbody=1.1; + player[0].proportionarms=1.1; + player[0].proportionlegs=1.1; + } + + if(player[0].creature==rabbittype){ + player[0].proportionhead=1.2; + player[0].proportionbody=1.05; + player[0].proportionarms=1.00; + player[0].proportionlegs=1.1; + player[0].proportionlegs.y=1.05; + } + + player[0].numclothes=0; + game->LoadTextureSave(creatureskin[player[0].creature][player[0].whichskin], + &player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0], + &player[0].skeleton.skinsize); + + editoractive=typeactive; + player[0].immobile=0; +} + +static void ch_play(Game *game, const char *args) +{ + int dlg, i; + sscanf(args, "%d", &dlg); + whichdialogue = dlg; + + if (whichdialogue >= numdialogues) + return; + + for(i=0;iSetUpLighting(); + + terrain.DoShadows(); + objects.DoShadows(); +} + +static void ch_skylight(Game *game, const char *args) +{ + sscanf(args, "%f%f%f", &skyboxlightr, &skyboxlightg, &skyboxlightb); + + game->SetUpLighting(); + + terrain.DoShadows(); + objects.DoShadows(); +} + +static void ch_skybox(Game *game, const char *args) +{ + skyboxtexture = !skyboxtexture; + + game->SetUpLighting(); + + terrain.DoShadows(); + objects.DoShadows(); +} + +static void cmd_dispatch(Game *game, const char *cmd) +{ + int i, n_cmds = sizeof(cmd_names) / sizeof(cmd_names[0]); + + for (i = 0; i < n_cmds; i++) + if (stripfx(cmd, cmd_names[i])) + { + cmd_handlers[i](game, cmd + strlen(cmd_names[i])); + break; + } + if (i < n_cmds) + { + PlaySoundEx(consolesuccesssound, samp[consolesuccesssound], NULL, true); + OPENAL_SetVolume(channels[consolesuccesssound], 256); + OPENAL_SetPaused(channels[consolesuccesssound], false); + } + else + { + PlaySoundEx(consolefailsound, samp[consolefailsound], NULL, true); + OPENAL_SetVolume(channels[consolefailsound], 256); + OPENAL_SetPaused(channels[consolefailsound], false); + } +} + + + +/********************> Tick() <*****/ extern void ScreenShot(const char * fname); void Screenshot (void) { char temp[1024]; time_t t = time(NULL); 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); + 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"); @@ -1671,7 +2592,6 @@ void Game::Tick() static XYZ test2; static XYZ lowpoint,lowpointtarget,lowpoint2,lowpointtarget2,lowpoint3,lowpointtarget3,lowpoint4,lowpointtarget4,lowpoint5,lowpointtarget5,lowpoint6,lowpointtarget6,lowpoint7,lowpointtarget7,colpoint,colpoint2; static int whichhit; - static bool donesomething; static bool oldjumpkeydown; int templength; @@ -1689,8 +2609,45 @@ void Game::Tick() static bool mainmenutogglekeydown; - if(!console){ - if(mainmenu&&endgame==1)mainmenu=10; + + if (IsKeyDown(theKeyMap, MAC_F6_KEY) && !freezetogglekeydown) { + if (IsKeyDown(theKeyMap, MAC_SHIFT_KEY)) { + stereoreverse=true; + } else { + stereoreverse=false; + } + + if (stereoreverse) { + printf("Stereo reversed\n"); + } else { + printf("Stereo unreversed\n"); + } + freezetogglekeydown=1; + } + + if (IsKeyDown(theKeyMap, MAC_F7_KEY)) { + if (IsKeyDown(theKeyMap, MAC_SHIFT_KEY)) { + stereoseparation -= 0.001; + } else { + stereoseparation -= 0.010; + } + + printf("Stereo decreased increased to %f\n", stereoseparation); + } + + if (IsKeyDown(theKeyMap, MAC_F8_KEY)) { + if (IsKeyDown(theKeyMap, MAC_SHIFT_KEY)) { + stereoseparation += 0.001; + } else { + stereoseparation += 0.010; + } + + printf("Stereo separation increased to %f\n", stereoseparation); + } + + + if(!console){ + if(mainmenu&&endgame==1)mainmenu=10; if(IsKeyDown(theKeyMap, MAC_ESCAPE_KEY)&&!mainmenutogglekeydown&&(mainmenu==7&&entername)){ for(j=0;j<255;j++){ displaytext[0][j]=' '; @@ -1831,81 +2788,7 @@ void Game::Tick() if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight<0)newscreenheight=screenheight; - ofstream opstream(ConvertFileName(":Data:config.txt", "w")); - opstream << "Screenwidth:\n"; - opstream << newscreenwidth; - opstream << "\nScreenheight:\n"; - opstream << newscreenheight; - opstream << "\nMouse sensitivity:\n"; - opstream << usermousesensitivity; - opstream << "\nBlur(0,1):\n"; - opstream << ismotionblur; - opstream << "\nOverall Detail(0,1,2) higher=better:\n"; - opstream << newdetail; - opstream << "\nFloating jump:\n"; - opstream << floatjump; - opstream << "\nMouse jump:\n"; - opstream << mousejump; - opstream << "\nAmbient sound:\n"; - opstream << ambientsound; - opstream << "\nBlood (0,1,2):\n"; - opstream << bloodtoggle; - opstream << "\nAuto slomo:\n"; - opstream << autoslomo; - opstream << "\nFoliage:\n"; - opstream << foliage; - opstream << "\nMusic:\n"; - opstream << musictoggle; - opstream << "\nTrilinear:\n"; - opstream << trilinear; - opstream << "\nDecals(shadows,blood puddles,etc):\n"; - opstream << decals; - opstream << "\nInvert mouse:\n"; - opstream << invertmouse; - opstream << "\nGamespeed:\n"; - if(oldgamespeed==0)oldgamespeed=1; - opstream << oldgamespeed; - opstream << "\nDifficulty(0,1,2) higher=harder:\n"; - opstream << difficulty; - opstream << "\nDamage effects(blackout, doublevision):\n"; - opstream << damageeffects; - opstream << "\nText:\n"; - opstream << texttoggle; - opstream << "\nDebug:\n"; - opstream << debugmode; - opstream << "\nVBL Sync:\n"; - opstream << vblsync; - opstream << "\nShow Points:\n"; - opstream << showpoints; - opstream << "\nAlways Blur:\n"; - opstream << alwaysblur; - opstream << "\nImmediate mode (turn on on G5):\n"; - opstream << immediate; - opstream << "\nVelocity blur:\n"; - opstream << velocityblur; - opstream << "\nVolume:\n"; - opstream << volume; - opstream << "\nForward key:\n"; - opstream << KeyToChar(forwardkey); - opstream << "\nBack key:\n"; - opstream << KeyToChar(backkey); - opstream << "\nLeft key:\n"; - opstream << KeyToChar(leftkey); - opstream << "\nRight key:\n"; - opstream << KeyToChar(rightkey); - opstream << "\nJump key:\n"; - opstream << KeyToChar(jumpkey); - opstream << "\nCrouch key:\n"; - opstream << KeyToChar(crouchkey); - opstream << "\nDraw key:\n"; - opstream << KeyToChar(drawkey); - opstream << "\nThrow key:\n"; - opstream << KeyToChar(throwkey); - opstream << "\nAttack key:\n"; - opstream << KeyToChar(attackkey); - opstream << "\nChat key:\n"; - opstream << KeyToChar(chatkey); - opstream.close(); + SaveSettings(*this); } if(mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==9||mainmenu==13||mainmenu==10||mainmenu==11||mainmenu==100){ float gLoc[3]={0,0,0}; @@ -2204,6 +3087,17 @@ void Game::Tick() mainmenu=4; keyselect=-1; } + if(Button() && !oldbutton && selected == 12) { + flashr=1; + flashg=0; + flashb=0; + flashamount=1; + flashdelay=1; + + newstereomode = stereomode; + mainmenu=18; + keyselect = -1; + } if(Button()&&!oldbutton&&selected==8){ float gLoc[3]={0,0,0}; float vel[3]={0,0,0}; @@ -2226,82 +3120,7 @@ void Game::Tick() if(newscreenheight<0)newscreenheight=screenheight; - ofstream opstream(ConvertFileName(":Data:config.txt", "w")); - opstream << "Screenwidth:\n"; - opstream << newscreenwidth; - opstream << "\nScreenheight:\n"; - opstream << newscreenheight; - opstream << "\nMouse sensitivity:\n"; - opstream << usermousesensitivity; - opstream << "\nBlur(0,1):\n"; - opstream << ismotionblur; - opstream << "\nOverall Detail(0,1,2) higher=better:\n"; - opstream << newdetail; - opstream << "\nFloating jump:\n"; - opstream << floatjump; - opstream << "\nMouse jump:\n"; - opstream << mousejump; - opstream << "\nAmbient sound:\n"; - opstream << ambientsound; - opstream << "\nBlood (0,1,2):\n"; - opstream << bloodtoggle; - opstream << "\nAuto slomo:\n"; - opstream << autoslomo; - opstream << "\nFoliage:\n"; - opstream << foliage; - opstream << "\nMusic:\n"; - opstream << musictoggle; - opstream << "\nTrilinear:\n"; - opstream << trilinear; - opstream << "\nDecals(shadows,blood puddles,etc):\n"; - opstream << decals; - opstream << "\nInvert mouse:\n"; - opstream << invertmouse; - opstream << "\nGamespeed:\n"; - if(oldgamespeed==0)oldgamespeed=1; - opstream << oldgamespeed; - opstream << "\nDifficulty(0,1,2) higher=harder:\n"; - opstream << difficulty; - opstream << "\nDamage effects(blackout, doublevision):\n"; - opstream << damageeffects; - opstream << "\nText:\n"; - opstream << texttoggle; - opstream << "\nDebug:\n"; - opstream << debugmode; - opstream << "\nVBL Sync:\n"; - opstream << vblsync; - opstream << "\nShow Points:\n"; - opstream << showpoints; - opstream << "\nAlways Blur:\n"; - opstream << alwaysblur; - opstream << "\nImmediate mode (turn on on G5):\n"; - opstream << immediate; - opstream << "\nVelocity blur:\n"; - opstream << velocityblur; - opstream << "\nVolume:\n"; - opstream << volume; - opstream << "\nForward key:\n"; - opstream << KeyToChar(forwardkey); - opstream << "\nBack key:\n"; - opstream << KeyToChar(backkey); - opstream << "\nLeft key:\n"; - opstream << KeyToChar(leftkey); - opstream << "\nRight key:\n"; - opstream << KeyToChar(rightkey); - opstream << "\nJump key:\n"; - opstream << KeyToChar(jumpkey); - opstream << "\nCrouch key:\n"; - opstream << KeyToChar(crouchkey); - opstream << "\nDraw key:\n"; - opstream << KeyToChar(drawkey); - opstream << "\nThrow key:\n"; - opstream << KeyToChar(throwkey); - opstream << "\nAttack key:\n"; - opstream << KeyToChar(attackkey); - opstream << "\nChat key:\n"; - opstream << KeyToChar(chatkey); - opstream.close(); - + SaveSettings(*this); if(mainmenu==3&&gameon)mainmenu=2; if(mainmenu==3&&!gameon)mainmenu=1; } @@ -2841,9 +3660,52 @@ void Game::Tick() if(Button())oldbutton=1; else oldbutton=0; } + if (mainmenu==18) { + if(Button()&&!oldbutton) { + printf("Button %i pressed\n", selected); + } + + if(Button()&&!oldbutton&&selected==0) { + newstereomode = (StereoMode)(newstereomode + 1); + while(!CanInitStereo(newstereomode)) { + printf("Failed to initialize mode %s (%i)\n", StereoModeName(newstereomode), newstereomode); + newstereomode = (StereoMode)(newstereomode + 1); + if ( newstereomode >= stereoCount ) { + newstereomode = stereoNone; + } + } + } + + if(buttons[0]&&!oldbutton&&selected==1) { + stereoseparation+=0.001; + } + if(buttons[1]&&!oldbutton&&selected==1) { + stereoseparation-=0.001; + } + + if(Button()&&!oldbutton&&selected==2) { + stereoreverse =! stereoreverse; + } + + if(Button()&&!oldbutton&&selected==3) { + flashr=1; + flashg=0; + flashb=0; + flashamount=1; + flashdelay=1; + + stereomode = newstereomode; + InitStereo(stereomode); + + mainmenu=3; + } + + if(Button() || buttons[1])oldbutton=1; + else oldbutton=0; + } - if(Button())oldbutton=1; + if(Button()||buttons[1])oldbutton=1; else oldbutton=0; if(IsKeyDown(theKeyMap, MAC_Q_KEY)&&IsKeyDown(theKeyMap, MAC_COMMAND_KEY)){ @@ -2854,81 +3716,7 @@ void Game::Tick() if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight<0)newscreenheight=screenheight; - ofstream opstream(ConvertFileName(":Data:config.txt", "w")); - opstream << "Screenwidth:\n"; - opstream << newscreenwidth; - opstream << "\nScreenheight:\n"; - opstream << newscreenheight; - opstream << "\nMouse sensitivity:\n"; - opstream << usermousesensitivity; - opstream << "\nBlur(0,1):\n"; - opstream << ismotionblur; - opstream << "\nOverall Detail(0,1,2) higher=better:\n"; - opstream << newdetail; - opstream << "\nFloating jump:\n"; - opstream << floatjump; - opstream << "\nMouse jump:\n"; - opstream << mousejump; - opstream << "\nAmbient sound:\n"; - opstream << ambientsound; - opstream << "\nBlood (0,1,2):\n"; - opstream << bloodtoggle; - opstream << "\nAuto slomo:\n"; - opstream << autoslomo; - opstream << "\nFoliage:\n"; - opstream << foliage; - opstream << "\nMusic:\n"; - opstream << musictoggle; - opstream << "\nTrilinear:\n"; - opstream << trilinear; - opstream << "\nDecals(shadows,blood puddles,etc):\n"; - opstream << decals; - opstream << "\nInvert mouse:\n"; - opstream << invertmouse; - opstream << "\nGamespeed:\n"; - if(oldgamespeed==0)oldgamespeed=1; - opstream << oldgamespeed; - opstream << "\nDifficulty(0,1,2) higher=harder:\n"; - opstream << difficulty; - opstream << "\nDamage effects(blackout, doublevision):\n"; - opstream << damageeffects; - opstream << "\nText:\n"; - opstream << texttoggle; - opstream << "\nDebug:\n"; - opstream << debugmode; - opstream << "\nVBL Sync:\n"; - opstream << vblsync; - opstream << "\nShow Points:\n"; - opstream << showpoints; - opstream << "\nAlways Blur:\n"; - opstream << alwaysblur; - opstream << "\nImmediate mode (turn on on G5):\n"; - opstream << immediate; - opstream << "\nVelocity blur:\n"; - opstream << velocityblur; - opstream << "\nVolume:\n"; - opstream << volume; - opstream << "\nForward key:\n"; - opstream << KeyToChar(forwardkey); - opstream << "\nBack key:\n"; - opstream << KeyToChar(backkey); - opstream << "\nLeft key:\n"; - opstream << KeyToChar(leftkey); - opstream << "\nRight key:\n"; - opstream << KeyToChar(rightkey); - opstream << "\nJump key:\n"; - opstream << KeyToChar(jumpkey); - opstream << "\nCrouch key:\n"; - opstream << KeyToChar(crouchkey); - opstream << "\nDraw key:\n"; - opstream << KeyToChar(drawkey); - opstream << "\nThrow key:\n"; - opstream << KeyToChar(throwkey); - opstream << "\nAttack key:\n"; - opstream << KeyToChar(attackkey); - opstream << "\nChat key:\n"; - opstream << KeyToChar(chatkey); - opstream.close(); + SaveSettings(*this); } } @@ -3249,2027 +4037,20 @@ void Game::Tick() } if(i==MAC_RETURN_KEY){ archiveselected=0; - donesomething=0; - if(stripfx(consoletext[0], "quit ")||stripfx(consoletext[0], "exit ")){ - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); - OPENAL_SetVolume(channels[consolesuccesssound], 256); - OPENAL_SetPaused(channels[consolesuccesssound], false); - donesomething=1; - tryquit=1; - } - /*if(stripfx(consoletext[0], "send ")){ - for(j=5;j32)numchars=32; - for(j=5;j0){ - for(k=14;k>=1;k--){ - for(j=0;j<255;j++){ - consoletext[k][j]=consoletext[k-1][j]; - } - consolechars[k]=consolechars[k-1]; - } - for(j=0;j<255;j++){ - consoletext[0][j]=' '; - } - if(v!=-4994)sprintf (consoletext[0], "Error #%d!!!",v); - else sprintf (consoletext[0], "Could not open connection"); - - consolechars[0]=255; - consoleselected=0; - } - } - else - { - donesomething=1; - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); - OPENAL_SetVolume(channels[consolesuccesssound], 256); - OPENAL_SetPaused(channels[consolesuccesssound], false); - - if(consolechars[0]>0){ - for(k=14;k>=1;k--){ - for(j=0;j<255;j++){ - consoletext[k][j]=consoletext[k-1][j]; - } - consolechars[k]=consolechars[k-1]; - } - for(j=0;j<255;j++){ - consoletext[0][j]=' '; - } - sprintf (consoletext[0], "Connected to %s",theIPAddress); - - consolechars[0]=255; - consoleselected=0; - } - } - } - - if(stripfx(consoletext[0], "host ")){ - unsigned char gameNameStr[32], playerNameStr[32]; - char gameName[32];//, playerName[32]; - NMUInt32 port; - int players; - int v; - - port = 25710; - players =4; - - strcpy(gameName, "Host's game"); - strcpy(playerName, "Host"); - GameC2PStr( gameName, gameNameStr ); - GameC2PStr( playerName, playerNameStr ); - - v=NetworkStartServer( (NMUInt16)port, players, gameNameStr, playerNameStr ); - if(v) - { - if(consolechars[0]>0){ - for(k=14;k>=1;k--){ - for(j=0;j<255;j++){ - consoletext[k][j]=consoletext[k-1][j]; - } - consolechars[k]=consolechars[k-1]; - } - for(j=0;j<255;j++){ - consoletext[0][j]=' '; - } - sprintf (consoletext[0], "Error #%d!!!",v); - - consolechars[0]=255; - consoleselected=0; - } - } - else - { - donesomething=1; - PlaySoundEx( consolesuccesssound, samp[consolesuccesssound], NULL, true); - OPENAL_SetVolume(channels[consolesuccesssound], 256); - OPENAL_SetPaused(channels[consolesuccesssound], false); + cmd_dispatch(this, consoletext[0]); if(consolechars[0]>0){ - for(k=14;k>=1;k--){ - for(j=0;j<255;j++){ - consoletext[k][j]=consoletext[k-1][j]; - } - consolechars[k]=consolechars[k-1]; - } - for(j=0;j<255;j++){ - consoletext[0][j]=' '; - } - sprintf (consoletext[0], "Game hosted"); - - consolechars[0]=255; - consoleselected=0; - } - } - } - */ - if(stripfx(consoletext[0], "save ")){ - mapname[0]=':'; - mapname[1]='D'; - mapname[2]='a'; - mapname[3]='t'; - mapname[4]='a'; - mapname[5]=':'; - mapname[6]='M'; - mapname[7]='a'; - mapname[8]='p'; - mapname[9]='s'; - mapname[10]=':'; - for(j=5;j0&&player[0].num_weapons<5) - for(j=0;j=1;k--){ + for(j=0;j<255;j++){ + consoletext[k][j]=consoletext[k-1][j]; } - - fpackf(tfile, "Bf Bf Bf", player[0].armorhead, player[0].armorhigh, player[0].armorlow); - fpackf(tfile, "Bf Bf Bf", player[0].protectionhead, player[0].protectionhigh, player[0].protectionlow); - fpackf(tfile, "Bf Bf Bf", player[0].metalhead, player[0].metalhigh, player[0].metallow); - fpackf(tfile, "Bf Bf", player[0].power, player[0].speedmult); - - fpackf(tfile, "Bi", player[0].numclothes); - - fpackf(tfile, "Bi Bi", player[0].whichskin, player[0].creature); - - fpackf(tfile, "Bi", numdialogues); - if(numdialogues) - for(k=0;k1&&numplayers0&&player[j].num_weapons<5) - for(k=0;k0&&player[0].num_weapons<5) - for(j=0;j1&&numplayers0&&player[j].num_weapons<5) - for(k=0;k0&&player[0].num_weapons<5) - for(j=0;j1&&numplayers0&&player[j].num_weapons<5) - for(k=0;k1) - for(i=1;i1) - for(i=1;i> numdialogueboxes[numdialogues]; - for(i=0;i> dialogueboxlocation[numdialogues][i]; - ipstream.ignore(256,':'); - ipstream >> dialogueboxcolor[numdialogues][i][0]; - ipstream >> dialogueboxcolor[numdialogues][i][1]; - ipstream >> dialogueboxcolor[numdialogues][i][2]; - ipstream.ignore(256,':'); - ipstream.getline(dialoguename[numdialogues][i],64); - ipstream.ignore(256,':'); - ipstream.ignore(256,' '); - ipstream.getline(dialoguetext[numdialogues][i],128); - for(j=0;j<128;j++){ - if(dialoguetext[numdialogues][i][j]=='\\')dialoguetext[numdialogues][i][j]='\n'; - } - ipstream.ignore(256,':'); - ipstream >> dialogueboxsound[numdialogues][i]; - } - - for(i=0;i> numdialogueboxes[whichdi]; - for(i=0;i> dialogueboxlocation[whichdi][i]; - ipstream.ignore(256,':'); - ipstream >> dialogueboxcolor[whichdi][i][0]; - ipstream >> dialogueboxcolor[whichdi][i][1]; - ipstream >> dialogueboxcolor[whichdi][i][2]; - ipstream.ignore(256,':'); - ipstream.getline(dialoguename[whichdi][i],64); - ipstream.ignore(256,':'); - ipstream.ignore(256,' '); - ipstream.getline(dialoguetext[whichdi][i],128); - for(j=0;j<128;j++){ - if(dialoguetext[whichdi][i][j]=='\\')dialoguetext[whichdi][i][j]='\n'; - } - ipstream.ignore(256,':'); - ipstream >> dialogueboxsound[whichdi][i]; - } - - ipstream.close(); - - donesomething=1; - } - - if(stripfx(consoletext[0], "fixtype ")){ - int startpoint; - int alldone; - int whichdi; - - alldone=0; - startpoint=8; - j=startpoint; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - dialoguetype[0]=atoi(mapname); - - startpoint=j+1; - - donesomething=1; - } - - - if(stripfx(consoletext[0], "fixrotation ")){ - participantrotation[whichdialogue][participantfocus[whichdialogue][indialogue]]=player[participantfocus[whichdialogue][indialogue]].rotation; - - donesomething=1; - } - - if(stripfx(consoletext[0], "ddialogue ")){ - numdialogues--; - if(numdialogues<0)numdialogues=0; - - donesomething=1; - } - - if(stripfx(consoletext[0], "immobile ")){ - player[0].immobile=1; - donesomething=1; - } - - if(stripfx(consoletext[0], "mobile ")){ - player[0].immobile=0; - donesomething=1; - } - - if(stripfx(consoletext[0], "play ")){ - int startpoint; - int alldone; - - alldone=0; - startpoint=5; - j=startpoint; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - startpoint=j+1; - - whichdialogue=atoi(mapname); - - if(numdialogues>whichdialogue){ - for(i=0;i0)player[i].immobile=1; - } - donesomething=1; - } - - - if(stripfx(consoletext[0], "default ")||stripfx(consoletext[0], "Default ")){ - player[0].armorhead=1; - player[0].armorhigh=1; - player[0].armorlow=1; - player[0].protectionhead=1; - player[0].protectionhigh=1; - player[0].protectionlow=1; - player[0].metalhead=1; - player[0].metalhigh=1; - player[0].metallow=1; - player[0].power=1; - player[0].speedmult=1; - player[0].scale=1; - - if(player[0].creature==wolftype){ - player[0].proportionhead=1.1; - player[0].proportionbody=1.1; - player[0].proportionarms=1.1; - player[0].proportionlegs=1.1; - } - - if(player[0].creature==rabbittype){ - player[0].proportionhead=1.2; - player[0].proportionbody=1.05; - player[0].proportionarms=1.00; - player[0].proportionlegs=1.1; - player[0].proportionlegs.y=1.05; - } - - player[0].numclothes=0; - LoadTextureSave(creatureskin[player[0].creature][player[0].whichskin], - &player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize); - - editoractive=typeactive; - player[0].immobile=0; - - - - donesomething=1; - } - - if(stripfx(consoletext[0], "tint ")||stripfx(consoletext[0], "Tint ")){ - int startpoint; - int alldone; - alldone=0; - startpoint=5; - j=startpoint; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - tintr=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - tintg=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - tintb=atof(mapname); - - donesomething=1; - } - - if(stripfx(consoletext[0], "sky tint ")||stripfx(consoletext[0], "Sky Tint ")){ - int startpoint; - int alldone; - alldone=0; - startpoint=9; - j=startpoint; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - skyboxr=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - skyboxg=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - skyboxb=atof(mapname); - - skyboxlightr=skyboxr; - skyboxlightg=skyboxg; - skyboxlightb=skyboxb; - - SetUpLighting(); - - //if(skyboxtexture){ - terrain.DoShadows(); - objects.DoShadows(); - /*} - else terrain.DoLighting(); - */ - donesomething=1; - } - - if(stripfx(consoletext[0], "sky light ")||stripfx(consoletext[0], "Sky Light ")){ - int startpoint; - int alldone; - alldone=0; - startpoint=10; - j=startpoint; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - skyboxlightr=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - skyboxlightg=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - skyboxlightb=atof(mapname); - - SetUpLighting(); - - //if(skyboxtexture){ - terrain.DoShadows(); - objects.DoShadows(); - /*} - else terrain.DoLighting(); - */ - donesomething=1; - } - - if(stripfx(consoletext[0], "skybox ")||stripfx(consoletext[0], "Skybox ")){ - skyboxtexture=1-skyboxtexture; - - SetUpLighting(); - //if(skyboxtexture){ - terrain.DoShadows(); - objects.DoShadows(); - /*} - else terrain.DoLighting(); - */ - donesomething=1; - } - - if(stripfx(consoletext[0], "protection ")||stripfx(consoletext[0], "Protection ")){ - int startpoint; - int alldone; - alldone=0; - startpoint=11; - j=startpoint; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - player[0].protectionhead=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - player[0].protectionhigh=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - player[0].protectionlow=atof(mapname); - - donesomething=1; - } - - if(stripfx(consoletext[0], "armor ")||stripfx(consoletext[0], "Armor ")){ - int startpoint; - int alldone; - alldone=0; - startpoint=6; - j=startpoint; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - player[0].armorhead=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - player[0].armorhigh=atof(mapname); - - j++; - startpoint=j; - while(consoletext[0][j]!='\0'&&consoletext[0][j]!=' '&&!alldone&&j<255){ - mapname[j-startpoint]=consoletext[0][j]; - j++; - if(consoletext[0][j]=='\0')alldone=1; - } - mapname[j-startpoint]='\0'; - - player[0].armorlow=atof(mapname); - - donesomething=1; - } - - if(stripfx(consoletext[0], "protectionreset ")||stripfx(consoletext[0], "Protectionreset ")){ - for(i=0;i1) - for(i=1;i1) - for(i=1;i1) - for(i=1;i1) - for(i=1;i0){ - for(k=14;k>=1;k--){ - for(j=0;j<255;j++){ - consoletext[k][j]=consoletext[k-1][j]; - } - consolechars[k]=consolechars[k-1]; - } - for(j=0;j<255;j++){ - consoletext[0][j]=' '; + for(j=0;j<255;j++){ + consoletext[0][j]=' '; } consolechars[0]=0; consoleselected=0; - - if(!donesomething){ - PlaySoundEx( consolefailsound, samp[consolefailsound], NULL, true); - OPENAL_SetVolume(channels[consolefailsound], 256); - OPENAL_SetPaused(channels[consolefailsound], false); - } } } } @@ -5296,81 +4077,7 @@ void Game::Tick() if(newscreenwidth<0)newscreenwidth=screenwidth; if(newscreenheight<0)newscreenheight=screenheight; - ofstream opstream(ConvertFileName(":Data:config.txt", "w")); - opstream << "Screenwidth:\n"; - opstream << newscreenwidth; - opstream << "\nScreenheight:\n"; - opstream << newscreenheight; - opstream << "\nMouse sensitivity:\n"; - opstream << usermousesensitivity; - opstream << "\nBlur(0,1):\n"; - opstream << ismotionblur; - opstream << "\nOverall Detail(0,1,2) higher=better:\n"; - opstream << newdetail; - opstream << "\nFloating jump:\n"; - opstream << floatjump; - opstream << "\nMouse jump:\n"; - opstream << mousejump; - opstream << "\nAmbient sound:\n"; - opstream << ambientsound; - opstream << "\nBlood (0,1,2):\n"; - opstream << bloodtoggle; - opstream << "\nAuto slomo:\n"; - opstream << autoslomo; - opstream << "\nFoliage:\n"; - opstream << foliage; - opstream << "\nMusic:\n"; - opstream << musictoggle; - opstream << "\nTrilinear:\n"; - opstream << trilinear; - opstream << "\nDecals(shadows,blood puddles,etc):\n"; - opstream << decals; - opstream << "\nInvert mouse:\n"; - opstream << invertmouse; - opstream << "\nGamespeed:\n"; - if(oldgamespeed==0)oldgamespeed=1; - opstream << oldgamespeed; - opstream << "\nDifficulty(0,1,2) higher=harder:\n"; - opstream << difficulty; - opstream << "\nDamage effects(blackout, doublevision):\n"; - opstream << damageeffects; - opstream << "\nText:\n"; - opstream << texttoggle; - opstream << "\nDebug:\n"; - opstream << debugmode; - opstream << "\nVBL Sync:\n"; - opstream << vblsync; - opstream << "\nShow Points:\n"; - opstream << showpoints; - opstream << "\nAlways Blur:\n"; - opstream << alwaysblur; - opstream << "\nImmediate mode (turn on on G5):\n"; - opstream << immediate; - opstream << "\nVelocity blur:\n"; - opstream << velocityblur; - opstream << "\nVolume:\n"; - opstream << volume; - opstream << "\nForward key:\n"; - opstream << KeyToChar(forwardkey); - opstream << "\nBack key:\n"; - opstream << KeyToChar(backkey); - opstream << "\nLeft key:\n"; - opstream << KeyToChar(leftkey); - opstream << "\nRight key:\n"; - opstream << KeyToChar(rightkey); - opstream << "\nJump key:\n"; - opstream << KeyToChar(jumpkey); - opstream << "\nCrouch key:\n"; - opstream << KeyToChar(crouchkey); - opstream << "\nDraw key:\n"; - opstream << KeyToChar(drawkey); - opstream << "\nThrow key:\n"; - opstream << KeyToChar(throwkey); - opstream << "\nAttack key:\n"; - opstream << KeyToChar(attackkey); - opstream << "\nChat key:\n"; - opstream << KeyToChar(chatkey); - opstream.close(); + SaveSettings(*this); } }