]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
Remove terraindetail (== 1 anyway)
[lugaru.git] / Source / GameTick.cpp
index 55fbb962a89ff8c10767c532f034cb504a61a236..7e231e0a03f508604dec7a56b2936c002da850e2 100644 (file)
@@ -63,7 +63,6 @@ extern Light light;
 extern float texdetail;
 extern GLubyte bloodText[512*512*3];
 extern GLubyte wolfbloodText[512*512*3];
-extern float terraindetail;
 extern float camerashake;
 extern float woozy;
 extern float blackout;
@@ -83,7 +82,6 @@ extern bool autoslomo;
 extern bool keyboardfrozen;
 extern int netdatanew;
 extern bool loadingstuff;
-extern char mapname[256];
 extern XYZ windvector;
 extern bool debugmode;
 static int music1;
@@ -157,28 +155,6 @@ extern int hostile;
 extern bool stillloading;
 extern bool winfreeze;
 
-extern int numdialogues;
-extern int numdialogueboxes[max_dialogues];
-extern int dialoguetype[max_dialogues];
-extern int dialogueboxlocation[max_dialogues][max_dialoguelength];
-extern float dialogueboxcolor[max_dialogues][max_dialoguelength][3];
-extern int dialogueboxsound[max_dialogues][max_dialoguelength];
-extern char dialoguetext[max_dialogues][max_dialoguelength][128];
-extern char dialoguename[max_dialogues][max_dialoguelength][64];
-extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
-extern XYZ participantlocation[max_dialogues][10];
-extern int participantfocus[max_dialogues][max_dialoguelength];
-extern int participantaction[max_dialogues][max_dialoguelength];
-extern float participantrotation[max_dialogues][10];
-extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
-extern float dialoguecamerarotation[max_dialogues][max_dialoguelength];
-extern float dialoguecamerarotation2[max_dialogues][max_dialoguelength];
-extern int indialogue;
-extern int whichdialogue;
-extern int directing;
-extern float dialoguetime;
-extern int dialoguegonethrough[20];
-
 extern bool campaign;
 
 extern float oldgamespeed;
@@ -238,9 +214,7 @@ static void ch_quit(Game *game, const char *args)
 
 static void ch_map(Game *game, const char *args)
 {
-  char buf[64];
-  snprintf(buf, 63, ":Data:Maps:%s", args);
-  game->Loadlevel(buf);
+  game->Loadlevel(args);
   game->whichlevel = -2;
   campaign = 0;
 }
@@ -1354,9 +1328,7 @@ void      Game::Setenvironment(int which)
                        ":Data:Textures:Skybox(snow):Back.jpg",
                        ":Data:Textures:Skybox(snow):Right.jpg",
                        ":Data:Textures:Skybox(snow):Up.jpg",
-                       ":Data:Textures:Skybox(snow):Down.jpg",
-                       ":Data:Textures:Skybox(snow):Cloud.jpg",
-                       ":Data:Textures:Skybox(snow):Reflect.jpg");
+                       ":Data:Textures:Skybox(snow):Down.jpg");
 
 
 
@@ -1395,9 +1367,7 @@ void      Game::Setenvironment(int which)
                        ":Data:Textures:Skybox(sand):Back.jpg",
                        ":Data:Textures:Skybox(sand):Right.jpg",
                        ":Data:Textures:Skybox(sand):Up.jpg",
-                       ":Data:Textures:Skybox(sand):Down.jpg",
-                       ":Data:Textures:Skybox(sand):Cloud.jpg",
-                       ":Data:Textures:Skybox(sand):Reflect.jpg");
+                       ":Data:Textures:Skybox(sand):Down.jpg");
 
 
 
@@ -1435,9 +1405,7 @@ void      Game::Setenvironment(int which)
                        ":Data:Textures:Skybox(grass):Back.jpg",
                        ":Data:Textures:Skybox(grass):Right.jpg",
                        ":Data:Textures:Skybox(grass):Up.jpg",
