From 29b23632dbddbb74ca9c74e3229c5e4729fe3622 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Mon, 19 Feb 2018 16:46:20 +0100 Subject: [PATCH] New non-atacking player --- Source/GameTick.cpp | 3 +++ Source/Objects/Person.cpp | 3 ++- Source/Objects/Person.hpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 1a22117..ed1aed9 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1472,6 +1472,9 @@ void Game::ProcessDevInput() Person::players.back()->power = Person::players[0]->power; Person::players.back()->speedmult = Person::players[0]->speedmult; + if (Input::isKeyDown(SDL_SCANCODE_RSHIFT)) + Person::players.back()->isplayerfriend = true; + Person::players.back()->loaded = true; } diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index d0e8f08..8022c0f 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -169,6 +169,7 @@ Person::Person() victim(nullptr) , hasvictim(false) + , isplayerfriend(false) , updatedelay(0) @@ -7324,7 +7325,7 @@ bool Person::addClothes(const int& clothesId) void Person::doAI() { - if (!isPlayerControlled() && !Dialog::inDialog()) { + if (!isPlayerControlled() && !isPlayerFriend() && !Dialog::inDialog()) { jumpclimb = 0; //disable movement in editor if (Game::editorenabled) { diff --git a/Source/Objects/Person.hpp b/Source/Objects/Person.hpp index 89d5b40..22c76eb 100644 --- a/Source/Objects/Person.hpp +++ b/Source/Objects/Person.hpp @@ -157,6 +157,7 @@ public: std::shared_ptr victim; bool hasvictim; + bool isplayerfriend; float updatedelay; float normalsupdatedelay; @@ -405,6 +406,7 @@ public: bool hasWeapon() { return (weaponactive != -1); } bool isPlayerControlled() { return (aitype == playercontrolled); } + bool isPlayerFriend() { return isplayerfriend; } }; const int maxplayers = 10; -- 2.39.5