]> git.jsancho.org Git - lugaru.git/commitdiff
Merge
authorAlexander Monakov <amonakov@gmail.com>
Sun, 6 Jun 2010 17:10:19 +0000 (21:10 +0400)
committerAlexander Monakov <amonakov@gmail.com>
Sun, 6 Jun 2010 17:10:19 +0000 (21:10 +0400)
CMakeLists.txt
Source/GameTick.cpp
Source/OpenGL_Windows.cpp
Source/Person.cpp
Source/Person.h
Source/Random.c [deleted file]
Source/Random.h

index d86c839cc3066e8317dba38886c40fe9d28f46fe..383779d1e0b92473765430a17a554627eb404cdd 100644 (file)
@@ -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
index 6ea23c2e87d01d1d27e4e8191fbd8b533d69ba5e..879082529777acd783620e0a525430de9a9ec49d 100644 (file)
@@ -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();
index 36998186c323d4351157336184096481115cedd5..4e163eb85f89637e779feb428a680dd4df02fa96 100644 (file)
@@ -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)
index 716130cd9957c71f6a6ad2b1405a93eff983f3dc..f55b400097bad76913ab38789dd405c51f71fa6c 100644 (file)
@@ -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;j<skeleton.num_joints;j++){
-average.x=average.x+skeleton.joints[j].position.x;
-average.y=average.y+skeleton.joints[j].position.y;
-average.z=average.z+skeleton.joints[j].position.z;
-howmany++;
-}
-average=average/howmany;
-distancemax=0;
-for(int j=0;j<skeleton.num_joints;j++){
-if(findDistancefast(average,skeleton.joints[j].position)>distancemax){
-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;j<skeleton.num_joints;j++){
-if(skeleton.joints[j].hasparent&&skeleton.joints[j].visible){
-tempbulletloc[0]=start;
-tempbulletloc[1]=end;
-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[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;j<skeleton.num_muscles;j++){
-if(skeleton.muscles[j].visible){
-tempbulletloc[0]=start;
-tempbulletloc[1]=end;
-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[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);
index 517ca0d5057a544358f8ac9b69ad70cd50b1d8f4..27666e4bf904fe99cd04b1d1c0b1d3e50710a665 100644 (file)
@@ -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 (file)
index add3a78..0000000
+++ /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();
-}
index 10f66cb257cac6b91648fb1790e0cea00db34101..3d53ebeb66897a533483922314ec1f908fa38cec 100644 (file)
@@ -22,18 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #ifndef _RANDOM_H_
 #define _RANDOM_H_
 
+#include <stdlib.h>
 
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-
-extern int randSeed;
-short Random ();
-
-
-#if defined(__cplusplus)
+static inline short Random()
+{
+    return rand();
 }
-#endif
 
 #endif