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/Animation.h"
25 #include "Utils/Folders.h"
28 extern float screenwidth, screenheight;
29 extern float viewdistance;
31 extern float fadestart;
32 extern float texscale;
35 extern Terrain terrain;
36 extern int kTextureSize;
37 extern float texdetail;
38 extern float realtexdetail;
40 extern Objects objects;
42 extern bool cellophane;
43 extern GLubyte bloodText[512 * 512 * 3];
44 extern GLubyte wolfbloodText[512 * 512 * 3];
45 extern bool ismotionblur;
46 extern bool trilinear;
47 extern bool musictoggle;
48 extern int environment;
49 extern bool ambientsound;
50 extern float multiplier;
51 extern int netdatanew;
53 extern bool stillloading;
55 extern bool visibleloading;
56 extern float flashamount, flashr, flashg, flashb;
57 extern int flashdelay;
58 extern int whichjointstartarray[26];
59 extern int whichjointendarray[26];
60 extern int difficulty;
61 extern float slomospeed;
62 extern bool gamestarted;
64 extern float accountcampaignhighscore[10];
65 extern float accountcampaignfasttime[10];
66 extern float accountcampaignscore[10];
67 extern float accountcampaigntime[10];
69 extern int accountcampaignchoicesmade[10];
70 extern int accountcampaignchoices[10][5000];
72 void LOG(const std::string &fmt, ...)
74 // !!! FIXME: write me.
81 if (Game::endgame == 2) {
82 Account::active->endGame();
86 Account::saveFile(Folders::getUserDataPath()+"/users");
90 LOG("Shutting down sound system...");
92 OPENAL_StopSound(OPENAL_ALL);
94 // this is causing problems on Linux, but we'll force an _exit() a little
95 // later in the shutdown process. --ryan.
98 for (int i = 0; i < sounds_count; ++i) {
99 OPENAL_Sample_Free(samp[i]);
109 skybox = new SkyBox();
112 void Game::deleteGame()
118 terraintexture.destroy();
119 terraintexture2.destroy();
120 cursortexture.destroy();
121 Maparrowtexture.destroy();
122 Mapboxtexture.destroy();
123 Mapcircletexture.destroy();
124 hawktexture.destroy();
125 loadscreentexture.destroy();
127 for (int i = 0; i < 10; i++)
128 Mainmenuitems[i].destroy();
130 glDeleteTextures(1, &screentexture);
131 glDeleteTextures(1, &screentexture2);
138 void LoadSave(const std::string& fileName, GLuint *textureid, bool mipmap, GLubyte *array, int *skinsize)
142 LOG(std::string("Loading (S)...") + fileName);
145 float temptexdetail = texdetail;
150 if (!load_image(Folders::getResourcePath(fileName).c_str(), texture)) {
151 texdetail = temptexdetail;
154 texdetail = temptexdetail;
156 int bytesPerPixel = texture.bpp / 8;
159 for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
160 if ((i + 1) % 4 || bytesPerPixel == 3) {
161 array[tempnum] = texture.data[i];
169 //***************> ResizeGLScene() <******/
170 GLvoid Game::ReSizeGLScene(float fov, float pnear)
172 if (screenheight == 0) {
176 glViewport(0, 0, screenwidth, screenheight);
178 glMatrixMode(GL_PROJECTION);
181 gluPerspective(fov, (GLfloat)screenwidth / (GLfloat)screenheight, pnear, viewdistance);
183 glMatrixMode(GL_MODELVIEW);
187 void Game::LoadingScreen()
189 static float loadprogress;
190 static AbsoluteTime frametime = {0, 0};
191 AbsoluteTime currTime = UpTime ();
192 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
194 if (0 > deltaTime) // if negative microseconds
195 deltaTime /= -1000000.0;
196 else // else milliseconds
199 multiplier = deltaTime;
200 if (multiplier < .001)
204 if (multiplier > .05) {
205 frametime = currTime; // reset for next time interval
209 glClearColor(0, 0, 0, 1);
210 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
213 loadtime += multiplier * 4;
215 loadprogress = loadtime;
216 if (loadprogress > 100)
221 glEnable(GL_TEXTURE_2D);
222 loadscreentexture.bind();
223 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
224 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
225 glDisable(GL_DEPTH_TEST);
226 glDisable(GL_CULL_FACE);
227 glDisable(GL_LIGHTING);
229 glMatrixMode(GL_PROJECTION);
232 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
233 glMatrixMode(GL_MODELVIEW);
236 glTranslatef(screenwidth / 2, screenheight / 2, 0);
237 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
238 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
240 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
243 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
244 glVertex3f(-1, -1, 0.0f);
245 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
246 glVertex3f(1, -1, 0.0f);
247 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
248 glVertex3f(1, 1, 0.0f);
249 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
250 glVertex3f(-1, 1, 0.0f);
256 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
257 glVertex3f(-1, -1, 0.0f);
258 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
259 glVertex3f(1, -1, 0.0f);
260 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
261 glVertex3f(1, 1, 0.0f);
262 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
263 glVertex3f(-1, 1, 0.0f);
266 glDisable(GL_TEXTURE_2D);
267 glMatrixMode(GL_PROJECTION);
269 glMatrixMode(GL_MODELVIEW);
274 glEnable(GL_TEXTURE_2D);
275 loadscreentexture.bind();
276 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
277 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
278 glDisable(GL_DEPTH_TEST);
279 glDisable(GL_CULL_FACE);
280 glDisable(GL_LIGHTING);
282 glMatrixMode(GL_PROJECTION);
285 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
286 glMatrixMode(GL_MODELVIEW);
289 glTranslatef(screenwidth / 2, screenheight / 2, 0);
290 glScalef((float)screenwidth / 2 * (1.5 - (loadprogress) / 200), (float)screenheight / 2 * (1.5 - (loadprogress) / 200), 1);
291 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
293 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
296 glTexCoord2f(0 + .5, 0 + .5);
297 glVertex3f(-1, -1, 0.0f);
298 glTexCoord2f(1 + .5, 0 + .5);
299 glVertex3f(1, -1, 0.0f);
300 glTexCoord2f(1 + .5, 1 + .5);
301 glVertex3f(1, 1, 0.0f);
302 glTexCoord2f(0 + .5, 1 + .5);
303 glVertex3f(-1, 1, 0.0f);
306 glDisable(GL_TEXTURE_2D);
307 glMatrixMode(GL_PROJECTION);
309 glMatrixMode(GL_MODELVIEW);
314 glEnable(GL_TEXTURE_2D);
315 loadscreentexture.bind();
316 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
317 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
318 glDisable(GL_DEPTH_TEST);
319 glDisable(GL_CULL_FACE);
320 glDisable(GL_LIGHTING);
322 glMatrixMode(GL_PROJECTION);
325 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
326 glMatrixMode(GL_MODELVIEW);
329 glTranslatef(screenwidth / 2, screenheight / 2, 0);
330 glScalef((float)screenwidth / 2 * (100 + loadprogress) / 100, (float)screenheight / 2 * (100 + loadprogress) / 100, 1);
331 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
333 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, .4);
336 glTexCoord2f(0 + .2, 0 + .8);
337 glVertex3f(-1, -1, 0.0f);
338 glTexCoord2f(1 + .2, 0 + .8);
339 glVertex3f(1, -1, 0.0f);
340 glTexCoord2f(1 + .2, 1 + .8);
341 glVertex3f(1, 1, 0.0f);
342 glTexCoord2f(0 + .2, 1 + .8);
343 glVertex3f(-1, 1, 0.0f);
346 glDisable(GL_TEXTURE_2D);
347 glMatrixMode(GL_PROJECTION);
349 glMatrixMode(GL_MODELVIEW);
356 if (flashamount > 0) {
360 flashamount -= multiplier;
364 glDisable(GL_DEPTH_TEST);
365 glDisable(GL_CULL_FACE);
366 glDisable(GL_LIGHTING);
367 glDisable(GL_TEXTURE_2D);
369 glMatrixMode(GL_PROJECTION);
372 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
373 glMatrixMode(GL_MODELVIEW);
376 glScalef(screenwidth, screenheight, 1);
377 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
379 glColor4f(flashr, flashg, flashb, flashamount);
381 glVertex3f(0, 0, 0.0f);
382 glVertex3f(256, 0, 0.0f);
383 glVertex3f(256, 256, 0.0f);
384 glVertex3f(0, 256, 0.0f);
386 glMatrixMode(GL_PROJECTION);
388 glMatrixMode(GL_MODELVIEW);
390 glEnable(GL_DEPTH_TEST);
391 glEnable(GL_CULL_FACE);
400 void FadeLoadingScreen(float howmuch)
402 static float loadprogress;
406 glClearColor(0, 0, 0, 1);
407 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
409 loadprogress = howmuch;
413 glDisable(GL_TEXTURE_2D);
414 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
415 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
416 glDisable(GL_DEPTH_TEST);
417 glDisable(GL_CULL_FACE);
418 glDisable(GL_LIGHTING);
420 glMatrixMode(GL_PROJECTION);
423 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
424 glMatrixMode(GL_MODELVIEW);
427 glTranslatef(screenwidth / 2, screenheight / 2, 0);
428 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
429 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
431 glColor4f(loadprogress / 100, 0, 0, 1);
435 glVertex3f(-1, -1, 0.0f);
437 glVertex3f(1, -1, 0.0f);
439 glVertex3f(1, 1, 0.0f);
441 glVertex3f(-1, 1, 0.0f);
444 glDisable(GL_TEXTURE_2D);
445 glMatrixMode(GL_PROJECTION);
447 glMatrixMode(GL_MODELVIEW);
455 void Game::InitGame()
459 numchallengelevels = 14;
461 Account::active = Account::loadFile(Folders::getUserDataPath()+"/users");
463 whichjointstartarray[0] = righthip;
464 whichjointendarray[0] = rightfoot;
466 whichjointstartarray[1] = righthip;
467 whichjointendarray[1] = rightankle;
469 whichjointstartarray[2] = righthip;
470 whichjointendarray[2] = rightknee;
472 whichjointstartarray[3] = rightknee;
473 whichjointendarray[3] = rightankle;
475 whichjointstartarray[4] = rightankle;
476 whichjointendarray[4] = rightfoot;
478 whichjointstartarray[5] = lefthip;
479 whichjointendarray[5] = leftfoot;
481 whichjointstartarray[6] = lefthip;
482 whichjointendarray[6] = leftankle;
484 whichjointstartarray[7] = lefthip;
485 whichjointendarray[7] = leftknee;
487 whichjointstartarray[8] = leftknee;
488 whichjointendarray[8] = leftankle;
490 whichjointstartarray[9] = leftankle;
491 whichjointendarray[9] = leftfoot;
493 whichjointstartarray[10] = abdomen;
494 whichjointendarray[10] = rightshoulder;
496 whichjointstartarray[11] = abdomen;
497 whichjointendarray[11] = rightelbow;
499 whichjointstartarray[12] = abdomen;
500 whichjointendarray[12] = rightwrist;
502 whichjointstartarray[13] = abdomen;
503 whichjointendarray[13] = righthand;
505 whichjointstartarray[14] = rightshoulder;
506 whichjointendarray[14] = rightelbow;
508 whichjointstartarray[15] = rightelbow;
509 whichjointendarray[15] = rightwrist;
511 whichjointstartarray[16] = rightwrist;
512 whichjointendarray[16] = righthand;
514 whichjointstartarray[17] = abdomen;
515 whichjointendarray[17] = leftshoulder;
517 whichjointstartarray[18] = abdomen;
518 whichjointendarray[18] = leftelbow;
520 whichjointstartarray[19] = abdomen;
521 whichjointendarray[19] = leftwrist;
523 whichjointstartarray[20] = abdomen;
524 whichjointendarray[20] = lefthand;
526 whichjointstartarray[21] = leftshoulder;
527 whichjointendarray[21] = leftelbow;
529 whichjointstartarray[22] = leftelbow;
530 whichjointendarray[22] = leftwrist;
532 whichjointstartarray[23] = leftwrist;
533 whichjointendarray[23] = lefthand;
535 whichjointstartarray[24] = abdomen;
536 whichjointendarray[24] = neck;
538 whichjointstartarray[25] = neck;
539 whichjointendarray[25] = head;
541 FadeLoadingScreen(0);
545 int temptexdetail = texdetail;
547 text->LoadFontTexture("Textures/Font.png");
549 texdetail = temptexdetail;
551 FadeLoadingScreen(10);
563 LOG("Initializing sound system...");
566 unsigned char rc = 0;
567 int output = OPENAL_OUTPUT_ALSA; // Try alsa first...
568 if (commandLineOptions[SOUND]) {
569 output = commandLineOptions[SOUND].last()->type(); // ...but let user override that.
572 OPENAL_SetOutput(output);
573 if ((rc = OPENAL_Init(44100, 32, 0)) == false) {
574 // if we tried ALSA and failed, fall back to OSS.
575 if ( (output == OPENAL_OUTPUT_ALSA) && (commandLineOptions[SOUND].last()->type() != OPENAL_OUTPUT_ALSA) ) {
577 output = OPENAL_OUTPUT_OSS;
578 OPENAL_SetOutput(output);
579 rc = OPENAL_Init(44100, 32, 0);
585 output = OPENAL_OUTPUT_NOSOUND; // we tried! just do silence.
586 OPENAL_SetOutput(output);
587 rc = OPENAL_Init(44100, 32, 0);
590 OPENAL_Init(44100, 32, 0);
593 OPENAL_SetSFXMasterVolume((int)(volume * 255));
597 emit_stream_np(stream_menutheme);
599 cursortexture.load("Textures/Cursor.png", 0);
601 Mapcircletexture.load("Textures/MapCircle.png", 0);
602 Mapboxtexture.load("Textures/MapBox.png", 0);
603 Maparrowtexture.load("Textures/MapArrow.png", 0);
605 temptexdetail = texdetail;
608 Mainmenuitems[0].load("Textures/Lugaru.png", 0);
609 Mainmenuitems[1].load("Textures/NewGame.png", 0);
610 Mainmenuitems[2].load("Textures/Options.png", 0);
611 Mainmenuitems[3].load("Textures/Quit.png", 0);
612 Mainmenuitems[4].load("Textures/Eyelid.png", 0);
613 Mainmenuitems[5].load("Textures/Resume.png", 0);
614 Mainmenuitems[6].load("Textures/EndGame.png", 0);
616 texdetail = temptexdetail;
618 FadeLoadingScreen(95);
628 newscreenwidth = screenwidth;
629 newscreenheight = screenheight;
633 Animation::loadAll();
637 void Game::LoadScreenTexture()
639 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
641 if (!Game::screentexture)
642 glGenTextures( 1, &Game::screentexture );
643 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
646 glEnable(GL_TEXTURE_2D);
647 glBindTexture( GL_TEXTURE_2D, Game::screentexture);
648 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
649 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
651 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
654 //TODO: move LoadStuff() closer to GameTick.cpp to get rid of various vars shared in Game.h
655 void Game::LoadStuff()
657 static float temptexdetail;
658 static float viewdistdetail;
668 for (auto p:Person::players) {
669 p->skeleton.drawmodel.textureptr.destroy();
672 i = abs(Random() % 4);
673 visibleloading = 0; //don't use loadscreentexture yet
674 loadscreentexture.load("Textures/Fire.jpg", 1);
677 temptexdetail = texdetail;
679 text->LoadFontTexture("Textures/Font.png");
681 texdetail = temptexdetail;
684 viewdistance = 50 * megascale * viewdistdetail;
696 realtexdetail = texdetail;
698 LOG("Loading weapon data...");
700 Weapon::knifetextureptr.load("Textures/Knife.png", 0);
701 Weapon::bloodknifetextureptr.load("Textures/BloodKnife.png", 0);
702 Weapon::lightbloodknifetextureptr.load("Textures/BloodKnifeLight.png", 0);
703 Weapon::swordtextureptr.load("Textures/Sword.jpg", 1);
704 Weapon::bloodswordtextureptr.load("Textures/SwordBlood.jpg", 1);
705 Weapon::lightbloodswordtextureptr.load("Textures/SwordBloodLight.jpg", 1);
706 Weapon::stafftextureptr.load("Textures/Staff.jpg", 1);
708 Weapon::throwingknifemodel.load("Models/ThrowingKnife.solid", 1);
709 Weapon::throwingknifemodel.Scale(.001, .001, .001);
710 Weapon::throwingknifemodel.Rotate(90, 0, 0);
711 Weapon::throwingknifemodel.Rotate(0, 90, 0);
712 Weapon::throwingknifemodel.flat = 0;
713 Weapon::throwingknifemodel.CalculateNormals(1);
715 Weapon::swordmodel.load("Models/Sword.solid", 1);
716 Weapon::swordmodel.Scale(.001, .001, .001);
717 Weapon::swordmodel.Rotate(90, 0, 0);
718 Weapon::swordmodel.Rotate(0, 90, 0);
719 Weapon::swordmodel.Rotate(0, 0, 90);
720 Weapon::swordmodel.flat = 1;
721 Weapon::swordmodel.CalculateNormals(1);
723 Weapon::staffmodel.load("Models/Staff.solid", 1);
724 Weapon::staffmodel.Scale(.005, .005, .005);
725 Weapon::staffmodel.Rotate(90, 0, 0);
726 Weapon::staffmodel.Rotate(0, 90, 0);
727 Weapon::staffmodel.Rotate(0, 0, 90);
728 Weapon::staffmodel.flat = 1;
729 Weapon::staffmodel.CalculateNormals(1);
731 terrain.shadowtexture.load("Textures/Shadow.png", 0);
732 terrain.bloodtexture.load("Textures/Blood.png", 0);
733 terrain.breaktexture.load("Textures/Break.png", 0);
734 terrain.bloodtexture2.load("Textures/Blood.png", 0);
737 terrain.footprinttexture.load("Textures/Footprint.png", 0);
738 terrain.bodyprinttexture.load("Textures/Bodyprint.png", 0);
739 hawktexture.load("Textures/Hawk.png", 0);
742 Sprite::cloudtexture.load("Textures/Cloud.png", 1);
743 Sprite::cloudimpacttexture.load("Textures/CloudImpact.png", 1);
744 Sprite::bloodtexture.load("Textures/BloodParticle.png", 1);
745 Sprite::snowflaketexture.load("Textures/SnowFlake.png", 1);
746 Sprite::flametexture.load("Textures/Flame.png", 1);
747 Sprite::bloodflametexture.load("Textures/BloodFlame.png", 1);
748 Sprite::smoketexture.load("Textures/Smoke.png", 1);
749 Sprite::shinetexture.load("Textures/Shine.png", 1);
750 Sprite::splintertexture.load("Textures/Splinter.png", 1);
751 Sprite::leaftexture.load("Textures/Leaf.png", 1);
752 Sprite::toothtexture.load("Textures/Tooth.png", 1);
756 ReSizeGLScene(90, .01);
768 //Set up distant light
769 light.color[0] = .95;
770 light.color[1] = .95;
772 light.ambient[0] = .2;
773 light.ambient[1] = .2;
774 light.ambient[2] = .24;
775 light.location.x = 1;
776 light.location.y = 1;
777 light.location.z = -.2;
778 Normalise(&light.location);
788 texscale = .2 / megascale / viewdistdetail;
789 terrain.scale = 3 * megascale * viewdistdetail;
791 viewer.x = terrain.size / 2 * terrain.scale;
792 viewer.z = terrain.size / 2 * terrain.scale;
794 hawk.load("Models/Hawk.solid", 1);
795 hawk.Scale(.03, .03, .03);
796 hawk.Rotate(90, 1, 1);
797 hawk.CalculateNormals(0);
798 hawk.ScaleNormals(-1, -1, -1);
799 hawkcoords.x = terrain.size / 2 * terrain.scale - 5 - 7;
800 hawkcoords.z = terrain.size / 2 * terrain.scale - 5 - 7;
801 hawkcoords.y = terrain.getHeight(hawkcoords.x, hawkcoords.z) + 25;
803 eye.load("Models/Eye.solid", 1);
804 eye.Scale(.03, .03, .03);
805 eye.CalculateNormals(0);
807 cornea.load("Models/Cornea.solid", 1);
808 cornea.Scale(.03, .03, .03);
809 cornea.CalculateNormals(0);
811 iris.load("Models/Iris.solid", 1);
812 iris.Scale(.03, .03, .03);
813 iris.CalculateNormals(0);
815 LoadSave("Textures/BloodFur.png", 0, 1, &bloodText[0], 0);
816 LoadSave("Textures/WolfBloodFur.png", 0, 1, &wolfbloodText[0], 0);
825 //Fix knife stab, too lazy to do it manually
829 // FIXME - Why this uses skeleton.joints.size() and not Animation::numjoints? (are they equal?)
830 // It seems skeleton.joints.size() is 0 at this point, so this is useless.
831 for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
832 for (j = 0; j < Animation::animations[knifesneakattackanim].frames.size(); j++) {
833 Animation::animations[knifesneakattackanim].frames[j].joints[i].position += moveamount;
839 for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
840 for (j = 0; j < Animation::animations[knifesneakattackedanim].frames.size(); j++) {
841 Animation::animations[knifesneakattackedanim].frames[j].joints[i].position += moveamount;
847 for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
848 Animation::animations[dead1anim].frames[1].joints[i].position = Animation::animations[dead1anim].frames[0].joints[i].position;
849 Animation::animations[dead2anim].frames[1].joints[i].position = Animation::animations[dead2anim].frames[0].joints[i].position;
850 Animation::animations[dead3anim].frames[1].joints[i].position = Animation::animations[dead3anim].frames[0].joints[i].position;
851 Animation::animations[dead4anim].frames[1].joints[i].position = Animation::animations[dead4anim].frames[0].joints[i].position;
853 Animation::animations[dead1anim].frames[0].speed = 0.001;
854 Animation::animations[dead2anim].frames[0].speed = 0.001;
855 Animation::animations[dead3anim].frames[0].speed = 0.001;
856 Animation::animations[dead4anim].frames[0].speed = 0.001;
858 Animation::animations[dead1anim].frames[1].speed = 0.001;
859 Animation::animations[dead2anim].frames[1].speed = 0.001;
860 Animation::animations[dead3anim].frames[1].speed = 0.001;
861 Animation::animations[dead4anim].frames[1].speed = 0.001;
863 for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
864 for (j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) {
865 Animation::animations[swordsneakattackanim].frames[j].joints[i].position += moveamount;
869 for (j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) {
870 Animation::animations[swordsneakattackanim].frames[j].weapontarget += moveamount;
875 for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
876 for (j = 0; j < Animation::animations[swordsneakattackedanim].frames.size(); j++) {
877 Animation::animations[swordsneakattackedanim].frames[j].joints[i].position += moveamount;
882 temptexdetail = texdetail;
884 texdetail = temptexdetail;
888 if (!screentexture) {
892 if (targetlevel != 7) {
893 emit_sound_at(fireendsound);