aboutsummaryrefslogtreecommitdiffstats
path: root/src/weapon.cpp
blob: 3f5dcecc564f2468f6e518435b3de8a1b1a1ceec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*********************************/
/*   THRESHOLD        (  //      */
/*   weapon            ( )/      */
/*   by salade         )(/       */
/*  ________________  ( /)       */
/* ()__)____________)))))   :^}  */
/*********************************/

#include "weapon.hpp"

Weapon::Weapon(float const & rg, unsigned int const & dmg, const char *s, const char *r) :
    range(rg), damage(dmg)
{
    InitAudioDevice();
    shot = LoadSound(s);
    reload = LoadSound(r);
    SetSoundVolume(shot, 0.3f);
    SetSoundVolume(reload, 0.3f);
    max = barrel = 200;
}

Weapon::~Weapon() {}

void Weapon::refill()
{
    auto time = GetTime();
}

int Weapon::bang()
{
    if (barrel == 0)
    {
        refill();
        return (1);
    } else {
        barrel--;
        PlaySound(shot);
        return (0);
    }
}