src/Projectile.hh
author ekku
Sun, 07 Dec 2008 18:21:44 +0000
changeset 247 b87f68be579f
parent 233 ff4ecea83cf5
child 248 e40ef56dc62c
permissions -rw-r--r--
When on the ground, dont integrate in vain
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
     1
#ifndef PROJECTILE_HH
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
     2
#define PROJECTILE_HH
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
     3
 
201
135616467a0a rename Shot -> Projectile
terom
parents: 197
diff changeset
     4
class Projectile;
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
     5
222
293ddf4c067d reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents: 211
diff changeset
     6
#include "GameState.hh"
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
     7
#include "PhysicsObject.hh"
208
7709571e1131 Digging now uses projectiles.
saiam
parents: 204
diff changeset
     8
#include "Timer.hh"
233
ff4ecea83cf5 start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents: 224
diff changeset
     9
#include "GraphicsPointer.hh"
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    10
201
135616467a0a rename Shot -> Projectile
terom
parents: 197
diff changeset
    11
class Projectile : public PhysicsObject {
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    12
protected:
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    13
    GameState &state;
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    14
    bool visible;
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    15
    bool target_visible;
208
7709571e1131 Digging now uses projectiles.
saiam
parents: 204
diff changeset
    16
    float radius;
223
2fcaf54ed37b basic network-projectiles
terom
parents: 222
diff changeset
    17
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    18
public:
208
7709571e1131 Digging now uses projectiles.
saiam
parents: 204
diff changeset
    19
    TickCount birth_tick;
7709571e1131 Digging now uses projectiles.
saiam
parents: 204
diff changeset
    20
    TickCount age;
7709571e1131 Digging now uses projectiles.
saiam
parents: 204
diff changeset
    21
223
2fcaf54ed37b basic network-projectiles
terom
parents: 222
diff changeset
    22
    Projectile (GameState &state, Vector position, Vector velocity, bool visible, float radius, TickCount age=1000000000);
222
293ddf4c067d reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents: 211
diff changeset
    23
    virtual ~Projectile (void);
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    24
233
ff4ecea83cf5 start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents: 224
diff changeset
    25
    virtual void draw (Graphics *g) const;
222
293ddf4c067d reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents: 211
diff changeset
    26
293ddf4c067d reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents: 211
diff changeset
    27
protected:
224
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    28
    /*
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    29
     * Removes ground at given position if applicable, and destroys this PhysicsObject.
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    30
     *
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    31
     * This is overriden by Network.
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    32
     */
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    33
    virtual void onDestroy (Vector position, bool removeGround);
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    34
    
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    35
    /*
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    36
     * Call onDestroy, removingGround
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    37
     */
222
293ddf4c067d reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents: 211
diff changeset
    38
    virtual void onCollision (void);
224
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    39
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    40
    /*
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    41
     * If we have expired, call onDestory without removingGround
e6faefba2ec1 fixed logger, and network projectiles should work reasonably well now
terom
parents: 223
diff changeset
    42
     */
222
293ddf4c067d reorganize PhysicsObject/Player/Projectile lists so that PhysicsObject doesn't need to know about its subclasses anymore, and PhysicsWorld doesn't need to know about GameState
ekku
parents: 211
diff changeset
    43
    virtual void tick (TimeMS dt);
197
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    44
};
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    45
 
d9ac888de778 Hajotetaan lis??
ekku
parents:
diff changeset
    46
#endif