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.
+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,
+Lugaru 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.
+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.
+along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
*/
// Enable full math definitions
}
}
- //if(terrain.lineTerrain(startpoint,endpoint,&colpoint)!=-1)return 1000;
-
return -1;
}
int mapvers;
FILE *tfile;
- //~ char* buff=getcwd(NULL,0);
- //~ cout << buff << " " << FixedFN << endl;
- //~ free(buff);
tfile = fopen( FixedFN, "rb" );
if (tfile) {
pause_sound(stream_firesound);
}
if (Input::isKeyPressed(SDL_SCANCODE_N) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
- //if(!Person::players[0]->skeleton.free)Person::players[0]->damage+=500;
Person::players[0]->RagDoll(0);
- //Person::players[0]->spurt=1;
- //Person::players[0]->DoDamage(1000);
emit_sound_at(whooshsound, Person::players[0]->coords, 128.);
}
}
if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
- //drawmode++;
- //if(drawmode>2)drawmode=0;
if (objects.numobjects < max_objects - 1) {
XYZ boxcoords;
boxcoords.x = Person::players[0]->coords.x;
Person::players[k]->yaw = stepTowardf(Person::players[k]->yaw, Person::players[k]->targetyaw, multiplier * Person::players[k]->turnspeed * 4);
}
- /*if(Person::players[k]->aitype!=passivetype||(distsq(&Person::players[k]->coords,&viewer)<viewdistance*viewdistance))*/
Person::players[k]->DoStuff();
if (Person::players[k]->immobile && k != 0)
Person::players[k]->coords = Person::players[k]->realoldcoords;
}
}
- if (tempcollide && (/*Person::players[k]->jumptogglekeydown*/1 == 1 || Person::players[k]->aitype != playercontrolled))
+ if (tempcollide)
for (int l = 0; l < terrain.patchobjectnum[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz]; l++) {
int i = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
lowpoint = Person::players[k]->coords;
if (j <= 6 || j <= 25 && Person::players[k]->animTarget == jumpdownanim)
break;
if (Person::players[k]->animTarget == jumpupanim || Person::players[k]->animTarget == jumpdownanim) {
- lowpoint = DoRotation(objects.model[i].facenormals[whichhit], 0, objects.yaw[k], 0);
lowpoint = Person::players[k]->coords;
lowpoint.y += (float)j / 13;
lowpointtarget = lowpoint + facing * 1.3;
if (Person::players[0]->animTarget != rabbitkickanim && Person::players[0]->weaponactive != -1) {
if (weapons[Person::players[0]->weaponids[0]].getType() == knife) {
if (Person::players[i]->isIdle() || Person::players[i]->isCrouch() || Person::players[i]->isRun() || Person::players[i]->isFlip()) {
- if (abs(Random() % 2 == 0))
+ if (abs(Random() % 2) == 0)
Person::players[i]->setAnimation(backhandspringanim);
else
Person::players[i]->setAnimation(rollanim);
hotspotvisual[i] -= multiplier / 320;
for (int i = 0; i < numhotspots; i++) {
- //if(hotspottype[i]<=10)
while (hotspotvisual[i] < 0) {
hotspotsprite = 0;
hotspotsprite.x = float(abs(Random() % 100000)) / 100000 * hotspotsize[i];
Person::players[i]->animTarget == rollanim ||
Person::players[i]->animTarget == backhandspringanim ||
Person::players[i]->isFlip() ||
- Person::players[i]->isFlip() ||
Person::players[i]->aitype != playercontrolled)) {
for (unsigned j = 0; j < weapons.size(); j++) {
if ((weapons[j].velocity.x == 0 && weapons[j].velocity.y == 0 && weapons[j].velocity.z == 0 ||
}
target.y += .1;
}
- if (Person::players[0]->skeleton.free != 2/*&&!autocam*/) {
+ if (Person::players[0]->skeleton.free != 2) {
cameraspeed = 20;
if (findLengthfast(&Person::players[0]->velocity) > 400) {
cameraspeed = 20 + (findLength(&Person::players[0]->velocity) - 20) * .96;
cameraloc.y = terrain.getHeight(cameraloc.x, cameraloc.z);
}
}
- /*
- //what did autocam do?
- if(Person::players[0]->skeleton.free!=2&&autocam){
- cameraspeed=20;
- if(findLengthfast(&Person::players[0]->velocity)>400){
- cameraspeed=20+(findLength(&Person::players[0]->velocity)-20)*.96;
- }
- if(Person::players[0]->skeleton.free==0&&Person::players[0]->animTarget!=hanganim&&Person::players[0]->animTarget!=climbanim)target.y+=1.4;
- cameradist+=multiplier*5;
- if(cameradist>3.3)cameradist=3.3;
- coltarget=target-cameraloc;
- if(findLengthfast(&coltarget)<multiplier*multiplier*400)cameraloc=target;
- else if(findLengthfast(&coltarget)>1)
- {
- Normalise(&coltarget);
- if(Person::players[0]->animTarget!=hanganim&&Person::players[0]->animTarget!=climbanim&&Person::players[0]->animCurrent!=climbanim&&Person::players[0]->currentoffset.x==0)cameraloc=cameraloc+coltarget*multiplier*cameraspeed;
- else cameraloc=cameraloc+coltarget*multiplier*8;
- }
- if(editorenabled)cameraloc=target;
- viewer=cameraloc;
- colviewer=viewer;
- coltarget=cameraloc;
- objects.SphereCheckPossible(&colviewer, findDistance(&colviewer,&coltarget));
- if(terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz])
- for(int j=0;j<terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz];j++){
- int i=terrain.patchobjects[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz][j];
- colviewer=viewer;
- coltarget=cameraloc;
- if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.yaw[i])!=-1)viewer=col;
- }
- if(terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz])
- for(int j=0;j<terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz];j++){
- int i=terrain.patchobjects[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz][j];
- colviewer=viewer;
- if(objects.model[i].SphereCheck(&colviewer,.15,&col,&objects.position[i],&objects.yaw[i])!=-1){
- viewer=colviewer;
- }
- }
- cameradist=findDistance(&viewer,&target);
- viewer.y=max((double)viewer.y,terrain.getHeight(viewer.x,viewer.z)+.6);
- if(cameraloc.y<terrain.getHeight(cameraloc.x,cameraloc.z)){
- cameraloc.y=terrain.getHeight(cameraloc.x,cameraloc.z);
- }
- }
- */
if (camerashake > .8)
camerashake = .8;
- //if(woozy>10)woozy=10;
- //woozy+=multiplier;
woozy += multiplier;
if (Person::players[0]->dead)
camerashake = 0;
woozy = 0;
camerashake -= multiplier * 2;
blackout -= multiplier * 2;
- //if(Person::players[0]->isCrouch())woozy-=multiplier*8;
if (camerashake < 0)
camerashake = 0;
if (blackout < 0)
blackout = 0;
- //if(woozy<0)woozy=0;
if (camerashake) {
viewer.x += (float)(Random() % 100) * .0005 * camerashake;
viewer.y += (float)(Random() % 100) * .0005 * camerashake;