]> git.jsancho.org Git - lugaru.git/commitdiff
cleanup, renamed rotations to yaw/pitch
authorsf17k <sf171k@gmail.com>
Sun, 29 May 2011 19:26:28 +0000 (15:26 -0400)
committersf17k <sf171k@gmail.com>
Sun, 29 May 2011 19:26:28 +0000 (15:26 -0400)
15 files changed:
Source/Game.cpp
Source/Game.h
Source/GameDraw.cpp
Source/GameInitDispose.cpp
Source/GameTick.cpp
Source/Globals.cpp
Source/Objects.cpp
Source/Objects.h
Source/OpenGL_Windows.cpp
Source/Person.cpp
Source/Person.h
Source/Skeleton.cpp
Source/Sprite.cpp
Source/Terrain.cpp
Source/Weapons.cpp

index 44c4e649526c530a4160ae2f93542b91a2f140bb..2beac5a342b9d21beff4582ae6b9318a3fdebab2 100644 (file)
@@ -16,10 +16,10 @@ XYZ dialoguecamera[max_dialogues][max_dialoguelength];
 XYZ participantlocation[max_dialogues][10];
 int participantfocus[max_dialogues][max_dialoguelength];
 int participantaction[max_dialogues][max_dialoguelength];
-float participantrotation[max_dialogues][10];
+float participantyaw[max_dialogues][10];
 XYZ participantfacing[max_dialogues][max_dialoguelength][10];
-float dialoguecamerarotation[max_dialogues][max_dialoguelength];
-float dialoguecamerarotation2[max_dialogues][max_dialoguelength];
+float dialoguecamerayaw[max_dialogues][max_dialoguelength];
+float dialoguecamerapitch[max_dialogues][max_dialoguelength];
 int indialogue;
 int whichdialogue;
 int directing;
@@ -27,325 +27,106 @@ float dialoguetime;
 int dialoguegonethrough[20];
 
 namespace Game{
-    GLuint terraintexture;
-    GLuint terraintexture2;
-    GLuint terraintexture3;
-    GLuint screentexture;
-    GLuint screentexture2;
-    GLuint logotexture;
-    GLuint loadscreentexture;
-    GLuint Maparrowtexture;
-    GLuint Mapboxtexture;
-    GLuint Mapcircletexture;
-    GLuint cursortexture;
-    GLuint Mainmenuitems[10];
-
-    int selected;
-    int keyselect;
-    int indemo;
-
-    bool won;
-
-    bool entername;
-
-    char registrationname[256];
-    float registrationnumber;
-
-    int newdetail;
-    int newscreenwidth;
-    int newscreenheight;
-
-    bool gameon;
-    float deltah,deltav;
-    int mousecoordh,mousecoordv;
-    int oldmousecoordh,oldmousecoordv;
-    float rotation,rotation2;
-    SkyBox skybox;
-    bool cameramode;
-    int olddrawmode;
-    int drawmode;
-    bool firstload;
-    bool oldbutton;
-
-    float leveltime;
-    float loadtime;
+    GLuint terraintexture = 0;
+    GLuint terraintexture2 = 0;
+    GLuint terraintexture3 = 0;
+    GLuint screentexture = 0;
+    GLuint screentexture2 = 0;
+    GLuint logotexture = 0;
+    GLuint loadscreentexture = 0;
+    GLuint Maparrowtexture = 0;
+    GLuint Mapboxtexture = 0;
+    GLuint Mapcircletexture = 0;
+    GLuint cursortexture = 0;
+    GLuint Mainmenuitems[10] = {};
+
+    int selected = 0;
+    int keyselect = 0;
+
+    int newdetail = 0;
+    int newscreenwidth = 0;
+    int newscreenheight = 0;
+
+    bool gameon = 0;
+    float deltah = 0;
+    float deltav = 0;
+    int mousecoordh = 0;
+    int mousecoordv = 0;
+    int oldmousecoordh = 0;
+    int oldmousecoordv = 0;
+    float yaw = 0;
+    float pitch = 0;
+    SkyBox *skybox = NULL;
+    bool cameramode = 0;
+    bool firstload = 0;
+
+       GLuint hawktexture = 0;
+       float hawkyaw = 0;
+       float hawkcalldelay = 0;
+    float leveltime = 0;
+    float loadtime = 0;
 
     Model hawk;
     XYZ hawkcoords;
     XYZ realhawkcoords;
-    GLuint hawktexture;
-    float hawkrotation;
-    float hawkcalldelay;
 
     Model eye;
     Model iris;
     Model cornea;
 
-    bool stealthloading;
-
-    std::vector<CampaignLevel> campaignlevels;
-    int whichchoice;
-    int actuallevel;
-    bool winhotspot;
-    bool windialogue;
-
-    bool minimap;
+    bool stealthloading = 0;
 
-    int musictype,oldmusictype,oldoldmusictype;
-    bool realthreat;
-
-    Model rabbit;
-    XYZ rabbitcoords;
+    int musictype = 0;
 
     XYZ mapcenter;
-    float mapradius;
-
-    Text* text;
-    float fps;
+    float mapradius = 0;
 
-    XYZ cameraloc;
-    float cameradist;
+    Text *text = NULL;
+    float fps = 0;
 
-    int drawtoggle;
+    bool editorenabled = 0;
+    int editortype = 0;
+    float editorsize = 0;
+    float editoryaw = 0;
+    float editorpitch = 0;
 
-    bool editorenabled;
-    int editortype;
-    float editorsize;
-    float editorrotation;
-    float editorrotation2;
-
-    float brightness;
-
-    int quit;
-    int tryquit;
+    int tryquit = 0;
 
     XYZ pathpoint[30];
-    int numpathpoints;
-    int numpathpointconnect[30];
-    int pathpointconnect[30][30];
-    int pathpointselected;
-
-    int endgame;
-    bool scoreadded;
-    int numchallengelevels;
-
-    bool console;
-    int archiveselected;
-    char consoletext[15][256];
-    int consolechars[15];
-    bool chatting;
-    char displaytext[15][256];
-    int displaychars[15];
-    float displaytime[15];
-    float displayblinkdelay;
-    bool displayblink;
-    int displayselected;
-    bool consolekeydown;
-    float consoleblinkdelay;
-    bool consoleblink;
-    int consoleselected;
-    bool autocam;
-
-    unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
-    unsigned short consolekey;
-    bool oldattackkey;
-
-    int loading;
-    float talkdelay;
+    int numpathpoints = 0;
+    int numpathpointconnect[30] = {};
+    int pathpointconnect[30][30] = {};
+    int pathpointselected = 0;
+
+    int endgame = 0;
+    bool scoreadded = 0;
+    int numchallengelevels = 0;
+
+    bool console = false;
+    char consoletext[15][256] = {};
+    int consolechars[15] = {};
+    bool chatting = 0;
+    char displaytext[15][256] = {};
+    int displaychars[15] = {};
+    float displaytime[15] = {};
+    float displayblinkdelay = 0;
+    bool displayblink = 0;
+    int displayselected = 0;
+    float consoleblinkdelay = 0;
+    bool consoleblink = 0;
+    int consoleselected = 0;
+
+    unsigned short crouchkey=0,jumpkey=0,forwardkey=0,chatkey=0,backkey=0,leftkey=0,rightkey=0,drawkey=0,throwkey=0,attackkey=0;
+    unsigned short consolekey=0;
+
+    int loading = 0;
     
-    int numboundaries;
-    XYZ boundary[360];
-
-    int whichlevel;
-    int oldenvironment;
-    int targetlevel;
-    float changedelay;
-
-    float musicvolume[4];
-    float oldmusicvolume[4];
-    int musicselected;
-    int change;
+    int oldenvironment = 0;
+    int targetlevel = 0;
+    float changedelay = 0;
 
-    bool waiting;
-    Account* accountactive;
-}
-
-void Game::newGame()
-{
-    text=NULL;
-    text=new Text();
-
-       terraintexture = 0;
-       terraintexture2 = 0;
-       terraintexture3 = 0;
-       screentexture = 0;
-       screentexture2 = 0;
-       logotexture = 0;
-       loadscreentexture = 0;
-       Maparrowtexture = 0;
-       Mapboxtexture = 0;
-       Mapcircletexture = 0;
-       cursortexture = 0;
-
-       memset(Mainmenuitems, 0, sizeof(Mainmenuitems));
-
-       selected = 0;
-       keyselect = 0;
-       indemo = 0;
-
-       won = 0;
-
-       entername = 0;
-
-       memset(registrationname, 0, sizeof(registrationname));
-       registrationnumber = 0;
-
-       newdetail = 0;
-       newscreenwidth = 0;
-       newscreenheight = 0;
-
-       gameon = 0;
-       deltah = 0,deltav = 0;
-       mousecoordh = 0,mousecoordv = 0;
-       oldmousecoordh = 0,oldmousecoordv = 0;
-       rotation = 0,rotation2 = 0;
-
-//     SkyBox skybox;
-
-       cameramode = 0;
-       olddrawmode = 0;
-       drawmode = 0;
-       firstload = 0;
-       oldbutton = 0;
-
-       leveltime = 0;
-       loadtime = 0;
-
-//     Model hawk;
-
-//     XYZ hawkcoords;
-//     XYZ realhawkcoords;
-
-       hawktexture = 0;
-       hawkrotation = 0;
-       hawkcalldelay = 0;
-/*
-       Model eye;
-       Model iris;
-       Model cornea;
-*/
-       stealthloading = 0;
-
-       whichchoice = 0;
-       actuallevel = 0;
-       winhotspot = false;
-       windialogue = false;
-
-       minimap = 0;
-
-       musictype = 0,oldmusictype = 0,oldoldmusictype = 0;
-       realthreat = 0;
-
-//     Model rabbit;
-//     XYZ rabbitcoords;
-
-//     XYZ mapcenter;
-       mapradius = 0;
-
-//     Text text;
-       fps = 0;
-
-//     XYZ cameraloc;
-       cameradist = 0;
-
-       drawtoggle = 0;
-
-       editorenabled = 0;
-       editortype = 0;
-       editorsize = 0;
-       editorrotation = 0;
-       editorrotation2 = 0;
-
-       brightness = 0;
-
-       quit = 0;
-       tryquit = 0;
-
-//     XYZ pathpoint[30];
-       numpathpoints = 0;
-       memset(numpathpointconnect, 0, sizeof(numpathpointconnect));
-       memset(pathpointconnect, 0, sizeof(pathpointconnect));
-       pathpointselected = 0;
-
-       endgame = 0;
-       scoreadded = 0;
-       numchallengelevels = 0;
-
-       console = false;
-       archiveselected = 0;
-
-       memset(consoletext, 0, sizeof(consoletext));
-       memset(consolechars, 0, sizeof(consolechars));
-       chatting = 0;
-       memset(displaytext, 0, sizeof(displaytext));
-       memset(displaychars, 0, sizeof(displaychars));
-       memset(displaytime, 0, sizeof(displaytime));
-       displayblinkdelay = 0;
-       displayblink = 0;
-       displayselected = 0;
-       consolekeydown = 0;
-       consoleblinkdelay = 0;
-       consoleblink = 0;
-       consoleselected = 0;
-       autocam = 0;
-
-       crouchkey = 0,jumpkey = 0,forwardkey = 0,chatkey = 0,backkey = 0,leftkey = 0,rightkey = 0,drawkey = 0,throwkey = 0,attackkey = 0;
-       consolekey = 0;
-       oldattackkey = 0;
-
-       loading = 0;
-       talkdelay = 0;
-
-       numboundaries = 0;
-//     XYZ boundary[360];
-
-       whichlevel = 0;
-       oldenvironment = 0;
-       targetlevel = 0;
-       changedelay = 0;
-
-       memset(musicvolume, 0, sizeof(musicvolume));
-       memset(oldmusicvolume, 0, sizeof(oldmusicvolume));
-       musicselected = 0;
-       change = 0;
-       
-//------------
-
-       waiting = false;
-       mainmenu = 0;
-       
-       accountactive = NULL;
-}
-
-void Game::deleteGame(){
-    if(text)
-        delete text;
-    for(int i=0;i<10;i++){
-        if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
-    }
-    glDeleteTextures( 1, &cursortexture );
-    glDeleteTextures( 1, &Maparrowtexture );
-    glDeleteTextures( 1, &Mapboxtexture );
-    glDeleteTextures( 1, &Mapcircletexture );
-    glDeleteTextures( 1, &terraintexture );
-    glDeleteTextures( 1, &terraintexture2 );
-    if(screentexture>0)glDeleteTextures( 1, &screentexture );
-    if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
-    glDeleteTextures( 1, &hawktexture );
-    glDeleteTextures( 1, &logotexture );
-    glDeleteTextures( 1, &loadscreentexture );
-
-    Dispose();
+    bool waiting = false;
+    Account* accountactive = NULL;
 }
 
 void Game::fireSound(int sound) {
@@ -415,18 +196,8 @@ void Game::inputText(char* str, int* charselected, int* nb_chars) {
        }
 }
 
