blob: 5f4fe2f4921a370d5ba0d3dc3004d4b45a947a44 (
plain) (
blame)
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
41
42
43
44
45
46
47
48
49
|
#ifndef BULLET_H
#define BULLET_H
#include "smmath.hpp"
#include "smentity.hpp"
#include "coreshared.hpp"
class bulletBase
{
public:
smvec2d pos,vel,acc;
float velim;
//velim: velocity scalar limit.
float collrange,scollrange,renderscale;
//collision range and semi-collision range. Replacing "collable" and "scollable".
bool extborder,invincible;
//extborder: true=not removed if out of screen.
//invincible: true=not removed if collided with player or in range of CLR.
bool exist,addblend;
int attrd[8];
float attrf[8];
TColors basecolor;
virtual void init(...);
virtual void update();
virtual void render();
virtual ~bulletBase();
};
class bulletBonus:public bulletBase
{
void update()override;
};
class bulletManager
{
private:
bulletBase* bullets[10240];
int alloced,used;
smEntity2D* bulent2d[COLOR_COUNT];
smEntity3D* bulent3d[COLOR_COUNT];
public:
void init();
void deinit();
template<class T>int allocBullet();
template<class T>int createBullet();
void updateBullet();
void renderBullet();
bulletBase* getHandle(int id);
smEntity2D* getBulEntity2D(TColors col);
smEntity3D* getBulEntity3D(TColors col);
};
extern bulletManager *bmInstance;
#endif
|