From 59d902df725c2d6a1b7cad016326ca51316b937f Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Tue, 11 Jan 2022 17:06:20 +0100 Subject: clang format blind letsgo ! --- src/wp_assaultrifle.cpp | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) (limited to 'src/wp_assaultrifle.cpp') diff --git a/src/wp_assaultrifle.cpp b/src/wp_assaultrifle.cpp index 2d4ab0f..e12b440 100644 --- a/src/wp_assaultrifle.cpp +++ b/src/wp_assaultrifle.cpp @@ -1,21 +1,16 @@ #include "wp_assaultrifle.hpp" -#include -#include #include +#include +#include #include "entity.hpp" -wp_assaultrifle::wp_assaultrifle(const char *s, const char *r) - : AWeapon(300.0f, 10, 30, 0.0, s, r) -{} - - +wp_assaultrifle::wp_assaultrifle(const char* s, const char* r) + : AWeapon(300.0f, 10, 30, 0.0, s, r) {} -int wp_assaultrifle::bang(std::vector * enemies, Entity * player) -{ - if (barrel == 0) - { +int wp_assaultrifle::bang(std::vector* enemies, Entity* player) { + if (barrel == 0) { return (1); } else { Vector2 playerDirection = Vector2Normalize(player->direction); @@ -37,36 +32,35 @@ int wp_assaultrifle::bang(std::vector * enemies, Entity * player) r = playerDirection; r.x *= 2; r.y *= 2; - for (auto en = enemies->begin(); en != enemies->end(); en++) - { - if (CheckCollisionPointLine((Vector2){en->posX, en->posY}, playerPosition, add1, (en->radius * 2)) || - CheckCollisionPointLine((Vector2){en->posX, en->posY}, playerPosition, Vector2Add(playerPosition, r), (en->radius * 2)) || - CheckCollisionPointLine((Vector2){en->posX, en->posY}, playerPosition, add2, (en->radius * 2))) - { // enemy hit + for (auto en = enemies->begin(); en != enemies->end(); en++) { + if (CheckCollisionPointLine((Vector2){en->posX, en->posY}, + playerPosition, add1, + (en->radius * 2)) || + CheckCollisionPointLine( + (Vector2){en->posX, en->posY}, playerPosition, + Vector2Add(playerPosition, r), (en->radius * 2)) || + CheckCollisionPointLine((Vector2){en->posX, en->posY}, + playerPosition, add2, + (en->radius * 2))) { // enemy hit std::cout << "hit" << std::endl; en->hp--; - if (en->hp == 0) - { + if (en->hp == 0) { en->direction.x = (playerDirection.x / 2); en->direction.y = (playerDirection.y / 2); player->victims += 1; } player->fury += 1; - break ; + break; } } // assaultrifle cone DrawLineEx(playerPosition, add1, 10, ORANGE); - DrawLineEx(playerPosition, - Vector2Add(playerPosition, - r), - 10, ORANGE); + DrawLineEx(playerPosition, Vector2Add(playerPosition, r), 10, ORANGE); DrawLineEx(playerPosition, add2, 10, ORANGE); // // there - if (barrel == 0) - { + if (barrel == 0) { empty = true; } return (0); -- cgit v1.2.3