From: Alexander Monakov Date: Sun, 6 Jun 2010 17:10:19 +0000 (+0400) Subject: Merge X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=bbebd42229325d9f25a0360074e587dc2cc25e7e;hp=782cd2fc8113bcc923c14f49c43b2951e1bb2d6d;p=lugaru.git Merge --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d86c839..383779d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,6 @@ set(LUGARU_SRCS ${SRCDIR}/Person.cpp ${SRCDIR}/private.c ${SRCDIR}/Quaternions.cpp - ${SRCDIR}/Random.c ${SRCDIR}/Skeleton.cpp ${SRCDIR}/Skybox.cpp ${SRCDIR}/Sprite.cpp diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 6ea23c2..8790825 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -2726,7 +2726,7 @@ void Game::Tick() gameon=1; OPENAL_SetPaused(channels[stream_music3], true); } - if(Input::Button()&&!oldbutton&&(selected-7>=accountactive->getCampaignChoicesMade())){//selected>=7&&(selected-7<=campaignnumchoices)){ + if(Input::Button()&&!oldbutton&&(selected-7>=accountactive->getCampaignChoicesMade())){ fireSound(); flash(); diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 3699818..4e163eb 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -230,8 +230,6 @@ Boolean SetUp (Game & game) LOGFUNC; - randSeed = UpTime().lo; - osx = 0; cellophane=0; texdetail=4; @@ -772,7 +770,7 @@ int main(int argc, char **argv) pgame = 0; CleanUp (); - + return 0; } catch (const std::exception& error) diff --git a/Source/Person.cpp b/Source/Person.cpp index 716130c..f55b400 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -1752,175 +1752,6 @@ void Person::Puff(int whichlabel){ } -/* -HitStruct Person::BulletCollideWithPlayer(XYZ start, XYZ end){ -float damage=20; -XYZ tempbulletloc[2]; -XYZ collisionpoint; -XYZ sparkpos; -GLfloat M[16]; -int collide; -float howfar; -XYZ average; -XYZ facing; -int howmany; -float distancemax; -HitStruct hitstruct; -hitstruct.collision=0; -//Make bounding sphere -average=0; -howmany=0; -for(int j=0;jdistancemax){ -distancemax=findDistancefast(average,skeleton.joints[j].position); -} -} -distancemax=fast_sqrt(distancemax); -//Collide with player -if(skeleton.free<1){ -start=start-coords; -end=end-coords; -if(rotation)start=DoRotation(start,0,-rotation,0); -if(rotation)end=DoRotation(end,0,-rotation,0); -} -tempbulletloc[0]=start; -tempbulletloc[1]=end; -if(sphere_line_intersection(tempbulletloc[0].x,tempbulletloc[0].y,tempbulletloc[0].z, -tempbulletloc[1].x,tempbulletloc[1].y,tempbulletloc[1].z, -average.x, average.y, average.z, distancemax)){ -for(int j=0;jposition.x)/2), -(-(skeleton.joints[j].position.y+skeleton.joints[j].parent->position.y)/2), -(-(skeleton.joints[j].position.z+skeleton.joints[j].parent->position.z)/2)); -glTranslatef(tempbulletloc[0].x,tempbulletloc[0].y,tempbulletloc[0].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[0].x=M[12]; -tempbulletloc[0].y=M[13]; -tempbulletloc[0].z=M[14]; -glPopMatrix(); -glPushMatrix(); -glLoadIdentity(); -glScalef(1,1/skeleton.joints[j].length,1); -glRotatef(skeleton.joints[j].rotate2-90,0,0,1); -glRotatef(skeleton.joints[j].rotate1-90,0,1,0); -glTranslatef( (-(skeleton.joints[j].position.x+skeleton.joints[j].parent->position.x)/2), -(-(skeleton.joints[j].position.y+skeleton.joints[j].parent->position.y)/2), -(-(skeleton.joints[j].position.z+skeleton.joints[j].parent->position.z)/2)); -glTranslatef(tempbulletloc[1].x,tempbulletloc[1].y,tempbulletloc[1].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[1].x=M[12]; -tempbulletloc[1].y=M[13]; -tempbulletloc[1].z=M[14]; -glPopMatrix(); -collide=skeletonmodels[skeleton.joints[j].modelnum].LineCheck(tempbulletloc[0],tempbulletloc[1],&collisionpoint); -if(collide!=-1) -{ -glPushMatrix(); -glLoadIdentity(); -glTranslatef( (skeleton.joints[j].position.x+skeleton.joints[j].parent->position.x)/2, -(skeleton.joints[j].position.y+skeleton.joints[j].parent->position.y)/2, -(skeleton.joints[j].position.z+skeleton.joints[j].parent->position.z)/2); -glRotatef(-skeleton.joints[j].rotate1+90,0,1,0); -glRotatef(-skeleton.joints[j].rotate2+90,0,0,1); -glScalef(1,skeleton.joints[j].length,1); -glTranslatef(collisionpoint.x,collisionpoint.y,collisionpoint.z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -collisionpoint.x=M[12]; -collisionpoint.y=M[13]; -collisionpoint.z=M[14]; -glPopMatrix(); -hitstruct.collision=1; -hitstruct.hitlocation=collisionpoint; -hitstruct.joint1=&skeleton.joints[j]; -hitstruct.joint2=skeleton.joints[j].parent; -} -} -} -for(int j=0;jposition.x+skeleton.muscles[j].parent2->position.x)/2), -(-(skeleton.muscles[j].parent1->position.y+skeleton.muscles[j].parent2->position.y)/2), -(-(skeleton.muscles[j].parent1->position.z+skeleton.muscles[j].parent2->position.z)/2)); - -glTranslatef(tempbulletloc[0].x,tempbulletloc[0].y,tempbulletloc[0].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[0].x=M[12]; -tempbulletloc[0].y=M[13]; -tempbulletloc[0].z=M[14]; -glPopMatrix(); -glPushMatrix(); -glLoadIdentity(); -glScalef(1,1/skeleton.muscles[j].length,1); -glRotatef(skeleton.muscles[j].rotate3,0,1,0); -glRotatef(skeleton.muscles[j].rotate2-90,0,0,1); -glRotatef(skeleton.muscles[j].rotate1-90,0,1,0); - -glTranslatef( (-(skeleton.muscles[j].parent1->position.x+skeleton.muscles[j].parent2->position.x)/2), -(-(skeleton.muscles[j].parent1->position.y+skeleton.muscles[j].parent2->position.y)/2), -(-(skeleton.muscles[j].parent1->position.z+skeleton.muscles[j].parent2->position.z)/2)); -glTranslatef(tempbulletloc[1].x,tempbulletloc[1].y,tempbulletloc[1].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[1].x=M[12]; -tempbulletloc[1].y=M[13]; -tempbulletloc[1].z=M[14]; -glPopMatrix(); -collide=skeletonmodels[skeleton.muscles[j].parent1->modelnum].LineCheck(tempbulletloc[0],tempbulletloc[1],&collisionpoint); -if(collide!=-1) -{ -glPushMatrix(); -glLoadIdentity(); -glTranslatef( (skeleton.muscles[j].parent1->position.x+skeleton.muscles[j].parent2->position.x)/2, -(skeleton.muscles[j].parent1->position.y+skeleton.muscles[j].parent2->position.y)/2, -(skeleton.muscles[j].parent1->position.z+skeleton.muscles[j].parent2->position.z)/2); -glRotatef(-skeleton.muscles[j].rotate1+90,0,1,0); -glRotatef(-skeleton.muscles[j].rotate2+90,0,0,1); -glRotatef(-skeleton.muscles[j].rotate3,0,1,0); -glScalef(1,findDistance(skeleton.muscles[j].parent1->position,skeleton.muscles[j].parent2->position),1); -glTranslatef(collisionpoint.x,collisionpoint.y,collisionpoint.z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -collisionpoint.x=M[12]; -collisionpoint.y=M[13]; -collisionpoint.z=M[14]; -glPopMatrix(); -hitstruct.collision=1; -hitstruct.hitlocation=collisionpoint; -hitstruct.joint1=skeleton.muscles[j].parent1; -hitstruct.joint2=skeleton.muscles[j].parent2; -} -} -} -} -if(skeleton.free<1){ -if(rotation)hitstruct.hitlocation=DoRotation(hitstruct.hitlocation,0,rotation,0); -hitstruct.hitlocation=hitstruct.hitlocation+coords; -} -return hitstruct; -} -*/ void Person::DoAnimations(){ if(!skeleton.free){ int i = 0; @@ -6500,21 +6331,6 @@ void Person::DoStuff(){ velocity=flatfacing*velspeed; } - /*if(creature==wolftype) - if(isRun()){ - velocity+=facing*multiplier*speed*700*scale; - velspeed=findLength(&velocity); - if(velspeed>speed*55*scale){ - velocity/=velspeed; - velspeed=speed*55*scale; - velocity*=velspeed; - } - velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); - velspeed=findLength(&velocity); - velocity=flatfacing*velspeed; - }*/ - if(targetanimation==rollanim&&animation[targetanimation].label[targetframe]!=6){ velocity+=facing*multiplier*speed*700*scale; velspeed=findLength(&velocity); diff --git a/Source/Person.h b/Source/Person.h index 517ca0d..27666e4 100644 --- a/Source/Person.h +++ b/Source/Person.h @@ -47,15 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define rabbittype 0 #define wolftype 1 -class HitStruct -{ - public: - Joint *joint1; - Joint *joint2; - XYZ hitlocation; - bool collision; -}; - class Person { public: @@ -380,7 +371,6 @@ class Person void DoStuff(); void DoAnimations(); void RagDoll(bool checkcollision); - HitStruct BulletCollideWithPlayer(XYZ start, XYZ end); }; #endif diff --git a/Source/Random.c b/Source/Random.c deleted file mode 100644 index add3a78..0000000 --- a/Source/Random.c +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright (C) 2003, 2010 - Wolfire Games - -This file is part of Lugaru. - -Lugaru is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - - -#include "Random.h" -#include "stdlib.h" - - -int randSeed = 1; - -short Random() -{ - /*unsigned int value = (unsigned int)randSeed; - unsigned int out=0; - int i=31; - - while (i > 0) - { - value ^= 0x81010000; - value ^= out; - if (value & 1) - { - value >>= 1; - value |= 0x80000000; - } - else - value >>= 1; - out <<= 1; - out |= (value&0x1); - i--; - } - if (value&0x80000000) - { - out <<= 1; - out |= 1; - } - else - out <<= 1; - - randSeed += out; - */ - return rand(); -} diff --git a/Source/Random.h b/Source/Random.h index 10f66cb..3d53ebe 100644 --- a/Source/Random.h +++ b/Source/Random.h @@ -22,18 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _RANDOM_H_ #define _RANDOM_H_ +#include -#if defined(__cplusplus) -extern "C" { -#endif - - -extern int randSeed; -short Random (); - - -#if defined(__cplusplus) +static inline short Random() +{ + return rand(); } -#endif #endif