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 std::string& fileName, GLuint *textureid, bool mipmap, GLubyte *array, int *skinsize)
141 LOG(std::string("Loading (S)...") + fileName);
144 float temptexdetail = texdetail;
149 if (!load_image(Folders::getResourcePath(fileName).c_str(), texture)) {
150 texdetail = temptexdetail;
153 texdetail = temptexdetail;
155 int bytesPerPixel = texture.bpp / 8;
158 for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
159 if ((i + 1) % 4 || bytesPerPixel == 3) {
160 array[tempnum] = texture.data[i];
168 //***************> ResizeGLScene() <******/
169 GLvoid Game::ReSizeGLScene(float fov, float pnear)
171 if (screenheight == 0) {
175 glViewport(0, 0, screenwidth, screenheight);
177 glMatrixMode(GL_PROJECTION);
180 gluPerspective(fov, (GLfloat)screenwidth / (GLfloat)screenheight, pnear, viewdistance);
182 glMatrixMode(GL_MODELVIEW);
186 void Game::LoadingScreen()
188 static float loadprogress;
189 static AbsoluteTime frametime = {0, 0};
190 AbsoluteTime currTime = UpTime ();
191 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
193 if (0 > deltaTime) // if negative microseconds
194 deltaTime /= -1000000.0;
195 else // else milliseconds
198 multiplier = deltaTime;
199 if (multiplier < .001)
203 if (multiplier > .05) {
204 frametime = currTime; // reset for next time interval
208 glClearColor(0, 0, 0, 1);
209 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
212 loadtime += multiplier * 4;
214 loadprogress = loadtime;
215 if (loadprogress > 100)
220 glEnable(GL_TEXTURE_2D);
221 loadscreentexture.bind();
222 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
223 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
224 glDisable(GL_DEPTH_TEST);
225 glDisable(GL_CULL_FACE);
226 glDisable(GL_LIGHTING);
228 glMatrixMode(GL_PROJECTION);
231 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
232 glMatrixMode(GL_MODELVIEW);
235 glTranslatef(screenwidth / 2, screenheight / 2, 0);
236 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
237 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
239 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
242 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
243 glVertex3f(-1, -1, 0.0f);
244 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
245 glVertex3f(1, -1, 0.0f);
246 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
247 glVertex3f(1, 1, 0.0f);
248 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
249 glVertex3f(-1, 1, 0.0f);
255 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
256 glVertex3f(-1, -1, 0.0f);
257 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
258 glVertex3f(1, -1, 0.0f);
259 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
260 glVertex3f(1, 1, 0.0f);
261 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
262 glVertex3f(-1, 1, 0.0f);
265 glDisable(GL_TEXTURE_2D);
266 glMatrixMode(GL_PROJECTION);
268 glMatrixMode(GL_MODELVIEW);
273 glEnable(GL_TEXTURE_2D);
274 loadscreentexture.bind();
275 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
276 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
277 glDisable(GL_DEPTH_TEST);
278 glDisable(GL_CULL_FACE);
279 glDisable(GL_LIGHTING);
281 glMatrixMode(GL_PROJECTION);
284 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
285 glMatrixMode(GL_MODELVIEW);
288 glTranslatef(screenwidth / 2, screenheight / 2, 0);
289 glScalef((float)screenwidth / 2 * (1.5 - (loadprogress) / 200), (float)screenheight / 2 * (1.5 - (loadprogress) / 200), 1);
290 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
292 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
295 glTexCoord2f(0 + .5, 0 + .5);
296 glVertex3f(-1, -1, 0.0f);
297 glTexCoord2f(1 + .5, 0 + .5);
298 glVertex3f(1, -1, 0.0f);
299 glTexCoord2f(1 + .5, 1 + .5);
300 glVertex3f(1, 1, 0.0f);
301 glTexCoord2f(0 + .5, 1 + .5);
302 glVertex3f(-1, 1, 0.0f);
305 glDisable(GL_TEXTURE_2D);
306 glMatrixMode(GL_PROJECTION);
308 glMatrixMode(GL_MODELVIEW);
313 glEnable(GL_TEXTURE_2D);
314 loadscreentexture.bind();
315 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
316 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
317 glDisable(GL_DEPTH_TEST);
318 glDisable(GL_CULL_FACE);
319 glDisable(GL_LIGHTING);
321 glMatrixMode(GL_PROJECTION);
324 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
325 glMatrixMode(GL_MODELVIEW);
328 glTranslatef(screenwidth / 2, screenheight / 2, 0);
329 glScalef((float)screenwidth / 2 * (100 + loadprogress) / 100, (float)screenheight / 2 * (100 + loadprogress) / 100, 1);
330 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
332 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, .4);
335 glTexCoord2f(0 + .2, 0 + .8);
336 glVertex3f(-1, -1, 0.0f);
337 glTexCoord2f(1 + .2, 0 + .8);
338 glVertex3f(1, -1, 0.0f);
339 glTexCoord2f(1 + .2, 1 + .8);
340 glVertex3f(1, 1, 0.0f);
341 glTexCoord2f(0 + .2, 1 + .8);
342 glVertex3f(-1, 1, 0.0f);
345 glDisable(GL_TEXTURE_2D);
346 glMatrixMode(GL_PROJECTION);
348 glMatrixMode(GL_MODELVIEW);
355 if (flashamount > 0) {
359 flashamount -= multiplier;
363 glDisable(GL_DEPTH_TEST);
364 glDisable(GL_CULL_FACE);
365 glDisable(GL_LIGHTING);
366 glDisable(GL_TEXTURE_2D);
368 glMatrixMode(GL_PROJECTION);
371 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
372 glMatrixMode(GL_MODELVIEW);
375 glScalef(screenwidth, screenheight, 1);
376 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
378 glColor4f(flashr, flashg, flashb, flashamount);
380 glVertex3f(0, 0, 0.0f);
381 glVertex3f(256, 0, 0.0f);
382 glVertex3f(256, 256, 0.0f);
383 glVertex3f(0, 256, 0.0f);
385 glMatrixMode(GL_PROJECTION);
387 glMatrixMode(GL_MODELVIEW);
389 glEnable(GL_DEPTH_TEST);
390 glEnable(GL_CULL_FACE);
399 void FadeLoadingScreen(float howmuch)
401 static float loadprogress;
405 glClearColor(0, 0, 0, 1);
406 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
408 loadprogress = howmuch;
412 glDisable(GL_TEXTURE_2D);
413 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
414 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
415 glDisable(GL_DEPTH_TEST);
416 glDisable(GL_CULL_FACE);
417 glDisable(GL_LIGHTING);
419 glMatrixMode(GL_PROJECTION);
422 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
423 glMatrixMode(GL_MODELVIEW);
426 glTranslatef(screenwidth / 2, screenheight / 2, 0);
427 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
428 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
430 glColor4f(loadprogress / 100, 0, 0, 1);
434 glVertex3f(-1, -1, 0.0f);
436 glVertex3f(1, -1, 0.0f);
438 glVertex3f(1, 1, 0.0f);
440 glVertex3f(-1, 1, 0.0f);
443 glDisable(GL_TEXTURE_2D);
444 glMatrixMode(GL_PROJECTION);
446 glMatrixMode(GL_MODELVIEW);
454 void Game::InitGame()
458 numchallengelevels = 14;
460 accountactive = Account::loadFile(Folders::getUserDataPath()+"/users");
462 whichjointstartarray[0] = righthip;
463 whichjointendarray[0] = rightfoot;
465 whichjointstartarray[1] = righthip;
466 whichjointendarray[1] = rightankle;
468 whichjointstartarray[2] = righthip;
469 whichjointendarray[2] = rightknee;
471 whichjointstartarray[3] = rightknee;
472 whichjointendarray[3] = rightankle;
474 whichjointstartarray[4] = rightankle;
475 whichjointendarray[4] = rightfoot;
477 whichjointstartarray[5] = lefthip;
478 whichjointendarray[5] = leftfoot;
480 whichjointstartarray[6] = lefthip;
481 whichjointendarray[6] = leftankle;
483 whichjointstartarray[7] = lefthip;
484 whichjointendarray[7] = leftknee;
486 whichjointstartarray[8] = leftknee;
487 whichjointendarray[8] = leftankle;
489 whichjointstartarray[9] = leftankle;
490 whichjointendarray[9] = leftfoot;
492 whichjointstartarray[10] = abdomen;
493 whichjointendarray[10] = rightshoulder;
495 whichjointstartarray[11] = abdomen;
496 whichjointendarray[11] = rightelbow;
498 whichjointstartarray[12] = abdomen;
499 whichjointendarray[12] = rightwrist;
501 whichjointstartarray[13] = abdomen;
502 whichjointendarray[13] = righthand;
504 whichjointstartarray[14] = rightshoulder;
505 whichjointendarray[14] = rightelbow;
507 whichjointstartarray[15] = rightelbow;
508 whichjointendarray[15] = rightwrist;
510 whichjointstartarray[16] = rightwrist;
511 whichjointendarray[16] = righthand;
513 whichjointstartarray[17] = abdomen;
514 whichjointendarray[17] = leftshoulder;
516 whichjointstartarray[18] = abdomen;
517 whichjointendarray[18] = leftelbow;
519 whichjointstartarray[19] = abdomen;
520 whichjointendarray[19] = leftwrist;
522 whichjointstartarray[20] = abdomen;
523 whichjointendarray[20] = lefthand;
525 whichjointstartarray[21] = leftshoulder;
526 whichjointendarray[21] = leftelbow;
528 whichjointstartarray[22] = leftelbow;
529 whichjointendarray[22] = leftwrist;
531 whichjointstartarray[23] = leftwrist;
532 whichjointendarray[23] = lefthand;
534 whichjointstartarray[24] = abdomen;
535 whichjointendarray[24] = neck;
537 whichjointstartarray[25] = neck;
538 whichjointendarray[25] = head;
540 FadeLoadingScreen(0);
544 int temptexdetail = texdetail;
546 text->LoadFontTexture("Textures/Font.png");
548 texdetail = temptexdetail;
550 FadeLoadingScreen(10);
562 LOG("Initializing sound system...");
565 unsigned char rc = 0;
566 int output = OPENAL_OUTPUT_ALSA; // Try alsa first...
567 if (commandLineOptions[SOUND]) {
568 output = commandLineOptions[SOUND].last()->type(); // ...but let user override that.
571 OPENAL_SetOutput(output);
572 if ((rc = OPENAL_Init(44100, 32, 0)) == false) {
573 // if we tried ALSA and failed, fall back to OSS.
574 if ( (output == OPENAL_OUTPUT_ALSA) && (commandLineOptions[SOUND].last()->type() != OPENAL_OUTPUT_ALSA) ) {
576 output = OPENAL_OUTPUT_OSS;
577 OPENAL_SetOutput(output);
578 rc = OPENAL_Init(44100, 32, 0);
584 output = OPENAL_OUTPUT_NOSOUND; // we tried! just do silence.
585 OPENAL_SetOutput(output);
586 rc = OPENAL_Init(44100, 32, 0);
589 OPENAL_Init(44100, 32, 0);
592 OPENAL_SetSFXMasterVolume((int)(volume * 255));
596 emit_stream_np(stream_menutheme);
598 cursortexture.load("Textures/Cursor.png", 0);
600 Mapcircletexture.load("Textures/MapCircle.png", 0);
601 Mapboxtexture.load("Textures/MapBox.png", 0);
602 Maparrowtexture.load("Textures/MapArrow.png", 0);
604 temptexdetail = texdetail;
607 Mainmenuitems[0].load("Textures/Lugaru.png", 0);
608 Mainmenuitems[1].load("Textures/NewGame.png", 0);
609 Mainmenuitems[2].load("Textures/Options.png", 0);
610 Mainmenuitems[3].load("Textures/Quit.png", 0);
611 Mainmenuitems[4].load("Textures/Eyelid.png", 0);
612 Mainmenuitems[5].load("Textures/Resume.png", 0);
613 Mainmenuitems[6].load("Textures/EndGame.png", 0);
615 texdetail = temptexdetail;
617 FadeLoadingScreen(95);
627 newscreenwidth = screenwidth;
628 newscreenheight = screenheight;
634 void Game::LoadScreenTexture()
636 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
638 if (!Game::screentexture)
639 glGenTextures( 1, &Game::screentexture );
640 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
643 glEnable(GL_TEXTURE_2D);
644 glBindTexture( GL_TEXTURE_2D, Game::screentexture);
645 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
646 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
648 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
651 //TODO: move LoadStuff() closer to GameTick.cpp to get rid of various vars shared in Game.h
652 void Game::LoadStuff()
654 static float temptexdetail;
655 static float viewdistdetail;
665 for (auto p:Person::players) {
666 p->skeleton.drawmodel.textureptr.destroy();
669 i = abs(Random() % 4);
670 visibleloading = 0; //don't use loadscreentexture yet
671 loadscreentexture.load("Textures/Fire.jpg", 1);
674 temptexdetail = texdetail;
676 text->LoadFontTexture("Textures/Font.png");
678 texdetail = temptexdetail;
681 viewdistance = 50 * megascale * viewdistdetail;
693 realtexdetail = texdetail;
695 LOG("Loading weapon data...");
697 Weapon::knifetextureptr.load("Textures/Knife.png", 0);
698 Weapon::bloodknifetextureptr.load("Textures/BloodKnife.png", 0);
699 Weapon::lightbloodknifetextureptr.load("Textures/BloodKnifeLight.png", 0);
700 Weapon::swordtextureptr.load("Textures/Sword.jpg", 1);
701 Weapon::bloodswordtextureptr.load("Textures/SwordBlood.jpg", 1);
702 Weapon::lightbloodswordtextureptr.load("Textures/SwordBloodLight.jpg", 1);
703 Weapon::stafftextureptr.load("Textures/Staff.jpg", 1);
705 Weapon::throwingknifemodel.load("Models/ThrowingKnife.solid", 1);
706 Weapon::throwingknifemodel.Scale(.001, .001, .001);
707 Weapon::throwingknifemodel.Rotate(90, 0, 0);
708 Weapon::throwingknifemodel.Rotate(0, 90, 0);
709 Weapon::throwingknifemodel.flat = 0;
710 Weapon::throwingknifemodel.CalculateNormals(1);
712 Weapon::swordmodel.load("Models/Sword.solid", 1);
713 Weapon::swordmodel.Scale(.001, .001, .001);
714 Weapon::swordmodel.Rotate(90, 0, 0);
715 Weapon::swordmodel.Rotate(0, 90, 0);
716 Weapon::swordmodel.Rotate(0, 0, 90);
717 Weapon::swordmodel.flat = 1;
718 Weapon::swordmodel.CalculateNormals(1);
720 Weapon::staffmodel.load("Models/Staff.solid", 1);
721 Weapon::staffmodel.Scale(.005, .005, .005);
722 Weapon::staffmodel.Rotate(90, 0, 0);
723 Weapon::staffmodel.Rotate(0, 90, 0);
724 Weapon::staffmodel.Rotate(0, 0, 90);
725 Weapon::staffmodel.flat = 1;
726 Weapon::staffmodel.CalculateNormals(1);
728 terrain.shadowtexture.load("Textures/Shadow.png", 0);
729 terrain.bloodtexture.load("Textures/Blood.png", 0);
730 terrain.breaktexture.load("Textures/Break.png", 0);
731 terrain.bloodtexture2.load("Textures/Blood.png", 0);
734 terrain.footprinttexture.load("Textures/Footprint.png", 0);
735 terrain.bodyprinttexture.load("Textures/Bodyprint.png", 0);
736 hawktexture.load("Textures/Hawk.png", 0);
739 Sprite::cloudtexture.load("Textures/Cloud.png", 1);
740 Sprite::cloudimpacttexture.load("Textures/CloudImpact.png", 1);
741 Sprite::bloodtexture.load("Textures/BloodParticle.png", 1);
742 Sprite::snowflaketexture.load("Textures/SnowFlake.png", 1);
743 Sprite::flametexture.load("Textures/Flame.png", 1);
744 Sprite::bloodflametexture.load("Textures/BloodFlame.png", 1);
745 Sprite::smoketexture.load("Textures/Smoke.png", 1);
746 Sprite::shinetexture.load("Textures/Shine.png", 1);
747 Sprite::splintertexture.load("Textures/Splinter.png", 1);
748 Sprite::leaftexture.load("Textures/Leaf.png", 1);
749 Sprite::toothtexture.load("Textures/Tooth.png", 1);
753 ReSizeGLScene(90, .01);
765 //Set up distant light
766 light.color[0] = .95;
767 light.color[1] = .95;
769 light.ambient[0] = .2;
770 light.ambient[1] = .2;
771 light.ambient[2] = .24;
772 light.location.x = 1;
773 light.location.y = 1;
774 light.location.z = -.2;
775 Normalise(&light.location);
785 texscale = .2 / megascale / viewdistdetail;
786 terrain.scale = 3 * megascale * viewdistdetail;
788 viewer.x = terrain.size / 2 * terrain.scale;
789 viewer.z = terrain.size / 2 * terrain.scale;
791 hawk.load("Models/Hawk.solid", 1);
792 hawk.Scale(.03, .03, .03);
793 hawk.Rotate(90, 1, 1);
794 hawk.CalculateNormals(0);
795 hawk.ScaleNormals(-1, -1, -1);
796 hawkcoords.x = terrain.size / 2 * terrain.scale - 5 - 7;
797 hawkcoords.z = terrain.size / 2 * terrain.scale - 5 - 7;
798 hawkcoords.y = terrain.getHeight(hawkcoords.x, hawkcoords.z) + 25;
800 eye.load("Models/Eye.solid", 1);
801 eye.Scale(.03, .03, .03);
802 eye.CalculateNormals(0);
804 cornea.load("Models/Cornea.solid", 1);
805 cornea.Scale(.03, .03, .03);
806 cornea.CalculateNormals(0);
808 iris.load("Models/Iris.solid", 1);
809 iris.Scale(.03, .03, .03);
810 iris.CalculateNormals(0);
812 LoadSave("Textures/BloodFur.png", 0, 1, &bloodText[0], 0);
813 LoadSave("Textures/WolfBloodFur.png", 0, 1, &wolfbloodText[0], 0);
823 //Fix knife stab, too lazy to do it manually
827 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
828 for (j = 0; j < animation[knifesneakattackanim].numframes; j++) {
829 animation[knifesneakattackanim].position[i][j] += moveamount;
835 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
836 for (j = 0; j < animation[knifesneakattackedanim].numframes; j++) {
837 animation[knifesneakattackedanim].position[i][j] += moveamount;
843 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
844 animation[dead1anim].position[i][1] = animation[dead1anim].position[i][0];
845 animation[dead2anim].position[i][1] = animation[dead2anim].position[i][0];
846 animation[dead3anim].position[i][1] = animation[dead3anim].position[i][0];
847 animation[dead4anim].position[i][1] = animation[dead4anim].position[i][0];
849 animation[dead1anim].speed[0] = 0.001;
850 animation[dead2anim].speed[0] = 0.001;
851 animation[dead3anim].speed[0] = 0.001;
852 animation[dead4anim].speed[0] = 0.001;
854 animation[dead1anim].speed[1] = 0.001;
855 animation[dead2anim].speed[1] = 0.001;
856 animation[dead3anim].speed[1] = 0.001;
857 animation[dead4anim].speed[1] = 0.001;
859 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
860 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
861 animation[swordsneakattackanim].position[i][j] += moveamount;
865 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
866 animation[swordsneakattackanim].weapontarget[j] += moveamount;
871 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
872 for (j = 0; j < animation[swordsneakattackedanim].numframes; j++) {
873 animation[swordsneakattackedanim].position[i][j] += moveamount;
878 temptexdetail = texdetail;
880 texdetail = temptexdetail;
884 if (!screentexture) {
888 if (targetlevel != 7) {
889 emit_sound_at(fireendsound);