-                       ":Data:Textures:Skybox(grass):Down.jpg",
-                       ":Data:Textures:Skybox(grass):Cloud.jpg",
-                       ":Data:Textures:Skybox(grass):Reflect.jpg");
+                       ":Data:Textures:Skybox(grass):Down.jpg");
 
 
 
@@ -1453,35 +1421,31 @@ void    Game::Setenvironment(int which)
 
 void   Game::Loadlevel(int which){
        stealthloading=0;
-
-       if(which==0)Loadlevel((char *)":Data:Maps:map1");
-       else if(which==1)Loadlevel((char *)":Data:Maps:map2");
-       else if(which==2)Loadlevel((char *)":Data:Maps:map3");
-       else if(which==3)Loadlevel((char *)":Data:Maps:map4");
-       else if(which==4)Loadlevel((char *)":Data:Maps:map5");
-       else if(which==5)Loadlevel((char *)":Data:Maps:map6");
-       else if(which==6)Loadlevel((char *)":Data:Maps:map7");
-       else if(which==7)Loadlevel((char *)":Data:Maps:map8");
-       else if(which==8)Loadlevel((char *)":Data:Maps:map9");
-       else if(which==9)Loadlevel((char *)":Data:Maps:map10");
-       else if(which==10)Loadlevel((char *)":Data:Maps:map11");
-       else if(which==11)Loadlevel((char *)":Data:Maps:map12");
-       else if(which==12)Loadlevel((char *)":Data:Maps:map13");
-       else if(which==13)Loadlevel((char *)":Data:Maps:map14");
-       else if(which==14)Loadlevel((char *)":Data:Maps:map15");
-       else if(which==15)Loadlevel((char *)":Data:Maps:map16");
-       else if(which==-1){tutoriallevel=-1;Loadlevel((char *)":Data:Maps:tutorial");}
-       else Loadlevel((char *)":Data:Maps:mapsave");
-
        whichlevel=which;
+
+       if (which == -1)
+         {
+           tutoriallevel = -1;
+           Loadlevel("tutorial");
+         }
+       else if (which >= 0 && which <= 15)
+         {
+           char buf[32];
+           snprintf(buf, 32, "map%d", which + 1);
+           Loadlevel(buf);
+         }
+       else
+         Loadlevel("mapsave");
 }
 
