]> git.jsancho.org Git - lugaru.git/commitdiff
renaming some maps to be coherent.
authorCôme BERNIGAUD <come.bernigaud@gmail.com>
Mon, 16 May 2011 15:42:40 +0000 (17:42 +0200)
committerCôme BERNIGAUD <come.bernigaud@gmail.com>
Mon, 16 May 2011 15:42:40 +0000 (17:42 +0200)
51 files changed:
Data/Campaigns/main.txt
Data/Maps/Start1 [new file with mode: 0644]
Data/Maps/Start10 [new file with mode: 0644]
Data/Maps/Start11 [new file with mode: 0644]
Data/Maps/Start12 [new file with mode: 0644]
Data/Maps/Start13 [new file with mode: 0644]
Data/Maps/Start14 [new file with mode: 0644]
Data/Maps/Start15 [new file with mode: 0644]
Data/Maps/Start16 [new file with mode: 0644]
Data/Maps/Start17 [new file with mode: 0644]
Data/Maps/Start18 [new file with mode: 0644]
Data/Maps/Start19 [new file with mode: 0644]
Data/Maps/Start2 [new file with mode: 0644]
Data/Maps/Start20 [new file with mode: 0644]
Data/Maps/Start21 [new file with mode: 0644]
Data/Maps/Start22 [new file with mode: 0644]
Data/Maps/Start23 [new file with mode: 0644]
Data/Maps/Start3 [new file with mode: 0644]
Data/Maps/Start4 [new file with mode: 0644]
Data/Maps/Start5 [new file with mode: 0644]
Data/Maps/Start6 [new file with mode: 0644]
Data/Maps/Start7 [new file with mode: 0644]
Data/Maps/Start8 [new file with mode: 0644]
Data/Maps/Start9 [new file with mode: 0644]
Data/Maps/start1 [deleted file]
Data/Maps/start10 [deleted file]
Data/Maps/start11 [deleted file]
Data/Maps/start12 [deleted file]
Data/Maps/start13 [deleted file]
Data/Maps/start14 [deleted file]
Data/Maps/start15 [deleted file]
Data/Maps/start16 [deleted file]
Data/Maps/start17 [deleted file]
Data/Maps/start18 [deleted file]
Data/Maps/start19 [deleted file]
Data/Maps/start2 [deleted file]
Data/Maps/start20 [deleted file]
Data/Maps/start21 [deleted file]
Data/Maps/start22 [deleted file]
Data/Maps/start23 [deleted file]
Data/Maps/start3 [deleted file]
Data/Maps/start4 [deleted file]
Data/Maps/start5 [deleted file]
Data/Maps/start6 [deleted file]
Data/Maps/start7 [deleted file]
Data/Maps/start8 [deleted file]
Data/Maps/start9 [deleted file]
Source/GameDraw.cpp
Source/GameTick.cpp
Source/Terrain.cpp
Source/Weapons.cpp

