From 7f6e5a022b800af0a2f7ab502743805e6fbc448c Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Mon, 5 Oct 2015 23:49:07 +0800 Subject: Enable the BLR script VM (prototype). The code (definitely) still require improvements. TODOs: Reimplement the call stack. Unify float data types. --- src/core/bullet.hpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/core/bullet.hpp') diff --git a/src/core/bullet.hpp b/src/core/bullet.hpp index b240e81..e3dc8fe 100644 --- a/src/core/bullet.hpp +++ b/src/core/bullet.hpp @@ -38,8 +38,32 @@ private: public: void init(); void deinit(); - templateint allocBullet(); - templateint createBullet(); + templateint allocBullet() + { + if(!alloced) + { + alloced=1; + bullets[0]=new T; + return 0; + } + else + { + int i; + for(i=0;iexist)break; + if(i==alloced) + bullets[alloced++]=new T; + return i; + } + return -1; + } + templateint createBullet() + { + //stub... + int ptr=allocBullet(); + bullets[ptr]->init(); + return ptr; + } void updateBullet(); void renderBullet(); bulletBase* getHandle(int id); -- cgit v1.2.3