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"
25 #include "Utils/Folders.h"
27 extern float screenwidth, screenheight;
28 extern float viewdistance;
30 extern float fadestart;
31 extern float texscale;
34 extern Terrain terrain;
35 extern int kTextureSize;
36 extern float texdetail;
37 extern float realtexdetail;
39 extern Objects objects;
41 extern bool cellophane;
42 extern GLubyte bloodText[512 * 512 * 3];
43 extern GLubyte wolfbloodText[512 * 512 * 3];
44 extern bool ismotionblur;
45 extern bool trilinear;
46 extern bool musictoggle;
47 extern int environment;
48 extern bool ambientsound;
49 extern float multiplier;
50 extern int netdatanew;
52 extern bool stillloading;
54 extern bool visibleloading;
55 extern float flashamount, flashr, flashg, flashb;
56 extern int flashdelay;
57 extern int whichjointstartarray[26];
58 extern int whichjointendarray[26];
59 extern int difficulty;
60 extern float slomospeed;
61 extern bool gamestarted;
63 extern float accountcampaignhighscore[10];
64 extern float accountcampaignfasttime[10];
65 extern float accountcampaignscore[10];
66 extern float accountcampaigntime[10];
68 extern int accountcampaignchoicesmade[10];
69 extern int accountcampaignchoices[10][5000];
71 void LOG(const std::string &fmt, ...)
73 // !!! FIXME: write me.
80 if (Game::endgame == 2) {
81 Game::accountactive->endGame();
85 Account::saveFile(Folders::getUserDataPath()+"/users", Game::accountactive);
89 LOG("Shutting down sound system...");
91 OPENAL_StopSound(OPENAL_ALL);
93 // this is causing problems on Linux, but we'll force an _exit() a little
94 // later in the shutdown process. --ryan.
97 for (int i = 0; i < sounds_count; ++i) {
98 OPENAL_Sample_Free(samp[i]);
108 skybox = new SkyBox();
111 void Game::deleteGame()
117 terraintexture.destroy();
118 terraintexture2.destroy();
119 cursortexture.destroy();
120 Maparrowtexture.destroy();
121 Mapboxtexture.destroy();
122 Mapcircletexture.destroy();
123 hawktexture.destroy();
124 loadscreentexture.destroy();
126 for (int i = 0; i < 10; i++)
127 Mainmenuitems[i].destroy();
129 glDeleteTextures(1, &screentexture);
130 glDeleteTextures(1, &screentexture2);
137 void LoadSave(const char *fileName, GLuint *textureid, bool mipmap, GLubyte *array, int *skinsize)
141 LOG(std::string("Loading (S)...") + fileName);
144 float temptexdetail = texdetail;
149 load_image(Folders::getResourcePath(fileName).c_str(), texture);
150 texdetail = temptexdetail;
152 int bytesPerPixel = texture.bpp / 8;
155 for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
156 if ((i + 1) % 4 || bytesPerPixel == 3) {
157 array[tempnum] = texture.data[i];
165 //***************> ResizeGLScene() <******/
166 GLvoid Game::ReSizeGLScene(float fov, float pnear)
168 if (screenheight == 0) {
172 glViewport(0, 0, screenwidth, screenheight);
174 glMatrixMode(GL_PROJECTION);
177 gluPerspective(fov, (GLfloat)screenwidth / (GLfloat)screenheight, pnear, viewdistance);
179 glMatrixMode(GL_MODELVIEW);
183 void Game::LoadingScreen()
185 static float loadprogress;
186 static AbsoluteTime frametime = {0, 0};
187 AbsoluteTime currTime = UpTime ();
188 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
190 if (0 > deltaTime) // if negative microseconds
191 deltaTime /= -1000000.0;
192 else // else milliseconds
195 multiplier = deltaTime;
196 if (multiplier < .001)
200 if (multiplier > .05) {
201 frametime = currTime; // reset for next time interval
205 glClearColor(0, 0, 0, 1);
206 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
209 loadtime += multiplier * 4;
211 loadprogress = loadtime;
212 if (loadprogress > 100)
217 glEnable(GL_TEXTURE_2D);
218 loadscreentexture.bind();
219 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
220 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
221 glDisable(GL_DEPTH_TEST);
222 glDisable(GL_CULL_FACE);
223 glDisable(GL_LIGHTING);
225 glMatrixMode(GL_PROJECTION);
228 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
229 glMatrixMode(GL_MODELVIEW);
232 glTranslatef(screenwidth / 2, screenheight / 2, 0);
233 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
234 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
236 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
239 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
240 glVertex3f(-1, -1, 0.0f);
241 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
242 glVertex3f(1, -1, 0.0f);
243 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
244 glVertex3f(1, 1, 0.0f);
245 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
246 glVertex3f(-1, 1, 0.0f);
252 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
253 glVertex3f(-1, -1, 0.0f);
254 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
255 glVertex3f(1, -1, 0.0f);
256 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
257 glVertex3f(1, 1, 0.0f);
258 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
259 glVertex3f(-1, 1, 0.0f);
262 glDisable(GL_TEXTURE_2D);
263 glMatrixMode(GL_PROJECTION);
265 glMatrixMode(GL_MODELVIEW);
270 glEnable(GL_TEXTURE_2D);
271 loadscreentexture.bind();
272 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
273 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
274 glDisable(GL_DEPTH_TEST);
275 glDisable(GL_CULL_FACE);
276 glDisable(GL_LIGHTING);
278 glMatrixMode(GL_PROJECTION);
281 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
282 glMatrixMode(GL_MODELVIEW);
285 glTranslatef(screenwidth / 2, screenheight / 2, 0);
286 glScalef((float)screenwidth / 2 * (1.5 - (loadprogress) / 200), (float)screenheight / 2 * (1.5 - (loadprogress) / 200), 1);
287 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
289 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
292 glTexCoord2f(0 + .5, 0 + .5);
293 glVertex3f(-1, -1, 0.0f);
294 glTexCoord2f(1 + .5, 0 + .5);
295 glVertex3f(1, -1, 0.0f);
296 glTexCoord2f(1 + .5, 1 + .5);
297 glVertex3f(1, 1, 0.0f);
298 glTexCoord2f(0 + .5, 1 + .5);
299 glVertex3f(-1, 1, 0.0f);
302 glDisable(GL_TEXTURE_2D);
303 glMatrixMode(GL_PROJECTION);
305 glMatrixMode(GL_MODELVIEW);
310 glEnable(GL_TEXTURE_2D);
311 loadscreentexture.bind();
312 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
313 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
314 glDisable(GL_DEPTH_TEST);
315 glDisable(GL_CULL_FACE);
316 glDisable(GL_LIGHTING);
318 glMatrixMode(GL_PROJECTION);
321 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
322 glMatrixMode(GL_MODELVIEW);
325 glTranslatef(screenwidth / 2, screenheight / 2, 0);
326 glScalef((float)screenwidth / 2 * (100 + loadprogress) / 100, (float)screenheight / 2 * (100 + loadprogress) / 100, 1);
327 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
329 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, .4);
332 glTexCoord2f(0 + .2, 0 + .8);
333 glVertex3f(-1, -1, 0.0f);
334 glTexCoord2f(1 + .2, 0 + .8);
335 glVertex3f(1, -1, 0.0f);
336 glTexCoord2f(1 + .2, 1 + .8);
337 glVertex3f(1, 1, 0.0f);
338 glTexCoord2f(0 + .2, 1 + .8);
339 glVertex3f(-1, 1, 0.0f);
342 glDisable(GL_TEXTURE_2D);
343 glMatrixMode(GL_PROJECTION);
345 glMatrixMode(GL_MODELVIEW);
352 if (flashamount > 0) {
356 flashamount -= multiplier;
360 glDisable(GL_DEPTH_TEST);
361 glDisable(GL_CULL_FACE);
362 glDisable(GL_LIGHTING);
363 glDisable(GL_TEXTURE_2D);
365 glMatrixMode(GL_PROJECTION);
368 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
369 glMatrixMode(GL_MODELVIEW);
372 glScalef(screenwidth, screenheight, 1);
373 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
375 glColor4f(flashr, flashg, flashb, flashamount);
377 glVertex3f(0, 0, 0.0f);
378 glVertex3f(256, 0, 0.0f);
379 glVertex3f(256, 256, 0.0f);
380 glVertex3f(0, 256, 0.0f);
382 glMatrixMode(GL_PROJECTION);
384 glMatrixMode(GL_MODELVIEW);
386 glEnable(GL_DEPTH_TEST);
387 glEnable(GL_CULL_FACE);
396 void FadeLoadingScreen(float howmuch)
398 static float loadprogress;
402 glClearColor(0, 0, 0, 1);
403 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
405 loadprogress = howmuch;
409 glDisable(GL_TEXTURE_2D);
410 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
411 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
412 glDisable(GL_DEPTH_TEST);
413 glDisable(GL_CULL_FACE);
414 glDisable(GL_LIGHTING);
416 glMatrixMode(GL_PROJECTION);
419 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
420 glMatrixMode(GL_MODELVIEW);
423 glTranslatef(screenwidth / 2, screenheight / 2, 0);
424 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
425 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
427 glColor4f(loadprogress / 100, 0, 0, 1);
431 glVertex3f(-1, -1, 0.0f);
433 glVertex3f(1, -1, 0.0f);
435 glVertex3f(1, 1, 0.0f);
437 glVertex3f(-1, 1, 0.0f);
440 glDisable(GL_TEXTURE_2D);
441 glMatrixMode(GL_PROJECTION);
443 glMatrixMode(GL_MODELVIEW);
451 void Game::InitGame()
455 numchallengelevels = 14;
457 accountactive = Account::loadFile(Folders::getUserDataPath()+"/users");
459 whichjointstartarray[0] = righthip;
460 whichjointendarray[0] = rightfoot;
462 whichjointstartarray[1] = righthip;
463 whichjointendarray[1] = rightankle;
465 whichjointstartarray[2] = righthip;
466 whichjointendarray[2] = rightknee;
468 whichjointstartarray[3] = rightknee;
469 whichjointendarray[3] = rightankle;
471 whichjointstartarray[4] = rightankle;
472 whichjointendarray[4] = rightfoot;
474 whichjointstartarray[5] = lefthip;
475 whichjointendarray[5] = leftfoot;
477 whichjointstartarray[6] = lefthip;
478 whichjointendarray[6] = leftankle;
480 whichjointstartarray[7] = lefthip;
481 whichjointendarray[7] = leftknee;
483 whichjointstartarray[8] = leftknee;
484 whichjointendarray[8] = leftankle;
486 whichjointstartarray[9] = leftankle;
487 whichjointendarray[9] = leftfoot;
489 whichjointstartarray[10] = abdomen;
490 whichjointendarray[10] = rightshoulder;
492 whichjointstartarray[11] = abdomen;
493 whichjointendarray[11] = rightelbow;
495 whichjointstartarray[12] = abdomen;
496 whichjointendarray[12] = rightwrist;
498 whichjointstartarray[13] = abdomen;
499 whichjointendarray[13] = righthand;
501 whichjointstartarray[14] = rightshoulder;
502 whichjointendarray[14] = rightelbow;
504 whichjointstartarray[15] = rightelbow;
505 whichjointendarray[15] = rightwrist;
507 whichjointstartarray[16] = rightwrist;
508 whichjointendarray[16] = righthand;
510 whichjointstartarray[17] = abdomen;
511 whichjointendarray[17] = leftshoulder;
513 whichjointstartarray[18] = abdomen;
514 whichjointendarray[18] = leftelbow;
516 whichjointstartarray[19] = abdomen;
517 whichjointendarray[19] = leftwrist;
519 whichjointstartarray[20] = abdomen;
520 whichjointendarray[20] = lefthand;
522 whichjointstartarray[21] = leftshoulder;
523 whichjointendarray[21] = leftelbow;
525 whichjointstartarray[22] = leftelbow;
526 whichjointendarray[22] = leftwrist;
528 whichjointstartarray[23] = leftwrist;
529 whichjointendarray[23] = lefthand;
531 whichjointstartarray[24] = abdomen;
532 whichjointendarray[24] = neck;
534 whichjointstartarray[25] = neck;
535 whichjointendarray[25] = head;
537 FadeLoadingScreen(0);
541 int temptexdetail = texdetail;
543 text->LoadFontTexture("Textures/Font.png");
545 texdetail = temptexdetail;
547 FadeLoadingScreen(10);
559 LOG("Initializing sound system...");
562 unsigned char rc = 0;
563 int output = OPENAL_OUTPUT_ALSA; // Try alsa first...
564 if (commandLineOptions[SOUND]) {
565 output = commandLineOptions[SOUND].last()->type(); // ...but let user override that.
568 OPENAL_SetOutput(output);
569 if ((rc = OPENAL_Init(44100, 32, 0)) == false) {
570 // if we tried ALSA and failed, fall back to OSS.
571 if ( (output == OPENAL_OUTPUT_ALSA) && (commandLineOptions[SOUND].last()->type() != OPENAL_OUTPUT_ALSA) ) {
573 output = OPENAL_OUTPUT_OSS;
574 OPENAL_SetOutput(output);
575 rc = OPENAL_Init(44100, 32, 0);
581 output = OPENAL_OUTPUT_NOSOUND; // we tried! just do silence.
582 OPENAL_SetOutput(output);
583 rc = OPENAL_Init(44100, 32, 0);
586 OPENAL_Init(44100, 32, 0);
589 OPENAL_SetSFXMasterVolume((int)(volume * 255));
593 emit_stream_np(stream_menutheme);
595 cursortexture.load("Textures/Cursor.png", 0);
597 Mapcircletexture.load("Textures/MapCircle.png", 0);
598 Mapboxtexture.load("Textures/MapBox.png", 0);
599 Maparrowtexture.load("Textures/MapArrow.png", 0);
601 temptexdetail = texdetail;
604 Mainmenuitems[0].load("Textures/Lugaru.png", 0);
605 Mainmenuitems[1].load("Textures/NewGame.png", 0);
606 Mainmenuitems[2].load("Textures/Options.png", 0);
607 Mainmenuitems[3].load("Textures/Quit.png", 0);
608 Mainmenuitems[4].load("Textures/Eyelid.png", 0);
609 Mainmenuitems[5].load("Textures/Resume.png", 0);
610 Mainmenuitems[6].load("Textures/EndGame.png", 0);
612 texdetail = temptexdetail;
614 FadeLoadingScreen(95);
624 newscreenwidth = screenwidth;
625 newscreenheight = screenheight;
631 void Game::LoadScreenTexture()
633 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
635 if (!Game::screentexture)
636 glGenTextures( 1, &Game::screentexture );
637 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
640 glEnable(GL_TEXTURE_2D);
641 glBindTexture( GL_TEXTURE_2D, Game::screentexture);
642 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
643 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
645 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
648 //TODO: move LoadStuff() closer to GameTick.cpp to get rid of various vars shared in Game.h
649 void Game::LoadStuff()
651 static float temptexdetail;
652 static float viewdistdetail;
662 for (auto p:Person::players) {
663 p->skeleton.drawmodel.textureptr.destroy();
666 i = abs(Random() % 4);
667 visibleloading = 0; //don't use loadscreentexture yet
668 loadscreentexture.load("Textures/Fire.jpg", 1);
671 temptexdetail = texdetail;
673 text->LoadFontTexture("Textures/Font.png");
675 texdetail = temptexdetail;
678 viewdistance = 50 * megascale * viewdistdetail;
690 realtexdetail = texdetail;
692 LOG("Loading weapon data...");
694 Weapon::knifetextureptr.load("Textures/Knife.png", 0);
695 Weapon::bloodknifetextureptr.load("Textures/BloodKnife.png", 0);
696 Weapon::lightbloodknifetextureptr.load("Textures/BloodKnifeLight.png", 0);
697 Weapon::swordtextureptr.load("Textures/Sword.jpg", 1);
698 Weapon::bloodswordtextureptr.load("Textures/SwordBlood.jpg", 1);
699 Weapon::lightbloodswordtextureptr.load("Textures/SwordBloodLight.jpg", 1);
700 Weapon::stafftextureptr.load("Textures/Staff.jpg", 1);
702 Weapon::throwingknifemodel.load((char *)"Models/ThrowingKnife.solid", 1);
703 Weapon::throwingknifemodel.Scale(.001, .001, .001);
704 Weapon::throwingknifemodel.Rotate(90, 0, 0);
705 Weapon::throwingknifemodel.Rotate(0, 90, 0);
706 Weapon::throwingknifemodel.flat = 0;
707 Weapon::throwingknifemodel.CalculateNormals(1);
709 Weapon::swordmodel.load((char *)"Models/Sword.solid", 1);
710 Weapon::swordmodel.Scale(.001, .001, .001);
711 Weapon::swordmodel.Rotate(90, 0, 0);
712 Weapon::swordmodel.Rotate(0, 90, 0);
713 Weapon::swordmodel.Rotate(0, 0, 90);
714 Weapon::swordmodel.flat = 1;
715 Weapon::swordmodel.CalculateNormals(1);
717 Weapon::staffmodel.load((char *)"Models/Staff.solid", 1);
718 Weapon::staffmodel.Scale(.005, .005, .005);
719 Weapon::staffmodel.Rotate(90, 0, 0);
720 Weapon::staffmodel.Rotate(0, 90, 0);
721 Weapon::staffmodel.Rotate(0, 0, 90);
722 Weapon::staffmodel.flat = 1;
723 Weapon::staffmodel.CalculateNormals(1);
725 terrain.shadowtexture.load("Textures/Shadow.png", 0);
726 terrain.bloodtexture.load("Textures/Blood.png", 0);
727 terrain.breaktexture.load("Textures/Break.png", 0);
728 terrain.bloodtexture2.load("Textures/Blood.png", 0);
731 terrain.footprinttexture.load("Textures/Footprint.png", 0);
732 terrain.bodyprinttexture.load("Textures/Bodyprint.png", 0);
733 hawktexture.load("Textures/Hawk.png", 0);
736 Sprite::cloudtexture.load("Textures/Cloud.png", 1);
737 Sprite::cloudimpacttexture.load("Textures/CloudImpact.png", 1);
738 Sprite::bloodtexture.load("Textures/BloodParticle.png", 1);
739 Sprite::snowflaketexture.load("Textures/SnowFlake.png", 1);
740 Sprite::flametexture.load("Textures/Flame.png", 1);
741 Sprite::bloodflametexture.load("Textures/BloodFlame.png", 1);
742 Sprite::smoketexture.load("Textures/Smoke.png", 1);
743 Sprite::shinetexture.load("Textures/Shine.png", 1);
744 Sprite::splintertexture.load("Textures/Splinter.png", 1);
745 Sprite::leaftexture.load("Textures/Leaf.png", 1);
746 Sprite::toothtexture.load("Textures/Tooth.png", 1);
750 ReSizeGLScene(90, .01);
762 //Set up distant light
763 light.color[0] = .95;
764 light.color[1] = .95;
766 light.ambient[0] = .2;
767 light.ambient[1] = .2;
768 light.ambient[2] = .24;
769 light.location.x = 1;
770 light.location.y = 1;
771 light.location.z = -.2;
772 Normalise(&light.location);
782 texscale = .2 / megascale / viewdistdetail;
783 terrain.scale = 3 * megascale * viewdistdetail;
785 viewer.x = terrain.size / 2 * terrain.scale;
786 viewer.z = terrain.size / 2 * terrain.scale;
788 hawk.load((char *)"Models/Hawk.solid", 1);
789 hawk.Scale(.03, .03, .03);
790 hawk.Rotate(90, 1, 1);
791 hawk.CalculateNormals(0);
792 hawk.ScaleNormals(-1, -1, -1);
793 hawkcoords.x = terrain.size / 2 * terrain.scale - 5 - 7;
794 hawkcoords.z = terrain.size / 2 * terrain.scale - 5 - 7;
795 hawkcoords.y = terrain.getHeight(hawkcoords.x, hawkcoords.z) + 25;
797 eye.load((char *)"Models/Eye.solid", 1);
798 eye.Scale(.03, .03, .03);
799 eye.CalculateNormals(0);
801 cornea.load((char *)"Models/Cornea.solid", 1);
802 cornea.Scale(.03, .03, .03);
803 cornea.CalculateNormals(0);
805 iris.load((char *)"Models/Iris.solid", 1);
806 iris.Scale(.03, .03, .03);
807 iris.CalculateNormals(0);
809 LoadSave("Textures/BloodFur.png", 0, 1, &bloodText[0], 0);
810 LoadSave("Textures/WolfBloodFur.png", 0, 1, &wolfbloodText[0], 0);
820 //Fix knife stab, too lazy to do it manually
824 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
825 for (j = 0; j < animation[knifesneakattackanim].numframes; j++) {
826 animation[knifesneakattackanim].position[i][j] += moveamount;
832 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
833 for (j = 0; j < animation[knifesneakattackedanim].numframes; j++) {
834 animation[knifesneakattackedanim].position[i][j] += moveamount;
840 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
841 animation[dead1anim].position[i][1] = animation[dead1anim].position[i][0];
842 animation[dead2anim].position[i][1] = animation[dead2anim].position[i][0];
843 animation[dead3anim].position[i][1] = animation[dead3anim].position[i][0];
844 animation[dead4anim].position[i][1] = animation[dead4anim].position[i][0];
846 animation[dead1anim].speed[0] = 0.001;
847 animation[dead2anim].speed[0] = 0.001;
848 animation[dead3anim].speed[0] = 0.001;
849 animation[dead4anim].speed[0] = 0.001;
851 animation[dead1anim].speed[1] = 0.001;
852 animation[dead2anim].speed[1] = 0.001;
853 animation[dead3anim].speed[1] = 0.001;
854 animation[dead4anim].speed[1] = 0.001;
856 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
857 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
858 animation[swordsneakattackanim].position[i][j] += moveamount;
862 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
863 animation[swordsneakattackanim].weapontarget[j] += moveamount;
868 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
869 for (j = 0; j < animation[swordsneakattackedanim].numframes; j++) {
870 animation[swordsneakattackedanim].position[i][j] += moveamount;
875 temptexdetail = texdetail;
877 texdetail = temptexdetail;
881 if (!screentexture) {
885 if (targetlevel != 7) {
886 emit_sound_at(fireendsound);