index 9ea6a543f6e4499e414a2f8fa638a5f437062eff..9b576b7509c9ffa1896d00256c884b894894fab4 100644 (file)
@@ -1 +1 @@
-Campaign Levels: 27\r\rLevel 1:\rName: Start1\rDescription: Village_-_start_campaign_mode!\rChooseNext: 2\rNumNext: 1\rNextLevel: 2\rLocationX: 264\rLocationY: 310\r\rLevel 2:\rName: Start2\rDescription: Stranger\rChooseNext: 0\rNumNext: 1\rNextLevel: 3\rLocationX: 264\rLocationY: 310\r\rLevel 3:\rName: Start3\rDescription: Village\rChooseNext: 1\rNumNext: 1\rNextLevel: 4\rLocationX: 264\rLocationY: 310\r\rLevel 4:\rName: Start4\rDescription: Wanderer\rChooseNext: 1\rNumNext: 1\rNextLevel: 5\rLocationX: 274\rLocationY: 310\r\rLevel 5:\rName: Start5\rDescription: Village\rChooseNext: 1\rNumNext: 1\rNextLevel: 6\rLocationX: 264\rLocationY: 310\r\rLevel 6:\rName: Start6\rDescription: Clearing\rChooseNext: 1\rNumNext: 1\rNextLevel: 7\rLocationX: 260\rLocationY: 295\r\rLevel 7:\rName: Start7\rDescription: Raider_Patrol\rChooseNext: 1\rNumNext: 1\rNextLevel: 8\rLocationX: 250\rLocationY: 278\r\rLevel 8:\rName: raidercamp\rDescription: Raider_Camp\rChooseNext: 1\rNumNext: 1\rNextLevel: 9\rLocationX: 240\rLocationY: 270\r\r\rLevel 8:\rName: Start8\rDescription: Raider_Sentries\rChooseNext: 1\rNumNext: 1\rNextLevel: 10\rLocationX: 255\rLocationY: 265\r\rLevel 9:\rName: Start9\rDescription: Raider_Base\rChooseNext: 0\rNumNext: 1\rNextLevel: 11\rLocationX: 265\rLocationY: 273\r\rLevel 10:\rName: Start10\rDescription: Raider_Base\rChooseNext: 1\rNumNext: 1\rNextLevel: 12\rLocationX: 265\rLocationY: 273\r\rLevel 11:\rName: Start11\rDescription: Old_Raider_Base\rChooseNext: 1\rNumNext: 1\rNextLevel: 13\rLocationX: 286\rLocationY: 276\r\rLevel 12:\rName: Start12\rDescription: Village\rChooseNext: 1\rNumNext: 1\rNextLevel: 14\rLocationX: 264\rLocationY: 310\r\rLevel 13:\rName: Start13\rDescription: Rocky_Hall\rChooseNext: 1\rNumNext: 1\rNextLevel: 15\rLocationX: 284\rLocationY: 312\r\rLevel 14:\rName: Start14\rDescription: Heading_North\rChooseNext: 1\rNumNext: 1\rNextLevel: 16\rLocationX: 332\rLocationY: 272\r\rLevel 15:\rName: Start15\rDescription: Heading_North\rChooseNext: 1\rNumNext: 1\rNextLevel: 17\rLocationX: 345\rLocationY: 246\r\rLevel 16:\rName: Start16\rDescription: Jack's_camp\rChooseNext: 0\rNumNext: 1\rNextLevel: 18\rLocationX: 324\rLocationY: 224\r\rLevel 17:\rName: Start17\rDescription: Jack's_camp\rChooseNext: 1\rNumNext: 1\rNextLevel: 19\rLocationX: 324\rLocationY: 224\r\rLevel 18:\rName: Start18\rDescription: Rocky_Hall\rChooseNext: 0\rNumNext: 1\rNextLevel: 20\rLocationX: 284\rLocationY: 312\r\rLevel 19:\rName: Start19\rDescription: Rocky_Hall\rChooseNext: 1\rNumNext: 1\rNextLevel: 21\rLocationX: 284\rLocationY: 312\r\rLevel 20:\rName: Start20\rDescription: To_Alpha_Wolf\rChooseNext: 1\rNumNext: 1\rNextLevel: 22\rLocationX: 360\rLocationY: 269\r\rLevel 21:\rName: Start21\rDescription: To_Alpha_Wolf\rChooseNext: 1\rNumNext: 1\rNextLevel: 23\rLocationX: 343\rLocationY: 219\r\rLevel 22:\rName: Start22\rDescription: Wolf_Den\rChooseNext: 0\rNumNext: 1\rNextLevel: 24\rLocationX: 327\rLocationY: 179\r\rLevel 23:\rName: Start23\rDescription: Alpha_Wolf\rChooseNext: 1\rNumNext: 1\rNextLevel: 25\rLocationX: 314\rLocationY: 179\r\rLevel 24:\rName: Start24\rDescription: Rocky_Hall\rChooseNext: 0\rNumNext: 1\rNextLevel: 26\rLocationX: 284\rLocationY: 312\r\rLevel 25:\rName: Start25\rDescription: Rocky_Hall\rChooseNext: 0\rNumNext: 1\rNextLevel: 27\rLocationX: 284\rLocationY: 312\r\rLevel 26:\rName: Start26\rDescription: Leave\rChooseNext: 1\rNumNext: 0\rLocationX: 284\rLocationY: 312
\ No newline at end of file
+Campaign Levels: 27\r\rLevel 1:\rName: Start1\rDescription: Village_-_start_campaign_mode!\rChooseNext: 2\rNumNext: 1\rNextLevel: 2\rLocationX: 264\rLocationY: 310\r\rLevel 2:\rName: Start2\rDescription: Stranger\rChooseNext: 0\rNumNext: 1\rNextLevel: 3\rLocationX: 264\rLocationY: 310\r\rLevel 3:\rName: Start3\rDescription: Village\rChooseNext: 1\rNumNext: 1\rNextLevel: 4\rLocationX: 264\rLocationY: 310\r\rLevel 4:\rName: Start4\rDescription: Wanderer\rChooseNext: 1\rNumNext: 1\rNextLevel: 5\rLocationX: 274\rLocationY: 310\r\rLevel 5:\rName: Start5\rDescription: Village\rChooseNext: 1\rNumNext: 1\rNextLevel: 6\rLocationX: 264\rLocationY: 310\r\rLevel 6:\rName: Start6\rDescription: Clearing\rChooseNext: 1\rNumNext: 1\rNextLevel: 7\rLocationX: 260\rLocationY: 295\r\rLevel 7:\rName: Start7\rDescription: Raider_Patrol\rChooseNext: 1\rNumNext: 1\rNextLevel: 8\rLocationX: 250\rLocationY: 278\r\rLevel 8:\rName: raidercamp\rDescription: Raider_Camp\rChooseNext: 1\rNumNext: 1\rNextLevel: 9\rLocationX: 240\rLocationY: 270\r\r\rLevel 8:\rName: Start8\rDescription: Raider_Sentries\rChooseNext: 1\rNumNext: 1\rNextLevel: 10\rLocationX: 255\rLocationY: 265\r\rLevel 9:\rName: Start9\rDescription: Raider_Base\rChooseNext: 0\rNumNext: 1\rNextLevel: 11\rLocationX: 265\rLocationY: 273\r\rLevel 10:\rName: Start10\rDescription: Raider_Base\rChooseNext: 1\rNumNext: 1\rNextLevel: 12\rLocationX: 265\rLocationY: 273\r\rLevel 11:\rName: Start11\rDescription: Old_Raider_Base\rChooseNext: 1\rNumNext: 1\rNextLevel: 13\rLocationX: 286\rLocationY: 276\r\rLevel 12:\rName: Start12\rDescription: Village\rChooseNext: 1\rNumNext: 1\rNextLevel: 14\rLocationX: 264\rLocationY: 310\r\rLevel 13:\rName: Start13\rDescription: Rocky_Hall\rChooseNext: 1\rNumNext: 1\rNextLevel: 15\rLocationX: 284\rLocationY: 312\r\rLevel 14:\rName: Start14\rDescription: Heading_North\rChooseNext: 1\rNumNext: 1\rNextLevel: 16\rLocationX: 332\rLocationY: 272\r\rLevel 15:\rName: Start15\rDescription: Heading_North\rChooseNext: 1\rNumNext: 1\rNextLevel: 17\rLocationX: 345\rLocationY: 246\r\rLevel 16:\rName: Start16\rDescription: Jack's_camp\rChooseNext: 0\rNumNext: 1\rNextLevel: 18\rLocationX: 324\rLocationY: 224\r\rLevel 17:\rName: Start17\rDescription: Jack's_camp\rChooseNext: 1\rNumNext: 1\rNextLevel: 19\rLocationX: 324\rLocationY: 224\r\rLevel 18:\rName: Start18\rDescription: Rocky_Hall\rChooseNext: 0\rNumNext: 1\rNextLevel: 20\rLocationX: 284\rLocationY: 312\r\rLevel 19:\rName: Start19\rDescription: Rocky_Hall\rChooseNext: 1\rNumNext: 1\rNextLevel: 21\rLocationX: 284\rLocationY: 312\r\rLevel 20:\rName: Start20\rDescription: To_Alpha_Wolf\rChooseNext: 1\rNumNext: 1\rNextLevel: 22\rLocationX: 360\rLocationY: 269\r\rLevel 21:\rName: Start21\rDescription: To_Alpha_Wolf\rChooseNext: 1\rNumNext: 1\rNextLevel: 23\rLocationX: 343\rLocationY: 219\r\rLevel 22:\rName: Start22\rDescription: Wolf_Den\rChooseNext: 0\rNumNext: 1\rNextLevel: 24\rLocationX: 327\rLocationY: 179\r\rLevel 23:\rName: Start23\rDescription: Alpha_Wolf\rChooseNext: 1\rNumNext: 1\rNextLevel: 25\rLocationX: 314\rLocationY: 179\r\rLevel 24:\rName: Start24\rDescription: Rocky_Hall\rChooseNext: 0\rNumNext: 1\rNextLevel: 26\rLocationX: 284\rLocationY: 312\r\rLevel 25:\rName: Start25\rDescription: Rocky_Hall\rChooseNext: 0\rNumNext: 1\rNextLevel: 27\rLocationX: 284\rLocationY: 312\r\rLevel 26:\rName: Start26\rDescription: Leave\rChooseNext: 1\rNumNext: 0\rLocationX: 284\rLocationY: 312\r
\ No newline at end of file
diff --git a/Data/Maps/Start1 b/Data/Maps/Start1
new file mode 100644 (file)
index 0000000..3158705
Binary files /dev/null and b/Data/Maps/Start1 differ
diff --git a/Data/Maps/Start10 b/Data/Maps/Start10
new file mode 100644 (file)
index 0000000..79d5e17
Binary files /dev/null and b/Data/Maps/Start10 differ
diff --git a/Data/Maps/Start11 b/Data/Maps/Start11
new file mode 100644 (file)
index 0000000..547bb3c
Binary files /dev/null and b/Data/Maps/Start11 differ
diff --git a/Data/Maps/Start12 b/Data/Maps/Start12
new file mode 100644 (file)
index 0000000..055dd63
Binary files /dev/null and b/Data/Maps/Start12 differ
diff --git a/Data/Maps/Start13 b/Data/Maps/Start13
new file mode 100644 (file)
index 0000000..a383f82
Binary files /dev/null and b/Data/Maps/Start13 differ
diff --git a/Data/Maps/Start14 b/Data/Maps/Start14
new file mode 100644 (file)
index 0000000..b06be60
Binary files /dev/null and b/Data/Maps/Start14 differ
diff --git a/Data/Maps/Start15 b/Data/Maps/Start15
new file mode 100644 (file)
index 0000000..64e431a
Binary files /dev/null and b/Data/Maps/Start15 differ
diff --git a/Data/Maps/Start16 b/Data/Maps/Start16
new file mode 100644 (file)
index 0000000..9aabd00
Binary files /dev/null and b/Data/Maps/Start16 differ
diff --git a/Data/Maps/Start17 b/Data/Maps/Start17
new file mode 100644 (file)
index 0000000..45a0b22
Binary files /dev/null and b/Data/Maps/Start17 differ
diff --git a/Data/Maps/Start18 b/Data/Maps/Start18
new file mode 100644 (file)
index 0000000..768af0e
Binary files /dev/null and b/Data/Maps/Start18 differ
diff --git a/Data/Maps/Start19 b/Data/Maps/Start19
new file mode 100644 (file)
index 0000000..7da1f08
Binary files /dev/null and b/Data/Maps/Start19 differ
diff --git a/Data/Maps/Start2 b/Data/Maps/Start2
new file mode 100644 (file)
index 0000000..8df7cca
Binary files /dev/null and b/Data/Maps/Start2 differ
diff --git a/Data/Maps/Start20 b/Data/Maps/Start20
new file mode 100644 (file)
index 0000000..d80cdd7
Binary files /dev/null and b/Data/Maps/Start20 differ
diff --git a/Data/Maps/Start21 b/Data/Maps/Start21
new file mode 100644 (file)
index 0000000..6b35097
Binary files /dev/null and b/Data/Maps/Start21 differ
diff --git a/Data/Maps/Start22 b/Data/Maps/Start22
new file mode 100644 (file)
index 0000000..09a4ce4
Binary files /dev/null and b/Data/Maps/Start22 differ
diff --git a/Data/Maps/Start23 b/Data/Maps/Start23
new file mode 100644 (file)
index 0000000..16665b5
Binary files /dev/null and b/Data/Maps/Start23 differ
diff --git a/Data/Maps/Start3 b/Data/Maps/Start3
new file mode 100644 (file)
index 0000000..0586faa
Binary files /dev/null and b/Data/Maps/Start3 differ
diff --git a/Data/Maps/Start4 b/Data/Maps/Start4
new file mode 100644 (file)
index 0000000..2689636
Binary files /dev/null and b/Data/Maps/Start4 differ
diff --git a/Data/Maps/Start5 b/Data/Maps/Start5
new file mode 100644 (file)
index 0000000..178bf87
Binary files /dev/null and b/Data/Maps/Start5 differ
diff --git a/Data/Maps/Start6 b/Data/Maps/Start6
new file mode 100644 (file)
index 0000000..21bdad5
Binary files /dev/null and b/Data/Maps/Start6 differ
diff --git a/Data/Maps/Start7 b/Data/Maps/Start7
new file mode 100644 (file)
index 0000000..5499242
Binary files /dev/null and b/Data/Maps/Start7 differ
diff --git a/Data/Maps/Start8 b/Data/Maps/Start8
new file mode 100644 (file)
index 0000000..b299c6d
Binary files /dev/null and b/Data/Maps/Start8 differ
diff --git a/Data/Maps/Start9 b/Data/Maps/Start9
new file mode 100644 (file)
index 0000000..61bf1fe
Binary files /dev/null and b/Data/Maps/Start9 differ
diff --git a/Data/Maps/start1 b/Data/Maps/start1
deleted file mode 100644 (file)
index 3158705..0000000
Binary files a/Data/Maps/start1 and /dev/null differ
diff --git a/Data/Maps/start10 b/Data/Maps/start10
deleted file mode 100644 (file)
index 79d5e17..0000000
Binary files a/Data/Maps/start10 and /dev/null differ
diff --git a/Data/Maps/start11 b/Data/Maps/start11
deleted file mode 100644 (file)
index 547bb3c..0000000
Binary files a/Data/Maps/start11 and /dev/null differ
diff --git a/Data/Maps/start12 b/Data/Maps/start12
deleted file mode 100644 (file)
index 055dd63..0000000
Binary files a/Data/Maps/start12 and /dev/null differ
diff --git a/Data/Maps/start13 b/Data/Maps/start13
deleted file mode 100644 (file)
index a383f82..0000000
Binary files a/Data/Maps/start13 and /dev/null differ
diff --git a/Data/Maps/start14 b/Data/Maps/start14
deleted file mode 100644 (file)
index b06be60..0000000
Binary files a/Data/Maps/start14 and /dev/null differ
diff --git a/Data/Maps/start15 b/Data/Maps/start15
deleted file mode 100644 (file)
index 64e431a..0000000
Binary files a/Data/Maps/start15 and /dev/null differ
diff --git a/Data/Maps/start16 b/Data/Maps/start16
deleted file mode 100644 (file)
index 9aabd00..0000000
Binary files a/Data/Maps/start16 and /dev/null differ
diff --git a/Data/Maps/start17 b/Data/Maps/start17
deleted file mode 100644 (file)
index 45a0b22..0000000
Binary files a/Data/Maps/start17 and /dev/null differ
diff --git a/Data/Maps/start18 b/Data/Maps/start18
deleted file mode 100644 (file)
index 768af0e..0000000
Binary files a/Data/Maps/start18 and /dev/null differ
diff --git a/Data/Maps/start19 b/Data/Maps/start19
deleted file mode 100644 (file)
index 7da1f08..0000000
Binary files a/Data/Maps/start19 and /dev/null differ
diff --git a/Data/Maps/start2 b/Data/Maps/start2
deleted file mode 100644 (file)
index 8df7cca..0000000
Binary files a/Data/Maps/start2 and /dev/null differ
diff --git a/Data/Maps/start20 b/Data/Maps/start20
deleted file mode 100644 (file)
index d80cdd7..0000000
Binary files a/Data/Maps/start20 and /dev/null differ
diff --git a/Data/Maps/start21 b/Data/Maps/start21
deleted file mode 100644 (file)
index 6b35097..0000000
Binary files a/Data/Maps/start21 and /dev/null differ
diff --git a/Data/Maps/start22 b/Data/Maps/start22
deleted file mode 100644 (file)
index 09a4ce4..0000000
Binary files a/Data/Maps/start22 and /dev/null differ
diff --git a/Data/Maps/start23 b/Data/Maps/start23
deleted file mode 100644 (file)
index 16665b5..0000000
Binary files a/Data/Maps/start23 and /dev/null differ
diff --git a/Data/Maps/start3 b/Data/Maps/start3
deleted file mode 100644 (file)
index 0586faa..0000000
Binary files a/Data/Maps/start3 and /dev/null differ
diff --git a/Data/Maps/start4 b/Data/Maps/start4
deleted file mode 100644 (file)
index 2689636..0000000
Binary files a/Data/Maps/start4 and /dev/null differ
diff --git a/Data/Maps/start5 b/Data/Maps/start5
deleted file mode 100644 (file)
index 178bf87..0000000
Binary files a/Data/Maps/start5 and /dev/null differ
diff --git a/Data/Maps/start6 b/Data/Maps/start6
deleted file mode 100644 (file)
index 21bdad5..0000000
Binary files a/Data/Maps/start6 and /dev/null differ
diff --git a/Data/Maps/start7 b/Data/Maps/start7
deleted file mode 100644 (file)
index 5499242..0000000
Binary files a/Data/Maps/start7 and /dev/null differ
diff --git a/Data/Maps/start8 b/Data/Maps/start8
deleted file mode 100644 (file)
index b299c6d..0000000
Binary files a/Data/Maps/start8 and /dev/null differ
diff --git a/Data/Maps/start9 b/Data/Maps/start9
deleted file mode 100644 (file)
index 61bf1fe..0000000
Binary files a/Data/Maps/start9 and /dev/null differ
index 829a4ad8f3c121ea041fb2e0e974c2045de8d51b..0f3dd8cd07e277e8473b41ddd5bbcdd9d82c78bd 100644 (file)
@@ -2058,27 +2058,12 @@ void Game::DrawMenu() {
        glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
        ReSizeGLScene(90,.1f);
 
-       int temptexdetail;
-       temptexdetail=texdetail;
-       if(texdetail>2)texdetail=2;
-       //~ if(mainmenu!=oldmainmenu&&oldmainmenu!=0){
-               //~ if(mainmenu==1){
-                       //~ LoadTexture(":Data:Textures:Newgame.png",&Mainmenuitems[1],0,0);
-                       //~ LoadTexture(":Data:Textures:Quit.png",&Mainmenuitems[3],0,0);
-               //~ }
-               //~ if(mainmenu==2){
-                       //~ LoadTexture(":Data:Textures:Resume.png",&Mainmenuitems[1],0,0);
-                       //~ LoadTexture(":Data:Textures:Endgame.png",&Mainmenuitems[3],0,0);
-               //~ }
-       //~ }
        if(oldmainmenu!=mainmenu){
                if(mainmenu==5){
                        LoadCampaign();
                }
        }
 
-       texdetail=temptexdetail;
-
        oldmainmenu=mainmenu;
 
        glClear(GL_DEPTH_BUFFER_BIT);
@@ -2185,41 +2170,41 @@ void Game::DrawMenu() {
                        startx[0]=10+20;
                        starty[0]=440;
 
-                       if(newdetail==2)sprintf (menustring[1], "Detail: High");
-                       else if(newdetail==1)sprintf (menustring[1], "Detail: Medium");
-                       else sprintf (menustring[1], "Detail: Low");
+                       if(newdetail==2)                sprintf (menustring[1], "Detail: High");
+                       else if(newdetail==1)   sprintf (menustring[1], "Detail: Medium");
+                       else                                    sprintf (menustring[1], "Detail: Low");
                        startx[1]=10+60;
                        starty[1]=405;
 
-                       if(bloodtoggle==2)sprintf (menustring[2], "Blood: On, high detail (slower)");
-                       if(bloodtoggle==1)sprintf (menustring[2], "Blood: On, low detail");
-                       if(bloodtoggle==0)sprintf (menustring[2], "Blood: Off");
+                       if(bloodtoggle==2) sprintf (menustring[2], "Blood: On, high detail (slower)");
+                       if(bloodtoggle==1) sprintf (menustring[2], "Blood: On, low detail");
+                       if(bloodtoggle==0) sprintf (menustring[2], "Blood: Off");
                        startx[2]=10+70;
                        starty[2]=370;
 
-                       if(difficulty==2)sprintf (menustring[3], "Difficulty: Insane");
-                       if(difficulty==1)sprintf (menustring[3], "Difficulty: Difficult");
-                       if(difficulty==0)sprintf (menustring[3], "Difficulty: Easier");
+                       if(difficulty==2) sprintf (menustring[3], "Difficulty: Insane");
+                       if(difficulty==1) sprintf (menustring[3], "Difficulty: Difficult");
+                       if(difficulty==0) sprintf (menustring[3], "Difficulty: Easier");
                        startx[3]=10+20-1000;
                        starty[3]=335-1000;
 
-                       if(ismotionblur==1)sprintf (menustring[4], "Blur Effects: Enabled (less compatible)");
-                       if(ismotionblur==0)sprintf (menustring[4], "Blur Effects: Disabled (more compatible)");
+                       if(ismotionblur==1) sprintf (menustring[4], "Blur Effects: Enabled (less compatible)");
+                       if(ismotionblur==0) sprintf (menustring[4], "Blur Effects: Disabled (more compatible)");
                        startx[4]=10;
                        starty[4]=335;
 
-                       if(decals==1)sprintf (menustring[5], "Decals: Enabled (slower)");
-                       if(decals==0)sprintf (menustring[5], "Decals: Disabled");
+                       if(decals==1) sprintf (menustring[5], "Decals: Enabled (slower)");
+                       if(decals==0) sprintf (menustring[5], "Decals: Disabled");
                        startx[5]=10+60;
                        starty[5]=300;
 
-                       if(musictoggle==1)sprintf (menustring[6], "Music: Enabled");
-                       if(musictoggle==0)sprintf (menustring[6], "Music: Disabled");
+                       if(musictoggle==1) sprintf (menustring[6], "Music: Enabled");
+                       if(musictoggle==0) sprintf (menustring[6], "Music: Disabled");
                        startx[6]=10+70;
                        starty[6]=265;
 
-                       if(invertmouse==1)sprintf (menustring[9], "Invert mouse: Yes");
-                       if(invertmouse==0)sprintf (menustring[9], "Invert mouse: No");
+                       if(invertmouse==1) sprintf (menustring[9], "Invert mouse: Yes");
+                       if(invertmouse==0) sprintf (menustring[9], "Invert mouse: No");
                        startx[9]=10;
                        starty[9]=230;
 
@@ -2347,18 +2332,6 @@ void Game::DrawMenu() {
                        sprintf (menustring[2], "No");
                        startx[2]=10;
                        starty[2]=320;
-
-                       sprintf (menustring[3], "Extra 4");
-                       startx[3]=10;
-                       starty[3]=280;
-
-                       sprintf (menustring[4], "Extra 5");
-                       startx[4]=10;
-                       starty[4]=240;
-
-                       sprintf (menustring[5], "Back");
-                       startx[5]=10;
-                       starty[5]=10;
                }
                break;
                case 7: {       
index 3bf55e48d56c543d5caeeb001923e4957ac0fe9b..cd0a9765ae79bd7a22c20b289833b650e128852e 100644 (file)
@@ -2350,8 +2350,6 @@ void Game::doTutorial(){
                                        weapons[player[0].weaponids[player[0].weaponactive]].setType(staff);
                 else 
                                        weapons[0].setType(staff);
-
-                //~ weapons.size()++;
             break; case 49:
                 canattack=0;
                 cananger=0;
@@ -2362,10 +2360,8 @@ void Game::doTutorial(){
                 weapons[1].position=1000;
                 weapons[1].tippoint=1000;
 
-                //~ weapons.size()=1;
                 weapons[0].setType(knife);
 
-                //~ weapons.size()++;
                 weapons[0].owner=0;
                 player[1].weaponactive=-1;
                 player[1].num_weapons=0;
@@ -2427,7 +2423,7 @@ void Game::doTutorial(){
             break; case 25: if(player[0].targetanimation==backhandspringanim)tutorialsuccess=1;
             break; case 28: if(animation[player[0].targetanimation].attack==reversed&&player[0].feint)tutorialsuccess=1;
             break; case 29:
-                if(player[0].escapednum==2){
+                if(player[0].escapednum==2) {
                     tutorialsuccess=1;
                     reversaltrain=0;
                     cananger=0;
@@ -4554,7 +4550,7 @@ void Game::doAI(int i){
             if(     findDistancefastflat(&player[i].coords,&player[i].finalfinaltarget)<
                     findDistancefastflat(&player[i].coords,&player[i].finaltarget)||
                     findDistancefastflat(&player[i].coords,&player[i].finaltarget)<.6*sq(player[i].scale*5)||
-                    player[i].lastpathfindpoint==player[i].finalpathfindpoint){
+                    player[i].lastpathfindpoint==player[i].finalpathfindpoint) {
                 player[i].aitype=passivetype;
             }
 
@@ -4566,7 +4562,7 @@ void Game::doAI(int i){
             player[i].attackkeydown=0;
             player[i].throwkeydown=0;
 
-            if(player[i].avoidcollided>.8&&!player[i].jumpkeydown&&player[i].collided<.8)
+            if(player[i].avoidcollided>.8 && !player[i].jumpkeydown && player[i].collided<.8)
                 player[i].targetrotation+=90*(player[i].whichdirection*2-1);
 
             if(player[i].collided<1||player[i].targetanimation!=jumpupanim)
@@ -5141,7 +5137,7 @@ void Game::doAI(int i){
                                 weapons[i].velocity.x==0&&
                                 weapons[i].velocity.z==0&&
                                 weapons[i].velocity.y==0){
-                            if(findDistancefast(&player[i].coords,&weapons[k].position)<16){
+                            if(findDistancefast(&player[i].coords,&weapons[k].position)<16) {
                                 player[i].wentforweapon++;
                                 player[i].lastchecktime=6;
                                 player[i].aitype=getweapontype;
@@ -5170,7 +5166,7 @@ void Game::doAI(int i){
                     j=checkcollide(test2,test,player[i].laststanding);
                     if(j==-1)
                         j=checkcollide(test2,test);
-                    if(j==-1){
+                    if(j==-1) {
                         player[i].velocity=0;
                         setAnimation(i,player[i].getStop());
                         player[i].targetrotation+=180;
@@ -5183,7 +5179,7 @@ void Game::doAI(int i){
                         player[i].lastpathfindpoint2=-1;
                         player[i].lastpathfindpoint3=-1;
                         player[i].lastpathfindpoint4=-1;
-                    }else
+                    } else
                         player[i].laststanding=j;
                 }
             //lose sight of player in the air (?)
@@ -7755,7 +7751,9 @@ void Game::TickOnceAfter(){
                                        if(!firstload)
                                                LoadStuff();
                                        whichchoice=0;
+                                       cout << "from " << campaignlevels[actuallevel].mapname.c_str() << "(" << actuallevel << ")" << endl;
                                        actuallevel=campaignlevels[actuallevel].nextlevel.front();
+                                       cout << "to " << campaignlevels[actuallevel].mapname.c_str() << "(" << actuallevel << ")" << endl;
                                        visibleloading=1;
                                        stillloading=1;
                                        Loadlevel(campaignlevels[actuallevel].mapname.c_str());
index 649d3f390fc1cb2b0ea51a2851d17b5a9942e0b5..d9c73b056b320ff90bfcc49f8cadd158cbbc74f3 100644 (file)
@@ -978,7 +978,7 @@ void Terrain::draw(int layer)
        endz=(viewer.z+viewdistance)/(patch_size)+1;
        if(endz>subdivision)endz=subdivision;
 
-       if(!layer)
+       if(!layer) {
                for(i=beginx;i<endx;i++){       
                        for(j=beginz;j<endz;j++){       
                                terrainpoint.x=i*patch_size+(patch_size)/2;
@@ -987,35 +987,48 @@ void Terrain::draw(int layer)
                                distance[i][j]=findDistancefast(&viewer,&terrainpoint);
                        }
                }
-
-               for(i=beginx;i<endx;i++){       
-                       for(j=beginz;j<endz;j++){       
-                               if(distance[i][j]<(viewdistance+patch_size)*(viewdistance+patch_size)){
-                                       opacity=1;
-                                       if(distance[i][j]>viewdistsquared*fadestart-viewdistsquared)opacity=0;
-                                       if(opacity==1&&i!=subdivision)if(distance[i+1][j]>viewdistsquared*fadestart-viewdistsquared)opacity=0;
-                                       if(opacity==1&&j!=subdivision)if(distance[i][j+1]>viewdistsquared*fadestart-viewdistsquared)opacity=0;
-                                       if(opacity==1&&j!=subdivision&&i!=subdivision)if(distance[i+1][j+1]>viewdistsquared*fadestart-viewdistsquared)opacity=0;
-                                       glMatrixMode(GL_MODELVIEW);                                                     // Select The Modelview Matrix
-                                       glPushMatrix();
-                                               if(frustum.CubeInFrustum(i*patch_size+patch_size*.5,avgypatch[i][j],j*patch_size+patch_size*.5,heightypatch[i][j]/2))
-                                               {   
-                                                       if(environment==desertenvironment&&distance[i][j]>viewdistsquared/4)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness);
-                                                       else if(environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
-                                                       if(!layer&&textureness[i][j]!=allsecond)drawpatch(i,j,opacity);
-                                                       if(layer==1&&textureness[i][j]!=allfirst)drawpatchother(i,j,opacity);
-                                                       if(layer==2&&textureness[i][j]!=allfirst)drawpatchotherother(i,j,opacity);
-                                               }
-                                       glPopMatrix();
-                               }
+       }
+       for(i=beginx;i<endx;i++){
+               for(j=beginz;j<endz;j++){       
+                       if(distance[i][j]<(viewdistance+patch_size)*(viewdistance+patch_size)){
+                               opacity=1;
+                               if(distance[i][j]>viewdistsquared*fadestart-viewdistsquared)
+                                       opacity=0;
+                               if(opacity==1&&i!=subdivision)
+                                       if(distance[i+1][j]>viewdistsquared*fadestart-viewdistsquared)
+                                               opacity=0;
+                               if(opacity==1&&j!=subdivision)
+                                       if(distance[i][j+1]>viewdistsquared*fadestart-viewdistsquared)
+                                               opacity=0;
+                               if(opacity==1&&j!=subdivision&&i!=subdivision)
+                                       if(distance[i+1][j+1]>viewdistsquared*fadestart-viewdistsquared)
+                                               opacity=0;
+                               glMatrixMode(GL_MODELVIEW);                                                     // Select The Modelview Matrix
+                               glPushMatrix();
+                                       if(frustum.CubeInFrustum(i*patch_size+patch_size*.5,avgypatch[i][j],j*patch_size+patch_size*.5,heightypatch[i][j]/2))
+                                       {   
+                                               if(environment==desertenvironment&&distance[i][j]>viewdistsquared/4)
+                                                       glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness);
+                                               else if(environment==desertenvironment)
+                                                       glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
+                                               if(!layer&&textureness[i][j]!=allsecond)
+                                                       drawpatch(i,j,opacity);
+                                               if(layer==1&&textureness[i][j]!=allfirst)
+                                                       drawpatchother(i,j,opacity);
+                                               if(layer==2&&textureness[i][j]!=allfirst)
+                                                       drawpatchotherother(i,j,opacity);
+                                       }
+                               glPopMatrix();
                        }
                }
-               if(environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
+       }
+       if(environment==desertenvironment)
+               glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
 }
 
 void Terrain::drawdecals()
 {
-       if(decals){
+       if(decals) {
                static int i,j;
                static float distancemult;
                static int lasttype;
@@ -1186,8 +1199,8 @@ void Terrain::DeleteDecal(int which)
 }
 
 void Terrain::MakeDecal(int type, XYZ where, float size, float opacity, float rotation){
-       if(decals){
-               if(opacity>0&&size>0){
+       if(decals) {
+               if(opacity>0&&size>0) {
                        static int patchx[4];
                        static int patchy[4];
 
@@ -1237,11 +1250,9 @@ void Terrain::MakeDecalLock(int type, XYZ where,int whichx, int whichy, float si
                decalbrightness[numdecals]=(rot.x+rot.y+rot.z)/3;
                if(decalbrightness[numdecals]<.4)decalbrightness[numdecals]=.4;
 
-               //if(type==blooddecal||type==blooddecalfast||type==blooddecalslow){
                if(environment==grassyenvironment){
                        decalbrightness[numdecals]*=.6;
                }
-               //}
 
                if(decalbrightness[numdecals]>1)decalbrightness[numdecals]=1;
                decalbright=decalbrightness[numdecals];
index 2f87d33e3a6330e40a2b632c90db4efcffa71404..f6cf200fe8d5ef519b3d0222bb62796c292eea38 100644 (file)
@@ -98,7 +98,8 @@ void Weapon::setType(int t) {
 }
 
 void Weapon::DoStuff(int i) {
-       static int whichpatchx,whichpatchz,whichhit,m;
+       //~ cout << position.x << "," << position.y << "," << position.z << "|" << tippoint.x << "," << tippoint.y << "," << tippoint.z << endl;
+       static int whichpatchx,whichpatchz,whichhit;
        static XYZ start,end,colpoint,normalrot,footvel,footpoint;
        static XYZ terrainnormal;
        static XYZ vel;
@@ -116,20 +117,27 @@ void Weapon::DoStuff(int i) {
        static XYZ extramove;
        static float tempmult;
        
-       if(owner!=-1){
+       if(owner!=-1) {
                oldowner=owner;
        }
-       if(damage>=2 && type==staff && owner!=-1){
+       if(damage>=2 && type==staff && owner!=-1) { // the staff breaks
                emit_sound_at(staffbreaksound, tippoint);
                XYZ tempvel;
-               for(int j=0;j<40;j++){
+               for(int j=0;j<40;j++) {
                        tempvel.x=float(abs(Random()%100)-50)/20;
                        tempvel.y=float(abs(Random()%100)-50)/20;
                        tempvel.z=float(abs(Random()%100)-50)/20;
                        Sprite::MakeSprite(splintersprite, position+(tippoint-position)*((float)j-8)/32,tempvel*.5, 115/255,73/255,12/255, .1, 1);
                }
-               int tempowner;
-               tempowner=owner;
+               if(owner!=-1) {
+                       player[owner].weaponactive=-1;
+                       player[owner].num_weapons--;
+                       if(player[owner].num_weapons) {
+                               player[owner].weaponids[0]=player[owner].weaponids[player[owner].num_weapons];
+                               if(player[owner].weaponstuck==player[owner].num_weapons)
+                                       player[owner].weaponstuck=0;
+                       }
+               }
                owner=-1;
                hitsomething=0;
                missed=1;
@@ -137,38 +145,32 @@ void Weapon::DoStuff(int i) {
                firstfree=1;
                position=0;
                physics=0;
-               if(tempowner!=-1) {
-                       player[tempowner].num_weapons--;
-                       if(player[tempowner].num_weapons) {
-                               player[tempowner].weaponids[0]=player[tempowner].weaponids[player[tempowner].num_weapons];
-                               if(player[tempowner].weaponstuck==player[tempowner].num_weapons)
-                                       player[tempowner].weaponstuck=0;
-                       }
-                       player[tempowner].weaponactive=-1;
-               }
        }
        oldposition=position;
        oldtippoint=tippoint;
-       if(owner==-1&&(velocity.x||velocity.y||velocity.z)&&!physics){
+       if(owner==-1 && (velocity.x||velocity.y||velocity.z) && !physics) { // if the weapon is flying
                position+=velocity*multiplier;
                tippoint+=velocity*multiplier;
                whichpatchx=position.x/(terrain.size/subdivision*terrain.scale);
                whichpatchz=position.z/(terrain.size/subdivision*terrain.scale);
-               if(whichpatchx>0 && whichpatchz>0 && whichpatchx<subdivision && whichpatchz<subdivision)
-                       if(terrain.patchobjectnum[whichpatchx][whichpatchz]) {
-                               for(int j=0;j<terrain.patchobjectnum[whichpatchx][whichpatchz];j++){
+               if(whichpatchx>0 && whichpatchz>0 && whichpatchx<subdivision && whichpatchz<subdivision) {
+                       if(terrain.patchobjectnum[whichpatchx][whichpatchz]) { // if there are objects where the weapon is
+                               for(int j=0;j<terrain.patchobjectnum[whichpatchx][whichpatchz];j++) { // check for collision
                                        int k=terrain.patchobjects[whichpatchx][whichpatchz][j];
                                        start=oldtippoint;
                                        end=tippoint;
                                        whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
-                                       if(whichhit!=-1){
+                                       if(whichhit!=-1) {
                                                if(objects.type[k]==treetrunktype){
                                                        objects.model[k].MakeDecal(breakdecal,DoRotation(colpoint-objects.position[k],0,-objects.rotation[k],0),.1,1,Random()%360);
                                                        normalrot=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0);
                                                        velocity=0;
-                                                       if(type==knife)position=colpoint-normalrot*.1;
-                                                       if(type==sword)position=colpoint-normalrot*.2;
-                                                       if(type==staff)position=colpoint-normalrot*.2;
+                                                       if(type==knife)
+                                                               position=colpoint-normalrot*.1;
+                                                       else if(type==sword)
+                                                               position=colpoint-normalrot*.2;
+                                                       else if(type==staff)
+                                                               position=colpoint-normalrot*.2;
                                                        XYZ temppoint1,temppoint2,tempforward;
                                                        float distance;
 
@@ -181,7 +183,8 @@ void Weapon::DoStuff(int i) {
                                                        temppoint2.y=0;
                                                        rotation1=acos((temppoint1.z-temppoint2.z)/findDistance(&temppoint1,&temppoint2));
                                                        rotation1*=360/6.28;
-                                                       if(temppoint1.x>temppoint2.x)rotation1=360-rotation1;
+                                                       if(temppoint1.x>temppoint2.x)
+                                                               rotation1=360-rotation1;
 
                                                        rotation3=0;
                                                        smallrotation=90;
@@ -206,164 +209,176 @@ void Weapon::DoStuff(int i) {
                                        }
                                }
                        }
-                       if(velocity.x||velocity.y||velocity.z)
-                               for(int j=0;j<numplayers;j++){
-                                       footvel=0;
-                                       footpoint=DoRotation((player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].position+player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].position)/2,0,player[j].rotation,0)*player[j].scale+player[j].coords;
-                                       if(owner==-1 && findDistancefastflat(&position,&player[j].coords)<1.5 && 
-                                       findDistancefast(&position,&player[j].coords)<4&&player[j].weaponstuck==-1&&
-                                       !player[j].skeleton.free&&j!=oldowner) {
-                                               if((player[j].aitype!=attacktypecutoff||abs(Random()%6)==0||(player[j].targetanimation!=backhandspringanim&&player[j].targetanimation!=rollanim&&player[j].targetanimation!=flipanim&&Random()%2==0))&&!missed){
-                                                       if((player[j].creature==wolftype&&Random()%3!=0&&player[j].weaponactive==-1&&(player[j].isIdle()||player[j].isRun()||player[j].targetanimation==walkanim))||(player[j].creature==rabbittype&&Random()%2==0&&player[j].aitype==attacktypecutoff&&player[j].weaponactive==-1)){
-                                                               emit_sound_at(knifedrawsound, player[j].coords, 128.);
-
-                                                               player[j].weaponactive=0;
-                                                               player[j].targetanimation=removeknifeanim;
-                                                               player[j].targetframe=1;
-                                                               player[j].target=1;
-                                                               owner=player[j].id;
-                                                               if(player[j].num_weapons>0){
-                                                                       player[j].weaponids[player[j].num_weapons]=player[j].weaponids[0];
-                                                               }
-                                                               player[j].num_weapons++;
-                                                               player[j].weaponids[0]=i;
+               }
+               
+               if(velocity.x||velocity.y||velocity.z) {
+                       for(int j=0;j<numplayers;j++) {
+                               footvel=0;
+                               footpoint=DoRotation((player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].position+player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].position)/2,0,player[j].rotation,0)*player[j].scale+player[j].coords;
+                               if(owner==-1 && findDistancefastflat(&position,&player[j].coords)<1.5 && 
+                               findDistancefast(&position,&player[j].coords)<4 && player[j].weaponstuck==-1 &&
+                               !player[j].skeleton.free && j!=oldowner) {
+                                       if((player[j].aitype!=attacktypecutoff||abs(Random()%6)==0||(player[j].targetanimation!=backhandspringanim&&player[j].targetanimation!=rollanim&&player[j].targetanimation!=flipanim&&Random()%2==0))&&!missed) {
+                                               if( (player[j].creature==wolftype       &&      Random()%3!=0 && player[j].weaponactive==-1 && (player[j].isIdle()||player[j].isRun()||player[j].targetanimation==walkanim))||
+                                                       (player[j].creature==rabbittype &&      Random()%2==0 && player[j].aitype==attacktypecutoff && player[j].weaponactive==-1)) {
+                                                       emit_sound_at(knifedrawsound, player[j].coords, 128.);
+
+                                                       player[j].weaponactive=0;
+                                                       player[j].targetanimation=removeknifeanim;
+                                                       player[j].targetframe=1;
+                                                       player[j].target=1;
+                                                       owner=player[j].id;
+                                                       if(player[j].num_weapons>0){
+                                                               player[j].weaponids[player[j].num_weapons]=player[j].weaponids[0];
+                                                       }
+                                                       player[j].num_weapons++;
+                                                       player[j].weaponids[0]=i;
 
-                                                               player[j].aitype=attacktypecutoff;
+                                                       player[j].aitype=attacktypecutoff;
+                                               }
+                                               else {
+                                                       if(j!=0) numthrowkill++;
+                                                       player[j].num_weapons++;
+                                                       player[j].weaponstuck=player[j].num_weapons-1;
+                                                       if(normaldotproduct(player[j].facing,velocity)>0)
+                                                               player[j].weaponstuckwhere=1;
+                                                       else
+                                                               player[j].weaponstuckwhere=0;
+
+                                                       player[j].weaponids[player[j].num_weapons-1]=i;
+
+                                                       player[j].RagDoll(0);
+                                                       player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].velocity+=velocity*2;
+                                                       player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].velocity+=velocity*2;
+                                                       player[j].skeleton.joints[player[j].skeleton.jointlabels[rightshoulder]].velocity+=velocity*2;
+                                                       player[j].skeleton.joints[player[j].skeleton.jointlabels[leftshoulder]].velocity+=velocity*2;
+                                                       if(bloodtoggle&&tutoriallevel!=1)
+                                                               Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3);
+                                                       if(tutoriallevel==1)
+                                                               Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .8, .3);
+                                                       footvel=tippoint-position;
+                                                       Normalise(&footvel);
+                                                       if(bloodtoggle&&tutoriallevel!=1)
+                                                               Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*-1, 1,0,0, .6, 1);
+
+                                                       if(tutoriallevel!=1) {
+                                                               if(player[j].weaponstuckwhere==0)
+                                                                       player[j].DoBloodBig(2,205);
+                                                               if(player[j].weaponstuckwhere==1)
+                                                                       player[j].DoBloodBig(2,200);
+                                                               player[j].damage+=200/player[j].armorhigh;
+                                                               player[j].deathbleeding=1;
+                                                               player[j].bloodloss+=(200+abs((float)(Random()%40))-20)/player[j].armorhigh;
+                                                               owner=j;
+                                                               bloody=2;
+                                                               blooddrip=5;
                                                        }
-                                                       else {
-                                                               if(j!=0)numthrowkill++;
-                                                               player[j].num_weapons++;
-                                                               player[j].weaponstuck=player[j].num_weapons-1;
-                                                               if(normaldotproduct(player[j].facing,velocity)>0)player[j].weaponstuckwhere=1;
-                                                               else player[j].weaponstuckwhere=0;
-
-                                                               player[j].weaponids[player[j].num_weapons-1]=i;
-
-                                                               player[j].RagDoll(0);
-                                                               player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].velocity+=velocity*2;
-                                                               player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].velocity+=velocity*2;
-                                                               player[j].skeleton.joints[player[j].skeleton.jointlabels[rightshoulder]].velocity+=velocity*2;
-                                                               player[j].skeleton.joints[player[j].skeleton.jointlabels[leftshoulder]].velocity+=velocity*2;
-                                                               if(bloodtoggle&&tutoriallevel!=1)
-                                                                       Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3);
-                                                               if(tutoriallevel==1)
-                                                                       Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .8, .3);
-                                                               footvel=tippoint-position;
-                                                               Normalise(&footvel);
-                                                               if(bloodtoggle&&tutoriallevel!=1)
-                                                                       Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*-1, 1,0,0, .6, 1);
-
-                                                               if(tutoriallevel!=1) {
-                                                                       if(player[j].weaponstuckwhere==0)
-                                                                               player[j].DoBloodBig(2,205);
-                                                                       if(player[j].weaponstuckwhere==1)
-                                                                               player[j].DoBloodBig(2,200);
-                                                                       player[j].damage+=200/player[j].armorhigh;
-                                                                       player[j].deathbleeding=1;
-                                                                       player[j].bloodloss+=(200+abs((float)(Random()%40))-20)/player[j].armorhigh;
-                                                                       owner=j;
-                                                                       bloody=2;
-                                                                       blooddrip=5;
-                                                               }
 
-                                                               emit_sound_at(fleshstabsound, position, 128.);
+                                                       emit_sound_at(fleshstabsound, position, 128.);
 
-                                                               if(animation[player[0].targetanimation].height==highheight)
-                                                                 award_bonus(0, ninja);
-                                                               else
-                                                                 award_bonus(0, Bullseyebonus);
-                                                       }
+                                                       if(animation[player[0].targetanimation].height==highheight)
+                                                         award_bonus(0, ninja);
+                                                       else
+                                                         award_bonus(0, Bullseyebonus);
                                                }
-                                               else missed=1;
                                        }
+                                       else missed=1;
+                               }
+                       }
+               }
+               if(position.y<terrain.getHeight(position.x,position.z)) {
+                       if(terrain.getOpacity(position.x,position.z)<.2) {
+                               velocity=0;
+                               if(terrain.lineTerrain(oldposition,position,&colpoint)!=-1) {
+                                       position=colpoint*terrain.scale;
+                               } else {
+                                       position.y=terrain.getHeight(position.x,position.z);
                                }
-                               if(position.y<terrain.getHeight(position.x,position.z)){
-                                       if(terrain.getOpacity(position.x,position.z)<.2){
-                                               velocity=0;
-                                               if(terrain.lineTerrain(oldposition,position,&colpoint)!=-1){
-                                                       position=colpoint*terrain.scale;
-                                               }
-                                               else position.y=terrain.getHeight(position.x,position.z);
-
-                                               terrain.MakeDecal(shadowdecalpermanent,position,.06,.5,0);
-                                               normalrot=terrain.getNormal(position.x,position.z)*-1;
-                                               velocity=0;
-                                               glMatrixMode(GL_MODELVIEW);                                                     // Select The Modelview Matrix
-                                               glPushMatrix();
-                                                       GLfloat M[16];
-                                                       glLoadIdentity();
-                                                       glRotatef(bigrotation,0,1,0);
-                                                       glRotatef(bigtilt2,1,0,0);
-                                                       glRotatef(bigtilt,0,0,1);
-                                                       glRotatef(-rotation1+90,0,1,0);
-                                                       glRotatef(-rotation2+90,0,0,1);
-                                                       glRotatef(-rotation3,0,1,0);
-                                                       glRotatef(smallrotation,1,0,0);
-                                                       glRotatef(smallrotation2,0,1,0);
-                                                       glTranslatef(0,0,1);
-                                                       glGetFloatv(GL_MODELVIEW_MATRIX,M);
-                                                       tippoint.x=M[12];
-                                                       tippoint.y=M[13];
-                                                       tippoint.z=M[14];
-                                               glPopMatrix();
-                                               position-=tippoint*.15;
-                                               XYZ temppoint1,temppoint2,tempforward;
-
-                                               rotation3=0;
-                                               smallrotation=90;
-                                               smallrotation2=0;
-                                               bigtilt=0;
-                                               bigtilt2=0;
-                                               bigrotation=0;
-
-                                               emit_sound_at(knifesheathesound, position, 128.);
-
-                                               XYZ terrainlight;
-                                               terrainlight=terrain.getLighting(position.x,position.z);
-                                               if(environment==snowyenvironment){
-                                                       if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
-                                               }
-                                               else if(environment==grassyenvironment){
-                                                       if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
-                                               }
-                                               else if(environment==desertenvironment){
-                                                       if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
-                                               }
 
-                                               bloody=0;
-                                       }
-                                       else {
-                                               physics=1;
-                                               firstfree=1;
-                                               position-=velocity*multiplier;
-                                               tippoint-=velocity*multiplier;
-                                               tipvelocity=velocity;
-                                       }
+                               terrain.MakeDecal(shadowdecalpermanent,position,.06,.5,0);
+                               normalrot=terrain.getNormal(position.x,position.z)*-1;
+                               velocity=0;
+                               glMatrixMode(GL_MODELVIEW);                                                     // Select The Modelview Matrix
+                               glPushMatrix();
+                                       GLfloat M[16];
+                                       glLoadIdentity();
+                                       glRotatef(bigrotation,0,1,0);
+                                       glRotatef(bigtilt2,1,0,0);
+                                       glRotatef(bigtilt,0,0,1);
+                                       glRotatef(-rotation1+90,0,1,0);
+                                       glRotatef(-rotation2+90,0,0,1);
+                                       glRotatef(-rotation3,0,1,0);
+                                       glRotatef(smallrotation,1,0,0);
+                                       glRotatef(smallrotation2,0,1,0);
+                                       glTranslatef(0,0,1);
+                                       glGetFloatv(GL_MODELVIEW_MATRIX,M);
+                                       tippoint.x=M[12];
+                                       tippoint.y=M[13];
+                                       tippoint.z=M[14];
+                               glPopMatrix();
+                               position-=tippoint*.15;
+                               XYZ temppoint1,temppoint2,tempforward;
+
+                               rotation3=0;
+                               smallrotation=90;
+                               smallrotation2=0;
+                               bigtilt=0;
+                               bigtilt2=0;
+                               bigrotation=0;
+
+                               emit_sound_at(knifesheathesound, position, 128.);
+
+                               XYZ terrainlight;
+                               terrainlight=terrain.getLighting(position.x,position.z);
+                               if(environment==snowyenvironment){
+                                       if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+                                               Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
                                }
-                               if(velocity.x!=0||velocity.z!=0||velocity.y!=0){
-                                       velocity.y+=gravity*multiplier;
-
-                                       XYZ temppoint1,temppoint2,tempforward;
-                                       float distance;
-
-                                       temppoint1=0;
-                                       temppoint2=velocity;
-                                       distance=findDistance(&temppoint1,&temppoint2);
-                                       rotation2=asin((temppoint1.y-temppoint2.y)/distance);
-                                       rotation2*=360/6.28;
-                                       temppoint1.y=0;
-                                       temppoint2.y=0;
-                                       rotation1=acos((temppoint1.z-temppoint2.z)/findDistance(&temppoint1,&temppoint2));
-                                       rotation1*=360/6.28;
-                                       rotation3=0;
-                                       smallrotation=90;
-                                       smallrotation2=0;
-                                       bigtilt=0;
-                                       bigtilt2=0;
-                                       bigrotation=0;
-                                       if(temppoint1.x>temppoint2.x) rotation1=360-rotation1;
+                               else if(environment==grassyenvironment){
+                                       if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+                                               Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
                                }
+                               else if(environment==desertenvironment){
+                                       if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+                                               Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
+                               }
+
+                               bloody=0;
+                       }
+                       else {
+                               physics=1;
+                               firstfree=1;
+                               position-=velocity*multiplier;
+                               tippoint-=velocity*multiplier;
+                               tipvelocity=velocity;
+                       }
+               }
+               if(velocity.x!=0||velocity.z!=0||velocity.y!=0) {
+                       velocity.y+=gravity*multiplier;
+
+                       XYZ temppoint1,temppoint2,tempforward;
+                       float distance;
+
+                       temppoint1=0;
+                       temppoint2=velocity;
+                       distance=findDistance(&temppoint1,&temppoint2);
+                       rotation2=asin((temppoint1.y-temppoint2.y)/distance);
+                       rotation2*=360/6.28;
+                       temppoint1.y=0;
+                       temppoint2.y=0;
+                       rotation1=acos((temppoint1.z-temppoint2.z)/findDistance(&temppoint1,&temppoint2));
+                       rotation1*=360/6.28;
+                       rotation3=0;
+                       smallrotation=90;
+                       smallrotation2=0;
+                       bigtilt=0;
+                       bigtilt2=0;
+                       bigrotation=0;
+                       if(temppoint1.x>temppoint2.x) rotation1=360-rotation1;
+               }
+
        }
+       
        //Sword physics
        XYZ mid;
        XYZ oldmid;
@@ -384,8 +399,10 @@ void Weapon::DoStuff(int i) {
                        newpoint1=midp-vel*length*(tipmass/(mass+tipmass));
                        newpoint2=midp+vel*length*(mass/(mass+tipmass));
                        if(!freeze){
-                               if(freetime>.04)velocity=velocity+(newpoint1-position)/multiplier;
-                               if(freetime>.04)tipvelocity=tipvelocity+(newpoint2-tippoint)/multiplier;
+                               if(freetime>.04) {
+                                       velocity=velocity+(newpoint1-position)/multiplier;
+                                       tipvelocity=tipvelocity+(newpoint2-tippoint)/multiplier;
+                               }
                        }
                        position=newpoint1;
                        tippoint=newpoint2;
@@ -395,41 +412,40 @@ void Weapon::DoStuff(int i) {
                        whichpatchx=(position.x)/(terrain.size/subdivision*terrain.scale);
                        whichpatchz=(position.z)/(terrain.size/subdivision*terrain.scale);
                        if(whichpatchx>0&&whichpatchz>0&&whichpatchx<subdivision&&whichpatchz<subdivision)
-                               if(terrain.patchobjectnum[whichpatchx][whichpatchz]){
-                                       for(int j=0;j<terrain.patchobjectnum[whichpatchx][whichpatchz];j++){
+                               if(terrain.patchobjectnum[whichpatchx][whichpatchz]) {
+                                       for(int j=0;j<terrain.patchobjectnum[whichpatchx][whichpatchz];j++) {
                                                int k=terrain.patchobjects[whichpatchx][whichpatchz][j];
 
-                                               if(firstfree){
-                                                       if(type!=staff){
-                                                               start=position-(tippoint-position)/5;
-                                                               end=tippoint+(tippoint-position)/30;
+                                               if(firstfree) {
+                                                       if(type==staff) {
+                                                               start=tippoint-(position-tippoint)/5;
+                                                               end=position+(position-tippoint)/30;
                                                                whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
-                                                               if(whichhit!=-1){
+                                                               if(whichhit!=-1) {
                                                                        XYZ diff;
-                                                                       diff=(colpoint-tippoint);
+                                                                       diff=(colpoint-position);
                                                                        Normalise(&diff);
                                                                        hitsomething=1;
 
-                                                                       position+=(colpoint-tippoint)+diff*.05;
-                                                                       tippoint=colpoint+diff*.05;
-                                                                       oldposition=position;
+                                                                       tippoint+=(colpoint-position)+diff*.05;
+                                                                       position=colpoint+diff*.05;
                                                                        oldtippoint=tippoint;
+                                                                       oldposition=tippoint;
                                                                }
-                                                       }
-                                                       if(type==staff){
-                                                               start=tippoint-(position-tippoint)/5;
-                                                               end=position+(position-tippoint)/30;
+                                                       } else {
+                                                               start=position-(tippoint-position)/5;
+                                                               end=tippoint+(tippoint-position)/30;
                                                                whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
                                                                if(whichhit!=-1){
                                                                        XYZ diff;
-                                                                       diff=(colpoint-position);
+                                                                       diff=(colpoint-tippoint);
                                                                        Normalise(&diff);
                                                                        hitsomething=1;
 
-                                                                       tippoint+=(colpoint-position)+diff*.05;
-                                                                       position=colpoint+diff*.05;
+                                                                       position+=(colpoint-tippoint)+diff*.05;
+                                                                       tippoint=colpoint+diff*.05;
+                                                                       oldposition=position;
                                                                        oldtippoint=tippoint;
-                                                                       oldposition=tippoint;
                                                                }
                                                        }
                                                }
@@ -437,7 +453,7 @@ void Weapon::DoStuff(int i) {
                                                start=oldposition;
                                                end=position;
                                                whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
-                                               if(whichhit!=-1){
+                                               if(whichhit!=-1) {
                                                        hitsomething=1;
                                                        position=colpoint;
                                                        terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
@@ -445,24 +461,27 @@ void Weapon::DoStuff(int i) {
                                                        position+=terrainnormal*.002;
 
                                                        bounceness=terrainnormal*findLength(&velocity)*(abs(normaldotproduct(velocity,terrainnormal)));
-                                                       if(findLengthfast(&velocity)<findLengthfast(&bounceness))bounceness=0;
+                                                       if(findLengthfast(&velocity)<findLengthfast(&bounceness))
+                                                               bounceness=0;
                                                        frictionness=abs(normaldotproduct(velocity,terrainnormal));
                                                        velocity-=bounceness;
                                                        if(1-friction*frictionness>0)velocity*=1-friction*frictionness;
                                                        else velocity=0;
                                                        velocity+=bounceness*elasticity;
 
-                                                       if(findLengthfast(&bounceness)>1){
+                                                       if(findLengthfast(&bounceness)>1) {
                                                                int whichsound;
-                                                               if(type==staff)whichsound=footstepsound3+abs(Random()%2);
-                                                               if(type!=staff)whichsound=clank1sound+abs(Random()%4);
+                                                               if(type==staff)
+                                                                       whichsound=footstepsound3+abs(Random()%2);
+                                                               else
+                                                                       whichsound=clank1sound+abs(Random()%4);
                                                                emit_sound_at(whichsound, position, 128*findLengthfast(&bounceness));
                                                        }
                                                }
                                                start=oldtippoint;
                                                end=tippoint;
                                                whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
-                                               if(whichhit!=-1){
+                                               if(whichhit!=-1) {
                                                        hitsomething=1;
                                                        tippoint=colpoint;
                                                        terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
@@ -479,14 +498,16 @@ void Weapon::DoStuff(int i) {
 
                                                        if(findLengthfast(&bounceness)>1){
                                                                int whichsound;
-                                                               if(type==staff)whichsound=footstepsound3+abs(Random()%2);
-                                                               if(type!=staff)whichsound=clank1sound+abs(Random()%4);
+                                                               if(type==staff)
+                                                                       whichsound=footstepsound3+abs(Random()%2);
+                                                               else
+                                                                       whichsound=clank1sound+abs(Random()%4);
                                                                emit_sound_at(whichsound, position, 128*findLengthfast(&bounceness));
                                                        }
                                                }
 
-                                               if((objects.type[k]!=boxtype&&objects.type[k]!=platformtype&&objects.type[k]!=walltype&&objects.type[k]!=weirdtype)||objects.rotation2[k]!=0)
-                                                       for(m=0;m<2;m++){
+                                               if((objects.type[k]!=boxtype && objects.type[k]!=platformtype && objects.type[k]!=walltype && objects.type[k]!=weirdtype)||objects.rotation2[k]!=0)
+                                                       for(int m=0;m<2;m++){
                                                                mid=(position*(21+(float)m*10)+tippoint*(19-(float)m*10))/40;
                                                                oldmid2=mid;
                                                                oldmid=(oldposition*(21+(float)m*10)+oldtippoint*(19-(float)m*10))/40;
@@ -494,7 +515,7 @@ void Weapon::DoStuff(int i) {
                                                                start=oldmid;
                                                                end=mid;
                                                                whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
-                                                               if(whichhit!=-1){
+                                                               if(whichhit!=-1) {
                                                                        hitsomething=1;
                                                                        mid=colpoint;
                                                                        terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
@@ -510,8 +531,10 @@ void Weapon::DoStuff(int i) {
 
                                                                        if(findLengthfast(&bounceness)>1){
                                                                                int whichsound;
-                                                                               if(type==staff)whichsound=footstepsound3+abs(Random()%2);
-                                                                               if(type!=staff)whichsound=clank1sound+abs(Random()%4);
+                                                                               if(type==staff)
+                                                                                       whichsound=footstepsound3+abs(Random()%2);
+                                                                               else
+                                                                                       whichsound=clank1sound+abs(Random()%4);
                                                                                emit_sound_at(whichsound, mid, 128*findLengthfast(&bounceness));
                                                                        }
                                                                        position+=(mid-oldmid2)*(20/(1+(float)m*10));
@@ -524,7 +547,7 @@ void Weapon::DoStuff(int i) {
                                                                start=oldmid;
                                                                end=mid;
                                                                whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
-                                                               if(whichhit!=-1){
+                                                               if(whichhit!=-1) {
                                                                        hitsomething=1;
                                                                        mid=colpoint;
                                                                        terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
@@ -540,8 +563,10 @@ void Weapon::DoStuff(int i) {
 
                                                                        if(findLengthfast(&bounceness)>1){
                                                                                int whichsound;
-                                                                               if(type==staff)whichsound=footstepsound3+abs(Random()%2);
-                                                                               if(type!=staff)whichsound=clank1sound+abs(Random()%4);
+                                                                               if(type==staff)
+                                                                                       whichsound=footstepsound3+abs(Random()%2);
+                                                                               else
+                                                                                       whichsound=clank1sound+abs(Random()%4);
                                                                                emit_sound_at(whichsound, mid, 128*findLengthfast(&bounceness));
                                                                        }
                                                                        tippoint+=(mid-oldmid2)*(20/(1+(float)m*10));
@@ -552,48 +577,52 @@ void Weapon::DoStuff(int i) {
                                                        start=position;
                                                        end=tippoint;
                                                        whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
-                                                       if(whichhit!=-1){
+                                                       if(whichhit!=-1) {
                                                                hitsomething=1;
                                                                closestdistance=-1;
                                                                closestswordpoint=colpoint;//(position+tippoint)/2;
                                                                point[0]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[0]],0,objects.rotation[k],0)+objects.position[k];
                                                                point[1]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[1]],0,objects.rotation[k],0)+objects.position[k];
                                                                point[2]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[2]],0,objects.rotation[k],0)+objects.position[k];
-                                                               if(DistancePointLine(&closestswordpoint, &point[0], &point[1], &distance,&colpoint ))
+                                                               if(DistancePointLine(&closestswordpoint, &point[0], &point[1], &distance,&colpoint )) {
                                                                        if(distance<closestdistance||closestdistance==-1){
                                                                                closestpoint=colpoint;
                                                                                closestdistance=distance;
                                                                        }
-                                                                       if(DistancePointLine(&closestswordpoint, &point[1], &point[2], &distance,&colpoint ))
-                                                                               if(distance<closestdistance||closestdistance==-1){
-                                                                                       closestpoint=colpoint;
-                                                                                       closestdistance=distance;
-                                                                               }
-                                                                               if(DistancePointLine(&closestswordpoint, &point[2], &point[0], &distance,&colpoint ))
-                                                                                       if(distance<closestdistance||closestdistance==-1){
-                                                                                               closestpoint=colpoint;
-                                                                                               closestdistance=distance;
-                                                                                       }
-                                                                                       if(closestdistance!=-1&&isnormal(closestdistance)){
-                                                                                               if(DistancePointLine(&closestpoint, &position, &tippoint, &distance,&colpoint )){
-                                                                                                       closestswordpoint=colpoint;
-                                                                                                       velocity+=(closestpoint-closestswordpoint);
-                                                                                                       tipvelocity+=(closestpoint-closestswordpoint);
-                                                                                                       position+=(closestpoint-closestswordpoint);
-                                                                                                       tippoint+=(closestpoint-closestswordpoint);
-                                                                                               }
-                                                                                       }
+                                                               }
+                                                               if(DistancePointLine(&closestswordpoint, &point[1], &point[2], &distance,&colpoint )) {
+                                                                       if(distance<closestdistance||closestdistance==-1){
+                                                                               closestpoint=colpoint;
+                                                                               closestdistance=distance;
+                                                                       }
+                                                               }
+                                                               if(DistancePointLine(&closestswordpoint, &point[2], &point[0], &distance,&colpoint )) {
+                                                                       if(distance<closestdistance||closestdistance==-1){
+                                                                               closestpoint=colpoint;
+                                                                               closestdistance=distance;
+                                                                       }
+                                                               }
+                                                               if(closestdistance!=-1 && isnormal(closestdistance)) {
+                                                                       if(DistancePointLine(&closestpoint, &position, &tippoint, &distance,&colpoint )) {
+                                                                               closestswordpoint=colpoint;
+                                                                               velocity+=(closestpoint-closestswordpoint);
+                                                                               tipvelocity+=(closestpoint-closestswordpoint);
+                                                                               position+=(closestpoint-closestswordpoint);
+                                                                               tippoint+=(closestpoint-closestswordpoint);
+                                                                       }
+                                                               }
                                                        }
                                                }
-
                                        }
                                }
                                //Terrain collisions
                                whichhit=terrain.lineTerrain(oldposition,position,&colpoint);
-                               if(whichhit!=-1||position.y<terrain.getHeight(position.x,position.z)){
+                               if(whichhit!=-1||position.y<terrain.getHeight(position.x,position.z)) {
                                        hitsomething=1;
-                                       if(whichhit!=-1)position=colpoint*terrain.scale;
-                                       else position.y=terrain.getHeight(position.x,position.z);
+                                       if(whichhit!=-1)
+                                               position=colpoint*terrain.scale;
+                                       else
+                                               position.y=terrain.getHeight(position.x,position.z);
 
                                        terrainnormal=terrain.getNormal(position.x,position.z);
                                        ReflectVector(&velocity,&terrainnormal);
@@ -606,39 +635,45 @@ void Weapon::DoStuff(int i) {
                                        else velocity=0;
                                        if(terrain.getOpacity(position.x,position.z)<.2)velocity+=bounceness*elasticity*.3;
                                        else velocity+=bounceness*elasticity;
-//if (type==knife) printf("velocity of knife %d now %f,%f,%f.\n", i, velocity.x, velocity.y, velocity.z);
-                                       if(findLengthfast(&bounceness)>1){
+
+                                       if(findLengthfast(&bounceness)>1) {
                                                int whichsound;
                                                if(terrain.getOpacity(position.x,position.z)>.2){
-                                                       if(type==staff)whichsound=footstepsound3+abs(Random()%2);
-                                                       if(type!=staff)whichsound=clank1sound+abs(Random()%4);
+                                                       if(type==staff)
+                                                               whichsound=footstepsound3+abs(Random()%2);
+                                                       else
+                                                               whichsound=clank1sound+abs(Random()%4);
+                                               } else {
+                                                       whichsound=footstepsound+abs(Random()%2);
                                                }
-                                               else whichsound=footstepsound+abs(Random()%2);
                                                emit_sound_at(whichsound, position,
                                                                  findLengthfast(&bounceness)
-                                                                 * (terrain.getOpacity(position.x,position.z) > .2
-                                                                ? 128.
-                                                                : 32.));
+                                                                 * (terrain.getOpacity(position.x,position.z) > .2 ? 128. : 32.));
 
-                                               if(terrain.getOpacity(position.x,position.z)<.2){
+                                               if(terrain.getOpacity(position.x,position.z)<.2) {
                                                        XYZ terrainlight;
                                                        terrainlight=terrain.getLighting(position.x,position.z);
                                                        if(environment==snowyenvironment){
-                                                               if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
+                                                               if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+                                                                       Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
                                                        }
                                                        else if(environment==grassyenvironment){
-                                                               if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
+                                                               if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+                                                                       Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
                                                        }
                                                        else if(environment==desertenvironment){
-                                                               if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
+                                                               if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+                                                                       Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
                                                        }
                                                }
                                        }
                                }
                                whichhit=terrain.lineTerrain(oldtippoint,tippoint,&colpoint);
-                               if(whichhit!=-1||tippoint.y<terrain.getHeight(tippoint.x,tippoint.z)){
-                                       if(whichhit!=-1)tippoint=colpoint*terrain.scale;
-                                       else tippoint.y=terrain.getHeight(tippoint.x,tippoint.z);
+                               if(whichhit!=-1||tippoint.y<terrain.getHeight(tippoint.x,tippoint.z)) {
+                                       if(whichhit!=-1)
+                                               tippoint=colpoint*terrain.scale;
+                                       else
+                                               tippoint.y=terrain.getHeight(tippoint.x,tippoint.z);
 
                                        terrainnormal=terrain.getNormal(tippoint.x,tippoint.z);
                                        ReflectVector(&tipvelocity,&terrainnormal);
@@ -651,32 +686,35 @@ void Weapon::DoStuff(int i) {
                                        else tipvelocity=0;
                                        if(terrain.getOpacity(tippoint.x,tippoint.z)<.2)tipvelocity+=bounceness*elasticity*.3;
                                        else tipvelocity+=bounceness*elasticity;
-//if (type==knife) printf("tipvelocity of knife %d now %f,%f,%f.\n", i, tipvelocity.x, tipvelocity.y, tipvelocity.z);
 
-                                       if(findLengthfast(&bounceness)>1){
+                                       if(findLengthfast(&bounceness)>1){ 
                                                int whichsound;
                                                if(terrain.getOpacity(tippoint.x,tippoint.z)>.2){
-                                                       if(type==staff)whichsound=footstepsound3+abs(Random()%2);
-                                                       if(type!=staff)whichsound=clank1sound+abs(Random()%4);
+                                                       if(type==staff)
+                                                               whichsound=footstepsound3+abs(Random()%2);
+                                                       else
+                                                               whichsound=clank1sound+abs(Random()%4);
+                                               } else {
+                                                       whichsound=footstepsound+abs(Random()%2);
                                                }
-                                               else whichsound=footstepsound+abs(Random()%2);
                                                emit_sound_at(whichsound, tippoint,
                                                                  findLengthfast(&bounceness)
-                                                                 * (terrain.getOpacity(tippoint.x,tippoint.z) > .2
-                                                                ? 128.
-                                                                : 32.));
+                                                                 * (terrain.getOpacity(tippoint.x,tippoint.z) > .2  ? 128. : 32.));
 
-                                               if(terrain.getOpacity(tippoint.x,tippoint.z)<.2){
+                                               if(terrain.getOpacity(tippoint.x,tippoint.z)<.2) {
                                                        XYZ terrainlight;
                                                        terrainlight=terrain.getLighting(tippoint.x,tippoint.z);
                                                        if(environment==snowyenvironment){
-                                                               if(findDistancefast(&tippoint,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, tippoint,tipvelocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
+                                                               if(findDistancefast(&tippoint,&viewer)<viewdistance*viewdistance/4)
+                                                                       Sprite::MakeSprite(cloudsprite, tippoint,tipvelocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
                                                        }
                                                        else if(environment==grassyenvironment){
-                                                               if(findDistancefast(&tippoint,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, tippoint,tipvelocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
+                                                               if(findDistancefast(&tippoint,&viewer)<viewdistance*viewdistance/4)
+                                                                       Sprite::MakeSprite(cloudsprite, tippoint,tipvelocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
                                                        }
                                                        else if(environment==desertenvironment){
-                                                               if(findDistancefast(&tippoint,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, tippoint,tipvelocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
+                                                               if(findDistancefast(&tippoint,&viewer)<viewdistance*viewdistance/4)
+                                                                       Sprite::MakeSprite(cloudsprite, tippoint,tipvelocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
                                                        }
                                                }
                                        }
@@ -757,8 +795,6 @@ void Weapon::DoStuff(int i) {
                                //Gravity
                                velocity.y+=gravity*multiplier;
                                tipvelocity.y+=gravity*multiplier;
-                               //position.y+=gravity*multiplier*multiplier;
-                               //tippoint.y+=gravity*multiplier*multiplier;
 
                                //Rotation
                                XYZ temppoint1,temppoint2,tempforward;
@@ -786,8 +822,6 @@ void Weapon::DoStuff(int i) {
                                        freetime+=multiplier;
                                }
 
-                               //velocity=(position-oldposition)/multiplier;
-                               //tipvelocity==(tippoint[i-+oldtippoint)/multiplier;
                                if(freetime>.4){
                                        velocity=0;
                                        tipvelocity=0;
@@ -796,35 +830,35 @@ void Weapon::DoStuff(int i) {
                }
        }
        multiplier=tempmult;
-       if(blooddrip&&bloody){
+       if(blooddrip && bloody) {
                blooddripdelay-=blooddrip*multiplier/2;
                blooddrip-=multiplier;
-               if(blooddrip<0)blooddrip=0;
-               if(blooddrip>5)blooddrip=5;
-               if(blooddripdelay<0&&bloodtoggle){
+               if(blooddrip<0) blooddrip=0;
+               if(blooddrip>5) blooddrip=5;
+               if(blooddripdelay<0 && bloodtoggle) {
                        blooddripdelay=1;
                        XYZ bloodvel;
                        XYZ bloodloc;
                        bloodloc=position+(tippoint-position)*.7;
                        bloodloc.y-=.05;
-                       if(bloodtoggle){
+                       if(bloodtoggle) {
                                bloodvel=0;
                                Sprite::MakeSprite(bloodsprite, bloodloc,bloodvel, 1,1,1, .03, 1);
                        }
                }
        }
-       if(onfire){
+       if(onfire) {
                flamedelay-=multiplier;
-               if(onfire&&flamedelay<=0){
+               if(onfire&&flamedelay<=0) {
                        flamedelay=.020;
                        flamedelay-=multiplier;
                        normalrot=0;
-                       if(owner!=-1){
+                       if(owner!=-1) {
                                normalrot=player[owner].velocity;
                        }
                        normalrot.y+=1;
-                       if(owner!=-1){
-                               if(player[owner].onterrain){
+                       if(owner!=-1) {
+                               if(player[owner].onterrain) {
                                        normalrot.y=1;
                                }
                        }
@@ -834,13 +868,13 @@ void Weapon::DoStuff(int i) {
                }
        }
 
-       if(!onfire&&owner==-1&&type!=staff){
+       if(!onfire && owner==-1 && type!=staff) {
                flamedelay-=multiplier;
-               if(flamedelay<=0){
+               if(flamedelay<=0) {
                        flamedelay=.020;
                        flamedelay-=multiplier;
                        normalrot=0;
-                       if(Random()%50==0&&findDistancefast(&position,&viewer)>80){
+                       if(Random()%50==0&&findDistancefast(&position,&viewer)>80) {
                                XYZ shinepoint;
                                shinepoint=position+(tippoint-position)*(((float)abs(Random()%100))/100);
                                Sprite::MakeSprite(weaponshinesprite, shinepoint,normalrot, 1,1,1, (.1+(float)abs(Random()%100)/200-.25)*1/3*fast_sqrt(findDistance(&shinepoint,&viewer)), 1);
@@ -860,30 +894,47 @@ void Weapons::DoStuff() {
 }
 
 void Weapon::Draw() {
-       static int j;
        static XYZ terrainlight;
        static GLfloat M[16];
-       static bool draw;
        
-       if((frustum.SphereInFrustum(position.x,position.y,position.z,1)&&findDistancefast(&viewer,&position)<viewdistance*viewdistance))
+       if((frustum.SphereInFrustum(position.x,position.y,position.z,1)&&
+               findDistancefast(&viewer,&position)<viewdistance*viewdistance))
        {
-               draw=0;
+               bool draw=false;
                if(owner==-1)
                {
-                       draw=1;
-                       if(velocity.x&&!physics)drawhowmany=10;
-                       else drawhowmany=1;
-               }
-               if(owner!=-1)
-               {
+                       draw=true;
+                       if(velocity.x && !physics)
+                               drawhowmany=10;
+                       else
+                               drawhowmany=1;
+               } else {
                        if(player[owner].occluded<25)
                                if((frustum.SphereInFrustum(player[owner].coords.x,player[owner].coords.y+player[owner].scale*3,player[owner].coords.z,player[owner].scale*8)&&findDistancefast(&viewer,&player[owner].coords)<viewdistance*viewdistance)||player[owner].skeleton.free==3)
-                                       draw=1;
-                       if((player[owner].targetanimation==knifeslashstartanim||player[owner].targetanimation==swordsneakattackanim||(player[owner].currentanimation==staffhitanim&&player[owner].currentframe>1)||(player[owner].currentanimation==staffhitreversedanim&&player[owner].currentframe>1)||(player[owner].currentanimation==staffspinhitanim&&player[owner].currentframe>1)||(player[owner].currentanimation==staffspinhitreversedanim&&player[owner].currentframe>1)||(player[owner].currentanimation==staffgroundsmashanim&&player[owner].currentframe>1)||(player[owner].targetanimation==swordslashanim&&player[owner].targetframe<7)||player[owner].targetanimation==crouchstabanim||player[owner].targetanimation==swordslashreversalanim||player[owner].targetanimation==swordslashreversedanim||player[owner].targetanimation==knifefollowanim||player[owner].targetanimation==swordgroundstabanim||player[owner].targetanimation==knifethrowanim)&&player[owner].targetanimation==lastdrawnanim&&!player[owner].skeleton.free)
+                                       draw=true;
+                       if      (
+                               (player[owner].targetanimation==knifeslashstartanim||
+                                player[owner].targetanimation==swordsneakattackanim||
+                                (player[owner].currentanimation==staffhitanim  &&                              player[owner].currentframe>1)||
+                                (player[owner].currentanimation==staffhitreversedanim  &&              player[owner].currentframe>1)||
+                                (player[owner].currentanimation==staffspinhitanim      &&                      player[owner].currentframe>1)||
+                                (player[owner].currentanimation==staffspinhitreversedanim      &&      player[owner].currentframe>1)||
+                                (player[owner].currentanimation==staffgroundsmashanim  &&              player[owner].currentframe>1)||
+                                (player[owner].targetanimation==swordslashanim &&                              player[owner].targetframe<7)||
+                                player[owner].targetanimation==crouchstabanim||
+                                player[owner].targetanimation==swordslashreversalanim||
+                                player[owner].targetanimation==swordslashreversedanim||
+                                player[owner].targetanimation==knifefollowanim||
+                                player[owner].targetanimation==swordgroundstabanim||
+                                player[owner].targetanimation==knifethrowanim)&&
+                                player[owner].targetanimation==lastdrawnanim&&
+                                !player[owner].skeleton.free
+                               )
                        {
                                drawhowmany=10;
+                       } else {
+                               drawhowmany=1;
                        }
-                       else drawhowmany=1;
                        if(player[owner].targetanimation==swordgroundstabanim)
                        {
                                lastdrawnrotation1=rotation1;
@@ -903,14 +954,15 @@ void Weapon::Draw() {
                        {
                                glAlphaFunc(GL_GREATER, 0.01);
                        }
-                       for(j=drawhowmany;j>0;j--)
+                       for(int j=drawhowmany;j>0;j--)
                        {
                                glMatrixMode(GL_MODELVIEW);                                                     // Select The Modelview Matrix
                                glPushMatrix();
                                        glColor4f(terrainlight.x,terrainlight.y,terrainlight.z,j/drawhowmany);
-                                       if(owner!=-1)glTranslatef(position.x*(((float)(j))/drawhowmany)+lastdrawnposition.x*(1-((float)(j))/drawhowmany),position.y*(((float)(j))/drawhowmany)-.02+lastdrawnposition.y*(1-((float)(j))/drawhowmany),position.z*(((float)(j))/drawhowmany)+lastdrawnposition.z*(1-((float)(j))/drawhowmany));
-                                       if(owner==-1)glTranslatef(position.x*(((float)(j))/drawhowmany)+lastdrawnposition.x*(1-((float)(j))/drawhowmany),position.y*(((float)(j))/drawhowmany)+lastdrawnposition.y*(1-((float)(j))/drawhowmany),position.z*(((float)(j))/drawhowmany)+lastdrawnposition.z*(1-((float)(j))/drawhowmany));
-                                       //glTranslatef(position.x,position.y-.02,position.z);
+                                       if(owner==-1)
+                                               glTranslatef(position.x*(((float)(j))/drawhowmany)+lastdrawnposition.x*(1-((float)(j))/drawhowmany),position.y*(((float)(j))/drawhowmany)+lastdrawnposition.y*(1-((float)(j))/drawhowmany),position.z*(((float)(j))/drawhowmany)+lastdrawnposition.z*(1-((float)(j))/drawhowmany));
+                                       else
+                                               glTranslatef(position.x*(((float)(j))/drawhowmany)+lastdrawnposition.x*(1-((float)(j))/drawhowmany),position.y*(((float)(j))/drawhowmany)-.02+lastdrawnposition.y*(1-((float)(j))/drawhowmany),position.z*(((float)(j))/drawhowmany)+lastdrawnposition.z*(1-((float)(j))/drawhowmany));
                                        glRotatef(bigrotation*(((float)(j))/drawhowmany)+lastdrawnbigrotation*(1-((float)(j))/drawhowmany),0,1,0);
                                        glRotatef(bigtilt2*(((float)(j))/drawhowmany)+lastdrawnbigtilt2*(1-((float)(j))/drawhowmany),1,0,0);
                                        glRotatef(bigtilt*(((float)(j))/drawhowmany)+lastdrawnbigtilt*(1-((float)(j))/drawhowmany),0,0,1);