-void   Game::Loadlevel(char *name){
+void   Game::Loadlevel(const char *name){
        int i,j,k,l,m;
        static int oldlevel;
        int templength;
        float lamefloat;
        int lameint;
+       static const char *pfx = ":Data:Maps:";
+       char *buf;
 
        float headprop,legprop,armprop,bodyprop;
 
@@ -1514,7 +1478,9 @@ void      Game::Loadlevel(char *name){
        pause_sound(stream_firesound);
 
        // Change the map filename into something that is os specific
-       char *FixedFN = ConvertFileName(name);
+       buf = (char*) alloca(strlen(pfx) + strlen(name) + 1);
+       sprintf(buf, "%s%s", pfx, name);
+       const char *FixedFN = ConvertFileName(buf);
 
        int mapvers;
        FILE                    *tfile;
@@ -1686,21 +1652,6 @@ void     Game::Loadlevel(char *name){
                        player[0].creature=rabbittype;
                }
 
-               for(i=0;i<max_dialogues;i++)
-               {
-                       for(j=0;j<max_dialoguelength;j++)
-                       {
-                               for(k=0;k<128;k++)
-                               {
-                                       dialoguetext[i][j][k]='\0';
-                               }
-                               for(k=0;k<64;k++)
-                               {
-                                       dialoguename[i][j][k]='\0';
-                               }
-                       }
-               }
-
                player[0].lastattack=-1;
                player[0].lastattack2=-1;
                player[0].lastattack3=-1;
@@ -1737,6 +1688,7 @@ void      Game::Loadlevel(char *name){
                                                                funpackf(tfile, "Bb", &dialoguetext[k][l][m]);
                                                                if(dialoguetext[k][l][m]=='\0')break;
                                                        }
+                                                       dialoguetext[k][l][m] = 0;
 
                                                        funpackf(tfile, "Bi",&templength);
                                                        if(templength>64||templength<=0)templength=64;
@@ -1746,6 +1698,7 @@ void      Game::Loadlevel(char *name){
                                                                        break;
                                                                }
                                                        }
+                                                       dialoguename[k][l][m] = 0;
                                                        funpackf(tfile, "Bf Bf Bf", &dialoguecamera[k][l].x, &dialoguecamera[k][l].y, &dialoguecamera[k][l].z);
                                                        funpackf(tfile, "Bi", &participantfocus[k][l]);
                                                        funpackf(tfile, "Bi", &participantaction[k][l]);
@@ -2616,25 +2569,10 @@ void    Game::Tick()
                                targetlevel=7;
                                if(firstload) TickOnceAfter();
                                else LoadStuff();
-                               for(i=0;i<255;i++){
-                                       mapname[i]='\0';
-                               }
-                               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]=':';
-                               strcat(mapname,campaignmapname[campaignchoicewhich[selected-7-accountactive->getCampaignChoicesMade()]]);
                                whichchoice=selected-7-accountactive->getCampaignChoicesMade();
                                visibleloading=1;
                                stillloading=1;
-                               Loadlevel(mapname);
+                               Loadlevel(campaignmapname[campaignchoicewhich[selected-7-accountactive->getCampaignChoicesMade()]]);
                                //Loadlevel(campaignmapname[levelorder[selected-7]]);
                                campaign=1;
                                mainmenu=0;
@@ -4184,7 +4122,6 @@ void      Game::Tick()
 
 
                                                dialoguetime+=multiplier;
-                                               skybox.cloudmove+=multiplier;
                                                hawkrotation+=multiplier*25;
                                                realhawkcoords=0;
                                                realhawkcoords.x=25;
@@ -7250,8 +7187,8 @@ void      Game::Tick()
 
                                                        for(k=0;k<numplayers;k++){
                                                                player[k].DoAnimations();
-                                                               player[k].whichpatchx=player[k].coords.x/(terrain.size/subdivision*terrain.scale*terraindetail);
-                                                               player[k].whichpatchz=player[k].coords.z/(terrain.size/subdivision*terrain.scale*terraindetail);
+                                                               player[k].whichpatchx=player[k].coords.x/(terrain.size/subdivision*terrain.scale);
+                                                               player[k].whichpatchz=player[k].coords.z/(terrain.size/subdivision*terrain.scale);
                                                        }
 
                                                        objects.DoStuff();
@@ -7612,22 +7549,7 @@ void     Game::TickOnceAfter(){
 
                                        fireSound(firestartsound);
 
-                                       for(i=0;i<255;i++){
-                                               mapname[i]='\0';
-                                       }
-                                       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]=':';
-                                       strcat(mapname,campaignmapname[levelorder[accountactive->getCampaignChoicesMade()]]);//[campaignchoicewhich[whichchoice]]);
-                                       Loadlevel(mapname);
+                                       Loadlevel(campaignmapname[levelorder[accountactive->getCampaignChoicesMade()]]);
 
                                        fireSound();
 
@@ -7731,29 +7653,11 @@ void    Game::TickOnceAfter(){
                                        loading=2;
                                        loadtime=0;
                                        targetlevel=7;
-                                       //if(firstload)TickOnceAfter();
                                        if(!firstload)LoadStuff();
-                                       //else {
-                                       for(i=0;i<255;i++){
-                                               mapname[i]='\0';
-                                       }
-                                       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]=':';
-
-                                       strcat(mapname,campaignmapname[campaignchoicewhich[0]]);
                                        whichchoice=0;
                                        visibleloading=1;
                                        stillloading=1;
-                                       Loadlevel(mapname);
+                                       Loadlevel(campaignmapname[campaignchoicewhich[0]]);
                                        campaign=1;
                                        mainmenu=0;
                                        gameon=1;