X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FObjects%2FWeapons.cpp;h=5ef40e6ff08e47d17a8963419f2eed0e32c659f9;hb=7d7660368e11ce4a2423f23ecba4ffc5103c4798;hp=127c014cb41702bd2c10df4790514184369711e9;hpb=7d2f9d40d94d14a61ecdaaa2c41f964029815bc2;p=lugaru.git diff --git a/Source/Objects/Weapons.cpp b/Source/Objects/Weapons.cpp index 127c014..5ef40e6 100644 --- a/Source/Objects/Weapons.cpp +++ b/Source/Objects/Weapons.cpp @@ -27,6 +27,7 @@ along with Lugaru. If not, see . #include "Audio/Sounds.hpp" #include "Game.hpp" #include "Level/Awards.hpp" +#include "Tutorial.hpp" extern float multiplier; extern Terrain terrain; @@ -48,7 +49,6 @@ extern float woozy; extern float viewdistance; extern float blackout; extern bool freeze; -extern int tutoriallevel; extern int numthrowkill; Model Weapon::throwingknifemodel; @@ -166,7 +166,7 @@ void Weapon::DoStuff(int i) if (whichhit != -1) { if (Object::objects[k]->type == treetrunktype) { Object::objects[k]->model.MakeDecal(breakdecal, DoRotation(colpoint - Object::objects[k]->position, 0, -Object::objects[k]->yaw, 0), .1, 1, Random() % 360); - normalrot = DoRotation(Object::objects[k]->model.facenormals[whichhit], 0, Object::objects[k]->yaw, 0); + normalrot = DoRotation(Object::objects[k]->model.Triangles[whichhit].facenormal, 0, Object::objects[k]->yaw, 0); velocity = 0; if (type == knife) position = colpoint - normalrot * .1; @@ -248,16 +248,16 @@ void Weapon::DoStuff(int i) Person::players[j]->jointVel(neck) += velocity * 2; Person::players[j]->jointVel(rightshoulder) += velocity * 2; Person::players[j]->jointVel(leftshoulder) += velocity * 2; - if (bloodtoggle && tutoriallevel != 1) + if (bloodtoggle && !Tutorial::active) Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3); - if (tutoriallevel == 1) + if (Tutorial::active) Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 1, 1, .8, .3); footvel = tippoint - position; Normalise(&footvel); - if (bloodtoggle && tutoriallevel != 1) + if (bloodtoggle && !Tutorial::active) Sprite::MakeSprite(bloodflamesprite, footpoint, footvel * -1, 1, 0, 0, .6, 1); - if (tutoriallevel != 1) { + if (!Tutorial::active) { if (Person::players[j]->weaponstuckwhere == 0) Person::players[j]->DoBloodBig(2, 205); if (Person::players[j]->weaponstuckwhere == 1) @@ -451,7 +451,7 @@ void Weapon::DoStuff(int i) if (whichhit != -1) { hitsomething = 1; position = colpoint; - terrainnormal = DoRotation(Object::objects[k]->model.facenormals[whichhit], 0, Object::objects[k]->yaw, 0) * -1; + terrainnormal = DoRotation(Object::objects[k]->model.Triangles[whichhit].facenormal, 0, Object::objects[k]->yaw, 0) * -1; ReflectVector(&velocity, &terrainnormal); position += terrainnormal * .002; @@ -481,7 +481,7 @@ void Weapon::DoStuff(int i) if (whichhit != -1) { hitsomething = 1; tippoint = colpoint; - terrainnormal = DoRotation(Object::objects[k]->model.facenormals[whichhit], 0, Object::objects[k]->yaw, 0) * -1; + terrainnormal = DoRotation(Object::objects[k]->model.Triangles[whichhit].facenormal, 0, Object::objects[k]->yaw, 0) * -1; ReflectVector(&tipvelocity, &terrainnormal); tippoint += terrainnormal * .002; @@ -518,7 +518,7 @@ void Weapon::DoStuff(int i) if (whichhit != -1) { hitsomething = 1; mid = colpoint; - terrainnormal = DoRotation(Object::objects[k]->model.facenormals[whichhit], 0, Object::objects[k]->yaw, 0) * -1; + terrainnormal = DoRotation(Object::objects[k]->model.Triangles[whichhit].facenormal, 0, Object::objects[k]->yaw, 0) * -1; ReflectVector(&velocity, &terrainnormal); bounceness = terrainnormal * findLength(&velocity) * (abs(normaldotproduct(velocity, terrainnormal))); @@ -553,7 +553,7 @@ void Weapon::DoStuff(int i) if (whichhit != -1) { hitsomething = 1; mid = colpoint; - terrainnormal = DoRotation(Object::objects[k]->model.facenormals[whichhit], 0, Object::objects[k]->yaw, 0) * -1; + terrainnormal = DoRotation(Object::objects[k]->model.Triangles[whichhit].facenormal, 0, Object::objects[k]->yaw, 0) * -1; ReflectVector(&tipvelocity, &terrainnormal); bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal))); @@ -1111,15 +1111,3 @@ int Weapons::Draw() Weapons::Weapons() { } - -Weapons::~Weapons() -{ - Weapon::stafftextureptr.destroy(); - Weapon::knifetextureptr.destroy(); - Weapon::lightbloodknifetextureptr.destroy(); - Weapon::bloodknifetextureptr.destroy(); - Weapon::swordtextureptr.destroy(); - Weapon::lightbloodswordtextureptr.destroy(); - Weapon::bloodswordtextureptr.destroy(); -} -