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 float accountcampaignhighscore[10];
63 extern float accountcampaignfasttime[10];
64 extern float accountcampaignscore[10];
65 extern float accountcampaigntime[10];
67 extern int accountcampaignchoicesmade[10];
68 extern int accountcampaignchoices[10][5000];
70 void LOG(const std::string &fmt, ...)
72 // !!! FIXME: write me.
79 if (Game::endgame == 2) {
80 Game::accountactive->endGame();
84 Account::saveFile(":Data:Users", Game::accountactive);
88 LOG("Shutting down sound system...");
90 OPENAL_StopSound(OPENAL_ALL);
92 // this is causing problems on Linux, but we'll force an _exit() a little
93 // later in the shutdown process. --ryan.
96 for (int i = 0; i < sounds_count; ++i) {
97 OPENAL_Sample_Free(samp[i]);
107 skybox = new SkyBox();
110 void Game::deleteGame()
116 terraintexture.destroy();
117 terraintexture2.destroy();
118 cursortexture.destroy();
119 Maparrowtexture.destroy();
120 Mapboxtexture.destroy();
121 Mapcircletexture.destroy();
122 hawktexture.destroy();
123 loadscreentexture.destroy();
125 for (int i = 0; i < 10; i++)
126 Mainmenuitems[i].destroy();
128 glDeleteTextures(1, &screentexture);
129 glDeleteTextures(1, &screentexture2);
136 void LoadSave(const char *fileName, GLuint *textureid, bool mipmap, GLubyte *array, int *skinsize)
140 LOG(std::string("Loading (S)...") + fileName);
143 float temptexdetail = texdetail;
148 load_image(ConvertFileName(fileName), texture);
149 texdetail = temptexdetail;
151 int bytesPerPixel = texture.bpp / 8;
154 for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
155 if ((i + 1) % 4 || bytesPerPixel == 3) {
156 array[tempnum] = texture.data[i];
164 //***************> ResizeGLScene() <******/
165 GLvoid Game::ReSizeGLScene(float fov, float pnear)
167 if (screenheight == 0) {
171 glViewport(0, 0, screenwidth, screenheight);
173 glMatrixMode(GL_PROJECTION);
176 gluPerspective(fov, (GLfloat)screenwidth / (GLfloat)screenheight, pnear, viewdistance);
178 glMatrixMode(GL_MODELVIEW);
182 void Game::LoadingScreen()
184 static float loadprogress;
185 static AbsoluteTime frametime = {0, 0};
186 AbsoluteTime currTime = UpTime ();
187 double deltaTime = (float) AbsoluteDeltaToDuration (currTime, frametime);
189 if (0 > deltaTime) // if negative microseconds
190 deltaTime /= -1000000.0;
191 else // else milliseconds
194 multiplier = deltaTime;
195 if (multiplier < .001)
199 if (multiplier > .05) {
200 frametime = currTime; // reset for next time interval
204 glClearColor(0, 0, 0, 1);
205 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
208 loadtime += multiplier * 4;
210 loadprogress = loadtime;
211 if (loadprogress > 100)
216 glEnable(GL_TEXTURE_2D);
217 loadscreentexture.bind();
218 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
219 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
220 glDisable(GL_DEPTH_TEST);
221 glDisable(GL_CULL_FACE);
222 glDisable(GL_LIGHTING);
224 glMatrixMode(GL_PROJECTION);
227 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
228 glMatrixMode(GL_MODELVIEW);
231 glTranslatef(screenwidth / 2, screenheight / 2, 0);
232 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
233 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
235 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
238 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
239 glVertex3f(-1, -1, 0.0f);
240 glTexCoord2f(.1 - loadprogress / 100, 0 + loadprogress / 100 + .3);
241 glVertex3f(1, -1, 0.0f);
242 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
243 glVertex3f(1, 1, 0.0f);
244 glTexCoord2f(.1 - loadprogress / 100, 1 + loadprogress / 100 + .3);
245 glVertex3f(-1, 1, 0.0f);
251 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
252 glVertex3f(-1, -1, 0.0f);
253 glTexCoord2f(.4 + loadprogress / 100, 0 + loadprogress / 100);
254 glVertex3f(1, -1, 0.0f);
255 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
256 glVertex3f(1, 1, 0.0f);
257 glTexCoord2f(.4 + loadprogress / 100, 1 + loadprogress / 100);
258 glVertex3f(-1, 1, 0.0f);
261 glDisable(GL_TEXTURE_2D);
262 glMatrixMode(GL_PROJECTION);
264 glMatrixMode(GL_MODELVIEW);
269 glEnable(GL_TEXTURE_2D);
270 loadscreentexture.bind();
271 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
272 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
273 glDisable(GL_DEPTH_TEST);
274 glDisable(GL_CULL_FACE);
275 glDisable(GL_LIGHTING);
277 glMatrixMode(GL_PROJECTION);
280 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
281 glMatrixMode(GL_MODELVIEW);
284 glTranslatef(screenwidth / 2, screenheight / 2, 0);
285 glScalef((float)screenwidth / 2 * (1.5 - (loadprogress) / 200), (float)screenheight / 2 * (1.5 - (loadprogress) / 200), 1);
286 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
288 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, 1);
291 glTexCoord2f(0 + .5, 0 + .5);
292 glVertex3f(-1, -1, 0.0f);
293 glTexCoord2f(1 + .5, 0 + .5);
294 glVertex3f(1, -1, 0.0f);
295 glTexCoord2f(1 + .5, 1 + .5);
296 glVertex3f(1, 1, 0.0f);
297 glTexCoord2f(0 + .5, 1 + .5);
298 glVertex3f(-1, 1, 0.0f);
301 glDisable(GL_TEXTURE_2D);
302 glMatrixMode(GL_PROJECTION);
304 glMatrixMode(GL_MODELVIEW);
309 glEnable(GL_TEXTURE_2D);
310 loadscreentexture.bind();
311 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
312 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
313 glDisable(GL_DEPTH_TEST);
314 glDisable(GL_CULL_FACE);
315 glDisable(GL_LIGHTING);
317 glMatrixMode(GL_PROJECTION);
320 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
321 glMatrixMode(GL_MODELVIEW);
324 glTranslatef(screenwidth / 2, screenheight / 2, 0);
325 glScalef((float)screenwidth / 2 * (100 + loadprogress) / 100, (float)screenheight / 2 * (100 + loadprogress) / 100, 1);
326 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
328 glColor4f(loadprogress / 100, loadprogress / 100, loadprogress / 100, .4);
331 glTexCoord2f(0 + .2, 0 + .8);
332 glVertex3f(-1, -1, 0.0f);
333 glTexCoord2f(1 + .2, 0 + .8);
334 glVertex3f(1, -1, 0.0f);
335 glTexCoord2f(1 + .2, 1 + .8);
336 glVertex3f(1, 1, 0.0f);
337 glTexCoord2f(0 + .2, 1 + .8);
338 glVertex3f(-1, 1, 0.0f);
341 glDisable(GL_TEXTURE_2D);
342 glMatrixMode(GL_PROJECTION);
344 glMatrixMode(GL_MODELVIEW);
351 if (flashamount > 0) {
355 flashamount -= multiplier;
359 glDisable(GL_DEPTH_TEST);
360 glDisable(GL_CULL_FACE);
361 glDisable(GL_LIGHTING);
362 glDisable(GL_TEXTURE_2D);
364 glMatrixMode(GL_PROJECTION);
367 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
368 glMatrixMode(GL_MODELVIEW);
371 glScalef(screenwidth, screenheight, 1);
372 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
374 glColor4f(flashr, flashg, flashb, flashamount);
376 glVertex3f(0, 0, 0.0f);
377 glVertex3f(256, 0, 0.0f);
378 glVertex3f(256, 256, 0.0f);
379 glVertex3f(0, 256, 0.0f);
381 glMatrixMode(GL_PROJECTION);
383 glMatrixMode(GL_MODELVIEW);
385 glEnable(GL_DEPTH_TEST);
386 glEnable(GL_CULL_FACE);
395 void FadeLoadingScreen(float howmuch)
397 static float loadprogress;
401 glClearColor(0, 0, 0, 1);
402 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
404 loadprogress = howmuch;
408 glDisable(GL_TEXTURE_2D);
409 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
410 glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
411 glDisable(GL_DEPTH_TEST);
412 glDisable(GL_CULL_FACE);
413 glDisable(GL_LIGHTING);
415 glMatrixMode(GL_PROJECTION);
418 glOrtho(0, screenwidth, 0, screenheight, -100, 100);
419 glMatrixMode(GL_MODELVIEW);
422 glTranslatef(screenwidth / 2, screenheight / 2, 0);
423 glScalef((float)screenwidth / 2, (float)screenheight / 2, 1);
424 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
426 glColor4f(loadprogress / 100, 0, 0, 1);
430 glVertex3f(-1, -1, 0.0f);
432 glVertex3f(1, -1, 0.0f);
434 glVertex3f(1, 1, 0.0f);
436 glVertex3f(-1, 1, 0.0f);
439 glDisable(GL_TEXTURE_2D);
440 glMatrixMode(GL_PROJECTION);
442 glMatrixMode(GL_MODELVIEW);
450 void Game::InitGame()
454 numchallengelevels = 14;
456 accountactive = Account::loadFile(":Data:Users");
458 whichjointstartarray[0] = righthip;
459 whichjointendarray[0] = rightfoot;
461 whichjointstartarray[1] = righthip;
462 whichjointendarray[1] = rightankle;
464 whichjointstartarray[2] = righthip;
465 whichjointendarray[2] = rightknee;
467 whichjointstartarray[3] = rightknee;
468 whichjointendarray[3] = rightankle;
470 whichjointstartarray[4] = rightankle;
471 whichjointendarray[4] = rightfoot;
473 whichjointstartarray[5] = lefthip;
474 whichjointendarray[5] = leftfoot;
476 whichjointstartarray[6] = lefthip;
477 whichjointendarray[6] = leftankle;
479 whichjointstartarray[7] = lefthip;
480 whichjointendarray[7] = leftknee;
482 whichjointstartarray[8] = leftknee;
483 whichjointendarray[8] = leftankle;
485 whichjointstartarray[9] = leftankle;
486 whichjointendarray[9] = leftfoot;
488 whichjointstartarray[10] = abdomen;
489 whichjointendarray[10] = rightshoulder;
491 whichjointstartarray[11] = abdomen;
492 whichjointendarray[11] = rightelbow;
494 whichjointstartarray[12] = abdomen;
495 whichjointendarray[12] = rightwrist;
497 whichjointstartarray[13] = abdomen;
498 whichjointendarray[13] = righthand;
500 whichjointstartarray[14] = rightshoulder;
501 whichjointendarray[14] = rightelbow;
503 whichjointstartarray[15] = rightelbow;
504 whichjointendarray[15] = rightwrist;
506 whichjointstartarray[16] = rightwrist;
507 whichjointendarray[16] = righthand;
509 whichjointstartarray[17] = abdomen;
510 whichjointendarray[17] = leftshoulder;
512 whichjointstartarray[18] = abdomen;
513 whichjointendarray[18] = leftelbow;
515 whichjointstartarray[19] = abdomen;
516 whichjointendarray[19] = leftwrist;
518 whichjointstartarray[20] = abdomen;
519 whichjointendarray[20] = lefthand;
521 whichjointstartarray[21] = leftshoulder;
522 whichjointendarray[21] = leftelbow;
524 whichjointstartarray[22] = leftelbow;
525 whichjointendarray[22] = leftwrist;
527 whichjointstartarray[23] = leftwrist;
528 whichjointendarray[23] = lefthand;
530 whichjointstartarray[24] = abdomen;
531 whichjointendarray[24] = neck;
533 whichjointstartarray[25] = neck;
534 whichjointendarray[25] = head;
536 FadeLoadingScreen(0);
540 int temptexdetail = texdetail;
542 text->LoadFontTexture(":Data:Textures:Font.png");
544 texdetail = temptexdetail;
546 FadeLoadingScreen(10);
558 LOG("Initializing sound system...");
561 unsigned char rc = 0;
562 int output = OPENAL_OUTPUT_ALSA; // Try alsa first...
563 if (commandLineOptions[SOUND]) {
564 output = commandLineOptions[SOUND].last()->type(); // ...but let user override that.
567 OPENAL_SetOutput(output);
568 if ((rc = OPENAL_Init(44100, 32, 0)) == false) {
569 // if we tried ALSA and failed, fall back to OSS.
570 if ( (output == OPENAL_OUTPUT_ALSA) && (commandLineOptions[SOUND].last()->type() != OPENAL_OUTPUT_ALSA) ) {
572 output = OPENAL_OUTPUT_OSS;
573 OPENAL_SetOutput(output);
574 rc = OPENAL_Init(44100, 32, 0);
580 output = OPENAL_OUTPUT_NOSOUND; // we tried! just do silence.
581 OPENAL_SetOutput(output);
582 rc = OPENAL_Init(44100, 32, 0);
585 OPENAL_Init(44100, 32, 0);
588 OPENAL_SetSFXMasterVolume((int)(volume * 255));
592 emit_stream_np(stream_menutheme);
594 cursortexture.load(":Data:Textures:Cursor.png", 0);
596 Mapcircletexture.load(":Data:Textures:MapCircle.png", 0);
597 Mapboxtexture.load(":Data:Textures:MapBox.png", 0);
598 Maparrowtexture.load(":Data:Textures:MapArrow.png", 0);
600 temptexdetail = texdetail;
603 Mainmenuitems[0].load(":Data:Textures:Lugaru.png", 0);
604 Mainmenuitems[1].load(":Data:Textures:Newgame.png", 0);
605 Mainmenuitems[2].load(":Data:Textures:Options.png", 0);
606 Mainmenuitems[3].load(":Data:Textures:Quit.png", 0);
607 Mainmenuitems[4].load(":Data:Textures:Eyelid.png", 0);
608 Mainmenuitems[5].load(":Data:Textures:Resume.png", 0);
609 Mainmenuitems[6].load(":Data:Textures:Endgame.png", 0);
611 texdetail = temptexdetail;
613 FadeLoadingScreen(95);
623 newscreenwidth = screenwidth;
624 newscreenheight = screenheight;
630 void Game::LoadScreenTexture()
632 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
634 if (!Game::screentexture)
635 glGenTextures( 1, &Game::screentexture );
636 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
639 glEnable(GL_TEXTURE_2D);
640 glBindTexture( GL_TEXTURE_2D, Game::screentexture);
641 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
642 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
644 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, kTextureSize, kTextureSize, 0);
647 //TODO: move LoadStuff() closer to GameTick.cpp to get rid of various vars shared in Game.h
648 void Game::LoadStuff()
650 static float temptexdetail;
651 static float viewdistdetail;
661 for (auto p:Person::players) {
662 p->skeleton.drawmodel.textureptr.destroy();
665 i = abs(Random() % 4);
666 visibleloading = 0; //don't use loadscreentexture yet
667 loadscreentexture.load(":Data:Textures:fire.jpg", 1);
670 temptexdetail = texdetail;
672 text->LoadFontTexture(":Data:Textures:Font.png");
674 texdetail = temptexdetail;
677 viewdistance = 50 * megascale * viewdistdetail;
689 realtexdetail = texdetail;
691 LOG("Loading weapon data...");
693 Weapon::knifetextureptr.load(":Data:Textures:knife.png", 0);
694 Weapon::bloodknifetextureptr.load(":Data:Textures:bloodknife.png", 0);
695 Weapon::lightbloodknifetextureptr.load(":Data:Textures:lightbloodknife.png", 0);
696 Weapon::swordtextureptr.load(":Data:Textures:sword.jpg", 1);
697 Weapon::bloodswordtextureptr.load(":Data:Textures:Swordblood.jpg", 1);
698 Weapon::lightbloodswordtextureptr.load(":Data:Textures:Swordbloodlight.jpg", 1);
699 Weapon::stafftextureptr.load(":Data:Textures:Staff.jpg", 1);
701 Weapon::throwingknifemodel.load((char *)":Data:Models:throwingknife.solid", 1);
702 Weapon::throwingknifemodel.Scale(.001, .001, .001);
703 Weapon::throwingknifemodel.Rotate(90, 0, 0);
704 Weapon::throwingknifemodel.Rotate(0, 90, 0);
705 Weapon::throwingknifemodel.flat = 0;
706 Weapon::throwingknifemodel.CalculateNormals(1);
708 Weapon::swordmodel.load((char *)":Data:Models:sword.solid", 1);
709 Weapon::swordmodel.Scale(.001, .001, .001);
710 Weapon::swordmodel.Rotate(90, 0, 0);
711 Weapon::swordmodel.Rotate(0, 90, 0);
712 Weapon::swordmodel.Rotate(0, 0, 90);
713 Weapon::swordmodel.flat = 1;
714 Weapon::swordmodel.CalculateNormals(1);
716 Weapon::staffmodel.load((char *)":Data:Models:staff.solid", 1);
717 Weapon::staffmodel.Scale(.005, .005, .005);
718 Weapon::staffmodel.Rotate(90, 0, 0);
719 Weapon::staffmodel.Rotate(0, 90, 0);
720 Weapon::staffmodel.Rotate(0, 0, 90);
721 Weapon::staffmodel.flat = 1;
722 Weapon::staffmodel.CalculateNormals(1);
724 terrain.shadowtexture.load(":Data:Textures:shadow.png", 0);
725 terrain.bloodtexture.load(":Data:Textures:blood.png", 0);
726 terrain.breaktexture.load(":Data:Textures:break.png", 0);
727 terrain.bloodtexture2.load(":Data:Textures:blood.png", 0);
730 terrain.footprinttexture.load(":Data:Textures:footprint.png", 0);
731 terrain.bodyprinttexture.load(":Data:Textures:bodyprint.png", 0);
732 hawktexture.load(":Data:Textures:hawk.png", 0);
735 Sprite::cloudtexture.load(":Data:Textures:cloud.png", 1);
736 Sprite::cloudimpacttexture.load(":Data:Textures:cloudimpact.png", 1);
737 Sprite::bloodtexture.load(":Data:Textures:bloodparticle.png", 1);
738 Sprite::snowflaketexture.load(":Data:Textures:snowflake.png", 1);
739 Sprite::flametexture.load(":Data:Textures:flame.png", 1);
740 Sprite::bloodflametexture.load(":Data:Textures:bloodflame.png", 1);
741 Sprite::smoketexture.load(":Data:Textures:smoke.png", 1);
742 Sprite::shinetexture.load(":Data:Textures:shine.png", 1);
743 Sprite::splintertexture.load(":Data:Textures:splinter.png", 1);
744 Sprite::leaftexture.load(":Data:Textures:leaf.png", 1);
745 Sprite::toothtexture.load(":Data:Textures:tooth.png", 1);
749 ReSizeGLScene(90, .01);
761 //Set up distant light
762 light.color[0] = .95;
763 light.color[1] = .95;
765 light.ambient[0] = .2;
766 light.ambient[1] = .2;
767 light.ambient[2] = .24;
768 light.location.x = 1;
769 light.location.y = 1;
770 light.location.z = -.2;
771 Normalise(&light.location);
781 texscale = .2 / megascale / viewdistdetail;
782 terrain.scale = 3 * megascale * viewdistdetail;
784 viewer.x = terrain.size / 2 * terrain.scale;
785 viewer.z = terrain.size / 2 * terrain.scale;
787 hawk.load((char *)":Data:Models:hawk.solid", 1);
788 hawk.Scale(.03, .03, .03);
789 hawk.Rotate(90, 1, 1);
790 hawk.CalculateNormals(0);
791 hawk.ScaleNormals(-1, -1, -1);
792 hawkcoords.x = terrain.size / 2 * terrain.scale - 5 - 7;
793 hawkcoords.z = terrain.size / 2 * terrain.scale - 5 - 7;
794 hawkcoords.y = terrain.getHeight(hawkcoords.x, hawkcoords.z) + 25;
796 eye.load((char *)":Data:Models:eye.solid", 1);
797 eye.Scale(.03, .03, .03);
798 eye.CalculateNormals(0);
800 cornea.load((char *)":Data:Models:cornea.solid", 1);
801 cornea.Scale(.03, .03, .03);
802 cornea.CalculateNormals(0);
804 iris.load((char *)":Data:Models:iris.solid", 1);
805 iris.Scale(.03, .03, .03);
806 iris.CalculateNormals(0);
808 LoadSave(":Data:Textures:Bloodfur.png", 0, 1, &bloodText[0], 0);
809 LoadSave(":Data:Textures:Wolfbloodfur.png", 0, 1, &wolfbloodText[0], 0);
819 //Fix knife stab, too lazy to do it manually
823 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
824 for (j = 0; j < animation[knifesneakattackanim].numframes; j++) {
825 animation[knifesneakattackanim].position[i][j] += moveamount;
831 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
832 for (j = 0; j < animation[knifesneakattackedanim].numframes; j++) {
833 animation[knifesneakattackedanim].position[i][j] += moveamount;
839 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
840 animation[dead1anim].position[i][1] = animation[dead1anim].position[i][0];
841 animation[dead2anim].position[i][1] = animation[dead2anim].position[i][0];
842 animation[dead3anim].position[i][1] = animation[dead3anim].position[i][0];
843 animation[dead4anim].position[i][1] = animation[dead4anim].position[i][0];
845 animation[dead1anim].speed[0] = 0.001;
846 animation[dead2anim].speed[0] = 0.001;
847 animation[dead3anim].speed[0] = 0.001;
848 animation[dead4anim].speed[0] = 0.001;
850 animation[dead1anim].speed[1] = 0.001;
851 animation[dead2anim].speed[1] = 0.001;
852 animation[dead3anim].speed[1] = 0.001;
853 animation[dead4anim].speed[1] = 0.001;
855 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
856 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
857 animation[swordsneakattackanim].position[i][j] += moveamount;
861 for (j = 0; j < animation[swordsneakattackanim].numframes; j++) {
862 animation[swordsneakattackanim].weapontarget[j] += moveamount;
867 for (i = 0; i < Person::players[0]->skeleton.num_joints; i++) {
868 for (j = 0; j < animation[swordsneakattackedanim].numframes; j++) {
869 animation[swordsneakattackedanim].position[i][j] += moveamount;
874 temptexdetail = texdetail;
876 texdetail = temptexdetail;
880 if (!screentexture) {
884 if (targetlevel != 7) {
885 emit_sound_at(fireendsound);