2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
5 This file is part of Lugaru.
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
22 #include "openal_wrapper.h"
23 #include "Animation.h"
26 extern float screenwidth, screenheight;
27 extern float viewdistance;
29 extern float fadestart;
30 extern float texscale;
33 extern Terrain terrain;
34 extern int kTextureSize;
35 extern float texdetail;
36 extern float realtexdetail;
38 extern Objects objects;
40 extern bool cellophane;
41 extern GLubyte bloodText[512 * 512 * 3];
42 extern GLubyte wolfbloodText[512 * 512 * 3];
43 extern bool ismotionblur;
44 extern bool trilinear;
45 extern bool musictoggle;
46 extern int environment;
47 extern bool ambientsound;
48 extern float multiplier;
49 extern int netdatanew;
51 extern bool stillloading;
53 extern bool visibleloading;
54 extern float flashamount, flashr, flashg, flashb;
55 extern int flashdelay;
56 extern int whichjointstartarray[26];
57 extern int whichjointendarray[26];
58 extern int difficulty;
59 extern float slomospeed;
60 extern bool gamestarted;
62 extern int numdialogues;
63 extern int numdialogueboxes[20];
64 extern int dialoguetype[20];
65 extern int dialogueboxlocation[20][20];
66 extern float dialogueboxcolor[20][20][3];
67 extern int dialogueboxsound[20][20];
68 extern char dialoguetext[20][20][128];
69 extern char dialoguename[20][20][64];
70 extern XYZ dialoguecamera[20][20];
71 extern float dialoguecamerayaw[20][20];
72 extern float dialoguecamerapitch[20][20];
73 extern int indialogue;
74 extern int whichdialogue;
75 extern float dialoguetime;
77 extern float accountcampaignhighscore[10];
78 extern float accountcampaignfasttime[10];
79 extern float accountcampaignscore[10];
80 extern float accountcampaigntime[10];
82 extern int accountcampaignchoicesmade[10];
83 extern int accountcampaignchoices[10][5000];
85 void LOG(const std::string &fmt, ...)
87 // !!! FIXME: write me.
94 if (Game::endgame == 2) {
95 Game::accountactive->endGame();
99 Account::saveFile(":Data:Users", Game::accountactive);
103 LOG("Shutting down sound system...");
105 OPENAL_StopSound(OPENAL_ALL);
107 // this is causing problems on Linux, but we'll force an _exit() a little
108 // later in the shutdown process. --ryan.
111 for (int i = 0; i < sounds_count; ++i) {
112 OPENAL_Sample_Free(samp[i]);
122 skybox = new SkyBox();
125 void Game::deleteGame()
131 terraintexture.destroy();
132 terraintexture2.destroy();
133 cursortexture.destroy();
134 Maparrowtexture.destroy();
135 Mapboxtexture.destroy();
136 Mapcircletexture.destroy();
137 hawktexture.destroy();
138 loadscreentexture.destroy();
140 for (int i = 0; i < 10; i++)
141 Mainmenuitems[i].destroy();
143 glDeleteTextures(1, &screentexture);
144 glDeleteTextures(1, &screentexture2);
151 void LoadSave(const char *fileName, GLuint *textureid, bool mipmap, GLubyte *array, int *skinsize)
155 LOG(std::string("Loading (S)...") + fileName);
158 float temptexdetail = texdetail;
163 load_image(ConvertFileName(fileName), texture);
164 texdetail = temptexdetail;
166 int bytesPerPixel = texture.bpp / 8;
169 for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
170 if ((i + 1) % 4 || bytesPerPixel == 3) {
171 array[tempnum] = texture.data[i];
179 //***************> ResizeGLScene() <******/
180 GLvoid Game::ReSizeGLScene(float fov, float pnear)
182 if (screenheight == 0) {
186 glViewport(0, 0, screenwidth, screenheight);
188 glMatrixMode(GL_PROJECTION);
191 gluPerspective(fov, (GLfloat)screenwidth / (GLfloat)screenheight, pnear, viewdistance);
193 glMatrixMode(GL_MODELVIEW);
197 void Game::LoadingScreen()
199 static float loadprogress;
200 static AbsoluteTime frametime = {0, 0};
201 AbsoluteTime currTime = UpTime ();
202 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
204 if (0 > deltaTime) // if negative microseconds
205 deltaTime /= -1000000.0;
206 else // else milliseconds
209 multiplier = deltaTime;
210 if (multiplier < .001)
214 if (multiplier > .05) {
215 frametime = currTime; // reset for next time interval
219 glClearColor(0, 0, 0, 1);
220 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
223 loadtime += multiplier * 4;
225 loadprogress = loadtime;
226 if (loadprogress > 100)
231 glEnable(GL_TEXTURE_2D);
232 loadscreentexture.bind();
233 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
234 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
235 glDisable(GL_DEPTH_TEST);
236 glDisable(GL_CULL_FACE);
237 glDisable(GL_LIGHTING);
239 glMatrixMode(GL_PROJECTION);
242 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
243 glMatrixMode(GL_MODELVIEW);
246 glTranslatef(screenwidth / 2, screenheight / 2, 0);
247 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
248 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
250 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
253 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
254 glVertex3f(-1, -1, 0.0f);
255 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
256 glVertex3f(1, -1, 0.0f);
257 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
258 glVertex3f(1, 1, 0.0f);
259 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
260 glVertex3f(-1, 1, 0.0f);
266 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
267 glVertex3f(-1, -1, 0.0f);
268 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
269 glVertex3f(1, -1, 0.0f);
270 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
271 glVertex3f(1, 1, 0.0f);
272 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
273 glVertex3f(-1, 1, 0.0f);
276 glDisable(GL_TEXTURE_2D);
277 glMatrixMode(GL_PROJECTION);
279 glMatrixMode(GL_MODELVIEW);
284 glEnable(GL_TEXTURE_2D);
285 loadscreentexture.bind();
286 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
287 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
288 glDisable(GL_DEPTH_TEST);
289 glDisable(GL_CULL_FACE);
290 glDisable(GL_LIGHTING);
292 glMatrixMode(GL_PROJECTION);
295 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
296 glMatrixMode(GL_MODELVIEW);
299 glTranslatef(screenwidth / 2, screenheight / 2, 0);
300 glScalef((float)screenwidth / 2 * (1.5 - (loadprogress) / 200), (float)screenheight / 2 * (1.5 - (loadprogress) / 200), 1);
301 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
303 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
306 glTexCoord2f(0 + .5, 0 + .5);
307 glVertex3f(-1, -1, 0.0f);
308 glTexCoord2f(1 + .5, 0 + .5);
309 glVertex3f(1, -1, 0.0f);
310 glTexCoord2f(1 + .5, 1 + .5);
311 glVertex3f(1, 1, 0.0f);
312 glTexCoord2f(0 + .5, 1 + .5);
313 glVertex3f(-1, 1, 0.0f);
316 glDisable(GL_TEXTURE_2D);
317 glMatrixMode(GL_PROJECTION);
319 glMatrixMode(GL_MODELVIEW);
324 glEnable(GL_TEXTURE_2D);
325 loadscreentexture.bind();
326 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
327 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
328 glDisable(GL_DEPTH_TEST);
329 glDisable(GL_CULL_FACE);
330 glDisable(GL_LIGHTING);
332 glMatrixMode(GL_PROJECTION);
335 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
336 glMatrixMode(GL_MODELVIEW);
339 glTranslatef(screenwidth / 2, screenheight / 2, 0);
340 glScalef((float)screenwidth / 2 * (100 + loadprogress) / 100, (float)screenheight / 2 * (100 + loadprogress) / 100, 1);
341 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
343 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, .4);
346 glTexCoord2f(0 + .2, 0 + .8);
347 glVertex3f(-1, -1, 0.0f);
348 glTexCoord2f(1 + .2, 0 + .8);
349 glVertex3f(1, -1, 0.0f);
350 glTexCoord2f(1 + .2, 1 + .8);
351 glVertex3f(1, 1, 0.0f);
352 glTexCoord2f(0 + .2, 1 + .8);
353 glVertex3f(-1, 1, 0.0f);
356 glDisable(GL_TEXTURE_2D);
357 glMatrixMode(GL_PROJECTION);
359 glMatrixMode(GL_MODELVIEW);
366 if (flashamount > 0) {
370 flashamount -= multiplier;
374 glDisable(GL_DEPTH_TEST);
375 glDisable(GL_CULL_FACE);
376 glDisable(GL_LIGHTING);
377 glDisable(GL_TEXTURE_2D);
379 glMatrixMode(GL_PROJECTION);
382 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
383 glMatrixMode(GL_MODELVIEW);
386 glScalef(screenwidth, screenheight, 1);
387 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
389 glColor4f(flashr, flashg, flashb, flashamount);
391 glVertex3f(0, 0, 0.0f);
392 glVertex3f(256, 0, 0.0f);
393 glVertex3f(256, 256, 0.0f);
394 glVertex3f(0, 256, 0.0f);
396 glMatrixMode(GL_PROJECTION);
398 glMatrixMode(GL_MODELVIEW);
400 glEnable(GL_DEPTH_TEST);
401 glEnable(GL_CULL_FACE);
410 void FadeLoadingScreen(float howmuch)
412 static float loadprogress;
416 glClearColor(0, 0, 0, 1);
417 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
419 loadprogress = howmuch;
423 glDisable(GL_TEXTURE_2D);
424 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
425 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
426 glDisable(GL_DEPTH_TEST);
427 glDisable(GL_CULL_FACE);
428 glDisable(GL_LIGHTING);
430 glMatrixMode(GL_PROJECTION);
433 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
434 glMatrixMode(GL_MODELVIEW);
437 glTranslatef(screenwidth / 2, screenheight / 2, 0);
438 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
439 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
441 glColor4f(loadprogress / 100, 0, 0, 1);
445 glVertex3f(-1, -1, 0.0f);
447 glVertex3f(1, -1, 0.0f);
449 glVertex3f(1, 1, 0.0f);
451 glVertex3f(-1, 1, 0.0f);
454 glDisable(GL_TEXTURE_2D);
455 glMatrixMode(GL_PROJECTION);
457 glMatrixMode(GL_MODELVIEW);
465 void Game::InitGame()
469 numchallengelevels = 14;
471 accountactive = Account::loadFile(":Data:Users");
473 whichjointstartarray[0] = righthip;
474 whichjointendarray[0] = rightfoot;
476 whichjointstartarray[1] = righthip;
477 whichjointendarray[1] = rightankle;
479 whichjointstartarray[2] = righthip;
480 whichjointendarray[2] = rightknee;
482 whichjointstartarray[3] = rightknee;
483 whichjointendarray[3] = rightankle;
485 whichjointstartarray[4] = rightankle;
486 whichjointendarray[4] = rightfoot;
488 whichjointstartarray[5] = lefthip;
489 whichjointendarray[5] = leftfoot;
491 whichjointstartarray[6] = lefthip;
492 whichjointendarray[6] = leftankle;
494 whichjointstartarray[7] = lefthip;
495 whichjointendarray[7] = leftknee;
497 whichjointstartarray[8] = leftknee;
498 whichjointendarray[8] = leftankle;
500 whichjointstartarray[9] = leftankle;
501 whichjointendarray[9] = leftfoot;
503 whichjointstartarray[10] = abdomen;
504 whichjointendarray[10] = rightshoulder;
506 whichjointstartarray[11] = abdomen;
507 whichjointendarray[11] = rightelbow;
509 whichjointstartarray[12] = abdomen;
510 whichjointendarray[12] = rightwrist;
512 whichjointstartarray[13] = abdomen;
513 whichjointendarray[13] = righthand;
515 whichjointstartarray[14] = rightshoulder;
516 whichjointendarray[14] = rightelbow;
518 whichjointstartarray[15] = rightelbow;
519 whichjointendarray[15] = rightwrist;
521 whichjointstartarray[16] = rightwrist;
522 whichjointendarray[16] = righthand;
524 whichjointstartarray[17] = abdomen;
525 whichjointendarray[17] = leftshoulder;
527 whichjointstartarray[18] = abdomen;
528 whichjointendarray[18] = leftelbow;
530 whichjointstartarray[19] = abdomen;
531 whichjointendarray[19] = leftwrist;
533 whichjointstartarray[20] = abdomen;
534 whichjointendarray[20] = lefthand;
536 whichjointstartarray[21] = leftshoulder;
537 whichjointendarray[21] = leftelbow;
539 whichjointstartarray[22] = leftelbow;
540 whichjointendarray[22] = leftwrist;
542 whichjointstartarray[23] = leftwrist;
543 whichjointendarray[23] = lefthand;
545 whichjointstartarray[24] = abdomen;
546 whichjointendarray[24] = neck;
548 whichjointstartarray[25] = neck;
549 whichjointendarray[25] = head;
551 FadeLoadingScreen(0);
555 int temptexdetail = texdetail;
557 text->LoadFontTexture(":Data:Textures:Font.png");
559 texdetail = temptexdetail;
561 FadeLoadingScreen(10);
573 LOG("Initializing sound system...");
576 unsigned char rc = 0;
577 int output = OPENAL_OUTPUT_ALSA; // Try alsa first...
578 if (commandLineOptions[SOUND]) {
579 output = commandLineOptions[SOUND].last()->type(); // ...but let user override that.
582 OPENAL_SetOutput(output);
583 if ((rc = OPENAL_Init(44100, 32, 0)) == false) {
584 // if we tried ALSA and failed, fall back to OSS.
585 if ( (output == OPENAL_OUTPUT_ALSA) && (commandLineOptions[SOUND].last()->type() != OPENAL_OUTPUT_ALSA) ) {
587 output = OPENAL_OUTPUT_OSS;
588 OPENAL_SetOutput(output);
589 rc = OPENAL_Init(44100, 32, 0);
595 output = OPENAL_OUTPUT_NOSOUND; // we tried! just do silence.
596 OPENAL_SetOutput(output);
597 rc = OPENAL_Init(44100, 32, 0);
600 OPENAL_Init(44100, 32, 0);
603 OPENAL_SetSFXMasterVolume((int)(volume * 255));
607 emit_stream_np(stream_menutheme);
609 cursortexture.load(":Data:Textures:Cursor.png", 0);
611 Mapcircletexture.load(":Data:Textures:MapCircle.png", 0);
612 Mapboxtexture.load(":Data:Textures:MapBox.png", 0);
613 Maparrowtexture.load(":Data:Textures:MapArrow.png", 0);
615 temptexdetail = texdetail;
618 Mainmenuitems[0].load(":Data:Textures:Lugaru.png", 0);
619 Mainmenuitems[1].load(":Data:Textures:Newgame.png", 0);
620 Mainmenuitems[2].load(":Data:Textures:Options.png", 0);
621 Mainmenuitems[3].load(":Data:Textures:Quit.png", 0);
622 Mainmenuitems[4].load(":Data:Textures:Eyelid.png", 0);
623 Mainmenuitems[5].load(":Data:Textures:Resume.png", 0);
624 Mainmenuitems[6].load(":Data:Textures:Endgame.png", 0);
626 texdetail = temptexdetail;
628 FadeLoadingScreen(95);
638 newscreenwidth = screenwidth;
639 newscreenheight = screenheight;
645 void Game::LoadScreenTexture()
647 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
649 if (!Game::screentexture)
650 glGenTextures( 1, &Game::screentexture );
651 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
654 glEnable(GL_TEXTURE_2D);
655 glBindTexture( GL_TEXTURE_2D, Game::screentexture);
656 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
657 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
659 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
662 //TODO: move LoadStuff() closer to GameTick.cpp to get rid of various vars shared in Game.h
663 void Game::LoadStuff()
665 static float temptexdetail;
666 static float viewdistdetail;
676 for (auto p:Person::players) {
677 p->skeleton.drawmodel.textureptr.destroy();
680 i = abs(Random() % 4);
681 visibleloading = 0; //don't use loadscreentexture yet
682 loadscreentexture.load(":Data:Textures:fire.jpg", 1);
685 temptexdetail = texdetail;
687 text->LoadFontTexture(":Data:Textures:Font.png");
689 texdetail = temptexdetail;
692 viewdistance = 50 * megascale * viewdistdetail;
704 realtexdetail = texdetail;
706 LOG("Loading weapon data...");
708 Weapon::knifetextureptr.load(":Data:Textures:knife.png", 0);
709 Weapon::bloodknifetextureptr.load(":Data:Textures:bloodknife.png", 0);
710 Weapon::lightbloodknifetextureptr.load(":Data:Textures:lightbloodknife.png", 0);
711 Weapon::swordtextureptr.load(":Data:Textures:sword.jpg", 1);
712 Weapon::bloodswordtextureptr.load(":Data:Textures:Swordblood.jpg", 1);
713 Weapon::lightbloodswordtextureptr.load(":Data:Textures:Swordbloodlight.jpg", 1);
714 Weapon::stafftextureptr.load(":Data:Textures:Staff.jpg", 1);
716 Weapon::throwingknifemodel.load((char *)":Data:Models:throwingknife.solid", 1);
717 Weapon::throwingknifemodel.Scale(.001, .001, .001);
718 Weapon::throwingknifemodel.Rotate(90, 0, 0);
719 Weapon::throwingknifemodel.Rotate(0, 90, 0);
720 Weapon::throwingknifemodel.flat = 0;
721 Weapon::throwingknifemodel.CalculateNormals(1);
723 Weapon::swordmodel.load((char *)":Data:Models:sword.solid", 1);
724 Weapon::swordmodel.Scale(.001, .001, .001);
725 Weapon::swordmodel.Rotate(90, 0, 0);
726 Weapon::swordmodel.Rotate(0, 90, 0);
727 Weapon::swordmodel.Rotate(0, 0, 90);
728 Weapon::swordmodel.flat = 1;
729 Weapon::swordmodel.CalculateNormals(1);
731 Weapon::staffmodel.load((char *)":Data:Models:staff.solid", 1);
732 Weapon::staffmodel.Scale(.005, .005, .005);
733 Weapon::staffmodel.Rotate(90, 0, 0);
734 Weapon::staffmodel.Rotate(0, 90, 0);
735 Weapon::staffmodel.Rotate(0, 0, 90);
736 Weapon::staffmodel.flat = 1;
737 Weapon::staffmodel.CalculateNormals(1);
739 terrain.shadowtexture.load(":Data:Textures:shadow.png", 0);
740 terrain.bloodtexture.load(":Data:Textures:blood.png", 0);
741 terrain.breaktexture.load(":Data:Textures:break.png", 0);
742 terrain.bloodtexture2.load(":Data:Textures:blood.png", 0);
745 terrain.footprinttexture.load(":Data:Textures:footprint.png", 0);
746 terrain.bodyprinttexture.load(":Data:Textures:bodyprint.png", 0);
747 hawktexture.load(":Data:Textures:hawk.png", 0);
750 Sprite::cloudtexture.load(":Data:Textures:cloud.png", 1);
751 Sprite::cloudimpacttexture.load(":Data:Textures:cloudimpact.png", 1);
752 Sprite::bloodtexture.load(":Data:Textures:bloodparticle.png", 1);
753 Sprite::snowflaketexture.load(":Data:Textures:snowflake.png", 1);
754 Sprite::flametexture.load(":Data:Textures:flame.png", 1);
755 Sprite::bloodflametexture.load(":Data:Textures:bloodflame.png", 1);
756 Sprite::smoketexture.load(":Data:Textures:smoke.png", 1);
757 Sprite::shinetexture.load(":Data:Textures:shine.png", 1);
758 Sprite::splintertexture.load(":Data:Textures:splinter.png", 1);
759 Sprite::leaftexture.load(":Data:Textures:leaf.png", 1);
760 Sprite::toothtexture.load(":Data:Textures:tooth.png", 1);
764 ReSizeGLScene(90, .01);
776 //Set up distant light
777 light.color[0] = .95;
778 light.color[1] = .95;
780 light.ambient[0] = .2;
781 light.ambient[1] = .2;
782 light.ambient[2] = .24;
783 light.location.x = 1;
784 light.location.y = 1;
785 light.location.z = -.2;
786 Normalise(&light.location);
796 texscale = .2 / megascale / viewdistdetail;
797 terrain.scale = 3 * megascale * viewdistdetail;
799 viewer.x = terrain.size / 2 * terrain.scale;
800 viewer.z = terrain.size / 2 * terrain.scale;
802 hawk.load((char *)":Data:Models:hawk.solid", 1);
803 hawk.Scale(.03, .03, .03);
804 hawk.Rotate(90, 1, 1);
805 hawk.CalculateNormals(0);
806 hawk.ScaleNormals(-1, -1, -1);
807 hawkcoords.x = terrain.size / 2 * terrain.scale - 5 - 7;
808 hawkcoords.z = terrain.size / 2 * terrain.scale - 5 - 7;
809 hawkcoords.y = terrain.getHeight(hawkcoords.x, hawkcoords.z) + 25;
811 eye.load((char *)":Data:Models:eye.solid", 1);
812 eye.Scale(.03, .03, .03);
813 eye.CalculateNormals(0);
815 cornea.load((char *)":Data:Models:cornea.solid", 1);
816 cornea.Scale(.03, .03, .03);
817 cornea.CalculateNormals(0);
819 iris.load((char *)":Data:Models:iris.solid", 1);
820 iris.Scale(.03, .03, .03);
821 iris.CalculateNormals(0);
823 LoadSave(":Data:Textures:Bloodfur.png", 0, 1, &bloodText[0], 0);
824 LoadSave(":Data:Textures:Wolfbloodfur.png", 0, 1, &wolfbloodText[0], 0);
834 //Fix knife stab, too lazy to do it manually
838 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
839 for (j = 0; j < animation[knifesneakattackanim].numframes; j++) {
840 animation[knifesneakattackanim].position[i][j] += moveamount;
846 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
847 for (j = 0; j < animation[knifesneakattackedanim].numframes; j++) {
848 animation[knifesneakattackedanim].position[i][j] += moveamount;
854 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
855 animation[dead1anim].position[i][1] = animation[dead1anim].position[i][0];
856 animation[dead2anim].position[i][1] = animation[dead2anim].position[i][0];
857 animation[dead3anim].position[i][1] = animation[dead3anim].position[i][0];
858 animation[dead4anim].position[i][1] = animation[dead4anim].position[i][0];
860 animation[dead1anim].speed[0] = 0.001;
861 animation[dead2anim].speed[0] = 0.001;
862 animation[dead3anim].speed[0] = 0.001;
863 animation[dead4anim].speed[0] = 0.001;
865 animation[dead1anim].speed[1] = 0.001;
866 animation[dead2anim].speed[1] = 0.001;
867 animation[dead3anim].speed[1] = 0.001;
868 animation[dead4anim].speed[1] = 0.001;
870 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
871 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
872 animation[swordsneakattackanim].position[i][j] += moveamount;
876 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
877 animation[swordsneakattackanim].weapontarget[j] += moveamount;
882 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
883 for (j = 0; j < animation[swordsneakattackedanim].numframes; j++) {
884 animation[swordsneakattackedanim].position[i][j] += moveamount;
889 temptexdetail = texdetail;
891 texdetail = temptexdetail;
895 if (!screentexture) {
899 if (targetlevel != 7) {
900 emit_sound_at(fireendsound);