-void Game::setKeySelected() {
-       waiting=true;
-    printf("launch thread\n");
-       SDL_Thread* thread = SDL_CreateThread(Game::setKeySelected_thread,NULL);
-    if ( thread == NULL ) {
-        fprintf(stderr, "Unable to create thread: %s\n", SDL_GetError());
-               waiting=false;
-        return;
-    }
-}
-
-int Game::setKeySelected_thread(void* data) {
+int setKeySelected_thread(void* data) {
+    using namespace Game;
        int keycode=-1;
        SDL_Event evenement;
        while(keycode==-1) {
@@ -475,11 +246,13 @@ int Game::setKeySelected_thread(void* data) {
     return 0;
 }
 
-void Game::DrawGL() {
-       if ( stereomode == stereoNone ) {
-               DrawGLScene(stereoCenter);
-       } else {
-               DrawGLScene(stereoLeft);
-               DrawGLScene(stereoRight);
-       }
+void Game::setKeySelected() {
+       waiting=true;
+    printf("launch thread\n");
+       SDL_Thread* thread = SDL_CreateThread(setKeySelected_thread,NULL);
+    if ( thread == NULL ) {
+        fprintf(stderr, "Unable to create thread: %s\n", SDL_GetError());
+               waiting=false;
+        return;
+    }
 }
index 32dbced0608aa583e3838209a9faf6241fc2a7b7..ec30c86ae7a00df3267cbe7494830cd63aaa640c 100644 (file)
@@ -61,100 +61,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #define NB_CAMPAIGN_MENU_ITEM 7
 
-extern GLuint rabbittexture;
-
-struct TextureInfo;
-
-class CampaignLevel
-{
-private:
-       int width;
-       struct Position
-       {
-               int x;
-               int y;
-       };
-public: 
-       std::string mapname;
-       std::string description;
-       int choosenext;
-               /*      
-               0 = Immediately load next level at the end of this one.
-               1 = Go back to the world map.
-               2 = Don't bring up the Fiery loading screen. Maybe other things, I've not investigated.
-               */
-       //int numnext; // 0 on final level. As David said: he meant to add story branching, but he eventually hadn't. 
-       std::vector<int> nextlevel;
-       Position location;
-       
-       CampaignLevel() : width(10) {
-               choosenext = 1;
-               location.x = 0;
-               location.y = 0;
-       }
-       
-       int getStartX() {
-               return 30+120+location.x*400/512;
-       }
-       
-       int getStartY() {
-               return 30+30+(512-location.y)*400/512;
-       }
-       
-       int getEndX() {
-               return getStartX()+width;
-       }
-       
-       int getEndY() {
-               return getStartY()+width;
-       }
-       
-       XYZ getCenter() {
-               XYZ center;
-               center.x=getStartX()+width/2;
-               center.y=getStartY()+width/2;
-               return center;
-       }
-       
-       int getWidth() {
-               return width;
-       }
-       
-       istream& operator<< (istream& is) {
-               is.ignore(256,':');
-               is.ignore(256,':');
-               is.ignore(256,' ');
-               is >> mapname;
-               is.ignore(256,':');
-               is >> description;
-               for(int pos = description.find('_');pos!=string::npos;pos = description.find('_',pos)) {
-                       description.replace(pos,1,1,' ');
-               }
-               is.ignore(256,':');
-               is >> choosenext;
-               is.ignore(256,':');
-               int numnext,next;
-               is >> numnext;
-               for(int j=0;j<numnext;j++) {
-                       is.ignore(256,':');
-                       is >> next;
-                       nextlevel.push_back(next-1);
-               }
-               is.ignore(256,':');
-               is >> location.x;
-               is.ignore(256,':');
-               is >> location.y;
-               return is;
-       }
-       
-       friend istream& operator>> (istream& is, CampaignLevel& cl) {
-               return cl << is;
-       }
-};
-
-namespace Game
-{
-    //public:
+namespace Game {
     extern GLuint terraintexture;
     extern GLuint terraintexture2;
     extern GLuint terraintexture3;
@@ -170,14 +77,6 @@ namespace Game
 
     extern int selected;
     extern int keyselect;
-    extern int indemo;
-
-    extern bool won;
-
-    extern bool entername;
-
-    extern char registrationname[256];
-    extern float registrationnumber;
 
     extern int newdetail;
     extern int newscreenwidth;
@@ -187,13 +86,10 @@ namespace Game
     extern float deltah,deltav;
     extern int mousecoordh,mousecoordv;
     extern int oldmousecoordh,oldmousecoordv;
-    extern float rotation,rotation2;
-    extern SkyBox skybox;
+    extern float yaw,pitch;
+    extern SkyBox *skybox;
     extern bool cameramode;
-    extern int olddrawmode;
-    extern int drawmode;
     extern bool firstload;
-    extern bool oldbutton;
 
     extern float leveltime;
     extern float loadtime;
@@ -202,7 +98,7 @@ namespace Game
     extern XYZ hawkcoords;
     extern XYZ realhawkcoords;
     extern GLuint hawktexture;
-    extern float hawkrotation;
+    extern float hawkyaw;
     extern float hawkcalldelay;
 
     extern Model eye;
@@ -210,41 +106,22 @@ namespace Game
     extern Model cornea;
 
     extern bool stealthloading;
+    extern int loading;
 
-    extern std::vector<CampaignLevel> campaignlevels;
-    extern int whichchoice;
-    extern int actuallevel;
-    extern bool winhotspot;
-    extern bool windialogue;
-
-    extern bool minimap;
-
-    extern int musictype,oldmusictype,oldoldmusictype;
-    extern bool realthreat;
-
-    extern Model rabbit;
-    extern XYZ rabbitcoords;
+    extern int musictype;
 
     extern XYZ mapcenter;
     extern float mapradius;
 
-    extern Texttext;
+    extern Text *text;
     extern float fps;
 
-    extern XYZ cameraloc;
-    extern float cameradist;
-
-    extern int drawtoggle;
-
     extern bool editorenabled;
     extern int editortype;
     extern float editorsize;
-    extern float editorrotation;
-    extern float editorrotation2;
-
-    extern float brightness;
+    extern float editoryaw;
+    extern float editorpitch;
 
-    extern int quit;
     extern int tryquit;
 
     extern XYZ pathpoint[30];
@@ -258,7 +135,6 @@ namespace Game
     extern int numchallengelevels;
 
     extern bool console;
-    extern int archiveselected;
     extern char consoletext[15][256];
     extern int consolechars[15];
     extern bool chatting;
@@ -268,81 +144,43 @@ namespace Game
     extern float displayblinkdelay;
     extern bool displayblink;
     extern int displayselected;
-    extern bool consolekeydown;
     extern float consoleblinkdelay;
     extern bool consoleblink;
     extern int consoleselected;
-    extern bool autocam;
+
+    extern int oldenvironment;
+    extern int targetlevel;
+    extern float changedelay;
+
+    extern bool waiting;
+    extern Account* accountactive;
 
     extern unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
     extern unsigned short consolekey;
-    extern bool oldattackkey;
+
+    void newGame();
+    void deleteGame();
 
     void LoadTexture(const string fileName, GLuint *textureid,int mipmap, bool hasalpha);
     void LoadTextureSave(const string fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
-    void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
-    bool AddClothes(const char *fileName, GLubyte *array);
     void InitGame();
-    void LoadScreenTexture();
     void LoadStuff();
     void LoadingScreen();
-    void LoadCampaign();
-    std::vector<std::string> ListCampaigns();
-    void FadeLoadingScreen(float howmuch);
-    void Dispose();
     int DrawGLScene(StereoSide side);
-    void DrawMenu();
-    void DrawGL();
     void LoadMenu();
-    //factored from Tick() -sf17k
-    void MenuTick();
-    void doTutorial();
-    void doDebugKeys();
-    void doJumpReversals();
-    void doAerialAcrobatics();
-    void doAttacks();
-    void doPlayerCollisions();
-    void doAI(int i);
-    //end factored
     void Tick();
     void TickOnce();
     void TickOnceAfter();
     void SetUpLighting();
-    void Loadlevel(int which);
-    void Loadlevel(const char *name);
-    void Setenvironment(int which);
     GLvoid ReSizeGLScene(float fov, float near);
-    int findPathDist(int start,int end);
     int checkcollide(XYZ startpoint, XYZ endpoint);
     int checkcollide(XYZ startpoint, XYZ endpoint, int what);
-    extern int loading;
-    extern float talkdelay;
     
     void fireSound(int sound=fireendsound);
     void setKeySelected();
 
-    extern int numboundaries;
-    extern XYZ boundary[360];
-
-    extern int whichlevel;
-    extern int oldenvironment;
-    extern int targetlevel;
-    extern float changedelay;
-
-    extern float musicvolume[4];
-    extern float oldmusicvolume[4];
-    extern int musicselected;
-    extern int change;
-    void newGame();
-    void deleteGame();
-    extern bool waiting;
-    //private:
-    int setKeySelected_thread(void*);
-    int thread(void *data);
     void inputText(char* str, int* charselected, int* nb_chars);
     void flash();
-    //bool waiting;
-    extern Account* accountactive;
 }
 
 #ifndef __forceinline
@@ -377,10 +215,10 @@ extern XYZ dialoguecamera[max_dialogues][max_dialoguelength];
 extern XYZ participantlocation[max_dialogues][10];
 extern int participantfocus[max_dialogues][max_dialoguelength];
 extern int participantaction[max_dialogues][max_dialoguelength];
-extern float participantrotation[max_dialogues][10];
+extern float participantyaw[max_dialogues][10];
 extern XYZ participantfacing[max_dialogues][max_dialoguelength][10];
-extern float dialoguecamerarotation[max_dialogues][max_dialoguelength];
-extern float dialoguecamerarotation2[max_dialogues][max_dialoguelength];
+extern float dialoguecamerayaw[max_dialogues][max_dialoguelength];
+extern float dialoguecamerapitch[max_dialogues][max_dialoguelength];
 extern int indialogue;
 extern int whichdialogue;
 extern int directing;
index 09bdb1699ed8ad1a63d92825b19af98228846e7e..11a94010c5b5ebd1aedce2ed4690b21771498e02 100644 (file)
@@ -25,10 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "Awards.h"
 #include "Menu.h"
 
-#include <dirent.h>
-
-using namespace std;
-
 extern XYZ viewer;
 extern int environment;
 extern float texscale;
@@ -111,6 +107,15 @@ extern bool gamestarted;
 
 extern bool showdamagebar;
 
+
+
+int drawtoggle = 0;
+int numboundaries = 0;
+XYZ boundary[360];
+int change = 0;
+
+
+
 enum drawmodes {
   normalmode, motionblurmode, radialzoommode,
   realmotionblurmode, doublevisionmode, glowmode,
@@ -123,9 +128,12 @@ void Game::flash() { // shouldn't be that way, these should be attributes and Pe
        flashamount=1;
        flashdelay=1;
 }
+
+void DrawMenu();
+
 /*********************> DrawGLScene() <*****/
 int Game::DrawGLScene(StereoSide side)
-{      
+{
        static float texcoordwidth,texcoordheight;
        static float texviewwidth, texviewheight;
        static int i,j,k,l;
@@ -136,6 +144,7 @@ int Game::DrawGLScene(StereoSide side)
        static char string[256]="";
        static char string2[256]="";
        static char string3[256]="";
+    static int drawmode = 0;
 
        if ( stereomode == stereoAnaglyph ) {
                switch(side) {
@@ -171,7 +180,7 @@ int Game::DrawGLScene(StereoSide side)
                static int changed;
                changed=0;
 
-               olddrawmode=drawmode;
+               int olddrawmode=drawmode;
                if(ismotionblur&&!loading){
                        if((findLengthfast(&player[0].velocity)>200)&&velocityblur&&!cameramode){
                                drawmode=motionblurmode;
@@ -251,7 +260,7 @@ int Game::DrawGLScene(StereoSide side)
                static XYZ terrainlight;
                static float distance;
                if(drawmode==normalmode)
-            ReSizeGLScene(90,.1f);
+            Game::ReSizeGLScene(90,.1f);
                if(drawmode!=normalmode)
             glViewport(0,0,texviewwidth,texviewheight);        
                glDepthFunc(GL_LEQUAL);
@@ -274,12 +283,12 @@ int Game::DrawGLScene(StereoSide side)
             //shake
                        glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);
             //sway
-                       glRotatef(rotation2+sin(woozy/2)*(player[0].damage/player[0].damagetolerance)*5,1,0,0);
-                       glRotatef(rotation+sin(woozy)*(player[0].damage/player[0].damagetolerance)*5,0,1,0);
+                       glRotatef(pitch+sin(woozy/2)*(player[0].damage/player[0].damagetolerance)*5,1,0,0);
+                       glRotatef(yaw+sin(woozy)*(player[0].damage/player[0].damagetolerance)*5,0,1,0);
                }
                if(cameramode||freeze||winfreeze){
-                       glRotatef(rotation2,1,0,0);
-                       glRotatef(rotation,0,1,0);
+                       glRotatef(pitch,1,0,0);
+                       glRotatef(yaw,0,1,0);
                }
 
                if(environment==desertenvironment){
@@ -305,7 +314,7 @@ int Game::DrawGLScene(StereoSide side)
                        glRotatef((float)(abs(Random()%100))/1000,1,0,0);
                        glRotatef((float)(abs(Random()%100))/1000,0,1,0);
                }       
-               skybox.draw();
+               skybox->draw();
                glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0);
                glPopMatrix();
                glTranslatef(-viewer.x,-viewer.y,-viewer.z);
@@ -320,7 +329,7 @@ int Game::DrawGLScene(StereoSide side)
                                if(frustum.SphereInFrustum(player[k].coords.x,player[k].coords.y+player[k].scale*3,player[k].coords.z,player[k].scale*7)&&player[k].occluded<25)
                                        for(i=0;i<player[k].skeleton.num_joints;i++){
                                                if(player[k].skeleton.joints[i].label==leftknee||player[k].skeleton.joints[i].label==rightknee||player[k].skeleton.joints[i].label==groin){
-                                                       point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
+                                                       point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].yaw,0)*player[k].scale+player[k].coords;
                                                        size=.4f;
                                                        opacity=.4-player[k].skeleton.joints[i].position.y*player[k].scale/5-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/10;
                                                        if(k!=0&&tutoriallevel==1){
@@ -330,7 +339,7 @@ int Game::DrawGLScene(StereoSide side)
                                                        for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
                                                                j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
                                                                if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
-                                                                       point=DoRotation(DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords-objects.position[j],0,-objects.rotation[j],0);
+                                                                       point=DoRotation(DoRotation(player[k].skeleton.joints[i].position,0,player[k].yaw,0)*player[k].scale+player[k].coords-objects.position[j],0,-objects.yaw[j],0);
                                                                        size=.4f;
                                                                        opacity=.4f;
                                                                        if(k!=0&&tutoriallevel==1){
@@ -348,7 +357,7 @@ int Game::DrawGLScene(StereoSide side)
                             if(player[k].skeleton.free)
                                 point=player[k].skeleton.joints[i].position*player[k].scale+player[k].coords;
                             else
-                                point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
+                                point=DoRotation(player[k].skeleton.joints[i].position,0,player[k].yaw,0)*player[k].scale+player[k].coords;
                             size=.4f;
                             opacity=.4-player[k].skeleton.joints[i].position.y*player[k].scale/5-(player[k].coords.y-terrain.getHeight(player[k].coords.x,player[k].coords.z))/5;
                             if(k!=0&&tutoriallevel==1){
@@ -358,8 +367,8 @@ int Game::DrawGLScene(StereoSide side)
                             for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
                                 j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
                                 if(objects.position[j].y<player[k].coords.y||objects.type[j]==tunneltype||objects.type[j]==weirdtype){
-                                    if(player[k].skeleton.free)point=DoRotation(player[k].skeleton.joints[i].position*player[k].scale+player[k].coords-objects.position[j],0,-objects.rotation[j],0);
-                                    else point=DoRotation(DoRotation(player[k].skeleton.joints[i].position,0,player[k].rotation,0)*player[k].scale+player[k].coords-objects.position[j],0,-objects.rotation[j],0);
+                                    if(player[k].skeleton.free)point=DoRotation(player[k].skeleton.joints[i].position*player[k].scale+player[k].coords-objects.position[j],0,-objects.yaw[j],0);
+                                    else point=DoRotation(DoRotation(player[k].skeleton.joints[i].position,0,player[k].yaw,0)*player[k].scale+player[k].coords-objects.position[j],0,-objects.yaw[j],0);
                                     size=.4f;
                                     opacity=.4f;
                                     if(k!=0&&tutoriallevel==1){
@@ -379,7 +388,7 @@ int Game::DrawGLScene(StereoSide side)
                     terrain.MakeDecal(shadowdecal,point,size,opacity*.7,rotation);
                     for(l=0;l<terrain.patchobjectnum[player[k].whichpatchx][player[k].whichpatchz];l++){
                         j=terrain.patchobjects[player[k].whichpatchx][player[k].whichpatchz][l];
-                        point=DoRotation(player[k].coords-objects.position[j],0,-objects.rotation[j],0);
+                        point=DoRotation(player[k].coords-objects.position[j],0,-objects.yaw[j],0);
                         size=.7;
                         opacity=.4f;
                         objects.model[j].MakeDecal(shadowdecal,&point,&size,&opacity,&rotation);
@@ -442,7 +451,7 @@ int Game::DrawGLScene(StereoSide side)
                                        if(distance>=1)
                         glDisable(GL_BLEND);
                                        if(distance>=.5){
-                                               checkpoint=DoRotation(player[k].skeleton.joints[abs(Random()%player[k].skeleton.num_joints)].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
+                                               checkpoint=DoRotation(player[k].skeleton.joints[abs(Random()%player[k].skeleton.num_joints)].position,0,player[k].yaw,0)*player[k].scale+player[k].coords;
                                                checkpoint.y+=1;
                                                if(!player[k].occluded==0)
                             i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
@@ -479,7 +488,7 @@ int Game::DrawGLScene(StereoSide side)
                        glDisable(GL_LIGHTING);
                        glEnable(GL_BLEND);
                        glTranslatef(hawkcoords.x,hawkcoords.y,hawkcoords.z);
-                       glRotatef(hawkrotation,0,1,0);
+                       glRotatef(hawkyaw,0,1,0);
                        glTranslatef(25,0,0);
                        distance=findDistancefast(&viewer,&realhawkcoords)*1.2;
                        glColor4f(light.color[0],light.color[1],light.color[2],(viewdistance*viewdistance-(distance-(viewdistance*viewdistance*fadestart))*(1/(1-fadestart)))/viewdistance/viewdistance);
@@ -505,7 +514,7 @@ int Game::DrawGLScene(StereoSide side)
                                if(distance>=1)
                     glDisable(GL_BLEND);
                                if(distance>=.5){
-                                       checkpoint=DoRotation(player[k].skeleton.joints[abs(Random()%player[k].skeleton.num_joints)].position,0,player[k].rotation,0)*player[k].scale+player[k].coords;
+                                       checkpoint=DoRotation(player[k].skeleton.joints[abs(Random()%player[k].skeleton.num_joints)].position,0,player[k].yaw,0)*player[k].scale+player[k].coords;
                                        checkpoint.y+=1;
                                        if(!player[k].occluded==0)
                         i=checkcollide(viewer,checkpoint,player[k].lastoccluded);
@@ -950,8 +959,8 @@ int Game::DrawGLScene(StereoSide side)
                         whichdialogue=hotspottype[closest]-20;
                         for(j=0;j<numdialogueboxes[whichdialogue];j++){
                             player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
-                            player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
-                            player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
+                            player[participantfocus[whichdialogue][j]].yaw=participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
+                            player[participantfocus[whichdialogue][j]].targetyaw=participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
                             player[participantfocus[whichdialogue][j]].velocity=0;
                             player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
                             player[participantfocus[whichdialogue][j]].targetframe=0;
@@ -1203,10 +1212,6 @@ int Game::DrawGLScene(StereoSide side)
                 sprintf (string, "The framespersecond is %d.",(int)(fps));
                 text->glPrint(10,30,string,0,.8,1024,768);
 
-                sprintf (string, "Name: %s", registrationname);
-                text->glPrint(10,260,string,0,.8,1024,768);
-
-
                 if(editorenabled)
                     sprintf (string, "Map editor enabled.");
                 else
@@ -1215,11 +1220,11 @@ int Game::DrawGLScene(StereoSide side)
                 if(editorenabled){
                     sprintf (string, "Object size: %f",editorsize);
                     text->glPrint(10,75,string,0,.8,1024,768);
-                    if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
-                    else sprintf (string, "Object rotation: Random");
+                    if(editoryaw>=0)sprintf (string, "Object yaw: %f",editoryaw);
+                    else sprintf (string, "Object yaw: Random");
                     text->glPrint(10,90,string,0,.8,1024,768);
-                    if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
-                    else sprintf (string, "Object rotation2: Random");
+                    if(editorpitch>=0)sprintf (string, "Object pitch: %f",editorpitch);
+                    else sprintf (string, "Object pitch: Random");
                     text->glPrint(10,105,string,0,.8,1024,768);
                     sprintf (string, "Object type: %d",editortype);
                     text->glPrint(10,120,string,0,.8,1024,768);
@@ -1413,7 +1418,7 @@ int Game::DrawGLScene(StereoSide side)
                                        }
                }
 
-               if(minimap&&indialogue==-1){
+               if(difficulty<2&&indialogue==-1){  // minimap
                        float mapviewdist = 20000;
 
                        glDisable(GL_DEPTH_TEST);
@@ -1491,7 +1496,7 @@ int Game::DrawGLScene(StereoSide side)
                        glPushMatrix();
                        glScalef(1/(1/radius*256*terrain.scale*.4),1/(1/radius*256*terrain.scale*.4),1);
                        glPopMatrix();
-                       glRotatef(player[0].lookrotation*-1+180,0,0,1);
+                       glRotatef(player[0].lookyaw*-1+180,0,0,1);
                        glTranslatef(-(center.x/terrain.scale/256*-2+1),(center.z/terrain.scale/256*-2+1),0);
                        for(i=0;i<objects.numobjects;i++){
                                if(objects.type[i]==treetrunktype){
@@ -1501,7 +1506,7 @@ int Game::DrawGLScene(StereoSide side)
                                                glColor4f(0,.3,0,opac*(1-distcheck/mapviewdist));
                                                glPushMatrix();
                                                glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
-                                               glRotatef(objects.rotation[i],0,0,1);
+                                               glRotatef(objects.yaw[i],0,0,1);
                                                glScalef(.003,.003,.003);
                                                glBegin(GL_QUADS);
                                                glTexCoord2f(0,0);
@@ -1523,7 +1528,7 @@ int Game::DrawGLScene(StereoSide side)
                                                glColor4f(.4,.4,.4,opac*(1-distcheck/mapviewdist));
                                                glPushMatrix();
                                                glTranslatef(objects.position[i].x/terrain.scale/256*-2+1,objects.position[i].z/terrain.scale/256*2-1,0);
-                                               glRotatef(objects.rotation[i],0,0,1);
+                                               glRotatef(objects.yaw[i],0,0,1);
                                                glScalef(.01*objects.scale[i],.01*objects.scale[i],.01*objects.scale[i]);
                                                glBegin(GL_QUADS);
                                                glTexCoord2f(0,0);
@@ -1571,7 +1576,7 @@ int Game::DrawGLScene(StereoSide side)
                                        else if(player[i].aitype==passivetype)glColor4f(0,1,0,opac*(1-distcheck/mapviewdist));
                                        else glColor4f(1,1,0,1);
                                        glTranslatef(player[i].coords.x/terrain.scale/256*-2+1,player[i].coords.z/terrain.scale/256*2-1,0);
-                                       glRotatef(player[i].rotation+180,0,0,1);
+                                       glRotatef(player[i].yaw+180,0,0,1);
                                        glScalef(.005,.005,.005);
                                        glBegin(GL_QUADS);
                                        glTexCoord2f(0,0);
@@ -1762,7 +1767,7 @@ int Game::DrawGLScene(StereoSide side)
                }
 
                glClear(GL_DEPTH_BUFFER_BIT);
-               ReSizeGLScene(90,.1f);
+        Game::ReSizeGLScene(90,.1f);
                glViewport(0,0,screenwidth,screenheight);       
 
                if(drawmode!=normalmode){
@@ -2028,63 +2033,14 @@ int Game::DrawGLScene(StereoSide side)
        return 0;
 }
 
-vector<string> Game::ListCampaigns() {
-       DIR *campaigns = opendir(ConvertFileName(":Data:Campaigns"));
-       struct dirent *campaign = NULL;
-       if(!campaigns) {
-               perror("Problem while loading campaigns");
-               cerr << "campaign folder was : " << ConvertFileName(":Data:Campaigns") << endl;
-               exit(EXIT_FAILURE);
-       }
-       vector<string> campaignNames;
-       while ((campaign = readdir(campaigns)) != NULL) {
-               string name(campaign->d_name);
-               if(name.length()<5)
-                       continue;
-               if(!name.compare(name.length()-4,4,".txt")) {
-                       campaignNames.push_back(name.substr(0,name.length()-4));
-               }
-       }
-       closedir(campaigns);
-       return campaignNames;
-}
-
-void Game::LoadCampaign() {
-       if(!accountactive)
-               return;
-       ifstream ipstream(ConvertFileName((":Data:Campaigns:"+accountactive->getCurrentCampaign()+".txt").c_str()));
-       ipstream.ignore(256,':');
-       int numlevels;
-       ipstream >> numlevels;
-       campaignlevels.clear();
-       for(int i=0;i<numlevels;i++) {
-               CampaignLevel cl;
-               ipstream >> cl;
-               campaignlevels.push_back(cl);
-       }
-       ipstream.close();
-
-       ifstream test(ConvertFileName((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str()));
-       if(test.good()) {
-               LoadTexture((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str(),&Mainmenuitems[7],0,0);
-       } else {
-               LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
-       }
-
-       if(accountactive->getCampaignChoicesMade()==0) {
-               accountactive->setCampaignScore(0);
-               accountactive->resetFasttime();
-       }
-}
-
-void Game::DrawMenu() {
+void DrawMenu() {
        // !!! FIXME: hack: clamp framerate in menu so text input works correctly on fast systems.
        SDL_Delay(15);
 
        glDrawBuffer(GL_BACK);
        glReadBuffer(GL_BACK);
        glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
-       ReSizeGLScene(90,.1f);
+    Game::ReSizeGLScene(90,.1f);
 
     //draw menu background
        glClear(GL_DEPTH_BUFFER_BIT);
@@ -2122,7 +2078,7 @@ void Game::DrawMenu() {
                                glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
                                glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
                                glEnable(GL_TEXTURE_2D);
-                               glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
+                               glBindTexture( GL_TEXTURE_2D, Game::Mainmenuitems[4]);
                                        glBegin(GL_QUADS);
                                        glTexCoord2f(0,0);
                                        glVertex3f(-1,-1,0);
@@ -2175,14 +2131,14 @@ void Game::DrawMenu() {
                                        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
                                        glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
                                glPopMatrix();
-                               if(!waiting) { // hide the cursor while waiting for a key
+                               if(!Game::waiting) { // hide the cursor while waiting for a key
                                        glPushMatrix();
-                                               glTranslatef(mousecoordh-screenwidth/2,mousecoordv*-1+screenheight/2,0);
+                                               glTranslatef(Game::mousecoordh-screenwidth/2,Game::mousecoordv*-1+screenheight/2,0);
                                                glScalef((float)screenwidth/64,(float)screenwidth/64,1);
                                                glTranslatef(1,-1,0);
                                                glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
                                                glColor4f(1,1,1,1);
-                                               glBindTexture( GL_TEXTURE_2D, cursortexture);
+                                               glBindTexture( GL_TEXTURE_2D, Game::cursortexture);
                                                glPushMatrix();
                                                        //glScalef(.25,.25,.25);
                                                        glBegin(GL_QUADS);
index f6fd203517442763d32dc74fb8f882b589aa5f48..ee82765eea5200fcdee808c0b383f57dccbb208a 100644 (file)
@@ -28,7 +28,6 @@ extern float screenwidth,screenheight;
 extern float viewdistance;
 extern XYZ viewer;
 extern XYZ lightlocation;
-extern float lightambient[3],lightbrightness[3];
 extern float fadestart;
 extern float texscale;
 extern float gravity;
@@ -79,8 +78,8 @@ extern int dialogueboxsound[20][20];
 extern char dialoguetext[20][20][128];
 extern char dialoguename[20][20][64];
 extern XYZ dialoguecamera[20][20];
-extern float dialoguecamerarotation[20][20];
-extern float dialoguecamerarotation2[20][20];
+extern float dialoguecamerayaw[20][20];
+extern float dialoguecamerapitch[20][20];
 extern int indialogue;
 extern int whichdialogue;
 extern float dialoguetime;
@@ -98,16 +97,16 @@ void LOG(const std::string &fmt, ...)
     // !!! FIXME: write me.
 }
 
-void Game::Dispose()
+void Dispose()
 {
        LOGFUNC;
 
-       if(endgame==2){
-               accountactive->endGame();
-               endgame=0;
+       if(Game::endgame==2){
+        Game::accountactive->endGame();
+        Game::endgame=0;
        }
 
-       Account::saveFile(":Data:Users", accountactive);
+       Account::saveFile(":Data:Users", Game::accountactive);
 
        //textures.clear();
 
@@ -133,6 +132,35 @@ void Game::Dispose()
 #endif
 }
 
+void Game::newGame(){
+    text = new Text();
+    skybox = new SkyBox();
+}
+
+void Game::deleteGame(){
+    if(skybox)
+        delete skybox;
+    if(text)
+        delete text;
+    for(int i=0;i<10;i++){
+        if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
+    }
+    glDeleteTextures( 1, &cursortexture );
+    glDeleteTextures( 1, &Maparrowtexture );
+    glDeleteTextures( 1, &Mapboxtexture );
+    glDeleteTextures( 1, &Mapcircletexture );
+    glDeleteTextures( 1, &terraintexture );
+    glDeleteTextures( 1, &terraintexture2 );
+    if(screentexture>0)glDeleteTextures( 1, &screentexture );
+    if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
+    glDeleteTextures( 1, &hawktexture );
+    glDeleteTextures( 1, &logotexture );
+    glDeleteTextures( 1, &loadscreentexture );
+
+    Dispose();
+}
+
+
 
 void Game::LoadTexture(const string fileName, GLuint *textureid,int mipmap, bool hasalpha) {
        *textureid = Texture::Load(fileName,mipmap,hasalpha);
@@ -142,7 +170,7 @@ void Game::LoadTextureSave(const string fileName, GLuint *textureid,int mipmap,G
        *textureid = Texture::Load(fileName,mipmap,false,array,skinsize);
 }
 
-void Game::LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
+void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize)
 {
        int i;
        int bytesPerPixel;
@@ -181,53 +209,6 @@ void Game::LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte
        }
 }
 
-bool Game::AddClothes(const char *fileName, GLubyte *array)
-{
-       int i;
-       int bytesPerPixel;
-
-       LOGFUNC;
-
-       //upload_image( fileName );
-       //LoadTGA( fileName );
-       //Load Image
-       unsigned char fileNamep[256];
-       CopyCStringToPascal(fileName,fileNamep);
-       //Load Image
-       bool opened;
-       opened=upload_image( fileNamep ,1);
-
-       float alphanum;
-       //Is it valid?
-       if(opened){
-               if(tintr>1)tintr=1;
-               if(tintg>1)tintg=1;
-               if(tintb>1)tintb=1;
-
-               if(tintr<0)tintr=0;
-               if(tintg<0)tintg=0;
-               if(tintb<0)tintb=0;
-
-               bytesPerPixel=texture.bpp/8;
-
-               int tempnum=0;
-               alphanum=255;
-               for(i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
-                       if(bytesPerPixel==3)alphanum=255;
-                       else if((i+1)%4==0)alphanum=texture.data[i];
-                       //alphanum/=2;
-                       if((i+1)%4||bytesPerPixel==3){
-                               if((i%4)==0)texture.data[i]*=tintr;
-                               if((i%4)==1)texture.data[i]*=tintg;
-                               if((i%4)==2)texture.data[i]*=tintb;
-                               array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
-                               tempnum++;
-                       }
-               }
-       }
-       else return 0;
-       return 1;
-}
 
 
 //***************> ResizeGLScene() <******/
@@ -464,7 +445,7 @@ void Game::LoadingScreen()
        }
 }
 
-void Game::FadeLoadingScreen(float howmuch)
+void FadeLoadingScreen(float howmuch)
 {
        static float loadprogress;
 
@@ -549,8 +530,6 @@ void Game::InitGame()
 
        LOGFUNC;
 
-       autocam=0;
-
        numchallengelevels=14;
 
        accountactive=Account::loadFile(":Data:Users");
@@ -741,22 +720,23 @@ void Game::InitGame()
 }
 
 
-void Game::LoadScreenTexture() {
+void LoadScreenTexture() {
     glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
 
-    if(!screentexture)
-        glGenTextures( 1, &screentexture );
+    if(!Game::screentexture)
+        glGenTextures( 1, &Game::screentexture );
     glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
 
 
     glEnable(GL_TEXTURE_2D);
-    glBindTexture( GL_TEXTURE_2D, screentexture);
+    glBindTexture( GL_TEXTURE_2D, Game::screentexture);
     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
 
     glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
 }
 
+//TODO: move LoadStuff() closer to GameTick.cpp to get rid of various vars shared in Game.h
 void Game::LoadStuff()
 {
        static float temptexdetail;
@@ -795,8 +775,6 @@ void Game::LoadStuff()
        viewdistdetail=2;
        viewdistance=50*megascale*viewdistdetail;
 
-       brightness=100;
-
        if(detail==2){
                texdetail=1;
        }
@@ -881,8 +859,8 @@ void Game::LoadStuff()
        LoadTexture(":Data:Textures:leaf.png",&Sprite::leaftexture,1,1);
        LoadTexture(":Data:Textures:tooth.png",&Sprite::toothtexture,1,1);
 
-       rotation=0;
-       rotation2=0;
+       yaw=0;
+       pitch=0;
        ReSizeGLScene(90,.01);
 
        viewer=0;
@@ -949,9 +927,6 @@ void Game::LoadStuff()
 
        firstload=0;
 
-       rabbitcoords=player[0].coords;
-       rabbitcoords.y=terrain.getHeight(rabbitcoords.x,rabbitcoords.z);
-
        loadAllAnimations();
        //Fix knife stab, too lazy to do it manually
        XYZ moveamount;
index 75d13958223f69ed036a538a4f5c7eacceeddbc6..99dab372a90a5850442ae0b97b3706401a20522e 100644 (file)
@@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <limits>
 #include <ctime>
+#include <dirent.h>
 #include "Game.h"
 #include "openal_wrapper.h"
 #include "Settings.h"
@@ -119,6 +120,7 @@ extern float damagedealt;
 extern int maptype;
 extern int editoractive;
 extern int editorpathtype;
+extern TGAImageRec texture;
 
 extern float hostiletime;
 
@@ -139,6 +141,95 @@ extern bool winfreeze;
 
 extern bool campaign;
 
+
+
+void Loadlevel(int which);
+void Loadlevel(const char *name);
+
+
+
+class CampaignLevel {
+private:
+       int width;
+       struct Position { int x,y; };
+public: 
+       std::string mapname;
+       std::string description;
+       int choosenext;
+               /*      
+               0 = Immediately load next level at the end of this one.
+               1 = Go back to the world map.
+               2 = Don't bring up the Fiery loading screen. Maybe other things, I've not investigated.
+               */
+       //int numnext; // 0 on final level. As David said: he meant to add story branching, but he eventually hadn't. 
+       std::vector<int> nextlevel;
+       Position location;
+       CampaignLevel() : width(10) {
+               choosenext = 1;
+               location.x = 0;
+               location.y = 0;
+       }
+       int getStartX() { return 30+120+location.x*400/512; }
+       int getStartY() { return 30+30+(512-location.y)*400/512; }
+       int getEndX() { return getStartX()+width; }
+       int getEndY() { return getStartY()+width; }
+       XYZ getCenter() {
+               XYZ center;
+               center.x=getStartX()+width/2;
+               center.y=getStartY()+width/2;
+               return center;
+       }
+       int getWidth() { return width; }
+       istream& operator<< (istream& is) {
+               is.ignore(256,':');
+               is.ignore(256,':');
+               is.ignore(256,' ');
+               is >> mapname;
+               is.ignore(256,':');
+               is >> description;
+               for(int pos = description.find('_');pos!=string::npos;pos = description.find('_',pos)) {
+                       description.replace(pos,1,1,' ');
+               }
+               is.ignore(256,':');
+               is >> choosenext;
+               is.ignore(256,':');
+               int numnext,next;
+               is >> numnext;
+               for(int j=0;j<numnext;j++) {
+                       is.ignore(256,':');
+                       is >> next;
+                       nextlevel.push_back(next-1);
+               }
+               is.ignore(256,':');
+               is >> location.x;
+               is.ignore(256,':');
+               is >> location.y;
+               return is;
+       }
+       friend istream& operator>> (istream& is, CampaignLevel& cl) {
+               return cl << is;
+       }
+};
+
+int indemo = 0;
+bool won = false;
+int entername = 0;
+vector<CampaignLevel> campaignlevels;
+int whichchoice = 0;
+int actuallevel = 0;
+bool winhotspot = false;
+bool windialogue = false;
+bool realthreat = 0;
+XYZ cameraloc;
+float cameradist = 0;
+bool oldattackkey = 0;
+int whichlevel = 0;
+float musicvolume[4] = {};
+float oldmusicvolume[4] = {};
+int musicselected = 0;
+
+
+
 static const char *rabbitskin[] = {
 ":Data:Textures:Fur3.jpg",
 ":Data:Textures:Fur.jpg",
@@ -189,10 +280,9 @@ static console_handler cmd_handlers[] = {
 
 
 
-// added utility functions -sf17k =============================================================
+// utility functions
 
-//TODO: this is incorrect but I'm afraid to change it and break something,
-//probably causes quirky behavior that I might want to preserve
+// TODO: this is slightly incorrect
 inline float roughDirection(XYZ vec){
     Normalise(&vec);
     float angle=-asin(-vec.x)*180/M_PI;
@@ -203,18 +293,14 @@ inline float roughDirection(XYZ vec){
 inline float roughDirectionTo(XYZ start, XYZ end){
     return roughDirection(end-start);
 }
-
-//TODO: gotta be a better way
-inline float pitch(XYZ vec){
+inline float pitchOf(XYZ vec){
     Normalise(&vec);
     return -asin(vec.y)*180/M_PI;
 }
 inline float pitchTo(XYZ start, XYZ end){
-    return pitch(end-start);
+    return pitchOf(end-start);
 }
-
 inline float sq(float n) { return n*n; }
-
 inline float stepTowardf(float from, float to, float by){
     if(fabs(from-to)<by) return to;
     else if(from>to) return from-by;
@@ -257,7 +343,47 @@ void playdialogueboxsound(){
         emit_sound_at(sound, temppos);
 }
 
-// end added utility functions ================================================================
+// ================================================================
+
+bool AddClothes(const char *fileName, GLubyte *array) {
+       LOGFUNC;
+       //Load Image
+       unsigned char fileNamep[256];
+       CopyCStringToPascal(fileName,fileNamep);
+       bool opened;
+       opened=upload_image( fileNamep ,1);
+
+       float alphanum;
+       //Is it valid?
+       if(opened){
+               if(tintr>1)tintr=1;
+               if(tintg>1)tintg=1;
+               if(tintb>1)tintb=1;
+
+               if(tintr<0)tintr=0;
+               if(tintg<0)tintg=0;
+               if(tintb<0)tintb=0;
+
+               int bytesPerPixel=texture.bpp/8;
+
+               int tempnum=0;
+               alphanum=255;
+               for(int i=0;i<(int)(texture.sizeY*texture.sizeX*bytesPerPixel);i++){
+                       if(bytesPerPixel==3)alphanum=255;
+                       else if((i+1)%4==0)alphanum=texture.data[i];
+                       //alphanum/=2;
+                       if((i+1)%4||bytesPerPixel==3){
+                               if((i%4)==0)texture.data[i]*=tintr;
+                               if((i%4)==1)texture.data[i]*=tintg;
+                               if((i%4)==2)texture.data[i]*=tintb;
+                               array[tempnum]=(float)array[tempnum]*(1-alphanum/255)+(float)texture.data[i]*(alphanum/255);
+                               tempnum++;
+                       }
+               }
+       }
+       else return 0;
+       return 1;
+}
 
 
 
@@ -288,7 +414,7 @@ static void ch_save(const char *args){
     fpackf(tfile, "Bb Bf Bf Bf", skyboxtexture, skyboxr, skyboxg, skyboxb);
     fpackf(tfile, "Bf Bf Bf", skyboxlightr, skyboxlightg, skyboxlightb);
     fpackf(tfile, "Bf Bf Bf Bf Bf Bi", player[0].coords.x, player[0].coords.y, player[0].coords.z,
-            player[0].rotation, player[0].targetrotation, player[0].num_weapons);
+            player[0].yaw, player[0].targetyaw, player[0].num_weapons);
     if(player[0].num_weapons>0&&player[0].num_weapons<5)
         for(int j=0;j<player[0].num_weapons;j++)
           fpackf(tfile, "Bi", weapons[player[0].weaponids[j]].getType());
@@ -309,7 +435,7 @@ static void ch_save(const char *args){
                fpackf(tfile, "Bi", dialoguetype[k]);
                for(int l=0;l<10;l++){
                        fpackf(tfile, "Bf Bf Bf", participantlocation[k][l].x, participantlocation[k][l].y, participantlocation[k][l].z);
-                       fpackf(tfile, "Bf", participantrotation[k][l]);
+                       fpackf(tfile, "Bf", participantyaw[k][l]);
                }
                for(int l=0;l<numdialogueboxes[k];l++){
                        fpackf(tfile, "Bi", dialogueboxlocation[k][l]);
@@ -341,7 +467,7 @@ static void ch_save(const char *args){
                        for(int m=0;m<10;m++)
                                fpackf(tfile, "Bf Bf Bf", participantfacing[k][l][m].x, participantfacing[k][l][m].y, participantfacing[k][l][m].z);
 
-                       fpackf(tfile, "Bf Bf",dialoguecamerarotation[k][l],dialoguecamerarotation2[k][l]);
+                       fpackf(tfile, "Bf Bf",dialoguecamerayaw[k][l],dialoguecamerapitch[k][l]);
                }
        }
 
@@ -358,7 +484,7 @@ static void ch_save(const char *args){
     fpackf(tfile, "Bi", objects.numobjects);
 
     for(int k=0;k<objects.numobjects;k++)
-        fpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", objects.type[k], objects.rotation[k], objects.rotation2[k],
+        fpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", objects.type[k], objects.yaw[k], objects.pitch[k],
             objects.position[k].x, objects.position[k].y, objects.position[k].z, objects.scale[k]);
 
     fpackf(tfile, "Bi", numhotspots);
@@ -375,7 +501,7 @@ static void ch_save(const char *args){
         for(int j=1;j<numplayers;j++){
             fpackf(tfile, "Bi Bi Bf Bf Bf Bi Bi Bf Bb Bf", player[j].whichskin, player[j].creature,
                     player[j].coords.x, player[j].coords.y, player[j].coords.z,
-                    player[j].num_weapons, player[j].howactive, player[j].scale, player[j].immobile, player[j].rotation);
+                    player[j].num_weapons, player[j].howactive, player[j].scale, player[j].immobile, player[j].yaw);
             if(player[j].num_weapons<5)
                 for(int k=0;k<player[j].num_weapons;k++)
                     fpackf(tfile, "Bi", weapons[player[j].weaponids[k]].getType());
@@ -921,7 +1047,7 @@ static void ch_fixtype(const char *args)
 
 static void ch_fixrotation(const char *args)
 {
-  participantrotation[whichdialogue][participantfocus[whichdialogue][indialogue]]=player[participantfocus[whichdialogue][indialogue]].rotation;
+  participantyaw[whichdialogue][participantfocus[whichdialogue][indialogue]]=player[participantfocus[whichdialogue][indialogue]].yaw;
 }
 
 static void ch_ddialogue(const char *args)
@@ -1000,8 +1126,8 @@ static void ch_play(const char *args)
 
   for(int i=0;i<numdialogueboxes[whichdialogue];i++){
     player[participantfocus[whichdialogue][i]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][i]];
-    player[participantfocus[whichdialogue][i]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][i]];
-    player[participantfocus[whichdialogue][i]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][i]];
+    player[participantfocus[whichdialogue][i]].yaw=participantyaw[whichdialogue][participantfocus[whichdialogue][i]];
+    player[participantfocus[whichdialogue][i]].targetyaw=participantyaw[whichdialogue][participantfocus[whichdialogue][i]];
     player[participantfocus[whichdialogue][i]].velocity=0;
     player[participantfocus[whichdialogue][i]].targetanimation=player[participantfocus[whichdialogue][i]].getIdle();
     player[participantfocus[whichdialogue][i]].targetframe=0;
@@ -1140,7 +1266,7 @@ void Game::SetUpLighting(){
        light.ambient[2]*=(skyboxlightb+average)/2;
 }
 
-int Game::findPathDist(int start,int end){
+int findPathDist(int start,int end){
        int smallestcount,count,connected;
        int last,last2,last3,last4;
        int closest;
@@ -1207,7 +1333,7 @@ int Game::checkcollide(XYZ startpoint,XYZ endpoint){
                     objects.type[i]!=firetype){
                                colviewer=startpoint;
                                coltarget=endpoint;
-                               if(objects.model[i].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[i],&objects.rotation[i])!=-1)return i;
+                               if(objects.model[i].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[i],&objects.yaw[i])!=-1)return i;
                        }
                }
        }
@@ -1242,7 +1368,7 @@ int Game::checkcollide(XYZ startpoint,XYZ endpoint,int what){
                                colviewer=startpoint;
                                coltarget=endpoint;
                 //FIXME: i/what
-                               if(objects.model[what].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[what],&objects.rotation[what])!=-1)return i;
+                               if(objects.model[what].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[what],&objects.yaw[what])!=-1)return i;
                        }
                }
        }
@@ -1252,7 +1378,7 @@ int Game::checkcollide(XYZ startpoint,XYZ endpoint,int what){
        return -1;
 }
 
-void Game::Setenvironment(int which)
+void Setenvironment(int which)
 {
        LOGFUNC;
 
@@ -1295,7 +1421,7 @@ void Game::Setenvironment(int which)
 
                temptexdetail=texdetail;
                if(texdetail>1)texdetail=4;
-               skybox.load(    ":Data:Textures:Skybox(snow):Front.jpg",
+               skybox->load(   ":Data:Textures:Skybox(snow):Front.jpg",
                        ":Data:Textures:Skybox(snow):Left.jpg",
                        ":Data:Textures:Skybox(snow):Back.jpg",
                        ":Data:Textures:Skybox(snow):Right.jpg",
@@ -1333,7 +1459,7 @@ void Game::Setenvironment(int which)
 
                temptexdetail=texdetail;
                if(texdetail>1)texdetail=4;
-               skybox.load(    ":Data:Textures:Skybox(sand):Front.jpg",
+               skybox->load(   ":Data:Textures:Skybox(sand):Front.jpg",
                        ":Data:Textures:Skybox(sand):Left.jpg",
                        ":Data:Textures:Skybox(sand):Back.jpg",
                        ":Data:Textures:Skybox(sand):Right.jpg",
@@ -1370,7 +1496,7 @@ void Game::Setenvironment(int which)
 
                temptexdetail=texdetail;
                if(texdetail>1)texdetail=4;
-               skybox.load(    ":Data:Textures:Skybox(grass):Front.jpg",
+               skybox->load(   ":Data:Textures:Skybox(grass):Front.jpg",
                        ":Data:Textures:Skybox(grass):Left.jpg",
                        ":Data:Textures:Skybox(grass):Back.jpg",
                        ":Data:Textures:Skybox(grass):Right.jpg",
@@ -1388,7 +1514,56 @@ void Game::Setenvironment(int which)
        texdetail=temptexdetail;
 }
 
-void Game::Loadlevel(int which) {
+void LoadCampaign() {
+       if(!accountactive)
+               return;
+       ifstream ipstream(ConvertFileName((":Data:Campaigns:"+accountactive->getCurrentCampaign()+".txt").c_str()));
+       ipstream.ignore(256,':');
+       int numlevels;
+       ipstream >> numlevels;
+       campaignlevels.clear();
+       for(int i=0;i<numlevels;i++) {
+               CampaignLevel cl;
+               ipstream >> cl;
+               campaignlevels.push_back(cl);
+       }
+       ipstream.close();
+
+       ifstream test(ConvertFileName((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str()));
+       if(test.good()) {
+               LoadTexture((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str(),&Mainmenuitems[7],0,0);
+       } else {
+               LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
+       }
+
+       if(accountactive->getCampaignChoicesMade()==0) {
+               accountactive->setCampaignScore(0);
+               accountactive->resetFasttime();
+       }
+}
+
+vector<string> ListCampaigns() {
+       DIR *campaigns = opendir(ConvertFileName(":Data:Campaigns"));
+       struct dirent *campaign = NULL;
+       if(!campaigns) {
+               perror("Problem while loading campaigns");
+               cerr << "campaign folder was : " << ConvertFileName(":Data:Campaigns") << endl;
+               exit(EXIT_FAILURE);
+       }
+       vector<string> campaignNames;
+       while ((campaign = readdir(campaigns)) != NULL) {
+               string name(campaign->d_name);
+               if(name.length()<5)
+                       continue;
+               if(!name.compare(name.length()-4,4,".txt")) {
+                       campaignNames.push_back(name.substr(0,name.length()-4));
+               }
+       }
+       closedir(campaigns);
+       return campaignNames;
+}
+
+void Loadlevel(int which) {
        stealthloading=0;
        whichlevel=which;
 
@@ -1403,7 +1578,7 @@ void Game::Loadlevel(int which) {
            Loadlevel("mapsave");
 }
 
-void Game::Loadlevel(const char *name) {
+void Loadlevel(const char *name) {
        int templength;
        float lamefloat;
        static const char *pfx = ":Data:Maps:";
@@ -1474,11 +1649,6 @@ void Game::Loadlevel(const char *name) {
                if(accountactive)
             difficulty=accountactive->getDifficulty();
 
-               if(difficulty!=2)
-            minimap=1;
-               else
-            minimap=0;
-
                numhotspots=0;
                currenthotspot=-1;
                bonustime=1;
@@ -1578,7 +1748,7 @@ void Game::Loadlevel(const char *name) {
                        skyboxlightb=skyboxb;
                }
                if(!stealthloading)
-            funpackf(tfile, "Bf Bf Bf Bf Bf Bi", &player[0].coords.x,&player[0].coords.y,&player[0].coords.z,&player[0].rotation,&player[0].targetrotation, &player[0].num_weapons);
+            funpackf(tfile, "Bf Bf Bf Bf Bf Bi", &player[0].coords.x,&player[0].coords.y,&player[0].coords.z,&player[0].yaw,&player[0].targetyaw, &player[0].num_weapons);
                if(stealthloading)
             funpackf(tfile, "Bf Bf Bf Bf Bf Bi", &lamefloat,&lamefloat,&lamefloat,&lamefloat,&lamefloat, &player[0].num_weapons);
                player[0].originalcoords=player[0].coords;
@@ -1619,7 +1789,7 @@ void Game::Loadlevel(const char *name) {
                 funpackf(tfile, "Bi", &dialoguetype[k]);
                 for(int l=0;l<10;l++){
                     funpackf(tfile, "Bf Bf Bf", &participantlocation[k][l].x, &participantlocation[k][l].y, &participantlocation[k][l].z);
-                    funpackf(tfile, "Bf", &participantrotation[k][l]);
+                    funpackf(tfile, "Bf", &participantyaw[k][l]);
                 }
                 for(int l=0;l<numdialogueboxes[k];l++){
                     funpackf(tfile, "Bi", &dialogueboxlocation[k][l]);
@@ -1654,7 +1824,7 @@ void Game::Loadlevel(const char *name) {
                     for(m=0;m<10;m++)
                         funpackf(tfile, "Bf Bf Bf", &participantfacing[k][l][m].x, &participantfacing[k][l][m].y, &participantfacing[k][l][m].z);
 
-                    funpackf(tfile, "Bf Bf",&dialoguecamerarotation[k][l],&dialoguecamerarotation2[k][l]);
+                    funpackf(tfile, "Bf Bf",&dialoguecamerayaw[k][l],&dialoguecamerapitch[k][l]);
                 }
             }
                }else
@@ -1672,7 +1842,7 @@ void Game::Loadlevel(const char *name) {
 
                funpackf(tfile, "Bi", &objects.numobjects);
         for(int i=0;i<objects.numobjects;i++){
-            funpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", &objects.type[i],&objects.rotation[i],&objects.rotation2[i], &objects.position[i].x, &objects.position[i].y, &objects.position[i].z,&objects.scale[i]);
+            funpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", &objects.type[i],&objects.yaw[i],&objects.pitch[i], &objects.position[i].x, &objects.position[i].y, &objects.position[i].z,&objects.scale[i]);
             if(objects.type[i]==treeleavestype)
                 objects.scale[i]=objects.scale[i-1];
         }
@@ -1746,10 +1916,10 @@ void Game::Loadlevel(const char *name) {
                                else
                     player[i-howmanyremoved].immobile=0;
                                if(mapvers>=12)
-                    funpackf(tfile, "Bf",&player[i-howmanyremoved].rotation);
+                    funpackf(tfile, "Bf",&player[i-howmanyremoved].yaw);
                                else
-                    player[i-howmanyremoved].rotation=0;
-                               player[i-howmanyremoved].targetrotation=player[i-howmanyremoved].rotation;
+                    player[i-howmanyremoved].yaw=0;
+                               player[i-howmanyremoved].targetyaw=player[i-howmanyremoved].yaw;
                                if(player[i-howmanyremoved].num_weapons<0||player[i-howmanyremoved].num_weapons>5){
                                        removeanother=1;
                                        howmanyremoved++;
@@ -1848,7 +2018,7 @@ void Game::Loadlevel(const char *name) {
                        int j=objects.numobjects;
                        objects.numobjects=0;
                        for(int i=0;i<j;i++){
-                               objects.MakeObject(objects.type[i],objects.position[i],objects.rotation[i],objects.rotation2[i],objects.scale[i]);
+                               objects.MakeObject(objects.type[i],objects.position[i],objects.yaw[i],objects.pitch[i],objects.scale[i]);
                                if(visibleloading)
                     LoadingScreen();
                        }
@@ -2048,7 +2218,7 @@ void Game::Loadlevel(const char *name) {
             player[0].armorlow*=1.5;
                cameraloc=player[0].coords;
                cameraloc.y+=5;
-               rotation=player[0].rotation;
+               yaw=player[0].yaw;
 
                hawkcoords=player[0].coords;
                hawkcoords.y+=30;
@@ -2086,7 +2256,7 @@ void Game::Loadlevel(const char *name) {
        visibleloading=0;
 }
 
-void Game::doTutorial(){
+void doTutorial(){
     if(tutorialstagetime>tutorialmaxtime){
         tutorialstage++;
         tutorialsuccess=0;
@@ -2142,7 +2312,7 @@ void Game::doTutorial(){
                     if(Random()%2==0){
                         if(!player[1].skeleton.free)temp2=(player[1].coords-player[1].oldcoords)/multiplier/2;//velocity/2;
                         if(player[1].skeleton.free)temp2=player[1].skeleton.joints[i].velocity*player[1].scale/2;
-                        if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].rotation,0)*player[1].scale+player[1].coords;
+                        if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].yaw,0)*player[1].scale+player[1].coords;
                         if(player[1].skeleton.free)temp=player[1].skeleton.joints[i].position*player[1].scale+player[1].coords;
                         Sprite::MakeSprite(breathsprite, temp,temp2, 1,1,1, .6+(float)abs(Random()%100)/200-.25, 1);
                     }
@@ -2373,7 +2543,7 @@ void Game::doTutorial(){
                     if(Random()%2==0){
                         if(!player[1].skeleton.free)temp2=(player[1].coords-player[1].oldcoords)/multiplier/2;//velocity/2;
                         if(player[1].skeleton.free)temp2=player[1].skeleton.joints[i].velocity*player[1].scale/2;
-                        if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].rotation,0)*player[1].scale+player[1].coords;
+                        if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].yaw,0)*player[1].scale+player[1].coords;
                         if(player[1].skeleton.free)temp=player[1].skeleton.joints[i].position*player[1].scale+player[1].coords;
                         Sprite::MakeSprite(breathsprite, temp,temp2, 1,1,1, .6+(float)abs(Random()%100)/200-.25, 1);
                     }
@@ -2460,7 +2630,7 @@ void Game::doTutorial(){
     }
 }
 
-void Game::doDebugKeys(){
+void doDebugKeys(){
        float headprop,bodyprop,armprop,legprop;
     if(debugmode){
         if(Input::isKeyPressed(SDLK_h)){
@@ -2536,8 +2706,8 @@ void Game::doDebugKeys(){
                         closest=i;
                     }
                 }
-            player[closest].rotation+=multiplier*50;
-            player[closest].targetrotation=player[closest].rotation;
+            player[closest].yaw+=multiplier*50;
+            player[closest].targetyaw=player[closest].yaw;
         }
 
 
@@ -2690,7 +2860,7 @@ void Game::doDebugKeys(){
                     if(player[closest].skeleton.free)
                         flatvelocity2=headjoint.velocity;
                     if(!player[closest].skeleton.free)
-                        flatfacing2=DoRotation(DoRotation(DoRotation(headjoint.position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].rotation,0)*player[closest].scale+player[closest].coords;
+                        flatfacing2=DoRotation(DoRotation(DoRotation(headjoint.position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].yaw,0)*player[closest].scale+player[closest].coords;
                     if(player[closest].skeleton.free)
                         flatfacing2=headjoint.position*player[closest].scale+player[closest].coords;
                     flatvelocity2.x+=(float)(abs(Random()%100)-50)/10;
@@ -2742,7 +2912,7 @@ void Game::doDebugKeys(){
                 for(int i=0;i<player[closest].skeleton.num_joints; i++){
                     if(!player[closest].skeleton.free)flatvelocity2=player[closest].velocity;
                     if(player[closest].skeleton.free)flatvelocity2=player[closest].skeleton.joints[i].velocity;
-                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].rotation,0)*player[closest].scale+player[closest].coords;
+                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].yaw,0)*player[closest].scale+player[closest].coords;
                     if(player[closest].skeleton.free)flatfacing2=player[closest].skeleton.joints[i].position*player[closest].scale+player[closest].coords;
                     flatvelocity2.x+=(float)(abs(Random()%100)-50)/10;
                     flatvelocity2.y+=(float)(abs(Random()%100)-50)/10;
@@ -2755,7 +2925,7 @@ void Game::doDebugKeys(){
                 for(int i=0;i<player[closest].skeleton.num_joints; i++){
                     if(!player[closest].skeleton.free)flatvelocity2=player[closest].velocity;
                     if(player[closest].skeleton.free)flatvelocity2=player[closest].skeleton.joints[i].velocity;
-                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].rotation,0)*player[closest].scale+player[closest].coords;
+                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].yaw,0)*player[closest].scale+player[closest].coords;
                     if(player[closest].skeleton.free)flatfacing2=player[closest].skeleton.joints[i].position*player[closest].scale+player[closest].coords;
                     flatvelocity2.x+=(float)(abs(Random()%100)-50)/10;
                     flatvelocity2.y+=(float)(abs(Random()%100)-50)/10;
@@ -2767,7 +2937,7 @@ void Game::doDebugKeys(){
                 for(int i=0;i<player[closest].skeleton.num_joints; i++){
                     if(!player[closest].skeleton.free)flatvelocity2=player[closest].velocity;
                     if(player[closest].skeleton.free)flatvelocity2=player[closest].skeleton.joints[i].velocity;
-                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].rotation,0)*player[closest].scale+player[closest].coords;
+                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].yaw,0)*player[closest].scale+player[closest].coords;
                     if(player[closest].skeleton.free)flatfacing2=player[closest].skeleton.joints[i].position*player[closest].scale+player[closest].coords;
                     flatvelocity2.x+=(float)(abs(Random()%100)-50)/10;
                     flatvelocity2.y+=(float)(abs(Random()%100)-50)/10;
@@ -2779,7 +2949,7 @@ void Game::doDebugKeys(){
                 for(int i=0;i<player[closest].skeleton.num_joints; i++){
                     if(!player[closest].skeleton.free)flatvelocity2=player[closest].velocity;
                     if(player[closest].skeleton.free)flatvelocity2=player[closest].skeleton.joints[i].velocity;
-                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].rotation,0)*player[closest].scale+player[closest].coords;
+                    if(!player[closest].skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(player[closest].skeleton.joints[i].position,0,0,player[closest].tilt),player[closest].tilt2,0,0),0,player[closest].yaw,0)*player[closest].scale+player[closest].coords;
                     if(player[closest].skeleton.free)flatfacing2=player[closest].skeleton.joints[i].position*player[closest].scale+player[closest].coords;
                     flatvelocity2.x+=(float)(abs(Random()%100)-50)/10;
                     flatvelocity2.y+=(float)(abs(Random()%100)-50)/10;
@@ -2920,14 +3090,14 @@ void Game::doDebugKeys(){
                     if(editortype==firetype)boxcoords.y=player[0].coords.y-.5;
                     //objects.MakeObject(abs(Random()%3),boxcoords,Random()%360);
                     float temprotat,temprotat2;
-                    temprotat=editorrotation;
-                    temprotat2=editorrotation2;
+                    temprotat=editoryaw;
+                    temprotat2=editorpitch;
                     if(temprotat<0||editortype==bushtype)temprotat=Random()%360;
                     if(temprotat2<0)temprotat2=Random()%360;
 
                     objects.MakeObject(editortype,boxcoords,(int)temprotat-((int)temprotat)%30,(int)temprotat2,editorsize);
                     if(editortype==treetrunktype)
-                        objects.MakeObject(treeleavestype,boxcoords,Random()%360*(temprotat2<2)+(int)editorrotation-((int)editorrotation)%30,editorrotation2,editorsize);
+                        objects.MakeObject(treeleavestype,boxcoords,Random()%360*(temprotat2<2)+(int)editoryaw-((int)editoryaw)%30,editorpitch,editorsize);
                 }
             }
 
@@ -2968,8 +3138,8 @@ void Game::doDebugKeys(){
                     player[numplayers].bled=0;
                     player[numplayers].speed=1+(float)(Random()%100)/1000;
 
-                    player[numplayers].targetrotation=player[0].targetrotation;
-                    player[numplayers].rotation=player[0].rotation;
+                    player[numplayers].targetyaw=player[0].targetyaw;
+                    player[numplayers].yaw=player[0].yaw;
 
                     player[numplayers].velocity=0;
                     player[numplayers].coords=player[0].coords;
@@ -3162,12 +3332,12 @@ void Game::doDebugKeys(){
             }
 
             if(Input::isKeyDown(SDLK_LEFT)&&!Input::isKeyDown(SDLK_LSHIFT)&&!Input::isKeyDown(SDLK_LCTRL)){
-                editorrotation-=multiplier*100;
-                if(editorrotation<-.01)editorrotation=-.01;
+                editoryaw-=multiplier*100;
+                if(editoryaw<-.01)editoryaw=-.01;
             }
 
             if(Input::isKeyDown(SDLK_RIGHT)&&!Input::isKeyDown(SDLK_LSHIFT)&&!Input::isKeyDown(SDLK_LCTRL)){
-                editorrotation+=multiplier*100;
+                editoryaw+=multiplier*100;
             }
 
             if(Input::isKeyDown(SDLK_UP)&&!Input::isKeyDown(SDLK_LCTRL)){
@@ -3188,12 +3358,12 @@ void Game::doDebugKeys(){
                 mapradius+=multiplier*10;
             }
             if(Input::isKeyDown(SDLK_UP)&&Input::isKeyDown(SDLK_LCTRL)){
-                editorrotation2+=multiplier*100;
+                editorpitch+=multiplier*100;
             }
 
             if(Input::isKeyDown(SDLK_DOWN)&&Input::isKeyDown(SDLK_LCTRL)){
-                editorrotation2-=multiplier*100;
-                if(editorrotation2<-.01)editorrotation2=-.01;
+                editorpitch-=multiplier*100;
+                if(editorpitch<-.01)editorpitch=-.01;
             }
             if(Input::isKeyPressed(SDLK_DELETE)&&objects.numobjects&&Input::isKeyDown(SDLK_LSHIFT)){
                 int closest=-1;
@@ -3212,7 +3382,7 @@ void Game::doDebugKeys(){
     }
 }
 
-void Game::doJumpReversals(){
+void doJumpReversals(){
     for(int k=0;k<numplayers;k++)
         for(int i=k;i<numplayers;i++){
             if(i==k)continue;
@@ -3261,8 +3431,8 @@ void Game::doJumpReversals(){
                         player[i].target=0;
                         player[k].oldcoords=player[k].coords;
                         player[i].coords=player[k].coords;
-                        player[k].targetrotation=player[i].targetrotation;
-                        player[k].rotation=player[i].targetrotation;
+                        player[k].targetyaw=player[i].targetyaw;
+                        player[k].yaw=player[i].targetyaw;
                         if(player[k].aitype==attacktypecutoff)
                             player[k].stunned=.5;
                     }
@@ -3300,8 +3470,8 @@ void Game::doJumpReversals(){
                         player[k].target=0;
                         player[i].oldcoords=player[i].coords;
                         player[k].coords=player[i].coords;
-                        player[i].targetrotation=player[k].targetrotation;
-                        player[i].rotation=player[k].targetrotation;
+                        player[i].targetyaw=player[k].targetyaw;
+                        player[i].yaw=player[k].targetyaw;
                         if(player[i].aitype==attacktypecutoff)
                             player[i].stunned=.5;
                     }
@@ -3310,21 +3480,21 @@ void Game::doJumpReversals(){
         }
 }
 
-void Game::doAerialAcrobatics(){
+void doAerialAcrobatics(){
        static XYZ facing,flatfacing;
     for(int k=0;k<numplayers;k++){
         player[k].turnspeed=500;
 
         if((player[k].isRun()&&
-                    ((player[k].targetrotation!=rabbitrunninganim&&
-                      player[k].targetrotation!=wolfrunninganim)||
+                    ((player[k].targetyaw!=rabbitrunninganim&&
+                      player[k].targetyaw!=wolfrunninganim)||
                      player[k].targetframe==4))||
                 player[k].targetanimation==removeknifeanim||
                 player[k].targetanimation==crouchremoveknifeanim||
                 player[k].targetanimation==flipanim||
                 player[k].targetanimation==fightsidestep||
                 player[k].targetanimation==walkanim){
-            player[k].rotation=stepTowardf(player[k].rotation, player[k].targetrotation, multiplier*player[k].turnspeed);
+            player[k].yaw=stepTowardf(player[k].yaw, player[k].targetyaw, multiplier*player[k].turnspeed);
         }
 
 
@@ -3340,11 +3510,11 @@ void Game::doAerialAcrobatics(){
                  player[k].targetanimation!=rabbitkickanim&&
                  (player[k].targetanimation!=crouchstabanim||player[k].hasvictim)&&
                  (player[k].targetanimation!=swordgroundstabanim||player[k].hasvictim))){
-            player[k].rotation=stepTowardf(player[k].rotation, player[k].targetrotation, multiplier*player[k].turnspeed*2);
+            player[k].yaw=stepTowardf(player[k].yaw, player[k].targetyaw, multiplier*player[k].turnspeed*2);
         }
 
         if(player[k].targetanimation==sneakanim&&player[k].currentanimation!=sneakanim){
-            player[k].rotation=stepTowardf(player[k].rotation, player[k].targetrotation, multiplier*player[k].turnspeed*4);
+            player[k].yaw=stepTowardf(player[k].yaw, player[k].targetyaw, multiplier*player[k].turnspeed*4);
         }
 
         /*if(player[k].aitype!=passivetype||(findDistancefast(&player[k].coords,&viewer)<viewdistance*viewdistance))*/
@@ -3385,7 +3555,7 @@ void Game::doAerialAcrobatics(){
                     if(     player[k].coords.y<terrain.getHeight(player[k].coords.x,player[k].coords.z)&&
                             player[k].coords.y>terrain.getHeight(player[k].coords.x,player[k].coords.z)-.1)
                         player[k].coords.y=terrain.getHeight(player[k].coords.x,player[k].coords.z);
-                    if(player[k].SphereCheck(&lowpoint, 1.3, &colpoint, &objects.position[i], &objects.rotation[i], &objects.model[i])!=-1){
+                    if(player[k].SphereCheck(&lowpoint, 1.3, &colpoint, &objects.position[i], &objects.yaw[i], &objects.model[i])!=-1){
                         flatfacing=lowpoint-player[k].coords;
                         player[k].coords=lowpoint;
                         player[k].coords.y-=1.3;
@@ -3401,19 +3571,19 @@ void Game::doAerialAcrobatics(){
                                 player[k].jumpkeydown){
                             lowpointtarget=lowpoint+DoRotation(player[k].facing,0,-90,0)*1.5;
                             XYZ tempcoords1=lowpoint;
-                            whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.rotation[i]);
+                            whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.yaw[i]);
                             if(whichhit!=-1&&fabs(objects.model[i].facenormals[whichhit].y)<.3){
                                 player[k].setAnimation(walljumpleftanim);
                                 emit_sound_at(movewhooshsound, player[k].coords);
                                 if(k==0)
                                     pause_sound(whooshsound);
 
-                                lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
-                                player[k].rotation=-asin(0-lowpointtarget.x)*180/M_PI;
+                                lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.yaw[i],0);
+                                player[k].yaw=-asin(0-lowpointtarget.x)*180/M_PI;
                                 if(lowpointtarget.z<0)
-                                    player[k].rotation=180-player[k].rotation;
-                                player[k].targetrotation=player[k].rotation;
-                                player[k].lowrotation=player[k].rotation;
+                                    player[k].yaw=180-player[k].yaw;
+                                player[k].targetyaw=player[k].yaw;
+                                player[k].lowyaw=player[k].yaw;
                                 if(k==0)
                                     numwallflipped++;
                             }
@@ -3421,52 +3591,52 @@ void Game::doAerialAcrobatics(){
                             {
                                 lowpoint=tempcoords1;
                                 lowpointtarget=lowpoint+DoRotation(player[k].facing,0,90,0)*1.5;
-                                whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.rotation[i]);
+                                whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.yaw[i]);
                                 if(whichhit!=-1&&fabs(objects.model[i].facenormals[whichhit].y)<.3){
                                     player[k].setAnimation(walljumprightanim);
                                     emit_sound_at(movewhooshsound, player[k].coords);
                                     if(k==0)pause_sound(whooshsound);
 
-                                    lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
-                                    player[k].rotation=-asin(0-lowpointtarget.x)*180/M_PI;
-                                    if(lowpointtarget.z<0)player[k].rotation=180-player[k].rotation;
-                                    player[k].targetrotation=player[k].rotation;
-                                    player[k].lowrotation=player[k].rotation;
+                                    lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.yaw[i],0);
+                                    player[k].yaw=-asin(0-lowpointtarget.x)*180/M_PI;
+                                    if(lowpointtarget.z<0)player[k].yaw=180-player[k].yaw;
+                                    player[k].targetyaw=player[k].yaw;
+                                    player[k].lowyaw=player[k].yaw;
                                     if(k==0)numwallflipped++;
                                 }
                                 else
                                 {
                                     lowpoint=tempcoords1;
                                     lowpointtarget=lowpoint+player[k].facing*2;
-                                    whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.rotation[i]);
+                                    whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.yaw[i]);
                                     if(whichhit!=-1&&fabs(objects.model[i].facenormals[whichhit].y)<.3){
                                         player[k].setAnimation(walljumpbackanim);
                                         emit_sound_at(movewhooshsound, player[k].coords);
                                         if(k==0)pause_sound(whooshsound);
 
-                                        lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
-                                        player[k].rotation=-asin(0-lowpointtarget.x)*180/M_PI;
-                                        if(lowpointtarget.z<0)player[k].rotation=180-player[k].rotation;
-                                        player[k].targetrotation=player[k].rotation;
-                                        player[k].lowrotation=player[k].rotation;
+                                        lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.yaw[i],0);
+                                        player[k].yaw=-asin(0-lowpointtarget.x)*180/M_PI;
+                                        if(lowpointtarget.z<0)player[k].yaw=180-player[k].yaw;
+                                        player[k].targetyaw=player[k].yaw;
+                                        player[k].lowyaw=player[k].yaw;
                                         if(k==0)numwallflipped++;
                                     }
                                     else
                                     {
                                         lowpoint=tempcoords1;
                                         lowpointtarget=lowpoint-player[k].facing*2;
-                                        whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.rotation[i]);
+                                        whichhit=objects.model[i].LineCheck(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.yaw[i]);
                                         if(whichhit!=-1&&fabs(objects.model[i].facenormals[whichhit].y)<.3){
                                             player[k].setAnimation(walljumpfrontanim);
                                             emit_sound_at(movewhooshsound, player[k].coords);
                                             if(k==0)pause_sound(whooshsound);
 
-                                            lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
-                                            player[k].rotation=-asin(0-lowpointtarget.x)*180/M_PI;
-                                            if(lowpointtarget.z<0)player[k].rotation=180-player[k].rotation;
-                                            player[k].rotation+=180;
-                                            player[k].targetrotation=player[k].rotation;
-                                            player[k].lowrotation=player[k].rotation;
+                                            lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.yaw[i],0);
+                                            player[k].yaw=-asin(0-lowpointtarget.x)*180/M_PI;
+                                            if(lowpointtarget.z<0)player[k].yaw=180-player[k].yaw;
+                                            player[k].yaw+=180;
+                                            player[k].targetyaw=player[k].yaw;
+                                            player[k].lowyaw=player[k].yaw;
                                             if(k==0)numwallflipped++;
                                         }
                                     }
@@ -3479,7 +3649,7 @@ void Game::doAerialAcrobatics(){
                     lowpoint2=player[k].coords;
                     lowpoint=player[k].coords;
                     lowpoint.y+=2;
-                    if(objects.model[i].LineCheck(&lowpoint,&lowpoint2,&colpoint,&objects.position[i],&objects.rotation[i])!=-1){
+                    if(objects.model[i].LineCheck(&lowpoint,&lowpoint2,&colpoint,&objects.position[i],&objects.yaw[i])!=-1){
                         player[k].coords=colpoint;
                         player[k].collide=1;
                         tempcollide=1;
@@ -3527,7 +3697,7 @@ void Game::doAerialAcrobatics(){
                     lowpoint=player[k].coords;
                     lowpoint.y+=1.35;
                     if(objects.type[i]!=rocktype)
-                        if(player[k].SphereCheck(&lowpoint,1.33,&colpoint,&objects.position[i],&objects.rotation[i],&objects.model[i])!=-1){
+                        if(player[k].SphereCheck(&lowpoint,1.33,&colpoint,&objects.position[i],&objects.yaw[i],&objects.model[i])!=-1){
                             if(player[k].targetanimation!=jumpupanim&&
                                     player[k].targetanimation!=jumpdownanim&&
                                     player[k].onterrain)
@@ -3543,14 +3713,14 @@ void Game::doAerialAcrobatics(){
                                      player[k].targetanimation==jumpupanim||
                                      player[k].targetanimation==jumpdownanim)){
                                 lowpoint=player[k].coords;
-                                objects.model[i].SphereCheckPossible(&lowpoint, 1.5, &objects.position[i], &objects.rotation[i]);
+                                objects.model[i].SphereCheckPossible(&lowpoint, 1.5, &objects.position[i], &objects.yaw[i]);
                                 lowpoint=player[k].coords;
                                 lowpoint.y+=.05;
                                 facing=0;
                                 facing.z=-1;
-                                facing=DoRotation(facing,0,player[k].targetrotation+180,0);
+                                facing=DoRotation(facing,0,player[k].targetyaw+180,0);
                                 lowpointtarget=lowpoint+facing*1.4;
-                                whichhit=objects.model[i].LineCheckPossible(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.rotation[i]);
+                                whichhit=objects.model[i].LineCheckPossible(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.yaw[i]);
                                 if(whichhit!=-1){
                                     lowpoint=player[k].coords;
                                     lowpoint.y+=.1;
@@ -3579,7 +3749,7 @@ void Game::doAerialAcrobatics(){
                                     lowpointtarget6.y+=45/13;
                                     lowpointtarget6+=facing*.6;
                                     lowpointtarget7.y+=90/13;
-                                    whichhit=objects.model[i].LineCheckPossible(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.rotation[i]);
+                                    whichhit=objects.model[i].LineCheckPossible(&lowpoint,&lowpointtarget,&colpoint,&objects.position[i],&objects.yaw[i]);
                                     if(objects.friction[i]>.5)
                                         if(whichhit!=-1){
                                             if(whichhit!=-1&&player[k].targetanimation!=jumpupanim&&player[k].targetanimation!=jumpdownanim)
@@ -3587,28 +3757,28 @@ void Game::doAerialAcrobatics(){
                                             if(checkcollide(lowpoint7,lowpointtarget7)==-1)
                                                 if(checkcollide(lowpoint6,lowpointtarget6)==-1)
                                                     if(     objects.model[i].LineCheckPossible(&lowpoint2,&lowpointtarget2,
-                                                                &colpoint,&objects.position[i],&objects.rotation[i])!=-1&&
+                                                                &colpoint,&objects.position[i],&objects.yaw[i])!=-1&&
                                                             objects.model[i].LineCheckPossible(&lowpoint3,&lowpointtarget3,
-                                                                &colpoint,&objects.position[i],&objects.rotation[i])!=-1&&
+                                                                &colpoint,&objects.position[i],&objects.yaw[i])!=-1&&
                                                             objects.model[i].LineCheckPossible(&lowpoint4,&lowpointtarget4,
-                                                                &colpoint,&objects.position[i],&objects.rotation[i])!=-1&&
+                                                                &colpoint,&objects.position[i],&objects.yaw[i])!=-1&&
                                                             objects.model[i].LineCheckPossible(&lowpoint5,&lowpointtarget5,
-                                                                &colpoint,&objects.position[i],&objects.rotation[i])!=-1)
+                                                                &colpoint,&objects.position[i],&objects.yaw[i])!=-1)
                                                         for(int j=0;j<45;j++){
                                                             lowpoint=player[k].coords;
                                                             lowpoint.y+=(float)j/13;
                                                             lowpointtarget=lowpoint+facing*1.4;
                                                             if(objects.model[i].LineCheckPossible(&lowpoint,&lowpointtarget,
-                                                                        &colpoint2,&objects.position[i],&objects.rotation[i])==-1){
+                                                                        &colpoint2,&objects.position[i],&objects.yaw[i])==-1){
                                                                 if(j<=6||j<=25&&player[k].targetanimation==jumpdownanim)
                                                                     break;
                                                                 if(player[k].targetanimation==jumpupanim||player[k].targetanimation==jumpdownanim){
-                                                                    lowpoint=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[k],0);
+                                                                    lowpoint=DoRotation(objects.model[i].facenormals[whichhit],0,objects.yaw[k],0);
                                                                     lowpoint=player[k].coords;
                                                                     lowpoint.y+=(float)j/13;
                                                                     lowpointtarget=lowpoint+facing*1.3;
                                                                     flatfacing=player[k].coords;
-                                                                    player[k].coords=colpoint-DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[k],0)*.01;
+                                                                    player[k].coords=colpoint-DoRotation(objects.model[i].facenormals[whichhit],0,objects.yaw[k],0)*.01;
                                                                     player[k].coords.y=lowpointtarget.y-.07;
                                                                     player[k].currentoffset=(flatfacing-player[k].coords)/player[k].scale;
 
@@ -3619,12 +3789,12 @@ void Game::doAerialAcrobatics(){
                                                                         }
                                                                         emit_sound_at(jumpsound, player[k].coords, 128.);
 
-                                                                        lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.rotation[i],0);
-                                                                        player[k].rotation=-asin(0-lowpointtarget.x)*180/M_PI;
+                                                                        lowpointtarget=DoRotation(objects.model[i].facenormals[whichhit],0,objects.yaw[i],0);
+                                                                        player[k].yaw=-asin(0-lowpointtarget.x)*180/M_PI;
                                                                         if(lowpointtarget.z<0)
-                                                                            player[k].rotation=180-player[k].rotation;
-                                                                        player[k].targetrotation=player[k].rotation;
-                                                                        player[k].lowrotation=player[k].rotation;
+                                                                            player[k].yaw=180-player[k].yaw;
+                                                                        player[k].targetyaw=player[k].yaw;
+                                                                        player[k].lowyaw=player[k].yaw;
 
                                                                         //player[k].velocity=lowpointtarget*.03;
                                                                         player[k].velocity=0;
@@ -3685,7 +3855,7 @@ void Game::doAerialAcrobatics(){
     }
 }
 
-void Game::doAttacks(){
+void doAttacks(){
     static XYZ relative;
     static int randattack;
     static bool playerrealattackkeydown=0;
@@ -3747,19 +3917,19 @@ void Game::doAttacks(){
                                     player[i].targetanimation==staffspinhitanim)
                                 if(findDistancefast(&player[k].coords,&player[i].coords)<6.5&&!player[i].skeleton.free){
                                     player[k].setAnimation(dodgebackanim);
-                                    player[k].targetrotation=roughDirectionTo(player[k].coords,player[i].coords);
+                                    player[k].targetyaw=roughDirectionTo(player[k].coords,player[i].coords);
                                     player[k].targettilt2=pitchTo(player[k].coords,player[i].coords);
                                 }
                         }
                         if(player[k].targetanimation!=dodgebackanim){
                             if(k==0)numflipped++;
                             player[k].setAnimation(backhandspringanim);
-                            player[k].targetrotation=-rotation+180;
+                            player[k].targetyaw=-yaw+180;
                             if(player[k].leftkeydown)
-                                player[k].targetrotation-=45;
+                                player[k].targetyaw-=45;
                             if(player[k].rightkeydown)
-                                player[k].targetrotation+=45;
-                            player[k].rotation=player[k].targetrotation;
+                                player[k].targetyaw+=45;
+                            player[k].yaw=player[k].targetyaw;
                             player[k].jumppower-=2;
                         }
                     }
@@ -3995,9 +4165,9 @@ void Game::doAttacks(){
                                             player[k].targetframe=player[i].targetframe;
                                             player[k].target=player[i].target;
                                             player[k].velocity=0;
-                                            player[k].targetrotation=player[i].rotation;
-                                            player[k].rotation=player[i].rotation;
-                                            player[i].targetrotation=player[i].rotation;
+                                            player[k].targetyaw=player[i].yaw;
+                                            player[k].yaw=player[i].yaw;
+                                            player[i].targetyaw=player[i].yaw;
                                         }
                                     }
                                     if(animation[player[k].targetanimation].attack==normalattack&&
@@ -4007,7 +4177,7 @@ void Game::doAttacks(){
                                         player[k].targetframe=0;
                                         player[k].target=0;
 
-                                        player[k].targetrotation=roughDirectionTo(player[k].coords,player[i].coords);
+                                        player[k].targetyaw=roughDirectionTo(player[k].coords,player[i].coords);
                                         player[k].targettilt2=pitchTo(player[k].coords,player[i].coords);
                                         player[k].lastattack3=player[k].lastattack2;
                                         player[k].lastattack2=player[k].lastattack;
@@ -4016,7 +4186,7 @@ void Game::doAttacks(){
                                     if(player[k].targetanimation==knifefollowanim&&
                                             player[k].victim==&player[i]){
                                         oldattackkey=1;
-                                        player[k].targetrotation=roughDirectionTo(player[k].coords,player[i].coords);
+                                        player[k].targetyaw=roughDirectionTo(player[k].coords,player[i].coords);
                                         player[k].targettilt2=pitchTo(player[k].coords,player[i].coords);
                                         player[k].victim=&player[i];
                                         player[k].hasvictim=1;
@@ -4037,10 +4207,10 @@ void Game::doAttacks(){
                                         player[k].velocity=0;
                                         player[k].oldcoords=player[k].coords;
                                         player[i].coords=player[k].coords;
-                                        player[i].targetrotation=player[k].targetrotation;
-                                        player[i].rotation=player[k].targetrotation;
-                                        player[k].rotation=player[k].targetrotation;
-                                        player[i].rotation=player[k].targetrotation;
+                                        player[i].targetyaw=player[k].targetyaw;
+                                        player[i].yaw=player[k].targetyaw;
+                                        player[k].yaw=player[k].targetyaw;
+                                        player[i].yaw=player[k].targetyaw;
                                     }
                                 }
                         }
@@ -4148,11 +4318,11 @@ void Game::doAttacks(){
                                                  player[i].getJointFor(neck).position)/2*
                                                 player[i].scale;
                                     }
-                                    player[k].targetrotation=roughDirectionTo(player[k].coords,targetpoint);
+                                    player[k].targetyaw=roughDirectionTo(player[k].coords,targetpoint);
                                     player[k].targettilt2=pitchTo(player[k].coords,targetpoint);
 
                                     if(player[k].targetanimation==crouchstabanim||player[k].targetanimation==swordgroundstabanim){
-                                        player[k].targetrotation+=(float)(abs(Random()%100)-50)/4;
+                                        player[k].targetyaw+=(float)(abs(Random()%100)-50)/4;
                                     }
 
                                     if(player[k].targetanimation==staffgroundsmashanim)
@@ -4163,7 +4333,7 @@ void Game::doAttacks(){
                                     player[k].lastattack=player[k].targetanimation;
 
                                     if(player[k].targetanimation==swordgroundstabanim){
-                                        player[k].targetrotation+=30;
+                                        player[k].targetyaw+=30;
                                     }
                                 }
                             }
@@ -4219,7 +4389,7 @@ void Game::doAttacks(){
     }
 }
 
-void Game::doPlayerCollisions(){
+void doPlayerCollisions(){
        static XYZ rotatetarget;
     static float collisionradius;
     if(numplayers>1)
@@ -4290,7 +4460,7 @@ void Game::doPlayerCollisions(){
                                 player[0].coords.y=player[l].coords.y;
                                 player[l].velocity=player[0].velocity;
                                 player[l].skeleton.free=0;
-                                player[l].rotation=0;
+                                player[l].yaw=0;
                                 player[l].RagDoll(0);
                                 player[l].DoDamage(20);
                                 camerashake+=.3;
@@ -4420,7 +4590,7 @@ void Game::doPlayerCollisions(){
             }
 }
 
-void Game::doAI(int i){
+void doAI(int i){
     static bool connected;
     if(player[i].aitype!=playercontrolled&&indialogue==-1){
         player[i].jumpclimb=0;
@@ -4524,8 +4694,8 @@ void Game::doAI(int i){
             }
             player[i].losupdatedelay-=multiplier;
 
-            player[i].targetrotation=roughDirectionTo(player[i].coords,pathpoint[player[i].targetpathfindpoint]);
-            player[i].lookrotation=player[i].targetrotation;
+            player[i].targetyaw=roughDirectionTo(player[i].coords,pathpoint[player[i].targetpathfindpoint]);
+            player[i].lookyaw=player[i].targetyaw;
 
             //reached target point
             if(findDistancefastflat(&player[i].coords,&pathpoint[player[i].targetpathfindpoint])<.6){
@@ -4557,7 +4727,7 @@ void Game::doAI(int i){
             player[i].throwkeydown=0;
 
             if(player[i].avoidcollided>.8 && !player[i].jumpkeydown && player[i].collided<.8)
-                player[i].targetrotation+=90*(player[i].whichdirection*2-1);
+                player[i].targetyaw+=90*(player[i].whichdirection*2-1);
 
             if(player[i].collided<1||player[i].targetanimation!=jumpupanim)
                 player[i].jumpkeydown=0;
@@ -4588,9 +4758,9 @@ void Game::doAI(int i){
                                     if(normaldotproduct(player[i].facing,player[j].coords-player[i].coords)>0)
                                         if(player[j].coords.y<player[i].coords.y+5||player[j].onterrain)
                                             if(!player[j].isWallJump()&&-1==checkcollide(
-                                                            DoRotation(player[i].getJointFor(head).position,0,player[i].rotation,0)
+                                                            DoRotation(player[i].getJointFor(head).position,0,player[i].yaw,0)
                                                                 *player[i].scale+player[i].coords,
-                                                            DoRotation(player[j].getJointFor(head).position,0,player[j].rotation,0)
+                                                            DoRotation(player[j].getJointFor(head).position,0,player[j].yaw,0)
                                                                 *player[j].scale+player[j].coords)||
                                                     (player[j].targetanimation==hanganim&&
                                                      normaldotproduct(player[j].facing,player[i].coords-player[j].coords)<0)){
@@ -4621,8 +4791,8 @@ void Game::doAI(int i){
 
             if(player[i].aiupdatedelay<0){
                 if(player[i].numwaypoints>1&&player[i].howactive==typeactive&&player[i].pausetime<=0){
-                    player[i].targetrotation=roughDirectionTo(player[i].coords,player[i].waypoints[player[i].waypoint]);
-                    player[i].lookrotation=player[i].targetrotation;
+                    player[i].targetyaw=roughDirectionTo(player[i].coords,player[i].waypoints[player[i].waypoint]);
+                    player[i].lookyaw=player[i].targetyaw;
                     player[i].aiupdatedelay=.05;
 
                     if(findDistancefastflat(&player[i].coords,&player[i].waypoints[player[i].waypoint])<1){
@@ -4648,7 +4818,7 @@ void Game::doAI(int i){
 
                 if(player[i].avoidcollided>.8&&!player[i].jumpkeydown&&player[i].collided<.8){
                     if(!player[i].avoidsomething)
-                        player[i].targetrotation+=90*(player[i].whichdirection*2-1);
+                        player[i].targetyaw+=90*(player[i].whichdirection*2-1);
                     else{
                         XYZ leftpos,rightpos;
                         float leftdist,rightdist;
@@ -4657,9 +4827,9 @@ void Game::doAI(int i){
                         leftdist = findDistancefast(&leftpos, &player[i].avoidwhere);
                         rightdist = findDistancefast(&rightpos, &player[i].avoidwhere);
                         if(leftdist<rightdist)
-                            player[i].targetrotation+=90;
+                            player[i].targetyaw+=90;
                         else
-                            player[i].targetrotation-=90;
+                            player[i].targetyaw-=90;
                     }
                 }
             }
@@ -4731,9 +4901,9 @@ void Game::doAI(int i){
                                 if(findDistancefast(&player[i].coords,&player[j].coords)<400)
                                     if(normaldotproduct(player[i].facing,player[j].coords-player[i].coords)>0)
                                         if((-1==checkcollide(
-                                                        DoRotation(player[i].getJointFor(head).position,0,player[i].rotation,0)*
+                                                        DoRotation(player[i].getJointFor(head).position,0,player[i].yaw,0)*
                                                             player[i].scale+player[i].coords,
-                                                        DoRotation(player[j].getJointFor(head).position,0,player[j].rotation,0)*
+                                                        DoRotation(player[j].getJointFor(head).position,0,player[j].yaw,0)*
                                                             player[j].scale+player[j].coords)&&
                                                     !player[j].isWallJump())||
                                                 (player[j].targetanimation==hanganim&&
@@ -4789,7 +4959,7 @@ void Game::doAI(int i){
                     if(j==-1){
                         player[i].velocity=0;
                         player[i].setAnimation(player[i].getStop());
-                        player[i].targetrotation+=180;
+                        player[i].targetyaw+=180;
                         player[i].stunned=.5;
                         //player[i].aitype=passivetype;
                         player[i].aitype=pathfindtype;
@@ -4806,8 +4976,8 @@ void Game::doAI(int i){
             }
             //check out last seen location
             if(player[i].aiupdatedelay<0){
-                player[i].targetrotation=roughDirectionTo(player[i].coords,player[i].lastseen);
-                player[i].lookrotation=player[i].targetrotation;
+                player[i].targetyaw=roughDirectionTo(player[i].coords,player[i].lastseen);
+                player[i].lookyaw=player[i].targetyaw;
                 player[i].aiupdatedelay=.05;
                 player[i].forwardkeydown=1;
 
@@ -4827,7 +4997,7 @@ void Game::doAI(int i){
                 player[i].throwkeydown=0;
 
                 if(player[i].avoidcollided>.8&&!player[i].jumpkeydown&&player[i].collided<.8){
-                    if(!player[i].avoidsomething)player[i].targetrotation+=90*(player[i].whichdirection*2-1);
+                    if(!player[i].avoidsomething)player[i].targetyaw+=90*(player[i].whichdirection*2-1);
                     else{
                         XYZ leftpos,rightpos;
                         float leftdist,rightdist;
@@ -4835,8 +5005,8 @@ void Game::doAI(int i){
                         rightpos = player[i].coords-DoRotation(player[i].facing,0,90,0);
                         leftdist = findDistancefast(&leftpos, &player[i].avoidwhere);
                         rightdist = findDistancefast(&rightpos, &player[i].avoidwhere);
-                        if(leftdist<rightdist)player[i].targetrotation+=90;
-                        else player[i].targetrotation-=90;
+                        if(leftdist<rightdist)player[i].targetyaw+=90;
+                        else player[i].targetyaw-=90;
                     }
                 }
             }
@@ -4867,9 +5037,9 @@ void Game::doAI(int i){
                     if(findDistancefast(&player[i].coords,&player[0].coords)<400)
                         if(normaldotproduct(player[i].facing,player[0].coords-player[i].coords)>0)
                             if((checkcollide(
-                                        DoRotation(player[i].getJointFor(head).position,0,player[i].rotation,0)*
+                                        DoRotation(player[i].getJointFor(head).position,0,player[i].yaw,0)*
                                             player[i].scale+player[i].coords,
-                                        DoRotation(player[0].getJointFor(head).position,0,player[0].rotation,0)*
+                                        DoRotation(player[0].getJointFor(head).position,0,player[0].yaw,0)*
                                             player[0].scale+player[0].coords)==-1)||
                                     (player[0].targetanimation==hanganim&&normaldotproduct(
                                         player[0].facing,player[i].coords-player[0].coords)<0)){
@@ -4954,8 +5124,8 @@ void Game::doAI(int i){
 
                 //seek out ally
                 if(player[i].ally>0){
-                    player[i].targetrotation=roughDirectionTo(player[i].coords,player[player[i].ally].coords);
-                    player[i].lookrotation=player[i].targetrotation;
+                    player[i].targetyaw=roughDirectionTo(player[i].coords,player[player[i].ally].coords);
+                    player[i].lookyaw=player[i].targetyaw;
                     player[i].aiupdatedelay=.05;
                     player[i].forwardkeydown=1;
 
@@ -4972,7 +5142,7 @@ void Game::doAI(int i){
 
                     if(player[i].avoidcollided>.8&&!player[i].jumpkeydown&&player[i].collided<.8){
                         if(!player[i].avoidsomething)
-                            player[i].targetrotation+=90*(player[i].whichdirection*2-1);
+                            player[i].targetyaw+=90*(player[i].whichdirection*2-1);
                         else{
                             XYZ leftpos,rightpos;
                             float leftdist,rightdist;
@@ -4981,9 +5151,9 @@ void Game::doAI(int i){
                             leftdist = findDistancefast(&leftpos, &player[i].avoidwhere);
                             rightdist = findDistancefast(&rightpos, &player[i].avoidwhere);
                             if(leftdist<rightdist)
-                                player[i].targetrotation+=90;
+                                player[i].targetyaw+=90;
                             else
-                                player[i].targetrotation-=90;
+                                player[i].targetyaw-=90;
                         }
                     }
                 }
@@ -5042,15 +5212,15 @@ void Game::doAI(int i){
                             player[i].lastseentime=1;
                         }
                         //TODO: factor these out as moveToward()
-                        player[i].targetrotation=roughDirectionTo(player[i].coords,weapons[player[i].ally].position);
-                        player[i].lookrotation=player[i].targetrotation;
+                        player[i].targetyaw=roughDirectionTo(player[i].coords,weapons[player[i].ally].position);
+                        player[i].lookyaw=player[i].targetyaw;
                         player[i].aiupdatedelay=.05;
                         player[i].forwardkeydown=1;
 
 
                         if(player[i].avoidcollided>.8&&!player[i].jumpkeydown&&player[i].collided<.8){
                             if(!player[i].avoidsomething)
-                                player[i].targetrotation+=90*(player[i].whichdirection*2-1);
+                                player[i].targetyaw+=90*(player[i].whichdirection*2-1);
                             else{
                                 XYZ leftpos,rightpos;
                                 float leftdist,rightdist;
@@ -5059,9 +5229,9 @@ void Game::doAI(int i){
                                 leftdist = findDistancefast(&leftpos, &player[i].avoidwhere);
                                 rightdist = findDistancefast(&rightpos, &player[i].avoidwhere);
                                 if(leftdist<rightdist)
-                                    player[i].targetrotation+=90;
+                                    player[i].targetyaw+=90;
                                 else
-                                    player[i].targetrotation-=90;
+                                    player[i].targetyaw-=90;
                             }
                         }
                     }
@@ -5103,7 +5273,7 @@ void Game::doAI(int i){
                                     player[i].setAnimation(backhandspringanim);
                                 else
                                     player[i].setAnimation(rollanim);
-                                player[i].targetrotation+=90*(abs(Random()%2)*2-1);
+                                player[i].targetyaw+=90*(abs(Random()%2)*2-1);
                                 player[i].wentforweapon=0;
                             }
                             if(player[i].targetanimation==jumpupanim||player[i].targetanimation==jumpdownanim)
@@ -5163,7 +5333,7 @@ void Game::doAI(int i){
                     if(j==-1) {
                         player[i].velocity=0;
                         player[i].setAnimation(player[i].getStop());
-                        player[i].targetrotation+=180;
+                        player[i].targetyaw+=180;
                         player[i].stunned=.5;
                         player[i].aitype=pathfindtype;
                         player[i].finalfinaltarget=player[i].waypoints[player[i].waypoint];
@@ -5209,8 +5379,8 @@ void Game::doAI(int i){
                         findDistancefast(&rotatetarget,&player[i].coords))
                     targetpoint+=player[0].velocity*
                         findDistance(&player[0].coords,&player[i].coords)/findLength(&player[i].velocity);
-                player[i].targetrotation=roughDirectionTo(player[i].coords,targetpoint);
-                player[i].lookrotation=player[i].targetrotation;
+                player[i].targetyaw=roughDirectionTo(player[i].coords,targetpoint);
+                player[i].lookyaw=player[i].targetyaw;
                 player[i].aiupdatedelay=.2+fabs((float)(Random()%100)/1000);
 
                 if(findDistancefast(&player[i].coords,&player[0].coords)>5&&(player[0].weaponactive==-1||player[i].weaponactive!=-1))
@@ -5246,7 +5416,7 @@ void Game::doAI(int i){
                 player[i].throwkeydown=0;
 
                 if(player[i].avoidcollided>.8&&!player[i].jumpkeydown&&player[i].collided<.8)
-                    player[i].targetrotation+=90*(player[i].whichdirection*2-1);
+                    player[i].targetyaw+=90*(player[i].whichdirection*2-1);
                 //attack!!!
                 if(Random()%2==0||player[i].weaponactive!=-1||player[i].creature==wolftype)
                     player[i].attackkeydown=1;
@@ -5355,7 +5525,7 @@ void Game::doAI(int i){
                 player[i].pause&&player[i].damage>player[i].superpermanentdamage){
             if(player[i].pause)
                 player[i].lastseentime=1;
-            player[i].targetrotation=player[i].rotation;
+            player[i].targetyaw=player[i].yaw;
             player[i].forwardkeydown=0;
             player[i].leftkeydown=0;
             player[i].backkeydown=0;
@@ -5371,15 +5541,15 @@ void Game::doAI(int i){
         facing=0;
         facing.z=-1;
 
-        XYZ flatfacing=DoRotation(facing,0,player[i].rotation+180,0);
+        XYZ flatfacing=DoRotation(facing,0,player[i].yaw+180,0);
         facing=flatfacing;
 
         if(player[i].aitype==attacktypecutoff){
-            player[i].targetheadrotation=180-roughDirectionTo(player[i].coords,player[0].coords);
-            player[i].targetheadrotation2=pitchTo(player[i].coords,player[0].coords);
+            player[i].targetheadyaw=180-roughDirectionTo(player[i].coords,player[0].coords);
+            player[i].targetheadpitch=pitchTo(player[i].coords,player[0].coords);
         }else if(player[i].howactive>=typesleeping){
-            player[i].targetheadrotation=player[i].targetrotation;
-            player[i].targetheadrotation2=0;
+            player[i].targetheadyaw=player[i].targetyaw;
+            player[i].targetheadpitch=0;
         }else{
             if(player[i].interestdelay<=0){
                 player[i].interestdelay=.7+(float)(abs(Random()%100))/100;
@@ -5389,8 +5559,8 @@ void Game::doAI(int i){
                 player[i].headtarget.y+=(float)(abs(Random()%200)-100)/300;
                 player[i].headtarget+=player[i].facing*1.5;
             }
-            player[i].targetheadrotation=180-roughDirectionTo(player[i].coords,player[i].headtarget);
-            player[i].targetheadrotation2=pitchTo(player[i].coords,player[i].headtarget);
+            player[i].targetheadyaw=180-roughDirectionTo(player[i].coords,player[i].headtarget);
+            player[i].targetheadpitch=pitchTo(player[i].coords,player[i].headtarget);
         }
     }
 }
@@ -5613,7 +5783,7 @@ void Game::LoadMenu(){
     }
 }
 
-void Game::MenuTick(){
+void MenuTick(){
     //menu buttons
     selected=Menu::getSelected(mousecoordh*640/screenwidth,480-mousecoordv*480/screenheight);
 
@@ -5995,6 +6165,7 @@ void Game::MenuTick(){
                 displayselected=0;
             }
             entername=0;
+            LoadMenu();
         }
         
         displayblinkdelay-=multiplier;
@@ -6096,7 +6267,6 @@ void Game::Tick(){
                        LoadMenu();
         }
         //escape key pressed
-        //TODO: there must be code somewhere else that handles clicking the Back button, merge it with this
                if(Input::isKeyPressed(SDLK_ESCAPE)&&
                 (gameon||mainmenu==0||(mainmenu>=3&&mainmenu!=8&&!(mainmenu==7&&entername)))) {
                        selected=-1;
@@ -6193,7 +6363,6 @@ void Game::Tick(){
                if(console&&!Input::isKeyDown(SDLK_LMETA)) {
                        inputText(consoletext[0],&consoleselected,&consolechars[0]);
                        if(!waiting) {
-                               archiveselected=0;
                                if(consolechars[0]>0) {
                     consoletext[0][consolechars[0]]='\0';
                     cmd_dispatch(consoletext[0]);
@@ -6250,10 +6419,11 @@ void Game::Tick(){
 
 
 
-        //TODO: what is this test?
                if(!freeze&&!winfreeze&&!(mainmenu&&gameon)&&(gameon||!gamestarted)){
 
             //dialogues
+            static float talkdelay = 0;
+
                        if(indialogue!=-1)
                 talkdelay=1;
                        talkdelay-=multiplier;
@@ -6297,8 +6467,8 @@ void Game::Tick(){
                             whichdialogue=i;
                             for(int j=0;j<numdialogueboxes[whichdialogue];j++){
                                 player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
-                                player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
-                                player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
+                                player[participantfocus[whichdialogue][j]].yaw=participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
+                                player[participantfocus[whichdialogue][j]].targetyaw=participantyaw[whichdialogue][participantfocus[whichdialogue][j]];
                                 player[participantfocus[whichdialogue][j]].velocity=0;
                                 player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
                                 player[participantfocus[whichdialogue][j]].targetframe=0;
@@ -6437,13 +6607,13 @@ void Game::Tick(){
                     facing=0;
                     facing.z=-1;
 
-                    facing=DoRotation(facing,-rotation2,0,0);
-                    facing=DoRotation(facing,0,0-rotation,0);
+                    facing=DoRotation(facing,-pitch,0,0);
+                    facing=DoRotation(facing,0,0-yaw,0);
 
                     flatfacing=0;
                     flatfacing.z=-1;
 
-                    flatfacing=DoRotation(flatfacing,0,-rotation,0);
+                    flatfacing=DoRotation(flatfacing,0,-yaw,0);
 
                     if(Input::isKeyDown(forwardkey))
                         viewer+=facing*multiplier*4;
@@ -6484,7 +6654,7 @@ void Game::Tick(){
                         if(whichend!=-1){
                             participantfocus[whichdialogue][indialogue]=whichend;
                             participantlocation[whichdialogue][whichend]=player[whichend].coords;
-                            participantrotation[whichdialogue][whichend]=player[whichend].rotation;
+                            participantyaw[whichdialogue][whichend]=player[whichend].yaw;
                         }
                         if(whichend==-1){
                             participantfocus[whichdialogue][indialogue]=-1;
@@ -6495,8 +6665,8 @@ void Game::Tick(){
                             cameramode=0;
                         }
                         dialoguecamera[whichdialogue][indialogue]=viewer;
-                        dialoguecamerarotation[whichdialogue][indialogue]=rotation;
-                        dialoguecamerarotation2[whichdialogue][indialogue]=rotation2;
+                        dialoguecamerayaw[whichdialogue][indialogue]=yaw;
+                        dialoguecamerapitch[whichdialogue][indialogue]=pitch;
                         indialogue++;
                         if(indialogue<numdialogueboxes[whichdialogue]){
                             if(dialogueboxsound[whichdialogue][indialogue]!=0){
@@ -6542,8 +6712,8 @@ void Game::Tick(){
                     pause_sound(whooshsound);
                     viewer=dialoguecamera[whichdialogue][indialogue];
                     viewer.y=max((double)viewer.y,terrain.getHeight(viewer.x,viewer.z)+.1);
-                    rotation=dialoguecamerarotation[whichdialogue][indialogue];
-                    rotation2=dialoguecamerarotation2[whichdialogue][indialogue];
+                    yaw=dialoguecamerayaw[whichdialogue][indialogue];
+                    pitch=dialoguecamerapitch[whichdialogue][indialogue];
                     if(dialoguetime>0.5)
                         if(     Input::isKeyPressed(SDLK_1)||
                                 Input::isKeyPressed(SDLK_2)||
@@ -6611,10 +6781,10 @@ void Game::Tick(){
 
 
             dialoguetime+=multiplier;
-            hawkrotation+=multiplier*25;
+            hawkyaw+=multiplier*25;
             realhawkcoords=0;
             realhawkcoords.x=25;
-            realhawkcoords=DoRotation(realhawkcoords,0,hawkrotation,0)+hawkcoords;
+            realhawkcoords=DoRotation(realhawkcoords,0,hawkyaw,0)+hawkcoords;
             hawkcalldelay-=multiplier/2;
 
             if(hawkcalldelay<=0){
@@ -6670,9 +6840,9 @@ void Game::Tick(){
 
             //?
             for(int i=0;i<numplayers;i++){
-                static float oldtargetrotation;
+                static float oldtargetyaw;
                 if(!player[i].skeleton.free){
-                    oldtargetrotation=player[i].targetrotation;
+                    oldtargetyaw=player[i].targetyaw;
                     if(i==0&&indialogue==-1){
                         //TODO: refactor repetitive code
                         if(!animation[player[0].targetanimation].attack&&
@@ -6685,26 +6855,26 @@ void Game::Tick(){
                                 player[0].targetanimation!=walljumprightkickanim&&
                                 player[0].targetanimation!=walljumpleftkickanim){
                             if(cameramode)
-                                player[0].targetrotation=0;
+                                player[0].targetyaw=0;
                             else
-                                player[0].targetrotation=-rotation+180;
+                                player[0].targetyaw=-yaw+180;
                         }
 
                         facing=0;
                         facing.z=-1;
 
-                        flatfacing=DoRotation(facing,0,player[i].rotation+180,0);
+                        flatfacing=DoRotation(facing,0,player[i].yaw+180,0);
                         if(cameramode){
                             facing=flatfacing;
                         }else{
-                            facing=DoRotation(facing,-rotation2,0,0);
-                            facing=DoRotation(facing,0,0-rotation,0);
+                            facing=DoRotation(facing,-pitch,0,0);
+                            facing=DoRotation(facing,0,0-yaw,0);
                         }
 
-                        player[0].lookrotation=-rotation;
+                        player[0].lookyaw=-yaw;
 
-                        player[i].targetheadrotation=rotation;
-                        player[i].targetheadrotation2=rotation2;
+                        player[i].targetheadyaw=yaw;
+                        player[i].targetheadpitch=pitch;
                     }
                     if(i!=0&&player[i].aitype==playercontrolled&&indialogue==-1){
                         if(!animation[player[i].targetanimation].attack&&
@@ -6716,23 +6886,23 @@ void Game::Tick(){
                                 player[i].targetanimation!=dodgebackanim&&
                                 player[i].targetanimation!=walljumprightkickanim&&
                                 player[i].targetanimation!=walljumpleftkickanim){
-                            player[i].targetrotation=-player[i].lookrotation+180;
+                            player[i].targetyaw=-player[i].lookyaw+180;
                         }
 
                         facing=0;
                         facing.z=-1;
 
-                        flatfacing=DoRotation(facing,0,player[i].rotation+180,0);
+                        flatfacing=DoRotation(facing,0,player[i].yaw+180,0);
 
-                        facing=DoRotation(facing,-player[i].lookrotation2,0,0);
-                        facing=DoRotation(facing,0,0-player[i].lookrotation,0);
+                        facing=DoRotation(facing,-player[i].lookpitch,0,0);
+                        facing=DoRotation(facing,0,0-player[i].lookyaw,0);
 
-                        player[i].targetheadrotation=player[i].lookrotation;
-                        player[i].targetheadrotation2=player[i].lookrotation2;
+                        player[i].targetheadyaw=player[i].lookyaw;
+                        player[i].targetheadpitch=player[i].lookpitch;
                     }
                     if(indialogue!=-1){
-                        player[i].targetheadrotation=180-roughDirection(participantfacing[whichdialogue][indialogue][i]);
-                        player[i].targetheadrotation2=pitch(participantfacing[whichdialogue][indialogue][i]);
+                        player[i].targetheadyaw=180-roughDirection(participantfacing[whichdialogue][indialogue][i]);
+                        player[i].targetheadpitch=pitchOf(participantfacing[whichdialogue][indialogue][i]);
                     }
 
                     if(leveltime<.5)
@@ -6778,7 +6948,7 @@ void Game::Tick(){
                     doAI(i);
 
                     if(animation[player[i].targetanimation].attack==reversed){
-                        //player[i].targetrotation=player[i].rotation;
+                        //player[i].targetyaw=player[i].yaw;
                         player[i].forwardkeydown=0;
                         player[i].leftkeydown=0;
                         player[i].backkeydown=0;
@@ -6854,7 +7024,7 @@ void Game::Tick(){
                                                     player[i].aitype!=playercontrolled){
                                                 player[i].throwtogglekeydown=1;
                                                 player[i].setAnimation(crouchremoveknifeanim);
-                                                player[i].targetrotation=roughDirectionTo(player[i].coords,weapons[j].position);
+                                                player[i].targetyaw=roughDirectionTo(player[i].coords,weapons[j].position);
                                                 player[i].hasvictim=0;
                                             }
                                             if(player[i].targetanimation==rollanim||player[i].targetanimation==backhandspringanim){
@@ -6887,7 +7057,7 @@ void Game::Tick(){
                                             if(!player[i].isFlip()){
                                                 player[i].throwtogglekeydown=1;
                                                 player[i].setAnimation(removeknifeanim);
-                                                player[i].targetrotation=roughDirectionTo(player[i].coords,weapons[j].position);
+                                                player[i].targetyaw=roughDirectionTo(player[i].coords,weapons[j].position);
                                             }
                                             if(player[i].isFlip()){
                                                 player[i].throwtogglekeydown=1;
@@ -6940,7 +7110,7 @@ void Game::Tick(){
                                                         player[i].victim=&player[j];
                                                         player[i].hasvictim=1;
                                                         player[i].setAnimation(crouchremoveknifeanim);
-                                                        player[i].targetrotation=roughDirectionTo(player[i].coords,player[j].coords);
+                                                        player[i].targetyaw=roughDirectionTo(player[i].coords,player[j].coords);
                                                     }
                                                     if(player[i].targetanimation==rollanim||player[i].targetanimation==backhandspringanim){
                                                         player[i].throwtogglekeydown=1;
@@ -7034,12 +7204,12 @@ void Game::Tick(){
                                                                 findDistancefast(&player[i].coords,&player[j].coords)<100&&
                                                                 findDistancefast(&player[i].coords,&player[j].coords)>1.5&&
                                                                 !player[j].skeleton.free&&
-                                                                -1==checkcollide(DoRotation(player[j].getJointFor(head).position,0,player[j].rotation,0)*player[j].scale+player[j].coords,DoRotation(player[i].getJointFor(head).position,0,player[i].rotation,0)*player[i].scale+player[i].coords)){
+                                                                -1==checkcollide(DoRotation(player[j].getJointFor(head).position,0,player[j].yaw,0)*player[j].scale+player[j].coords,DoRotation(player[i].getJointFor(head).position,0,player[i].yaw,0)*player[i].scale+player[i].coords)){
                                                             if(!player[i].isFlip()){
                                                                 player[i].throwtogglekeydown=1;
                                                                 player[i].victim=&player[j];
                                                                 player[i].setAnimation(knifethrowanim);
-                                                                player[i].targetrotation=roughDirectionTo(player[i].coords,player[j].coords);
+                                                                player[i].targetyaw=roughDirectionTo(player[i].coords,player[j].coords);
                                                                 player[i].targettilt2=pitchTo(player[i].coords,player[j].coords);
                                                             }
                                                             if(player[i].isFlip()){
@@ -7048,7 +7218,7 @@ void Game::Tick(){
                                                                     player[i].victim=&player[j];
                                                                     XYZ aim;
                                                                     weapons[player[i].weaponids[0]].owner=-1;
-                                                                    aim=player[i].victim->coords+DoRotation(player[i].victim->getJointFor(abdomen).position,0,player[i].victim->rotation,0)*player[i].victim->scale+player[i].victim->velocity*findDistance(&player[i].victim->coords,&player[i].coords)/50-(player[i].coords+DoRotation(player[i].getJointFor(righthand).position,0,player[i].rotation,0)*player[i].scale);
+                                                                    aim=player[i].victim->coords+DoRotation(player[i].victim->getJointFor(abdomen).position,0,player[i].victim->yaw,0)*player[i].victim->scale+player[i].victim->velocity*findDistance(&player[i].victim->coords,&player[i].coords)/50-(player[i].coords+DoRotation(player[i].getJointFor(righthand).position,0,player[i].yaw,0)*player[i].scale);
                                                                     Normalise(&aim);
 
                                                                     aim=DoRotation(aim,(float)abs(Random()%30)-15,(float)abs(Random()%30)-15,0);
@@ -7156,7 +7326,7 @@ void Game::Tick(){
                         absflatfacing=0;
                         absflatfacing.z=-1;
 
-                        absflatfacing=DoRotation(absflatfacing,0,-rotation,0);
+                        absflatfacing=DoRotation(absflatfacing,0,-yaw,0);
                     } else
                                                absflatfacing=flatfacing;
 
@@ -7272,7 +7442,7 @@ void Game::Tick(){
                         if(player[i].forwardkeydown){
                             if(player[i].isIdle()||
                                     (player[i].isStop()&&
-                                     player[i].targetrotation==player[i].rotation)||
+                                     player[i].targetyaw==player[i].yaw)||
                                     (player[i].isLanding()&&
                                      player[i].targetframe>0&&
                                      !player[i].jumpkeydown)||
@@ -7305,7 +7475,7 @@ void Game::Tick(){
                         if (player[i].rightkeydown){
                             if(player[i].isIdle()||
                                     (player[i].isStop()&&
-                                     player[i].targetrotation==player[i].rotation)||
+                                     player[i].targetyaw==player[i].yaw)||
                                     (player[i].isLanding()&&
                                      player[i].targetframe>0&&
                                      !player[i].jumpkeydown)||
@@ -7324,15 +7494,15 @@ void Game::Tick(){
                             if(player[i].targetanimation==jumpupanim||player[i].targetanimation==jumpdownanim||player[i].isFlip()){
                                 player[i].velocity+=DoRotation(absflatfacing*5*multiplier,0,-90,0);
                             }
-                            player[i].targetrotation-=90;
-                            if(player[i].forwardkeydown)player[i].targetrotation+=45;
-                            if(player[i].backkeydown)player[i].targetrotation-=45;
+                            player[i].targetyaw-=90;
+                            if(player[i].forwardkeydown)player[i].targetyaw+=45;
+                            if(player[i].backkeydown)player[i].targetyaw-=45;
                             movekey=1;
                         }
                         if ( player[i].leftkeydown){
                             if(player[i].isIdle()||
                                     (player[i].isStop()&&
-                                     player[i].targetrotation==player[i].rotation)||
+                                     player[i].targetyaw==player[i].yaw)||
                                     (player[i].isLanding()&&
                                      player[i].targetframe>0&&
                                      !player[i].jumpkeydown)||
@@ -7351,15 +7521,15 @@ void Game::Tick(){
                             if(player[i].targetanimation==jumpupanim||player[i].targetanimation==jumpdownanim||player[i].isFlip()){
                                 player[i].velocity-=DoRotation(absflatfacing*5*multiplier,0,-90,0);
                             }
-                            player[i].targetrotation+=90;
-                            if(player[i].forwardkeydown)player[i].targetrotation-=45;
-                            if(player[i].backkeydown)player[i].targetrotation+=45;
+                            player[i].targetyaw+=90;
+                            if(player[i].forwardkeydown)player[i].targetyaw-=45;
+                            if(player[i].backkeydown)player[i].targetyaw+=45;
                             movekey=1;
                         }
                         if(player[i].backkeydown){
                             if(player[i].isIdle()||
                                     (player[i].isStop()&&
-                                     player[i].targetrotation==player[i].rotation)||
+                                     player[i].targetyaw==player[i].yaw)||
                                     (player[i].isLanding()&&
                                      player[i].targetframe>0&&
                                      !player[i].jumpkeydown)||
@@ -7390,7 +7560,7 @@ void Game::Tick(){
                                 player[i].grabdelay=1;
                             }
                             if ( !player[i].leftkeydown&&!player[i].rightkeydown)
-                                player[i].targetrotation+=180;
+                                player[i].targetyaw+=180;
                             movekey=1;
                         }
                         if((player[i].jumpkeydown&&!player[i].jumpclimb)||player[i].jumpstart){
@@ -7404,14 +7574,14 @@ void Game::Tick(){
                                       player[i].targetanimation!=wolfrunninganim)||i!=0)){
                                 player[i].jumpstart=0;
                                 player[i].setAnimation(jumpupanim);
-                                player[i].rotation=player[i].targetrotation;
+                                player[i].yaw=player[i].targetyaw;
                                 player[i].transspeed=20;
                                 player[i].FootLand(0,1);
                                 player[i].FootLand(1,1);
 
                                 facing=0;
                                 facing.z=-1;
-                                flatfacing=DoRotation(facing,0,player[i].targetrotation+180,0);
+                                flatfacing=DoRotation(facing,0,player[i].targetyaw+180,0);
 
                                 if(movekey)player[i].velocity=flatfacing*player[i].speed*45*player[i].scale;
                                 if(!movekey)player[i].velocity=0;
@@ -7494,20 +7664,20 @@ void Game::Tick(){
                     }
                 }
                 if(player[i].targetanimation==rollanim)
-                    player[i].targetrotation=oldtargetrotation;
+                    player[i].targetyaw=oldtargetyaw;
             }
 
             //Rotation
             for(int k=0;k<numplayers;k++){
-                if(fabs(player[k].rotation-player[k].targetrotation)>180){
-                    if(player[k].rotation>player[k].targetrotation)
-                        player[k].rotation-=360;
+                if(fabs(player[k].yaw-player[k].targetyaw)>180){
+                    if(player[k].yaw>player[k].targetyaw)
+                        player[k].yaw-=360;
                     else
-                        player[k].rotation+=360;
+                        player[k].yaw+=360;
                 }
 
                 //stop to turn in right direction
-                if(fabs(player[k].rotation-player[k].targetrotation)>90&&(player[k].isRun()||player[k].targetanimation==walkanim))
+                if(fabs(player[k].yaw-player[k].targetyaw)>90&&(player[k].isRun()||player[k].targetanimation==walkanim))
                     player[k].setAnimation(player[k].getStop());
 
                 if(player[k].targetanimation==backhandspringanim||player[k].targetanimation==dodgebackanim)
@@ -7528,7 +7698,7 @@ void Game::Tick(){
                 }
 
                 if(player[k].isRun())
-                    player[k].targettilt=(player[k].rotation-player[k].targetrotation)/4;
+                    player[k].targettilt=(player[k].yaw-player[k].targetyaw)/4;
 
                 player[k].tilt=stepTowardf(player[k].tilt,player[k].targettilt,multiplier*150);
                 player[k].grabdelay-=multiplier;
@@ -7604,7 +7774,7 @@ void Game::Tick(){
                             if(Random()%2==0){
                                 if(!player[1].skeleton.free)temp2=(player[1].coords-player[1].oldcoords)/multiplier/2;//velocity/2;
                                 if(player[1].skeleton.free)temp2=player[1].skeleton.joints[i].velocity*player[1].scale/2;
-                                if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].rotation,0)*player[1].scale+player[1].coords;
+                                if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].yaw,0)*player[1].scale+player[1].coords;
                                 if(player[1].skeleton.free)temp=player[1].skeleton.joints[i].position*player[1].scale+player[1].coords;
                                 Sprite::MakeSprite(breathsprite, temp,temp2, 1,1,1, .6+(float)abs(Random()%100)/200-.25, 1);
                             }
@@ -7616,7 +7786,7 @@ void Game::Tick(){
                             if(Random()%2==0){
                                 if(!player[1].skeleton.free)temp2=(player[1].coords-player[1].oldcoords)/multiplier/2;//velocity/2;
                                 if(player[1].skeleton.free)temp2=player[1].skeleton.joints[i].velocity*player[1].scale/2;
-                                if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].rotation,0)*player[1].scale+player[1].coords;
+                                if(!player[1].skeleton.free)temp=DoRotation(DoRotation(DoRotation(player[1].skeleton.joints[i].position,0,0,player[1].tilt),player[1].tilt2,0,0),0,player[1].yaw,0)*player[1].scale+player[1].coords;
                                 if(player[1].skeleton.free)temp=player[1].skeleton.joints[i].position*player[1].scale+player[1].coords;
                                 Sprite::MakeSprite(breathsprite, temp,temp2, 1,1,1, .6+(float)abs(Random()%100)/200-.25, 1);
                             }
@@ -7640,14 +7810,14 @@ void Game::Tick(){
             upvector=0;
             upvector.z=-1;
 
-            upvector=DoRotation(upvector,-rotation2+90,0,0);
-            upvector=DoRotation(upvector,0,0-rotation,0);
+            upvector=DoRotation(upvector,-pitch+90,0,0);
+            upvector=DoRotation(upvector,0,0-yaw,0);
 
             facing=0;
             facing.z=-1;
 
-            facing=DoRotation(facing,-rotation2,0,0);
-            facing=DoRotation(facing,0,0-rotation,0);
+            facing=DoRotation(facing,-pitch,0,0);
+            facing=DoRotation(facing,0,0-yaw,0);
 
 
             static float ori[6];
@@ -7671,18 +7841,18 @@ void Game::Tick(){
 
 void Game::TickOnce(){
        if(mainmenu)
-               rotation+=multiplier*5;
+               yaw+=multiplier*5;
        else
                if(directing||indialogue==-1) {
-                       rotation+=deltah*.7;
+                       yaw+=deltah*.7;
                        if(!invertmouse)
-                rotation2+=deltav*.7;
+                pitch+=deltav*.7;
                        if(invertmouse)
-                rotation2-=deltav*.7;
-                       if(rotation2>90)
-                rotation2=90;
-                       if(rotation2<-70)
-                rotation2=-70;
+                pitch-=deltav*.7;
+                       if(pitch>90)
+                pitch=90;
+                       if(pitch<-70)
+                pitch=-70;
                }
 }
 
@@ -7698,6 +7868,7 @@ void Game::TickOnceAfter(){
        static float cameraspeed;
 
        if(!mainmenu){
+        static int oldmusictype=musictype;
 
                if(environment==snowyenvironment)
             leveltheme=stream_snowtheme;
@@ -7993,8 +8164,8 @@ void Game::TickOnceAfter(){
        facing=0;
        facing.z=-1;
 
-       facing=DoRotation(facing,-rotation2,0,0);
-       facing=DoRotation(facing,0,0-rotation,0);
+       facing=DoRotation(facing,-pitch,0,0);
+       facing=DoRotation(facing,0,0-yaw,0);
        viewerfacing=facing;
 
        if(!cameramode){
@@ -8008,7 +8179,7 @@ void Game::TickOnceAfter(){
                        }
                        target.y+=.1;
                }
-               if(player[0].skeleton.free!=2&&!autocam){
+               if(player[0].skeleton.free!=2/*&&!autocam*/){
                        cameraspeed=20;
                        if(findLengthfast(&player[0].velocity)>400){
                                cameraspeed=20+(findLength(&player[0].velocity)-20)*.96;
@@ -8033,13 +8204,13 @@ void Game::TickOnceAfter(){
                                        int i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
                                        colviewer=viewer;
                                        coltarget=cameraloc;
-                                       if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.rotation[i])!=-1)viewer=col;
+                                       if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.yaw[i])!=-1)viewer=col;
                                }
             if(terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz])
                 for(int j=0;j<terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz];j++){
                     int i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
                     colviewer=viewer;
-                    if(objects.model[i].SphereCheck(&colviewer,.15,&col,&objects.position[i],&objects.rotation[i])!=-1){
+                    if(objects.model[i].SphereCheck(&colviewer,.15,&col,&objects.position[i],&objects.yaw[i])!=-1){
                         viewer=colviewer;
                     }
                 }
@@ -8049,6 +8220,8 @@ void Game::TickOnceAfter(){
                 cameraloc.y=terrain.getHeight(cameraloc.x,cameraloc.z);
             }
                }
+        /*
+        //what did autocam do?
                if(player[0].skeleton.free!=2&&autocam){
                        cameraspeed=20;
                        if(findLengthfast(&player[0].velocity)>400){
@@ -8075,13 +8248,13 @@ void Game::TickOnceAfter(){
                                        int i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
                                        colviewer=viewer;
                                        coltarget=cameraloc;
-                                       if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.rotation[i])!=-1)viewer=col;
+                                       if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.yaw[i])!=-1)viewer=col;
                                }
             if(terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz])
                 for(int j=0;j<terrain.patchobjectnum[player[0].whichpatchx][player[0].whichpatchz];j++){
                     int i=terrain.patchobjects[player[0].whichpatchx][player[0].whichpatchz][j];
                     colviewer=viewer;
-                    if(objects.model[i].SphereCheck(&colviewer,.15,&col,&objects.position[i],&objects.rotation[i])!=-1){
+                    if(objects.model[i].SphereCheck(&colviewer,.15,&col,&objects.position[i],&objects.yaw[i])!=-1){
                         viewer=colviewer;
                     }
                 }
@@ -8091,6 +8264,7 @@ void Game::TickOnceAfter(){
                 cameraloc.y=terrain.getHeight(cameraloc.x,cameraloc.z);
             }
                }
+        */
                if(camerashake>.8)camerashake=.8;
                //if(woozy>10)woozy=10;
                //woozy+=multiplier;
index ffc13d7f44a2dfe8772d4add4fa9319b00e7d841..6add2e26c628899f353e29288aa39fb1d618798f 100644 (file)
@@ -183,8 +183,6 @@ bool vertexweird[6] = {0};
 TGAImageRec texture;
 bool debugmode = false;
 
-bool won = false;
-
 
 bool campaign = false;
 
index a01fc1193598d379c0cc390c5fc7d7d53372ffec..353fa6e31f74b8d88215b2aa40928466b447bd74 100644 (file)
@@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "Objects.h"
 extern XYZ viewer;
 extern float viewdistance;
-extern float lightambient[3],lightbrightness[3];
 extern float fadestart;
 extern int environment;
 extern float texscale;
@@ -53,7 +52,7 @@ bool  Objects::checkcollide(XYZ startpoint,XYZ endpoint,int which){
                if(type[i]!=treeleavestype&&type[i]!=treetrunktype&&type[i]!=bushtype&&type[i]!=firetype&&i!=which){
                        colviewer=startpoint;
                        coltarget=endpoint;
-                       if(model[i].LineCheck(&colviewer,&coltarget,&colpoint,&position[i],&rotation[i])!=-1)return 1;  
+                       if(model[i].LineCheck(&colviewer,&coltarget,&colpoint,&position[i],&yaw[i])!=-1)return 1;       
                }
        }
 
@@ -74,7 +73,7 @@ void Objects::SphereCheckPossible(XYZ *p1,float radius)
                        for(j=0;j<terrain.patchobjectnum[whichpatchx][whichpatchz];j++){
                                i=terrain.patchobjects[whichpatchx][whichpatchz][j];
                                possible[i]=0;
-                               if(model[i].SphereCheckPossible(p1, radius, &position[i], &rotation[i])!=-1){
+                               if(model[i].SphereCheckPossible(p1, radius, &position[i], &yaw[i])!=-1){
                                        possible[i]=1;
                                }
                        }
@@ -89,7 +88,7 @@ void Objects::Draw()
 
        for(i=0;i<numobjects;i++){
                if(type[i]!=firetype){
-                       moved=DoRotation(model[i].boundingspherecenter,0,rotation[i],0);
+                       moved=DoRotation(model[i].boundingspherecenter,0,yaw[i],0);
                        if(type[i]==tunneltype||frustum.SphereInFrustum(position[i].x+moved.x,position[i].y+moved.y,position[i].z+moved.z,model[i].boundingsphereradius)){   
                                distance=findDistancefast(&viewer,&position[i]);
                                distance*=1.2;
@@ -102,7 +101,7 @@ void Objects::Draw()
                                        if(distance>1)distance=1;
                                        if(distance>0){
 
-                                               /*if(checkcollide(viewer,DoRotation(model[i].vertex[model[i].vertexNum],0,rotation[i],0)*scale[i]+position[i],i)){
+                                               /*if(checkcollide(viewer,DoRotation(model[i].vertex[model[i].vertexNum],0,yaw[i],0)*scale[i]+position[i],i)){
                                                occluded[i]+=1;
                                                }
                                                else occluded[i]=0;*/
@@ -255,7 +254,7 @@ void Objects::Draw()
                                                                                glRotatef((sin(windvar+position[i].x*.3)+.5)*4*.5*(sin(windvar*2+position[i].x*.3)+1)/2,1,0,0);
                                                                        }
                                                                }
-                                                               glRotatef(rotation[i],0,1,0);
+                                                               glRotatef(yaw[i],0,1,0);
                                                                if(distance>1)distance=1;
                                                                glColor4f((1-shadowed[i])/2+.5,(1-shadowed[i])/2+.5,(1-shadowed[i])/2+.5,distance);
                                                                if(distance>=1){
@@ -328,7 +327,7 @@ void Objects::Draw()
        glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0 );
        for(i=0;i<numobjects;i++){
                if(type[i]==treeleavestype||type[i]==bushtype){
-                       moved=DoRotation(model[i].boundingspherecenter,0,rotation[i],0);
+                       moved=DoRotation(model[i].boundingspherecenter,0,yaw[i],0);
                        if(frustum.SphereInFrustum(position[i].x+moved.x,position[i].y+moved.y,position[i].z+moved.z,model[i].boundingsphereradius)){   
                                hidden=findDistancefastflat(&viewer,&position[i])<=playerdist+3;
                                if(hidden){
@@ -436,7 +435,7 @@ void Objects::Draw()
                                                                                glRotatef((sin(windvar+position[i].x*.3)+.5)*4*.5*(sin(windvar*2+position[i].x*.3)+1)/2,1,0,0);
                                                                        }
                                                                }
-                                                               glRotatef(rotation[i],0,1,0);
+                                                               glRotatef(yaw[i],0,1,0);
                                                                glColor4f(1,1,1,distance);
                                                                if(type[i]==treeleavestype){
                                                                        glDisable(GL_CULL_FACE);
@@ -475,7 +474,7 @@ void Objects::Draw()
 void Objects::DeleteObject(int which)
 {
        type[numobjects-1]=0;
-       rotation[numobjects-1]=0;
+       yaw[numobjects-1]=0;
        position[numobjects-1]=0;
        scale[numobjects-1]=0;
        friction[numobjects-1]=0;
@@ -483,7 +482,7 @@ void Objects::DeleteObject(int which)
        numobjects--;
 }
 
-void Objects::MakeObject(int atype, XYZ where, float arotation, float ascale){
+void Objects::MakeObject(int atype, XYZ where, float ayaw, float ascale){
        if((atype!=treeleavestype&&atype!=bushtype)||foliage==1){
                scale[numobjects]=ascale;
                if(atype==treeleavestype)scale[numobjects]+=fabs((float)(Random()%100)/900)*ascale;
@@ -496,7 +495,7 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float ascale){
 
                position[numobjects]=where;
                if(atype==bushtype)position[numobjects].y=terrain.getHeight(position[numobjects].x,position[numobjects].z)-.3;
-               rotation[numobjects]=arotation;
+               yaw[numobjects]=ayaw;
 
                rotxvel[numobjects]=0;
                rotyvel[numobjects]=0;
@@ -546,7 +545,7 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float ascale){
                model[numobjects].Scale(.3*scale[numobjects],.3*scale[numobjects],.3*scale[numobjects]);
                model[numobjects].Rotate(90,1,1);
                if(type[numobjects]==rocktype){
-                       model[numobjects].Rotate(arotation*5,1,1);
+                       model[numobjects].Rotate(ayaw*5,1,1);
                }
                model[numobjects].CalculateNormals(1);
                model[numobjects].ScaleNormals(-1,-1,-1);
@@ -560,13 +559,13 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float ascale){
                }
 
                if(atype!=treeleavestype&&atype!=bushtype&&atype!=firetype)
-                       terrain.AddObject(where+DoRotation(model[numobjects].boundingspherecenter,0,arotation,0),model[numobjects].boundingsphereradius,numobjects);
+                       terrain.AddObject(where+DoRotation(model[numobjects].boundingspherecenter,0,ayaw,0),model[numobjects].boundingsphereradius,numobjects);
 
                numobjects++;
        }       
 }
 
-void Objects::MakeObject(int atype, XYZ where, float arotation, float arotation2, float ascale){
+void Objects::MakeObject(int atype, XYZ where, float ayaw, float apitch, float ascale){
        if((atype!=treeleavestype&&atype!=bushtype)||foliage==1){
                scale[numobjects]=ascale;
                if(atype==treeleavestype)scale[numobjects]+=fabs((float)(Random()%100)/900)*ascale;
@@ -583,8 +582,8 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float arotation2
                if(position[numobjects].y<terrain.getHeight(position[numobjects].x,position[numobjects].z)-.3)
                position[numobjects].y=terrain.getHeight(position[numobjects].x,position[numobjects].z)-.3;
                }*/
-               rotation[numobjects]=arotation;
-               rotation2[numobjects]=arotation2;
+               yaw[numobjects]=ayaw;
+               pitch[numobjects]=apitch;
 
                rotxvel[numobjects]=0;
                rotyvel[numobjects]=0;
@@ -616,7 +615,7 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float arotation2
                if(atype==treetrunktype)friction[numobjects]=.4;
                if(atype==treeleavestype)friction[numobjects]=0;
 
-               if(friction[numobjects]==1.5&&fabs(arotation2)>5)friction[numobjects]=.5;
+               if(friction[numobjects]==1.5&&fabs(apitch)>5)friction[numobjects]=.5;
 
                if(atype==platformtype){
                        model[numobjects].loaddecal((char *)":Data:Models:Platform.solid",0);
@@ -635,9 +634,9 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float arotation2
                }
                model[numobjects].Scale(.3*scale[numobjects],.3*scale[numobjects],.3*scale[numobjects]);
                model[numobjects].Rotate(90,1,1);
-               model[numobjects].Rotate(arotation2,0,0);
+               model[numobjects].Rotate(apitch,0,0);
                if(type[numobjects]==rocktype){
-                       model[numobjects].Rotate(arotation*5,0,0);
+                       model[numobjects].Rotate(ayaw*5,0,0);
                }
                model[numobjects].CalculateNormals(1);
                model[numobjects].ScaleNormals(-1,-1,-1);
@@ -651,7 +650,7 @@ void Objects::MakeObject(int atype, XYZ where, float arotation, float arotation2
                }
 
                if(atype!=treeleavestype&&atype!=bushtype&&atype!=firetype)
-                       terrain.AddObject(where+DoRotation(model[numobjects].boundingspherecenter,0,arotation,0),model[numobjects].boundingsphereradius,numobjects);
+                       terrain.AddObject(where+DoRotation(model[numobjects].boundingspherecenter,0,ayaw,0),model[numobjects].boundingsphereradius,numobjects);
 
                numobjects++;
        }       
@@ -696,8 +695,7 @@ void Objects::DoStuff()
 
 void Objects::DoShadows()
 {
-       int i,j,k,l,todivide;
-       static float brightness, total;
+       int i,j,k,l;
        static XYZ testpoint,testpoint2, terrainpoint,lightloc,col;
        lightloc=light.location;
        if(!skyboxtexture)lightloc=0;
@@ -709,7 +707,7 @@ void Objects::DoShadows()
                for(i=0;i<numobjects;i++){
                        if(type[i]!=treeleavestype&&type[i]!=treetrunktype&&type[i]!=bushtype&&type[i]!=firetype){
                                for(j=0;j<model[i].vertexNum;j++){
-                                       terrainpoint=position[i]+DoRotation(model[i].vertex[j]+model[i].normals[j]*.1,0,rotation[i],0);
+                                       terrainpoint=position[i]+DoRotation(model[i].vertex[j]+model[i].normals[j]*.1,0,yaw[i],0);
                                        //terrainpoint.y+=model[i].boundingsphereradius;
                                        shadowed[i]=0;
                                        patchx=terrainpoint.x/(terrain.size/subdivision*terrain.scale);
@@ -721,13 +719,13 @@ void Objects::DoShadows()
                                                                if(type[l]!=treetrunktype/*&&l!=i*/){
                                                                        testpoint=terrainpoint;
                                                                        testpoint2=terrainpoint+lightloc*50*(1-shadowed[i]);
-                                                                       if(model[l].LineCheck(&testpoint,&testpoint2,&col,&position[l],&rotation[l])!=-1){
+                                                                       if(model[l].LineCheck(&testpoint,&testpoint2,&col,&position[l],&yaw[l])!=-1){
                                                                                shadowed[i]=1-(findDistance(&terrainpoint,&col)/50);    
                                                                        }
                                                                }
                                                        }
                                                        if(shadowed[i]>0){
-                                                               col=model[i].normals[j]-DoRotation(lightloc*shadowed[i],0,-rotation[i],0);
+                                                               col=model[i].normals[j]-DoRotation(lightloc*shadowed[i],0,-yaw[i],0);
                                                                Normalise(&col);
                                                                for(k=0;k<model[i].TriangleNum;k++){
                                                                        if(model[i].Triangles[k].vertex[0]==j){
@@ -768,8 +766,8 @@ Objects::Objects()
 
        memset(position, 0, sizeof(position));
        memset(type, 0, sizeof(type));
-       memset(rotation, 0, sizeof(rotation));
-       memset(rotation2, 0, sizeof(rotation2));
+       memset(yaw, 0, sizeof(yaw));
+       memset(pitch, 0, sizeof(pitch));
        memset(rotx, 0, sizeof(rotx));
        memset(rotxvel, 0, sizeof(rotxvel));
        memset(roty, 0, sizeof(roty));
index 400d6b3064e4f300b744dd134d50fef0de96d26d..4d35552acd773694affea99fd543070c06ca2467 100644 (file)
@@ -59,8 +59,8 @@ public:
        float radius;
        XYZ position[max_objects];
        int type[max_objects];
-       float rotation[max_objects];
-       float rotation2[max_objects];
+       float yaw[max_objects];
+       float pitch[max_objects];
        float rotx[max_objects];
        float rotxvel[max_objects];
        float roty[max_objects];
@@ -85,8 +85,8 @@ public:
 
        void SphereCheckPossible(XYZ *p1,float radius);
        void DeleteObject(int which);
-       void MakeObject(int atype, XYZ where, float arotation, float ascale);
-       void MakeObject(int atype, XYZ where, float arotation, float arotation2, float ascale);
+       void MakeObject(int atype, XYZ where, float ayaw, float ascale);
+       void MakeObject(int atype, XYZ where, float ayaw, float apitch, float ascale);
        void Draw();
        void DoShadows();
        void DoStuff();
index a9edfb56952e54b6a068342e2d366fe18e99fea0..e064f99d2362aad372358a5665b4b947c526ad5b 100644 (file)
@@ -549,7 +549,12 @@ void DoUpdate ()
                num_channels = 0;
        }
 */
-       DrawGL();
+       if ( stereomode == stereoNone ) {
+               DrawGLScene(stereoCenter);
+       } else {
+               DrawGLScene(stereoLeft);
+               DrawGLScene(stereoRight);
+       }
 }
 
 // --------------------------------------------------------------------------
@@ -707,7 +712,7 @@ int main(int argc, char **argv)
                        if (!SetUp ())
                 return 42;
 
-                       while (!gDone&&!quit&&(!tryquit))
+                       while (!gDone&&!tryquit)
                        {
                                        if (IsFocused())
                                        {
index b2bb052e035868fe2ef559d6834e0272c7c2a150..4a9898f14b0f9d3894486145151d7db3b1471a78 100644 (file)
@@ -141,7 +141,7 @@ void Person::CheckKick()
       velocity=0;
       victim->oldcoords=victim->coords;
       coords=victim->coords;
-      victim->targetrotation=targetrotation;
+      victim->targetyaw=targetyaw;
       victim->victim=this;
     }
 }
@@ -153,7 +153,7 @@ void Person::CatchFire(){
                howmany=abs(Random()%(skeleton.num_joints));
                if(!skeleton.free)flatvelocity=velocity;
                if(skeleton.free)flatvelocity=skeleton.joints[howmany].velocity;
-               if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords;
+               if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,yaw,0)*scale+coords;
                if(skeleton.free)flatfacing=skeleton.joints[howmany].position*scale+coords;
                Sprite::MakeSprite(flamesprite, flatfacing,flatvelocity, 1,1,1, 2, 1);
        }
@@ -254,20 +254,20 @@ void Person::DoBlood(float howmuch,int which){
                                bloodvel=0;
                                if(!skeleton.free){
                                        bloodvel.z=10;
-                                       bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                                       bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                }
                                if(skeleton.free){
                                        bloodvel-=DoRotation(skeleton.forward*10*scale,((float)(Random()%100))/4,((float)(Random()%100))/4,0);
                                }
-                               if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                               if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale;
                                if(skeleton.free){
                                        Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1);
                                        Sprite::MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1);
                                }
                                if(!skeleton.free){
-                                       Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
-                                       Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1);
+                                       Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
+                                       Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .3, 1);
                                }
                        }
                        if(Random()%2==0)
@@ -276,17 +276,17 @@ void Person::DoBlood(float howmuch,int which){
                                                bloodvel=0;
                                                if(skeleton.free) {
                                                        bloodvel-=DoRotation(skeleton.forward*10*scale,((float)(Random()%100))/4,((float)(Random()%100))/4,0);
-                                                       bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                                                       bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                                } else {
                                                        bloodvel.z=10;
-                                                       bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                                                       bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                                        bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale;
                                                }
                                                bloodvel*=.2;
                                                if(skeleton.free){
                                                        Sprite::MakeSprite(splintersprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1);
                                                } else {
-                                                       Sprite::MakeSprite(splintersprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
+                                                       Sprite::MakeSprite(splintersprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
                                                }
                                                Sprite::setLastSpriteSpecial(3);
                                        }
@@ -365,20 +365,20 @@ void Person::DoBloodBig(float howmuch,int which){
                                        bloodvel=0;
                                        if(!skeleton.free){
                                                bloodvel.z=10;
-                                               bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                                               bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                        }
                                        if(skeleton.free){
                                                bloodvel-=DoRotation(skeleton.forward*10*scale,((float)(Random()%100))/4,((float)(Random()%100))/4,0);
                                        }
-                                       if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                                       if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                        if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale;
                                        if(skeleton.free){
                                                Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1);
                                                Sprite::MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1);
                                        }
                                        if(!skeleton.free){
-                                               Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
-                                               Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1);
+                                               Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
+                                               Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .3, 1);
                                        }
                                }
                        }
@@ -530,7 +530,7 @@ bool Person::DoBloodBigWhere(float howmuch,int which, XYZ where){
 
        if(bloodtoggle&&decals&&tutoriallevel!=1){
                where-=coords;
-               if(!skeleton.free)where=DoRotation(where,0,-rotation,0);
+               if(!skeleton.free)where=DoRotation(where,0,-yaw,0);
                //where=scale;
                startpoint=where;
                startpoint.y+=100;
@@ -589,20 +589,20 @@ bool Person::DoBloodBigWhere(float howmuch,int which, XYZ where){
                                        bloodvel=0;
                                        if(!skeleton.free){
                                                bloodvel.z=10;
-                                               bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                                               bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                        }
                                        if(skeleton.free){
                                                bloodvel-=DoRotation(skeleton.forward*10*scale,((float)(Random()%100))/4,((float)(Random()%100))/4,0);
                                        }
-                                       if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                                       if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                        if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale;
                                        if(skeleton.free){
                                                Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1);
                                                Sprite::MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1);
                                        }
                                        if(!skeleton.free){
-                                               Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
-                                               Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1);
+                                               Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
+                                               Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .3, 1);
                                        }
                                }
                        }
@@ -892,8 +892,8 @@ void Person::Reverse()
     victim->velocity=0;
     victim->oldcoords=victim->coords;
     victim->coords=coords;
-    victim->targetrotation=targetrotation;
-    victim->rotation=targetrotation;
+    victim->targetyaw=targetyaw;
+    victim->yaw=targetyaw;
     victim->victim=this;
   }
   if(targetanimation==winduppunchanim){
@@ -902,7 +902,7 @@ void Person::Reverse()
     victim->targetframe=1;
     victim->target=.5;
     victim->victim=this;
-    victim->targetrotation=targetrotation+180;
+    victim->targetyaw=targetyaw+180;
   }
   if(targetanimation==wolfslapanim){
     targetanimation=winduppunchblockedanim;
@@ -910,7 +910,7 @@ void Person::Reverse()
     victim->targetframe=1;
     victim->target=.5;
     victim->victim=this;
-    victim->targetrotation=targetrotation+180;
+    victim->targetyaw=targetyaw+180;
   }
   if((targetanimation==swordslashanim||targetanimation==staffhitanim||targetanimation==staffspinhitanim)&&victim->weaponactive!=-1){
     targetanimation=swordslashparriedanim;
@@ -920,7 +920,7 @@ void Person::Reverse()
     victim->targetframe=1;
     victim->target=.5;
     victim->victim=this;
-    victim->targetrotation=targetrotation+180;
+    victim->targetyaw=targetyaw+180;
 
     if(abs(Random()%20)==0||weapons[victim->weaponids[victim->weaponactive]].getType()==knife){
       if(victim->weaponactive!=-1){
@@ -940,7 +940,7 @@ void Person::Reverse()
       victim->target=0;
       victim->targetframe=0;
       victim->targetanimation=staggerbackhighanim;
-      victim->targetrotation=targetrotation+180;
+      victim->targetyaw=targetyaw+180;
       victim->target=0;
       weapons[victim->weaponids[0]].owner=-1;
       aim=DoRotation(facing,0,90,0)*21;
@@ -981,7 +981,7 @@ void Person::Reverse()
       target=0;
       targetframe=0;
       targetanimation=staggerbackhighanim;
-      targetrotation=targetrotation+180;
+      targetyaw=targetyaw+180;
       target=0;
       weapons[weaponids[0]].owner=-1;
       aim=DoRotation(facing,0,90,0)*21;
@@ -1016,9 +1016,9 @@ void Person::Reverse()
        XYZ rotatetarget;
        rotatetarget=coords-victim->coords;
        Normalise(&rotatetarget);
-       victim->targetrotation=-asin(0-rotatetarget.x);
-       victim->targetrotation*=360/6.28;
-       if(rotatetarget.z<0)victim->targetrotation=180-victim->targetrotation;
+       victim->targetyaw=-asin(0-rotatetarget.x);
+       victim->targetyaw*=360/6.28;
+       if(rotatetarget.z<0)victim->targetyaw=180-victim->targetyaw;
 
        victim->targettilt2=-asin(rotatetarget.y)*360/6.28;//*-70;
 
@@ -1035,9 +1035,9 @@ void Person::Reverse()
          XYZ rotatetarget;
          rotatetarget=coords-victim->coords;
          Normalise(&rotatetarget);
-         victim->targetrotation=-asin(0-rotatetarget.x);
-         victim->targetrotation*=360/6.28;
-         if(rotatetarget.z<0)victim->targetrotation=180-victim->targetrotation;
+         victim->targetyaw=-asin(0-rotatetarget.x);
+         victim->targetyaw*=360/6.28;
+         if(rotatetarget.z<0)victim->targetyaw=180-victim->targetyaw;
 
          victim->targettilt2=-asin(rotatetarget.y)*360/6.28;//*-70;
 
@@ -1088,7 +1088,7 @@ void Person::DoDamage(float howmuch){
                for(int i=0;i<skeleton.num_joints; i++){
                        if(!skeleton.free)flatvelocity2=velocity;
                        if(skeleton.free)flatvelocity2=skeleton.joints[i].velocity;
-                       if(!skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(skeleton.joints[i].position,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords;
+                       if(!skeleton.free)flatfacing2=DoRotation(DoRotation(DoRotation(skeleton.joints[i].position,0,0,tilt),tilt2,0,0),0,yaw,0)*scale+coords;
                        if(skeleton.free)flatfacing2=skeleton.joints[i].position*scale+coords;
                        flatvelocity2.x+=(float)(abs(Random()%100)-50)/10;
                        flatvelocity2.y+=(float)(abs(Random()%100)-50)/10;
@@ -1156,68 +1156,68 @@ void Person::DoHead(){
        if(!freeze&&!winfreeze){
 
                //head facing
-               targetheadrotation=(float)((int)((0-rotation-targetheadrotation+180)*100)%36000)/100;
-               targetheadrotation2=(float)((int)(targetheadrotation2*100)%36000)/100;
+               targetheadyaw=(float)((int)((0-yaw-targetheadyaw+180)*100)%36000)/100;
+               targetheadpitch=(float)((int)(targetheadpitch*100)%36000)/100;
 
-               while(targetheadrotation>180)targetheadrotation-=360;
-               while(targetheadrotation<-180)targetheadrotation+=360;
+               while(targetheadyaw>180)targetheadyaw-=360;
+               while(targetheadyaw<-180)targetheadyaw+=360;
 
-               if(targetheadrotation>160)targetheadrotation2=targetheadrotation2*-1;
-               if(targetheadrotation<-160)targetheadrotation2=targetheadrotation2*-1;
-               if(targetheadrotation>160)targetheadrotation=targetheadrotation-180;
-               if(targetheadrotation<-160)targetheadrotation=targetheadrotation+180;
+               if(targetheadyaw>160)targetheadpitch=targetheadpitch*-1;
+               if(targetheadyaw<-160)targetheadpitch=targetheadpitch*-1;
+               if(targetheadyaw>160)targetheadyaw=targetheadyaw-180;
+               if(targetheadyaw<-160)targetheadyaw=targetheadyaw+180;
 
-               if(targetheadrotation2>120)targetheadrotation2=120;
-               if(targetheadrotation2<-120)targetheadrotation2=-120;
-               if(targetheadrotation>120)targetheadrotation=120;
-               if(targetheadrotation<-120)targetheadrotation=-120;
+               if(targetheadpitch>120)targetheadpitch=120;
+               if(targetheadpitch<-120)targetheadpitch=-120;
+               if(targetheadyaw>120)targetheadyaw=120;
+               if(targetheadyaw<-120)targetheadyaw=-120;
 
-               if(!isIdle())targetheadrotation2=0;
+               if(!isIdle())targetheadpitch=0;
                if(isIdle()){
-                       if(targetheadrotation>80)targetheadrotation=80;
-                       if(targetheadrotation<-80)targetheadrotation=-80;
-                       if(targetheadrotation2>50)targetheadrotation2=50;
-                       if(targetheadrotation2<-50)targetheadrotation2=-50;
+                       if(targetheadyaw>80)targetheadyaw=80;
+                       if(targetheadyaw<-80)targetheadyaw=-80;
+                       if(targetheadpitch>50)targetheadpitch=50;
+                       if(targetheadpitch<-50)targetheadpitch=-50;
                }
 
-               if(abs(headrotation-targetheadrotation)<multiplier*lookspeed)headrotation=targetheadrotation;
-               else if(headrotation>targetheadrotation){
-                       headrotation-=multiplier*lookspeed;
+               if(abs(headyaw-targetheadyaw)<multiplier*lookspeed)headyaw=targetheadyaw;
+               else if(headyaw>targetheadyaw){
+                       headyaw-=multiplier*lookspeed;
                }
-               else if(headrotation<targetheadrotation){
-                       headrotation+=multiplier*lookspeed;
+               else if(headyaw<targetheadyaw){
+                       headyaw+=multiplier*lookspeed;
                }
 
-               if(abs(headrotation2-targetheadrotation2)<multiplier*lookspeed/2)headrotation2=targetheadrotation2;
-               else if(headrotation2>targetheadrotation2){
-                       headrotation2-=multiplier*lookspeed/2;
+               if(abs(headpitch-targetheadpitch)<multiplier*lookspeed/2)headpitch=targetheadpitch;
+               else if(headpitch>targetheadpitch){
+                       headpitch-=multiplier*lookspeed/2;
                }
-               else if(headrotation2<targetheadrotation2){
-                       headrotation2+=multiplier*lookspeed/2;
+               else if(headpitch<targetheadpitch){
+                       headpitch+=multiplier*lookspeed/2;
                }
 
                rotatearound=skeleton.joints[skeleton.jointlabels[neck]].position;
-               skeleton.joints[skeleton.jointlabels[head]].position=rotatearound+DoRotation(skeleton.joints[skeleton.jointlabels[head]].position-rotatearound,headrotation2,0,0);
+               skeleton.joints[skeleton.jointlabels[head]].position=rotatearound+DoRotation(skeleton.joints[skeleton.jointlabels[head]].position-rotatearound,headpitch,0,0);
 
                facing=0;
                facing.z=-1;
                if(targetanimation!=bounceidleanim&&targetanimation!=fightidleanim&&targetanimation!=wolfidle&&targetanimation!=knifefightidleanim&&targetanimation!=drawrightanim&&targetanimation!=drawleftanim&&targetanimation!=walkanim){
-                       facing=DoRotation(facing,headrotation2*.4,0,0);
-                       facing=DoRotation(facing,0,headrotation*.4,0);
+                       facing=DoRotation(facing,headpitch*.4,0,0);
+                       facing=DoRotation(facing,0,headyaw*.4,0);
                }
 
                if(targetanimation==bounceidleanim||targetanimation==fightidleanim||targetanimation==wolfidle||targetanimation==knifefightidleanim||targetanimation==drawrightanim||targetanimation==drawleftanim){
-                       facing=DoRotation(facing,headrotation2*.8,0,0);
-                       facing=DoRotation(facing,0,headrotation*.8,0);
+                       facing=DoRotation(facing,headpitch*.8,0,0);
+                       facing=DoRotation(facing,0,headyaw*.8,0);
                }
 
                if(targetanimation==walkanim){
-                       facing=DoRotation(facing,headrotation2*.6,0,0);
-                       facing=DoRotation(facing,0,headrotation*.6,0);
+                       facing=DoRotation(facing,headpitch*.6,0,0);
+                       facing=DoRotation(facing,0,headyaw*.6,0);
                }
 
                skeleton.specialforward[0]=facing;
-               //skeleton.specialforward[0]=DoRotation(facing,0,rotation,0);
+               //skeleton.specialforward[0]=DoRotation(facing,0,yaw,0);
                static int i;
                for(i=0;i<skeleton.num_muscles;i++){
                        if(skeleton.muscles[i].visible&&(skeleton.muscles[i].parent1->label==head||skeleton.muscles[i].parent2->label==head))
@@ -1240,7 +1240,7 @@ void Person::RagDoll(bool checkcollision){
 
                facing=0;
                facing.z=1;
-               facing=DoRotation(facing,0,rotation,0);
+               facing=DoRotation(facing,0,yaw,0);
 
                skeleton.freetime=0;
 
@@ -1255,7 +1255,7 @@ void Person::RagDoll(bool checkcollision){
                if(!isnormal(velocity.x))velocity.x=0;
                if(!isnormal(velocity.y))velocity.y=0;
                if(!isnormal(velocity.z))velocity.z=0;
-               if(!isnormal(rotation))rotation=0;
+               if(!isnormal(yaw))yaw=0;
                if(!isnormal(coords.x))coords=0;
                if(!isnormal(tilt))tilt=0;
                if(!isnormal(tilt2))tilt2=0;
@@ -1263,8 +1263,8 @@ void Person::RagDoll(bool checkcollision){
                for(i=0;i<skeleton.num_joints;i++){
                        skeleton.joints[i].delay=0;
                        skeleton.joints[i].locked=0;
-                       skeleton.joints[i].position=DoRotation(DoRotation(DoRotation(skeleton.joints[i].position,0,0,tilt),tilt2,0,0),0,rotation,0);
-                       if(!isnormal(skeleton.joints[i].position.x))skeleton.joints[i].position=DoRotation(skeleton.joints[i].position,0,rotation,0);
+                       skeleton.joints[i].position=DoRotation(DoRotation(DoRotation(skeleton.joints[i].position,0,0,tilt),tilt2,0,0),0,yaw,0);
+                       if(!isnormal(skeleton.joints[i].position.x))skeleton.joints[i].position=DoRotation(skeleton.joints[i].position,0,yaw,0);
                        if(!isnormal(skeleton.joints[i].position.x))skeleton.joints[i].position=skeleton.joints[i].position;
                        if(!isnormal(skeleton.joints[i].position.x))skeleton.joints[i].position=coords;
                        skeleton.joints[i].position.y+=.1;
@@ -1294,7 +1294,7 @@ void Person::RagDoll(bool checkcollision){
                speed*=speedmult;
 
                for(i=0;i<skeleton.num_joints;i++){
-                       if((animation[currentanimation].attack!=reversed||currentanimation==swordslashreversedanim)&&currentanimation!=rabbitkickanim&&!isLanding()&&!wasLanding()&&animation[currentanimation].height==animation[targetanimation].height)skeleton.joints[i].velocity=velocity/scale+facing*5+DoRotation(DoRotation(DoRotation((animation[targetanimation].position[i][targetframe]-animation[currentanimation].position[i][currentframe])*speed,0,0,tilt),tilt2,0,0),0,rotation,0);
+                       if((animation[currentanimation].attack!=reversed||currentanimation==swordslashreversedanim)&&currentanimation!=rabbitkickanim&&!isLanding()&&!wasLanding()&&animation[currentanimation].height==animation[targetanimation].height)skeleton.joints[i].velocity=velocity/scale+facing*5+DoRotation(DoRotation(DoRotation((animation[targetanimation].position[i][targetframe]-animation[currentanimation].position[i][currentframe])*speed,0,0,tilt),tilt2,0,0),0,yaw,0);
                        else skeleton.joints[i].velocity=velocity/scale+facing*5;
                        change.x=(float)(Random()%100)/100;
                        change.y=(float)(Random()%100)/100;
@@ -1333,14 +1333,14 @@ void Person::RagDoll(bool checkcollision){
                                        i=terrain.patchobjects[whichpatchx][whichpatchz][l];
                                        lowpoint=coords;
                                        lowpoint.y+=1;
-                                       if(SphereCheck(&lowpoint, 3, &colpoint, &objects.position[i], &objects.rotation[i], &objects.model[i])!=-1){
+                                       if(SphereCheck(&lowpoint, 3, &colpoint, &objects.position[i], &objects.yaw[i], &objects.model[i])!=-1){
                                                coords.x=lowpoint.x;
                                                coords.z=lowpoint.z;
                                        }
                                }
                }
 
-               rotation=0;
+               yaw=0;
                updatedelay=0;
 
                velocity=0;
@@ -1388,26 +1388,26 @@ void Person::FootLand(int which, float opacity){
                if(opacity>1)
                {
                        footvel=0;
-                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
-                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
+                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                        //footpoint.y=coords.y;
                        if(findDistancefast(&footpoint,&viewer))Sprite::MakeSprite(cloudsprite, footpoint,footvel, 1,1,1, .5, .2*opacity);
                }
                else if(environment==snowyenvironment&&onterrain&&terrain.getOpacity(coords.x,coords.z)<.2){
                        footvel=velocity/5;
                        if(footvel.y<.8)footvel.y=.8;
-                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
-                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
+                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                        footpoint.y=terrain.getHeight(footpoint.x,footpoint.z);
                        terrainlight=terrain.getLighting(footpoint.x,footpoint.z);
                        if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, footpoint,footvel*.6, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7*opacity);
-                       if(opacity>=1||detail==2)if(detail==2)if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)terrain.MakeDecal(footprintdecal,footpoint,.2,1*opacity,rotation);
+                       if(opacity>=1||detail==2)if(detail==2)if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)terrain.MakeDecal(footprintdecal,footpoint,.2,1*opacity,yaw);
                }
                else if(environment==grassyenvironment&&onterrain&&terrain.getOpacity(coords.x,coords.z)<.2){
                        footvel=velocity/5;
                        if(footvel.y<.8)footvel.y=.8;
-                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
-                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
+                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                        footpoint.y=terrain.getHeight(footpoint.x,footpoint.z);
                        terrainlight=terrain.getLighting(footpoint.x,footpoint.z);
                        if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, footpoint,footvel*.6, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5*opacity);
@@ -1415,19 +1415,19 @@ void Person::FootLand(int which, float opacity){
                else if(environment==desertenvironment&&onterrain&&terrain.getOpacity(coords.x,coords.z)<.2){
                        footvel=velocity/5;
                        if(footvel.y<.8)footvel.y=.8;
-                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
-                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
+                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                        footpoint.y=terrain.getHeight(footpoint.x,footpoint.z);
                        terrainlight=terrain.getLighting(footpoint.x,footpoint.z);
                        if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, footpoint,footvel*.6, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7*opacity);
-                       if(opacity>=1||detail==2)if(detail==2)if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)terrain.MakeDecal(footprintdecal,footpoint,.2,.25*opacity,rotation);
+                       if(opacity>=1||detail==2)if(detail==2)if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)terrain.MakeDecal(footprintdecal,footpoint,.2,.25*opacity,yaw);
                }
                else if(isLanding()||targetanimation==jumpupanim||isLandhard())
                {
                        footvel=velocity/5;
                        if(footvel.y<.8)footvel.y=.8;
-                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
-                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                       if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
+                       if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                        //footpoint.y=coords.y;
                        if(findDistancefast(&footpoint,&viewer)<viewdistance*viewdistance/4)Sprite::MakeSprite(cloudsprite, footpoint,footvel*.6, 1,1,1, .5, .2*opacity);
                }
@@ -1437,7 +1437,7 @@ void Person::Puff(int whichlabel){
        static XYZ footvel,footpoint;
 
        footvel=0;
-       footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[whichlabel]].position,0,rotation,0)*scale+coords;
+       footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[whichlabel]].position,0,yaw,0)*scale+coords;
        Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .9, .3);
 }
 
@@ -1483,7 +1483,7 @@ void      Person::DoAnimations(){
                        targfacing=0;
                        targfacing.z=1;
 
-                       targfacing=DoRotation(targfacing,0,targetrotation,0);
+                       targfacing=DoRotation(targfacing,0,targetyaw,0);
 
                        if(normaldotproduct(targfacing,velocity)>=-.3)targetanimation=flipanim;
                        else targetanimation=backflipanim;
@@ -1526,8 +1526,8 @@ void      Person::DoAnimations(){
                                        else victim->targetanimation=rabbittackledfrontanim;
                                        victim->targetframe=2;
                                        victim->target=0;
-                                       victim->rotation=rotation;
-                                       victim->targetrotation=rotation;
+                                       victim->yaw=yaw;
+                                       victim->targetyaw=yaw;
                                        if(victim->aitype==gethelptype)victim->DoDamage(victim->damagetolerance-victim->damage);
                                        //victim->DoDamage(30);
                                        if(creature==wolftype){
@@ -1775,14 +1775,14 @@ void    Person::DoAnimations(){
 
 
                                                        if((currentanimation==walljumprightkickanim&&targetanimation==walljumprightkickanim)||(currentanimation==walljumpleftkickanim&&targetanimation==walljumpleftkickanim)){
-                                                               XYZ rotatetarget=DoRotation(skeleton.forward,0,rotation,0);
+                                                               XYZ rotatetarget=DoRotation(skeleton.forward,0,yaw,0);
                                                                Normalise(&rotatetarget);
-                                                               targetrotation=-asin(0-rotatetarget.x);
-                                                               targetrotation*=360/6.28;
-                                                               if(rotatetarget.z<0)targetrotation=180-targetrotation;
+                                                               targetyaw=-asin(0-rotatetarget.x);
+                                                               targetyaw*=360/6.28;
+                                                               if(rotatetarget.z<0)targetyaw=180-targetyaw;
 
-                                                               if(targetanimation==walljumprightkickanim)targetrotation+=40;
-                                                               if(targetanimation==walljumpleftkickanim)targetrotation-=40;
+                                                               if(targetanimation==walljumprightkickanim)targetyaw+=40;
+                                                               if(targetanimation==walljumpleftkickanim)targetyaw-=40;
                                                        }
 
                                                        bool dojumpattack;
@@ -1825,9 +1825,9 @@ void      Person::DoAnimations(){
                                                                                if(coords.z!=victim->coords.z||coords.x!=victim->coords.x){
                                                                                        rotatetarget=coords-victim->coords;
                                                                                        Normalise(&rotatetarget);
-                                                                                       targetrotation=-asin(0-rotatetarget.x);
-                                                                                       targetrotation*=360/6.28;
-                                                                                       if(rotatetarget.z<0)targetrotation=180-targetrotation;
+                                                                                       targetyaw=-asin(0-rotatetarget.x);
+                                                                                       targetyaw*=360/6.28;
+                                                                                       if(rotatetarget.z<0)targetyaw=180-targetyaw;
                                                                                }
                                                                                if(targetanimation!=rabbitrunninganim){
                                                                                        emit_sound_at(jumpsound, coords, 128.);
@@ -2118,7 +2118,7 @@ void      Person::DoAnimations(){
                                                                                        if(weapons[weaponids[weaponactive]].getType()==knife){
                                                                                                where=(weapons[weaponids[weaponactive]].tippoint*.6+weapons[weaponids[weaponactive]].position*.4);
                                                                                                where-=victim->coords;
-                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                                //where=scale;
                                                                                                startpoint=where;
                                                                                                startpoint.y+=100;
@@ -2128,21 +2128,21 @@ void    Person::DoAnimations(){
                                                                                        if(weapons[weaponids[weaponactive]].getType()==sword){
                                                                                                where=weapons[weaponids[weaponactive]].position;
                                                                                                where-=victim->coords;
-                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                                startpoint=where;
                                                                                                where=weapons[weaponids[weaponactive]].tippoint;
                                                                                                where-=victim->coords;
-                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                                endpoint=where;
                                                                                        }
                                                                                        if(weapons[weaponids[weaponactive]].getType()==staff){
                                                                                                where=weapons[weaponids[weaponactive]].position;
                                                                                                where-=victim->coords;
-                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                                startpoint=where;
                                                                                                where=weapons[weaponids[weaponactive]].tippoint;
                                                                                                where-=victim->coords;
-                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                               if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                                endpoint=where;
                                                                                        }
                                                                                        movepoint=0;
@@ -2201,11 +2201,11 @@ void    Person::DoAnimations(){
 
                                                                                        where=weapons[weaponids[weaponactive]].position;
                                                                                        where-=victim->coords;
-                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                        startpoint=where;
                                                                                        where=weapons[weaponids[weaponactive]].tippoint;
                                                                                        where-=victim->coords;
-                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                        endpoint=where;
 
                                                                                        movepoint=0;
@@ -2224,11 +2224,11 @@ void    Person::DoAnimations(){
 
                                                                                        where=weapons[weaponids[weaponactive]].position;
                                                                                        where-=victim->coords;
-                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                        startpoint=where;
                                                                                        where=weapons[weaponids[weaponactive]].tippoint;
                                                                                        where-=victim->coords;
-                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
+                                                                                       if(!victim->skeleton.free)where=DoRotation(where,0,-victim->yaw,0);
                                                                                        endpoint=where;
 
                                                                                        movepoint=0;
@@ -2299,7 +2299,7 @@ void      Person::DoAnimations(){
 
                                                                                victim->targetframe=0;
                                                                                victim->targetanimation=staggerbackhardanim;
-                                                                               victim->targetrotation=targetrotation+180;
+                                                                               victim->targetyaw=targetyaw+180;
                                                                                victim->target=0;
                                                                                victim->stunned=1;
 
@@ -2347,7 +2347,7 @@ void      Person::DoAnimations(){
 
                                                                                victim->targetframe=0;
                                                                                victim->targetanimation=staggerbackhardanim;
-                                                                               victim->targetrotation=targetrotation+180;
+                                                                               victim->targetyaw=targetyaw+180;
                                                                                victim->target=0;
                                                                                victim->stunned=1;
 
@@ -2392,7 +2392,7 @@ void      Person::DoAnimations(){
                                                                                escapednum=0;
                                                                                XYZ aim;
                                                                                weapons[weaponids[0]].owner=-1;
-                                                                               aim=victim->coords+DoRotation(victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position,0,victim->rotation,0)*victim->scale+victim->velocity*findDistance(&victim->coords,&coords)/50-(coords+DoRotation(skeleton.joints[skeleton.jointlabels[righthand]].position,0,rotation,0)*scale);
+                                                                               aim=victim->coords+DoRotation(victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position,0,victim->yaw,0)*victim->scale+victim->velocity*findDistance(&victim->coords,&coords)/50-(coords+DoRotation(skeleton.joints[skeleton.jointlabels[righthand]].position,0,yaw,0)*scale);
                                                                                Normalise(&aim);
                                                                                /*if(victim->targetanimation==jumpupanim||victim->targetanimation==jumpdownanim){
                                                                                aim=DoRotation(aim,(float)abs(Random()%15)-7,(float)abs(Random()%15)-7,0);
@@ -2427,7 +2427,7 @@ void      Person::DoAnimations(){
                                                                                                if(victim->id != 0 || difficulty==2){
                                                                                                        victim->targetframe=0;
                                                                                                        victim->targetanimation=staggerbackhardanim;
-                                                                                                       victim->targetrotation=targetrotation+180;
+                                                                                                       victim->targetyaw=targetyaw+180;
                                                                                                        victim->target=0;
                                                                                                }
                                                                                        }
@@ -2444,7 +2444,7 @@ void      Person::DoAnimations(){
                                                                                                footpoint=(victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2*victim->scale+victim->coords;
                                                                                        }
                                                                                        if(!skeleton.free){
-                                                                                               footpoint=DoRotation((victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2,0,victim->rotation,0)*victim->scale+victim->coords;
+                                                                                               footpoint=DoRotation((victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2,0,victim->yaw,0)*victim->scale+victim->coords;
                                                                                        }
                                                                                        if(tutoriallevel!=1){
                                                                                                if(bloodtoggle)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .6, .3);
@@ -2476,7 +2476,7 @@ void      Person::DoAnimations(){
                                                                                        if(tutoriallevel!=1){
                                                                                                victim->targetframe=0;
                                                                                                victim->targetanimation=staggerbackhardanim;
-                                                                                               victim->targetrotation=targetrotation+180;
+                                                                                               victim->targetyaw=targetyaw+180;
                                                                                                victim->target=0;
                                                                                        }
 
@@ -2496,7 +2496,7 @@ void      Person::DoAnimations(){
                                                                                                        footpoint=(victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2*victim->scale+victim->coords;
                                                                                                }
                                                                                                if(!skeleton.free){
-                                                                                                       footpoint=DoRotation((victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2,0,victim->rotation,0)*victim->scale+victim->coords;
+                                                                                                       footpoint=DoRotation((victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2,0,victim->yaw,0)*victim->scale+victim->coords;
                                                                                                }
                                                                                                if(bloodtoggle)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3);
                                                                                                footvel=DoRotation(facing,0,90,0)*.8;
@@ -2526,7 +2526,7 @@ void      Person::DoAnimations(){
                                                                                        victim->target=0;
                                                                                        victim->targetframe=0;
                                                                                        victim->targetanimation=staggerbackhighanim;
-                                                                                       victim->targetrotation=targetrotation+180;
+                                                                                       victim->targetyaw=targetyaw+180;
                                                                                        victim->target=0;
                                                                                        weapons[victim->weaponids[0]].owner=-1;
                                                                                        aim=DoRotation(facing,0,90,0)*21;
@@ -2712,7 +2712,7 @@ void      Person::DoAnimations(){
                                                                                        victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
                                                                                        victim->targetframe=0;
                                                                                        victim->targetanimation=staggerbackhighanim;
-                                                                                       victim->targetrotation=targetrotation+180;
+                                                                                       victim->targetyaw=targetyaw+180;
                                                                                        victim->target=0;
                                                                                        if(tutoriallevel!=1){
                                                                                                emit_sound_at(landsound2, victim->coords, 128.);
@@ -2770,7 +2770,7 @@ void      Person::DoAnimations(){
                                                                                        victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
                                                                                        victim->targetframe=0;
                                                                                        victim->targetanimation=staggerbackhighanim;
-                                                                                       victim->targetrotation=targetrotation+180;
+                                                                                       victim->targetyaw=targetyaw+180;
                                                                                        victim->target=0;
                                                                                        if(tutoriallevel!=1){
                                                                                                emit_sound_at(landsound2, victim->coords, 128.);
@@ -3034,8 +3034,8 @@ void      Person::DoAnimations(){
                                                                                        bloodvel=0;
                                                                                        bloodvel.z=20;
                                                                                        bloodvel.y=5;
-                                                                                       bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
-                                                                                       Sprite::MakeSprite(bloodsprite, DoRotation(skeleton.joints[skeleton.jointlabels[neck]].position,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
+                                                                                       bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
+                                                                                       Sprite::MakeSprite(bloodsprite, DoRotation(skeleton.joints[skeleton.jointlabels[neck]].position,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
                                                                                        */
                                                                                        XYZ footvel,footpoint;
                                                                                        footvel=0;
@@ -3337,9 +3337,9 @@ void      Person::DoAnimations(){
                                                                                                targetframe=0;
                                                                                                XYZ rotatetarget=victim->coords-coords;
                                                                                                Normalise(&rotatetarget);
-                                                                                               rotation=-asin(0-rotatetarget.x);
-                                                                                               rotation*=360/6.28;
-                                                                                               if(rotatetarget.z<0)rotation=180-rotation;
+                                                                                               yaw=-asin(0-rotatetarget.x);
+                                                                                               yaw*=360/6.28;
+                                                                                               if(rotatetarget.z<0)yaw=180-yaw;
                                                                                                targettilt2=-asin(rotatetarget.y)*360/6.28;
                                                                                                velocity=(victim->coords-coords)*4;
                                                                                                velocity.y+=2;
@@ -3357,16 +3357,16 @@ void    Person::DoAnimations(){
                                                                        if(targetanimation==walljumprightanim){
                                                                                targetanimation=rightflipanim;
                                                                                targetframe=4;
-                                                                               targetrotation-=90;
-                                                                               rotation-=90;
+                                                                               targetyaw-=90;
+                                                                               yaw-=90;
                                                                                velocity=DoRotation(facing,0,30,0)*-8;
                                                                                velocity.y=4;
                                                                        }
                                                                        if(targetanimation==walljumpfrontanim){
                                                                                targetanimation=frontflipanim;
                                                                                targetframe=2;
-                                                                               //targetrotation-=180;
-                                                                               ////rotation-=180;
+                                                                               //targetyaw-=180;
+                                                                               ////yaw-=180;
                                                                                velocity=facing*8;
                                                                                velocity.y=4;
                                                                        }
@@ -3394,9 +3394,9 @@ void      Person::DoAnimations(){
                                                                                                targetframe=0;
                                                                                                XYZ rotatetarget=victim->coords-coords;
                                                                                                Normalise(&rotatetarget);
-                                                                                               rotation=-asin(0-rotatetarget.x);
-                                                                                               rotation*=360/6.28;
-                                                                                               if(rotatetarget.z<0)rotation=180-rotation;
+                                                                                               yaw=-asin(0-rotatetarget.x);
+                                                                                               yaw*=360/6.28;
+                                                                                               if(rotatetarget.z<0)yaw=180-yaw;
                                                                                                targettilt2=-asin(rotatetarget.y)*360/6.28;
                                                                                                velocity=(victim->coords-coords)*4;
                                                                                                velocity.y+=2;
@@ -3406,8 +3406,8 @@ void      Person::DoAnimations(){
                                                                        if(targetanimation!=walljumpleftkickanim){
                                                                                targetanimation=leftflipanim;
                                                                                targetframe=4;
-                                                                               targetrotation+=90;
-                                                                               rotation+=90;
+                                                                               targetyaw+=90;
+                                                                               yaw+=90;
                                                                                velocity=DoRotation(facing,0,-30,0)*-8;
                                                                                velocity.y=4;
                                                                        }
@@ -3419,12 +3419,12 @@ void    Person::DoAnimations(){
                                                                        targetanimation=getCrouch();
                                                                        targetframe=1;
                                                                        currentframe=0;
-                                                                       targetrotation+=180;
-                                                                       rotation+=180;
+                                                                       targetyaw+=180;
+                                                                       yaw+=180;
                                                                        targettilt2*=-1;
                                                                        tilt2*=-1;
                                                                        transspeed=1000000;
-                                                                       targetheadrotation+=180;
+                                                                       targetheadyaw+=180;
                                                                        coords-=facing*.7;
                                                                        if(onterrain)coords.y=terrain.getHeight(coords.x,coords.z);
 
@@ -3444,12 +3444,12 @@ void    Person::DoAnimations(){
                                                                if(animation[targetanimation].attack==reversal&&currentanimation!=sneakattackanim&&currentanimation!=knifesneakattackanim&&currentanimation!=swordsneakattackanim&&currentanimation!=knifefollowanim){
                                                                        float ycoords=oldcoords.y;
                                                                        targetanimation=getStop();
-                                                                       targetrotation+=180;
-                                                                       rotation+=180;
+                                                                       targetyaw+=180;
+                                                                       yaw+=180;
                                                                        targettilt2*=-1;
                                                                        tilt2*=-1;
                                                                        transspeed=1000000;
-                                                                       targetheadrotation+=180;
+                                                                       targetheadyaw+=180;
                                                                        if(!isnormal(coords.x))
                                                                                coords=oldcoords;
                                                                        if(currentanimation==spinkickreversalanim||currentanimation==swordslashreversalanim)
@@ -3458,24 +3458,24 @@ void    Person::DoAnimations(){
                                                                                oldcoords=coords+facing*1.1;
                                                                        else if(currentanimation==upunchreversalanim){
                                                                                oldcoords=coords+facing*1.5;
-                                                                               targetrotation+=180;
-                                                                               rotation+=180;
-                                                                               targetheadrotation+=180;
+                                                                               targetyaw+=180;
+                                                                               yaw+=180;
+                                                                               targetheadyaw+=180;
                                                                                targettilt2*=-1;
                                                                                tilt2*=-1;
                                                                        }
                                                                        else if(currentanimation==knifeslashreversalanim){
                                                                                oldcoords=coords+facing*.5;
-                                                                               targetrotation+=90;
-                                                                               rotation+=90;
-                                                                               targetheadrotation+=90;
+                                                                               targetyaw+=90;
+                                                                               yaw+=90;
+                                                                               targetheadyaw+=90;
                                                                                targettilt2=0;
                                                                                tilt2=0;
                                                                        }
                                                                        else if(currentanimation==staffspinhitreversalanim){
-                                                                               targetrotation+=180;
-                                                                               rotation+=180;
-                                                                               targetheadrotation+=180;
+                                                                               targetyaw+=180;
+                                                                               yaw+=180;
+                                                                               targetheadyaw+=180;
                                                                                targettilt2=0;
                                                                                tilt2=0;
                                                                        }
@@ -3494,7 +3494,7 @@ void      Person::DoAnimations(){
                                                                }
                                                                if(animation[targetanimation].attack==reversed){
                                                                        escapednum++;
-                                                                       if(targetanimation==sweepreversedanim)targetrotation+=90;
+                                                                       if(targetanimation==sweepreversedanim)targetyaw+=90;
                                                                        targetanimation=backhandspringanim;
                                                                        targetframe=2;
                                                                        emit_sound_at(landsound, coords, 128);
@@ -3503,16 +3503,16 @@ void    Person::DoAnimations(){
                                                                                targetanimation=rollanim;
                                                                                targetframe=5;
                                                                                oldcoords=coords;
-                                                                               coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0))/2*scale;
+                                                                               coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0))/2*scale;
                                                                                coords.y=oldcoords.y;
                                                                        }
                                                                        if(currentanimation==knifeslashreversedanim){
                                                                                targetanimation=rollanim;
                                                                                targetframe=0;
-                                                                               targetrotation+=90;
-                                                                               rotation+=90;
+                                                                               targetyaw+=90;
+                                                                               yaw+=90;
                                                                                oldcoords=coords;
-                                                                               coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0))/2*scale;
+                                                                               coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0))/2*scale;
                                                                                coords.y=oldcoords.y;
                                                                        }
                                                                }
@@ -3524,12 +3524,12 @@ void    Person::DoAnimations(){
                                                                if(currentanimation==spinkickanim||currentanimation==getupfrombackanim||currentanimation==getupfromfrontanim||currentanimation==lowkickanim){
                                                                        targetanimation=getIdle();
                                                                        oldcoords=coords;
-                                                                       coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0))/2*scale;
+                                                                       coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0))/2*scale;
                                                                        coords.y=oldcoords.y;
-                                                                       //coords+=DoRotation(animation[currentanimation].offset,0,rotation,0)*scale;
+                                                                       //coords+=DoRotation(animation[currentanimation].offset,0,yaw,0)*scale;
                                                                        targetoffset.y=coords.y;
                                                                        if(onterrain)targetoffset.y=terrain.getHeight(coords.x,coords.z);
-                                                                       currentoffset=DoRotation(animation[currentanimation].offset*-1,0,rotation,0)*scale;
+                                                                       currentoffset=DoRotation(animation[currentanimation].offset*-1,0,yaw,0)*scale;
                                                                        currentoffset.y-=(coords.y-targetoffset.y);
                                                                        coords.y=targetoffset.y;
                                                                        targetoffset=0;
@@ -3541,7 +3541,7 @@ void      Person::DoAnimations(){
                                                                        lastfeint=0;
                                                                }
                                                                if(currentanimation==rabbitkickanim&&targetanimation!=backflipanim){
-                                                                       targetrotation=rotation;
+                                                                       targetyaw=yaw;
                                                                        bool hasstaff;
                                                                        hasstaff=0;
                                                                        if(num_weapons>0)if(weapons[0].getType()==staff)hasstaff=1;
@@ -3649,7 +3649,7 @@ void      Person::DoAnimations(){
                        if(target>1){currentframe=targetframe; target=1;}
                        oldrot=rot;
                        rot=targetrot*target;
-                       rotation+=rot-oldrot;
+                       yaw+=rot-oldrot;
                        if(target==1){
                                rot=0;
                                oldrot=0;
@@ -3840,7 +3840,7 @@ void      Person::DoStuff(){
                howmany=abs(Random()%(skeleton.num_joints));
                if(!skeleton.free)flatvelocity=(coords-oldcoords)/multiplier/2;//velocity/2;
                if(skeleton.free)flatvelocity=skeleton.joints[howmany].velocity*scale/2;
-               if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords;
+               if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,yaw,0)*scale+coords;
                if(skeleton.free)flatfacing=skeleton.joints[howmany].position*scale+coords;
                Sprite::MakeSprite(flamesprite, flatfacing,flatvelocity, 1,1,1, .6+(float)abs(Random()%100)/200-.25, 1);
        }
@@ -3850,7 +3850,7 @@ void      Person::DoStuff(){
                howmany=abs(Random()%(skeleton.num_joints));
                if(!skeleton.free)flatvelocity=(coords-oldcoords)/multiplier/2;//velocity/2;
                if(skeleton.free)flatvelocity=skeleton.joints[howmany].velocity*scale/2;
-               if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords;
+               if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,yaw,0)*scale+coords;
                if(skeleton.free)flatfacing=skeleton.joints[howmany].position*scale+coords;
                Sprite::MakeSprite(breathsprite, flatfacing,flatvelocity, 1,1,1, .6+(float)abs(Random()%100)/200-.25, .3);
        }
@@ -3872,15 +3872,15 @@ void    Person::DoStuff(){
                        bloodvel=0;
                        if(!skeleton.free){
                                bloodvel.z=5*neckspurtamount;
-                               bloodvel=DoRotation(bloodvel,((float)(Random()%100))/40,rotation+((float)(Random()%100))/40,0)*scale;
+                               bloodvel=DoRotation(bloodvel,((float)(Random()%100))/40,yaw+((float)(Random()%100))/40,0)*scale;
                        }
                        if(skeleton.free){
                                bloodvel-=DoRotation(skeleton.forward*10*scale,((float)(Random()%100))/40,((float)(Random()%100))/40,0);
                        }
-                       if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/40,rotation+((float)(Random()%100))/40,0)*scale;
+                       if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/40,yaw+((float)(Random()%100))/40,0)*scale;
                        if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/40,((float)(Random()%100))/40,0)*scale;
                        if(skeleton.free)Sprite::MakeSprite(bloodsprite, (skeleton.joints[skeleton.jointlabels[neck]].position+(skeleton.joints[skeleton.jointlabels[neck]].position-skeleton.joints[skeleton.jointlabels[head]].position)/5)*scale+coords,bloodvel, 1,1,1, .05, .9);
-                       if(!skeleton.free)Sprite::MakeSprite(bloodsprite, DoRotation(skeleton.joints[skeleton.jointlabels[neck]].position+(skeleton.joints[skeleton.jointlabels[neck]].position-skeleton.joints[skeleton.jointlabels[head]].position)/5,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, .9);
+                       if(!skeleton.free)Sprite::MakeSprite(bloodsprite, DoRotation(skeleton.joints[skeleton.jointlabels[neck]].position+(skeleton.joints[skeleton.jointlabels[neck]].position-skeleton.joints[skeleton.jointlabels[head]].position)/5,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, .9);
                        neckspurtparticledelay=.05;
                }
                if(neckspurtdelay<0){
@@ -3896,10 +3896,10 @@ void    Person::DoStuff(){
                        XYZ bloodvel;
                        if(bloodtoggle){
                                bloodvel=0;
-                               if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[abdomen]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
+                               if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[abdomen]].velocity,((float)(Random()%100))/4,yaw+((float)(Random()%100))/4,0)*scale;
                                if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale;
                                if(skeleton.free)Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[abdomen]].position*scale+coords,bloodvel, 1,1,1, .05, 1);
-                               if(!skeleton.free)Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[abdomen]].position+skeleton.joints[skeleton.jointlabels[abdomen]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
+                               if(!skeleton.free)Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[abdomen]].position+skeleton.joints[skeleton.jointlabels[abdomen]].position)/2,0,yaw,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
                        }
                }
                bloodloss+=deathbleeding*multiplier*80;
@@ -4109,9 +4109,9 @@ void      Person::DoStuff(){
                        if(environment==snowyenvironment){
                                XYZ footpoint;
                                XYZ footvel;
-                               if(!skeleton.free)footvel=DoRotation(skeleton.specialforward[0],0,rotation,0)*-1;
+                               if(!skeleton.free)footvel=DoRotation(skeleton.specialforward[0],0,yaw,0)*-1;
                                if(skeleton.free)footvel=skeleton.specialforward[0]*-1;
-                               if(!skeleton.free)footpoint=DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords;
+                               if(!skeleton.free)footpoint=DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,yaw,0)*scale+coords;
                                if(skeleton.free)footpoint=((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2)*scale+coords;
                                if(targetanimation==sleepanim)footvel=DoRotation(footvel,0,90,0);
                                Sprite::MakeSprite(breathsprite, footpoint+footvel*.2,footvel*.4, 1,1,1, .4, .3);
@@ -4275,11 +4275,11 @@ void    Person::DoStuff(){
                if(bloodtoggle&&!bled)
                        for(l=0;l<terrain.patchobjectnum[whichpatchx][whichpatchz];l++){
                                j=terrain.patchobjects[whichpatchx][whichpatchz][l];
-                               XYZ point=DoRotation(headpoint-objects.position[j],0,-objects.rotation[j],0);
+                               XYZ point=DoRotation(headpoint-objects.position[j],0,-objects.yaw[j],0);
                                float size=.8;
                                float opacity=.6;
-                               float rotation=0;
-                               objects.model[j].MakeDecal(blooddecalslow,&point,&size,&opacity,&rotation);
+                               float yaw=0;
+                               objects.model[j].MakeDecal(blooddecalslow,&point,&size,&opacity,&yaw);
                        }
                        bled=1;
        }
@@ -4485,11 +4485,11 @@ void    Person::DoStuff(){
                                        if(bloodtoggle&&!bled)
                                                for(l=0;l<terrain.patchobjectnum[whichpatchx][whichpatchz];l++){
                                                        j=terrain.patchobjects[whichpatchx][whichpatchz][l];
-                                                       XYZ point=DoRotation(headpoint-objects.position[j],0,-objects.rotation[j],0);
+                                                       XYZ point=DoRotation(headpoint-objects.position[j],0,-objects.yaw[j],0);
                                                        float size=.2*1.2;
                                                        float opacity=.6;
-                                                       float rotation=0;
-                                                       objects.model[j].MakeDecal(blooddecal,&point,&size,&opacity,&rotation);
+                                                       float yaw=0;
+                                                       objects.model[j].MakeDecal(blooddecal,&point,&size,&opacity,&yaw);
                                                }
                                                bled=1;
                                }
@@ -4503,11 +4503,11 @@ void    Person::DoStuff(){
                                        if(bloodtoggle&&!bled)
                                                for(l=0;l<terrain.patchobjectnum[whichpatchx][whichpatchz];l++){
                                                        j=terrain.patchobjects[whichpatchx][whichpatchz][l];
-                                                       XYZ point=DoRotation(headpoint-objects.position[j],0,-objects.rotation[j],0);
+                                                       XYZ point=DoRotation(headpoint-objects.position[j],0,-objects.yaw[j],0);
                                                        float size=.8;
                                                        float opacity=.6;
-                                                       float rotation=0;
-                                                       objects.model[j].MakeDecal(blooddecalslow,&point,&size,&opacity,&rotation);
+                                                       float yaw=0;
+                                                       objects.model[j].MakeDecal(blooddecalslow,&point,&size,&opacity,&yaw);
                                                }
                                                bled=1;
                                }
@@ -4526,7 +4526,7 @@ void      Person::DoStuff(){
                                if(objects.type[i]!=treeleavestype&&objects.type[i]!=bushtype&&objects.type[i]!=firetype){
                                        colviewer=startpoint;
                                        coltarget=endpoint;
-                                       if(objects.model[i].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[i],&objects.rotation[i])!=-1)canrecover=0;
+                                       if(objects.model[i].LineCheck(&colviewer,&coltarget,&colpoint,&objects.position[i],&objects.yaw[i])!=-1)canrecover=0;
                                }
                        }
                        if(canrecover){
@@ -4549,10 +4549,10 @@ void    Person::DoStuff(){
                                }
                                Normalise(&terrainnormal);
 
-                               targetrotation=-asin(0-terrainnormal.x);
-                               targetrotation*=360/6.28;
-                               if(terrainnormal.z<0)targetrotation=180-targetrotation;
-                               rotation=targetrotation;
+                               targetyaw=-asin(0-terrainnormal.x);
+                               targetyaw*=360/6.28;
+                               if(terrainnormal.z<0)targetyaw=180-targetyaw;
+                               yaw=targetyaw;
 
                                targetframe=0;
                                //      targetframe=2;
@@ -4571,7 +4571,7 @@ void      Person::DoStuff(){
 
                                for(i=0;i<skeleton.num_joints;i++){
                                        tempanimation.position[i][0]=skeleton.joints[i].position;
-                                       tempanimation.position[i][0]=DoRotation(tempanimation.position[i][0],0,-rotation,0);
+                                       tempanimation.position[i][0]=DoRotation(tempanimation.position[i][0],0,-yaw,0);
                                }
                        }
                }
@@ -4600,10 +4600,10 @@ void    Person::DoStuff(){
                                }
                                Normalise(&terrainnormal);
 
-                               targetrotation=-asin(0-terrainnormal.x);
-                               targetrotation*=360/6.28;
-                               if(terrainnormal.z<0)targetrotation=180-targetrotation;
-                               rotation=targetrotation;
+                               targetyaw=-asin(0-terrainnormal.x);
+                               targetyaw*=360/6.28;
+                               if(terrainnormal.z<0)targetyaw=180-targetyaw;
+                               yaw=targetyaw;
 
                                targettilt2=asin(terrainnormal.y)*180/3.14*-1;
 
@@ -4615,8 +4615,8 @@ void      Person::DoStuff(){
                                }
                                if(skeleton.forward.y>-.3){
                                        targetanimation=getupfromfrontanim;
-                                       rotation+=180;
-                                       targetrotation+=180;
+                                       yaw+=180;
+                                       targetyaw+=180;
                                        targettilt2*=-1;
                                        targetframe=0;
                                        targettilt2=0;
@@ -4624,23 +4624,23 @@ void    Person::DoStuff(){
 
                                if((Random()%8==0&&id!=0&&creature==rabbittype)||(Random()%2==0&&id!=0&&creature==wolftype)||(id==0&&crouchkeydown&&(forwardkeydown||backkeydown||leftkeydown||rightkeydown))){
                                        targetanimation=rollanim;
-                                       targetrotation=lookrotation;
+                                       targetyaw=lookyaw;
                                        if(id==0){
                                                if(rightkeydown){
-                                                       targetrotation-=90;
-                                                       if(forwardkeydown)targetrotation+=45;
-                                                       if(backkeydown)targetrotation-=45;
+                                                       targetyaw-=90;
+                                                       if(forwardkeydown)targetyaw+=45;
+                                                       if(backkeydown)targetyaw-=45;
                                                }
                                                if(leftkeydown){
-                                                       targetrotation+=90;
-                                                       if(forwardkeydown)targetrotation-=45;
-                                                       if(backkeydown)targetrotation+=45;
+                                                       targetyaw+=90;
+                                                       if(forwardkeydown)targetyaw-=45;
+                                                       if(backkeydown)targetyaw+=45;
                                                }
                                                if(backkeydown){
                                                        if ( !leftkeydown&&!rightkeydown)
-                                                               targetrotation+=180;
+                                                               targetyaw+=180;
                                                }
-                                               targetrotation+=180;
+                                               targetyaw+=180;
                                        }
                                }
 
@@ -4654,7 +4654,7 @@ void      Person::DoStuff(){
 
                                for(i=0;i<skeleton.num_joints;i++){
                                        tempanimation.position[i][0]=skeleton.joints[i].position;
-                                       tempanimation.position[i][0]=DoRotation(tempanimation.position[i][0],0,-rotation,0);
+                                       tempanimation.position[i][0]=DoRotation(tempanimation.position[i][0],0,-yaw,0);
                                }
                        }
                }
@@ -4667,10 +4667,10 @@ void    Person::DoStuff(){
                                XYZ tempvelocity;
                                tempvelocity=velocity;
                                Normalise(&tempvelocity);
-                               targetrotation=-asin(0-tempvelocity.x);
-                               targetrotation*=360/6.28;
-                               if(velocity.z<0)targetrotation=180-targetrotation;
-                               //targetrotation+=180;
+                               targetyaw=-asin(0-tempvelocity.x);
+                               targetyaw*=360/6.28;
+                               if(velocity.z<0)targetyaw=180-targetyaw;
+                               //targetyaw+=180;
 
                                skeleton.free=0;
                                if(dotproduct(&skeleton.forward,&tempvelocity)<0){
@@ -4679,7 +4679,7 @@ void      Person::DoStuff(){
                                }
                                else{
                                        targetanimation=backhandspringanim;
-                                       targetrotation+=180;
+                                       targetyaw+=180;
                                        targetframe=6;
                                }
                                target=0;
@@ -4692,7 +4692,7 @@ void      Person::DoStuff(){
 
                                velocity=0;
 
-                               rotation=targetrotation;
+                               yaw=targetyaw;
                                tilt=0;
                                targettilt=0;
                                tilt2=0;
@@ -4786,11 +4786,11 @@ void    Person::DoStuff(){
                                                }
                                                XYZ tempcoord;
                                                if(objects.type[i]==treeleavestype&&environment!=desertenvironment){
-                                                       if(objects.rotation2[i]==0)tempcoord=coords;
+                                                       if(objects.pitch[i]==0)tempcoord=coords;
                                                        else{
                                                                tempcoord=coords-objects.position[i];
-                                                               tempcoord=DoRotation(tempcoord,0,-objects.rotation[i],0);
-                                                               tempcoord=DoRotation(tempcoord,-objects.rotation2[i],0,0);
+                                                               tempcoord=DoRotation(tempcoord,0,-objects.yaw[i],0);
+                                                               tempcoord=DoRotation(tempcoord,-objects.pitch[i],0,0);
                                                                tempcoord+=objects.position[i];
                                                        }
                                                        if(findDistancefastflat(&tempcoord,&objects.position[i])<objects.scale[i]*objects.scale[i]*8&&findDistancefast(&tempcoord,&objects.position[i])<objects.scale[i]*objects.scale[i]*300&&tempcoord.y>objects.position[i].y+3*objects.scale[i]){
@@ -4898,8 +4898,8 @@ void      Person::DoStuff(){
                                if(!isnormal(targettilt2)&&targettilt2){
                                        targettilt2=0;
                                }
-                               if(!isnormal(targetrotation)&&targetrotation){
-                                       targetrotation=0;
+                               if(!isnormal(targetyaw)&&targetyaw){
+                                       targetyaw=0;
                                }
 
                                if(targetanimation==bounceidleanim||targetanimation==wolfidle||targetanimation==walkanim||targetanimation==drawrightanim||targetanimation==crouchdrawrightanim||targetanimation==drawleftanim||targetanimation==fightidleanim||targetanimation==fightsidestep||targetanimation==hanganim||isCrouch()||targetanimation==backhandspringanim){
@@ -5026,7 +5026,7 @@ void      Person::DoStuff(){
                                        flatfacing=0;
                                        flatfacing.z=1;
 
-                                       flatfacing=DoRotation(flatfacing,0,rotation,0);
+                                       flatfacing=DoRotation(flatfacing,0,yaw,0);
                                        facing=flatfacing;
                                        ReflectVector(&facing,terrainnormal);
                                        Normalise(&facing);
@@ -5342,14 +5342,14 @@ void    Person::DoStuff(){
                                        if(animation[targetanimation].attack==normalattack&&targetanimation!=rabbitkickanim&&!victim->skeleton.free){
                                                terrainnormal=victim->coords-coords;
                                                Normalise(&terrainnormal);
-                                               targetrotation=-asin(0-terrainnormal.x);
-                                               targetrotation*=360/6.28;
-                                               if(terrainnormal.z<0)targetrotation=180-targetrotation;
+                                               targetyaw=-asin(0-terrainnormal.x);
+                                               targetyaw*=360/6.28;
+                                               if(terrainnormal.z<0)targetyaw=180-targetyaw;
                                                targettilt2=-asin(terrainnormal.y)*360/6.28;//*-70;
                                        }
 
                                        if(animation[targetanimation].attack==reversal&&targetanimation!=rabbittacklinganim){
-                                               targetrotation=victim->targetrotation;
+                                               targetyaw=victim->targetyaw;
                                        }
                                        if(targetanimation==rabbittacklinganim){
                                                coords=victim->coords;
@@ -5389,7 +5389,7 @@ int Person::DrawSkeleton(){
                XYZ terrainlight;
                float terrainheight;
                float distance;
-               if(!isnormal(rotation))rotation=0;
+               if(!isnormal(yaw))yaw=0;
                if(!isnormal(tilt))tilt=0;
                if(!isnormal(tilt2))tilt2=0;
                oldplayerdetail=playerdetail;
@@ -5430,41 +5430,41 @@ int Person::DrawSkeleton(){
                        if(!isSleeping()&&!isSitting()){
                                if(onterrain&&((isIdle()||isCrouch()||isLanding()||isLandhard()||targetanimation==drawrightanim||targetanimation==drawleftanim||targetanimation==crouchdrawrightanim)&&(wasIdle()||wasCrouch()||wasLanding()||wasLandhard()||currentanimation==drawrightanim||currentanimation==drawleftanim||currentanimation==crouchdrawrightanim))&&!skeleton.free){
                                        XYZ point,newpoint,change,change2;
-                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
+                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
                                        heightleft=terrain.getHeight(point.x,point.z)+.04;
                                        point.y=heightleft;
                                        change=skeleton.joints[skeleton.jointlabels[leftankle]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
                                        change2=skeleton.joints[skeleton.jointlabels[leftknee]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
-                                       skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0);
+                                       skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0);
                                        skeleton.joints[skeleton.jointlabels[leftankle]].position=skeleton.joints[skeleton.jointlabels[leftfoot]].position+change;
                                        skeleton.joints[skeleton.jointlabels[leftknee]].position=(skeleton.joints[skeleton.jointlabels[leftfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[leftknee]].position)/2;
 
-                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                                        heightright=terrain.getHeight(point.x,point.z)+.04;
                                        point.y=heightright;
                                        change=skeleton.joints[skeleton.jointlabels[rightankle]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
                                        change2=skeleton.joints[skeleton.jointlabels[rightknee]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
-                                       skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0);
+                                       skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0);
                                        skeleton.joints[skeleton.jointlabels[rightankle]].position=skeleton.joints[skeleton.jointlabels[rightfoot]].position+change;
                                        skeleton.joints[skeleton.jointlabels[rightknee]].position=(skeleton.joints[skeleton.jointlabels[rightfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[rightknee]].position)/2;
                                        skeleton.DoConstraints(&coords,&scale);
 
                                        if(creature==wolftype){
-                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
+                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
                                                heightleft=terrain.getHeight(point.x,point.z)+.04;
                                                point.y=heightleft;
                                                change=skeleton.joints[skeleton.jointlabels[leftankle]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
                                                change2=skeleton.joints[skeleton.jointlabels[leftknee]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
-                                               skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0);
+                                               skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0);
                                                skeleton.joints[skeleton.jointlabels[leftankle]].position=skeleton.joints[skeleton.jointlabels[leftfoot]].position+change;
                                                skeleton.joints[skeleton.jointlabels[leftknee]].position=(skeleton.joints[skeleton.jointlabels[leftfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[leftknee]].position)/2;
 
-                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                                                heightright=terrain.getHeight(point.x,point.z)+.04;
                                                point.y=heightright;
                                                change=skeleton.joints[skeleton.jointlabels[rightankle]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
                                                change2=skeleton.joints[skeleton.jointlabels[rightknee]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
-                                               skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0);
+                                               skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0);
                                                skeleton.joints[skeleton.jointlabels[rightankle]].position=skeleton.joints[skeleton.jointlabels[rightfoot]].position+change;
                                                skeleton.joints[skeleton.jointlabels[rightknee]].position=(skeleton.joints[skeleton.jointlabels[rightfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[rightknee]].position)/2;
                                                skeleton.DoConstraints(&coords,&scale);
@@ -5472,41 +5472,41 @@ int Person::DrawSkeleton(){
                                }
                                if(onterrain&&((isIdle()||isCrouch()||isLanding()||isLandhard()||targetanimation==drawrightanim||targetanimation==drawleftanim||targetanimation==crouchdrawrightanim)&&!(wasIdle()||wasCrouch()||wasLanding()||wasLandhard()||currentanimation==drawrightanim||currentanimation==drawleftanim||currentanimation==crouchdrawrightanim))&&!skeleton.free){
                                        XYZ point,newpoint,change,change2;
-                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
+                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
                                        heightleft=terrain.getHeight(point.x,point.z)+.04;
                                        point.y=heightleft;
                                        change=skeleton.joints[skeleton.jointlabels[leftankle]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
                                        change2=skeleton.joints[skeleton.jointlabels[leftknee]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
-                                       skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*target+skeleton.joints[skeleton.jointlabels[leftfoot]].position*(1-target);
+                                       skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*target+skeleton.joints[skeleton.jointlabels[leftfoot]].position*(1-target);
                                        skeleton.joints[skeleton.jointlabels[leftankle]].position=skeleton.joints[skeleton.jointlabels[leftfoot]].position+change;
                                        skeleton.joints[skeleton.jointlabels[leftknee]].position=(skeleton.joints[skeleton.jointlabels[leftfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[leftknee]].position)/2;
 
-                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                                        heightright=terrain.getHeight(point.x,point.z)+.04;
                                        point.y=heightright;
                                        change=skeleton.joints[skeleton.jointlabels[rightankle]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
                                        change2=skeleton.joints[skeleton.jointlabels[rightknee]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
-                                       skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*target+skeleton.joints[skeleton.jointlabels[rightfoot]].position*(1-target);
+                                       skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*target+skeleton.joints[skeleton.jointlabels[rightfoot]].position*(1-target);
                                        skeleton.joints[skeleton.jointlabels[rightankle]].position=skeleton.joints[skeleton.jointlabels[rightfoot]].position+change;
                                        skeleton.joints[skeleton.jointlabels[rightknee]].position=(skeleton.joints[skeleton.jointlabels[rightfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[rightknee]].position)/2;
                                        skeleton.DoConstraints(&coords,&scale);
 
                                        if(creature==wolftype){
-                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
+                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
                                                heightleft=terrain.getHeight(point.x,point.z)+.04;
                                                point.y=heightleft;
                                                change=skeleton.joints[skeleton.jointlabels[leftankle]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
                                                change2=skeleton.joints[skeleton.jointlabels[leftknee]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
-                                               skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*target+skeleton.joints[skeleton.jointlabels[leftfoot]].position*(1-target);
+                                               skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*target+skeleton.joints[skeleton.jointlabels[leftfoot]].position*(1-target);
                                                skeleton.joints[skeleton.jointlabels[leftankle]].position=skeleton.joints[skeleton.jointlabels[leftfoot]].position+change;
                                                skeleton.joints[skeleton.jointlabels[leftknee]].position=(skeleton.joints[skeleton.jointlabels[leftfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[leftknee]].position)/2;
 
-                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                                                heightright=terrain.getHeight(point.x,point.z)+.04;
                                                point.y=heightright;
                                                change=skeleton.joints[skeleton.jointlabels[rightankle]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
                                                change2=skeleton.joints[skeleton.jointlabels[rightknee]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
-                                               skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*target+skeleton.joints[skeleton.jointlabels[rightfoot]].position*(1-target);
+                                               skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*target+skeleton.joints[skeleton.jointlabels[rightfoot]].position*(1-target);
                                                skeleton.joints[skeleton.jointlabels[rightankle]].position=skeleton.joints[skeleton.jointlabels[rightfoot]].position+change;
                                                skeleton.joints[skeleton.jointlabels[rightknee]].position=(skeleton.joints[skeleton.jointlabels[rightfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[rightknee]].position)/2;
                                                skeleton.DoConstraints(&coords,&scale);
@@ -5515,41 +5515,41 @@ int Person::DrawSkeleton(){
 
                                if(onterrain&&(!(isIdle()||isCrouch()||isLanding()||isLandhard()||targetanimation==drawrightanim||targetanimation==drawleftanim||targetanimation==crouchdrawrightanim)&&(wasIdle()||wasCrouch()||wasLanding()||wasLandhard()||currentanimation==drawrightanim||currentanimation==drawleftanim||currentanimation==crouchdrawrightanim))&&!skeleton.free){
                                        XYZ point,newpoint,change,change2;
-                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
+                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
                                        heightleft=terrain.getHeight(point.x,point.z)+.04;
                                        point.y=heightleft;
                                        change=skeleton.joints[skeleton.jointlabels[leftankle]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
                                        change2=skeleton.joints[skeleton.jointlabels[leftknee]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
-                                       skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*(1-target)+skeleton.joints[skeleton.jointlabels[leftfoot]].position*target;
+                                       skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*(1-target)+skeleton.joints[skeleton.jointlabels[leftfoot]].position*target;
                                        skeleton.joints[skeleton.jointlabels[leftankle]].position=skeleton.joints[skeleton.jointlabels[leftfoot]].position+change;
                                        skeleton.joints[skeleton.jointlabels[leftknee]].position=(skeleton.joints[skeleton.jointlabels[leftfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[leftknee]].position)/2;
 
-                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                                       point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                                        heightright=terrain.getHeight(point.x,point.z)+.04;
                                        point.y=heightright;
                                        change=skeleton.joints[skeleton.jointlabels[rightankle]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
                                        change2=skeleton.joints[skeleton.jointlabels[rightknee]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
-                                       skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*(1-target)+skeleton.joints[skeleton.jointlabels[rightfoot]].position*target;
+                                       skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*(1-target)+skeleton.joints[skeleton.jointlabels[rightfoot]].position*target;
                                        skeleton.joints[skeleton.jointlabels[rightankle]].position=skeleton.joints[skeleton.jointlabels[rightfoot]].position+change;
                                        skeleton.joints[skeleton.jointlabels[rightknee]].position=(skeleton.joints[skeleton.jointlabels[rightfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[rightknee]].position)/2;
                                        skeleton.DoConstraints(&coords,&scale);
 
                                        if(creature==wolftype){
-                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords;
+                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,yaw,0)*scale+coords;
                                                heightleft=terrain.getHeight(point.x,point.z)+.04;
                                                point.y=heightleft;
                                                change=skeleton.joints[skeleton.jointlabels[leftankle]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
                                                change2=skeleton.joints[skeleton.jointlabels[leftknee]].position-skeleton.joints[skeleton.jointlabels[leftfoot]].position;
-                                               skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*(1-target)+skeleton.joints[skeleton.jointlabels[leftfoot]].position*target;
+                                               skeleton.joints[skeleton.jointlabels[leftfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*(1-target)+skeleton.joints[skeleton.jointlabels[leftfoot]].position*target;
                                                skeleton.joints[skeleton.jointlabels[leftankle]].position=skeleton.joints[skeleton.jointlabels[leftfoot]].position+change;
                                                skeleton.joints[skeleton.jointlabels[leftknee]].position=(skeleton.joints[skeleton.jointlabels[leftfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[leftknee]].position)/2;
 
-                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords;
+                                               point=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,yaw,0)*scale+coords;
                                                heightright=terrain.getHeight(point.x,point.z)+.04;
                                                point.y=heightright;
                                                change=skeleton.joints[skeleton.jointlabels[rightankle]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
                                                change2=skeleton.joints[skeleton.jointlabels[rightknee]].position-skeleton.joints[skeleton.jointlabels[rightfoot]].position;
-                                               skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-rotation,0)*(1-target)+skeleton.joints[skeleton.jointlabels[rightfoot]].position*target;
+                                               skeleton.joints[skeleton.jointlabels[rightfoot]].position=DoRotation((point-coords)/scale,0,-yaw,0)*(1-target)+skeleton.joints[skeleton.jointlabels[rightfoot]].position*target;
                                                skeleton.joints[skeleton.jointlabels[rightankle]].position=skeleton.joints[skeleton.jointlabels[rightfoot]].position+change;
                                                skeleton.joints[skeleton.jointlabels[rightknee]].position=(skeleton.joints[skeleton.jointlabels[rightfoot]].position+change2)/2+(skeleton.joints[skeleton.jointlabels[rightknee]].position)/2;
                                                skeleton.DoConstraints(&coords,&scale);
@@ -5559,9 +5559,9 @@ int Person::DrawSkeleton(){
                        if(!skeleton.free&&(!animation[targetanimation].attack&&targetanimation!=getupfrombackanim&&((targetanimation!=rollanim&&!isFlip())||animation[targetanimation].label[targetframe]==6)&&targetanimation!=getupfromfrontanim&&targetanimation!=wolfrunninganim&&targetanimation!=rabbitrunninganim&&targetanimation!=backhandspringanim&&targetanimation!=walljumpfrontanim&&targetanimation!=hurtidleanim&&!isLandhard()&&!isSleeping()))
                                DoHead();
                        else {
-                               targetheadrotation=-targetrotation;
-                               targetheadrotation2=0;
-                               if(animation[targetanimation].attack==3)targetheadrotation+=180;
+                               targetheadyaw=-targetyaw;
+                               targetheadpitch=0;
+                               if(animation[targetanimation].attack==3)targetheadyaw+=180;
                        }
                        for(i=0;i<skeleton.drawmodel.vertexNum;i++){
                                skeleton.drawmodel.vertex[i]=0;
@@ -5764,7 +5764,7 @@ int Person::DrawSkeleton(){
                if(!skeleton.free)glTranslatef(coords.x,coords.y-.02,coords.z);
                if(skeleton.free)glTranslatef(coords.x,coords.y-.02,coords.z);
                if(!skeleton.free)glTranslatef(offset.x*scale,offset.y*scale,offset.z*scale);
-               if(!skeleton.free)glRotatef(rotation,0,1,0);
+               if(!skeleton.free)glRotatef(yaw,0,1,0);
                if(showpoints){
                        glPointSize(5);
                        glColor4f(.4,1,.4,1);
@@ -5950,8 +5950,8 @@ int Person::DrawSkeleton(){
                                        weapons[i].bigtilt=0;
                                        weapons[i].bigtilt2=0;
                                } else {
-                                       weapons[i].position=DoRotation(DoRotation(DoRotation(weaponpoint,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords+currentoffset*(1-target)*scale+targetoffset*target*scale;
-                                       weapons[i].bigrotation=rotation;
+                                       weapons[i].position=DoRotation(DoRotation(DoRotation(weaponpoint,0,0,tilt),tilt2,0,0),0,yaw,0)*scale+coords+currentoffset*(1-target)*scale+targetoffset*target*scale;
+                                       weapons[i].bigrotation=yaw;
                                        weapons[i].bigtilt=tilt;
                                        weapons[i].bigtilt2=tilt2;
                                }
index 60cc8616754fda39e805f17468912f6dbbf03bac..9c6ebe968a31ad5222e299ff3165fa567ae3be24 100644 (file)
@@ -93,15 +93,15 @@ class Person
                bool immobile;
                
                float velspeed;
-               float targetrotation;
+               float targetyaw;
                float targetrot;
                float rot;
                float oldrot;
-               float lookrotation;
-               float lookrotation2;
-               float rotation;
-               float rotation2;
-               float lowrotation;
+               float lookyaw;
+               float lookpitch;
+               float yaw;
+               float pitch;
+               float lowyaw;
                float tilt;
                float targettilt;
                float tilt2;
@@ -138,8 +138,8 @@ class Person
                int direction;
                float texupdatedelay;
                
-               float headrotation,headrotation2;
-               float targetheadrotation,targetheadrotation2;
+               float headyaw,headpitch;
+               float targetheadyaw,targetheadpitch;
                
                bool onterrain;
                bool pause;
index b338724bf0a529062597b42eb61771eb7eb17f28..cb8e043e4dc57ff26edc1598bfebfb13e1f73a78 100644 (file)
@@ -308,7 +308,7 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale)
 
                                                if(tutoriallevel!=1||id==0)
                                                        if(findLengthfast(&bounceness)>8000&&breaking){
-                                                               objects.model[k].MakeDecal(breakdecal,DoRotation(temp-objects.position[k],0,-objects.rotation[k],0),.4,.5,Random()%360);
+                                                               objects.model[k].MakeDecal(breakdecal,DoRotation(temp-objects.position[k],0,-objects.yaw[k],0),.4,.5,Random()%360);
                                                                Sprite::MakeSprite(cloudsprite, joints[i].position*(*scale)+*coords,joints[i].velocity*.06, 1,1,1, 4, .2);
                                                                //Sprite::MakeSprite(cloudsprite, joints[i].position*(*scale)+*coords,joints[i].velocity*.06, 1,1,1, 1, .2);
                                                                breaking=0;
@@ -366,7 +366,7 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale)
                                                                        friction=objects.friction[k];
                                                                        start=joints[i].realoldposition;
                                                                        end=joints[i].position*(*scale)+*coords;
-                                                                       whichhit=objects.model[k].LineCheckPossible(&start,&end,&temp,&objects.position[k],&objects.rotation[k]);
+                                                                       whichhit=objects.model[k].LineCheckPossible(&start,&end,&temp,&objects.position[k],&objects.yaw[k]);
                                                                        if(whichhit!=-1){
                                                                                if(joints[i].label==groin&&!joints[i].locked&&joints[i].delay<=0){
                                                                                        joints[i].locked=1;
@@ -385,7 +385,7 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale)
                                                                                        }
                                                                                }
 
-                                                                               terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
+                                                                               terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.yaw[k],0)*-1;
                                                                                if(terrainnormal.y>.8)freefall=0;
                                                                                bounceness=terrainnormal*findLength(&joints[i].velocity)*(abs(normaldotproduct(joints[i].velocity,terrainnormal)));
                                                                                if(findLengthfast(&joints[i].velocity)>findLengthfast(&joints[i].oldvelocity)){
@@ -394,7 +394,7 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale)
                                                                                }
                                                                                if(tutoriallevel!=1||id==0)
                                                                                        if(findLengthfast(&bounceness)>4000&&breaking){
-                                                                                               objects.model[k].MakeDecal(breakdecal,DoRotation(temp-objects.position[k],0,-objects.rotation[k],0),.4,.5,Random()%360);
+                                                                                               objects.model[k].MakeDecal(breakdecal,DoRotation(temp-objects.position[k],0,-objects.yaw[k],0),.4,.5,Random()%360);
                                                                                                Sprite::MakeSprite(cloudsprite, joints[i].position*(*scale)+*coords,joints[i].velocity*.06, 1,1,1, 4, .2);
                                                                                                breaking=0;
                                                                                                camerashake+=.6;
@@ -469,7 +469,7 @@ float Skeleton::DoConstraints(XYZ *coords,float *scale)
                                                //Make this less stupid
                                                start=joints[jointlabels[whichjointstartarray[i]]].position*(*scale)+*coords;
                                                end=joints[jointlabels[whichjointendarray[i]]].position*(*scale)+*coords;
-                                               whichhit=objects.model[k].LineCheckSlidePossible(&start,&end,&temp,&objects.position[k],&objects.rotation[k]);
+                                               whichhit=objects.model[k].LineCheckSlidePossible(&start,&end,&temp,&objects.position[k],&objects.yaw[k]);
                                                if(whichhit!=-1){
                                                        joints[jointlabels[whichjointendarray[i]]].position=(end-*coords)/(*scale);
                                                        for(j=0; j<num_muscles; j++){
index 0998e093bfc65eb35f85c1f6740cc9d334e9ac31..dbc9c230455e7eb6eb87e1d12644db1c3ac9db23 100644 (file)
@@ -310,11 +310,11 @@ void Sprite::Draw()
                                        if(!spritehit&&player[j].dead&&sprites[i]->alivetime>.1){
                                                where=sprites[i]->oldposition;
                                                where-=player[j].coords;
-                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].rotation,0);
+                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].yaw,0);
                                                startpoint=where;
                                                where=sprites[i]->position;
                                                where-=player[j].coords;
-                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].rotation,0);
+                                               if(!player[j].skeleton.free)where=DoRotation(where,0,-player[j].yaw,0);
                                                endpoint=where;
 
                                                movepoint=0;
@@ -338,8 +338,8 @@ void Sprite::Draw()
                                                                start=sprites[i]->oldposition;
                                                                end=sprites[i]->position;
                                                                if(!spritehit)
-                                                                       if(objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k])!=-1){
-                                                                               if(detail==2||(detail==1&&abs(Random()%4)==0)||(detail==0&&abs(Random()%8)==0))objects.model[k].MakeDecal(blooddecalfast,DoRotation(colpoint-objects.position[k],0,-objects.rotation[k],0),sprites[i]->size*1.6/*+abs((float)(Random()%100))/2400*/,.5,Random()%360);
+                                                                       if(objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k])!=-1){
+                                                                               if(detail==2||(detail==1&&abs(Random()%4)==0)||(detail==0&&abs(Random()%8)==0))objects.model[k].MakeDecal(blooddecalfast,DoRotation(colpoint-objects.position[k],0,-objects.yaw[k],0),sprites[i]->size*1.6/*+abs((float)(Random()%100))/2400*/,.5,Random()%360);
                                                                                DeleteSprite(i);
                                                                                spritehit=1;
                                                                        }       
index 4c4ff7429afa3a3da34684225c29f776e6fa006b..74afa40af14551efc81a94686f266a3d58a4409c 100644 (file)
@@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "Objects.h"
 extern XYZ viewer;
 extern float viewdistance;
-extern float lightambient[3],lightbrightness[3];
 extern float fadestart;
 extern int environment;
 extern float texscale;
@@ -1459,7 +1458,7 @@ void Terrain::DoShadows()
                                        if(objects.type[l]!=treetrunktype){
                                                testpoint=terrainpoint;
                                                testpoint2=terrainpoint+lightloc*50*(1-shadowed);
-                                               if(objects.model[l].LineCheck(&testpoint,&testpoint2,&col,&objects.position[l],&objects.rotation[l])!=-1){
+                                               if(objects.model[l].LineCheck(&testpoint,&testpoint2,&col,&objects.position[l],&objects.yaw[l])!=-1){
                                                        shadowed=1-(findDistance(&terrainpoint,&col)/50);       
                                                }
                                        }
index f6cf200fe8d5ef519b3d0222bb62796c292eea38..2f6a1ffd65106ed999e25df90608104433b89347 100644 (file)
@@ -159,11 +159,11 @@ void Weapon::DoStuff(int i) {
                                        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]);
+                                       whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                        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);
+                                                       objects.model[k].MakeDecal(breakdecal,DoRotation(colpoint-objects.position[k],0,-objects.yaw[k],0),.1,1,Random()%360);
+                                                       normalrot=DoRotation(objects.model[k].facenormals[whichhit],0,objects.yaw[k],0);
                                                        velocity=0;
                                                        if(type==knife)
                                                                position=colpoint-normalrot*.1;
@@ -214,7 +214,7 @@ 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;
+                               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].yaw,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) {
@@ -420,7 +420,7 @@ void Weapon::DoStuff(int i) {
                                                        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]);
+                                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                                                if(whichhit!=-1) {
                                                                        XYZ diff;
                                                                        diff=(colpoint-position);
@@ -435,7 +435,7 @@ void Weapon::DoStuff(int i) {
                                                        } 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]);
+                                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                                                if(whichhit!=-1){
                                                                        XYZ diff;
                                                                        diff=(colpoint-tippoint);
@@ -452,11 +452,11 @@ void Weapon::DoStuff(int i) {
 
                                                start=oldposition;
                                                end=position;
-                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
+                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                                if(whichhit!=-1) {
                                                        hitsomething=1;
                                                        position=colpoint;
-                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
+                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.yaw[k],0)*-1;
                                                        ReflectVector(&velocity,&terrainnormal);
                                                        position+=terrainnormal*.002;
 
@@ -480,11 +480,11 @@ void Weapon::DoStuff(int i) {
                                                }
                                                start=oldtippoint;
                                                end=tippoint;
-                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
+                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                                if(whichhit!=-1) {
                                                        hitsomething=1;
                                                        tippoint=colpoint;
-                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
+                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.yaw[k],0)*-1;
                                                        ReflectVector(&tipvelocity,&terrainnormal);
                                                        tippoint+=terrainnormal*.002;
 
@@ -506,7 +506,7 @@ void Weapon::DoStuff(int i) {
                                                        }
                                                }
 
-                                               if((objects.type[k]!=boxtype && objects.type[k]!=platformtype && objects.type[k]!=walltype && objects.type[k]!=weirdtype)||objects.rotation2[k]!=0)
+                                               if((objects.type[k]!=boxtype && objects.type[k]!=platformtype && objects.type[k]!=walltype && objects.type[k]!=weirdtype)||objects.pitch[k]!=0)
                                                        for(int m=0;m<2;m++){
                                                                mid=(position*(21+(float)m*10)+tippoint*(19-(float)m*10))/40;
                                                                oldmid2=mid;
@@ -514,11 +514,11 @@ void Weapon::DoStuff(int i) {
 
                                                                start=oldmid;
                                                                end=mid;
-                                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
+                                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                                                if(whichhit!=-1) {
                                                                        hitsomething=1;
                                                                        mid=colpoint;
-                                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
+                                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.yaw[k],0)*-1;
                                                                        ReflectVector(&velocity,&terrainnormal);
 
                                                                        bounceness=terrainnormal*findLength(&velocity)*(abs(normaldotproduct(velocity,terrainnormal)));
@@ -546,11 +546,11 @@ void Weapon::DoStuff(int i) {
 
                                                                start=oldmid;
                                                                end=mid;
-                                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
+                                                               whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                                                if(whichhit!=-1) {
                                                                        hitsomething=1;
                                                                        mid=colpoint;
-                                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.rotation[k],0)*-1;
+                                                                       terrainnormal=DoRotation(objects.model[k].facenormals[whichhit],0,objects.yaw[k],0)*-1;
                                                                        ReflectVector(&tipvelocity,&terrainnormal);
 
                                                                        bounceness=terrainnormal*findLength(&tipvelocity)*(abs(normaldotproduct(tipvelocity,terrainnormal)));
@@ -576,14 +576,14 @@ void Weapon::DoStuff(int i) {
                                                {
                                                        start=position;
                                                        end=tippoint;
-                                                       whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.rotation[k]);
+                                                       whichhit=objects.model[k].LineCheck(&start,&end,&colpoint,&objects.position[k],&objects.yaw[k]);
                                                        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];
+                                                               point[0]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[0]],0,objects.yaw[k],0)+objects.position[k];
+                                                               point[1]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[1]],0,objects.yaw[k],0)+objects.position[k];
+                                                               point[2]=DoRotation(objects.model[k].vertex[objects.model[k].Triangles[whichhit].vertex[2]],0,objects.yaw[k],0)+objects.position[k];
                                                                if(DistancePointLine(&closestswordpoint, &point[0], &point[1], &distance,&colpoint )) {
                                                                        if(distance<closestdistance||closestdistance==-1){
                                                                                closestpoint=colpoint;