aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/bullet.cpp15
-rw-r--r--src/core/bullet.hpp5
-rw-r--r--src/core/player.cpp2
-rw-r--r--src/plugin/pluginmgr.hpp15
-rw-r--r--src/plugin/pluginmgr_dl.cpp20
5 files changed, 50 insertions, 7 deletions
diff --git a/src/core/bullet.cpp b/src/core/bullet.cpp
index 8fdaa99..7a5682b 100644
--- a/src/core/bullet.cpp
+++ b/src/core/bullet.cpp
@@ -30,18 +30,20 @@ void bulletBonus::init(char fstarg,...)
pos.x=va_arg(val,double);
pos.y=va_arg(val,double);
basecolor=grey;rendercolor=0x33FFFFFF;
- va_end(val);renderscale=0.5;
+ va_end(val);renderscale=0.8;
attrf[0]=0;attrd[0]=0;exist=special=true;
- vel.x=0;vel.y=-2;acc.x=0;acc.y=0.1;
+ vel.x=0;vel.y=2;acc.x=0;acc.y=-0.1;
}
void bulletBonus::update()
{
- //the player is not implemented yet...
- if(vel.y>0)attrd[0]=1,acc=smvec2d(0,0);
+ bulletBase::update();
+ if((pos-player->pos).l()<9) exist=false;
+
+ if(vel.y<0&&!attrd[0])attrd[0]=1,acc=smvec2d(0,0);
if(attrd[0])
{
if(attrf[0]<10)attrf[0]+=.5;else attrf[0]=10.1;
- vel=vel-player->pos;
+ vel=pos-player->pos;
vel.normalize();
vel=attrf[0]*vel;
}
@@ -70,8 +72,9 @@ void bulletManager::updateBullet()
if(bullets[i]->exist&&!bullets[i]->special)
{
bullets[i]->exist=false;
+ smvec2d p=bullets[i]->pos;
int ptr=allocBullet<bulletBonus>();
- bullets[ptr]->init(0,bullets[i]->vel.x,bullets[i]->vel.y);
+ bullets[ptr]->init(0,p.x,p.y);
}
for(int i=0;i<alloced;++i)
if(bullets[i]->exist)
diff --git a/src/core/bullet.hpp b/src/core/bullet.hpp
index d8f275e..afba038 100644
--- a/src/core/bullet.hpp
+++ b/src/core/bullet.hpp
@@ -56,6 +56,11 @@ public:
if(!bullets[i]->exist)break;
if(i==alloced)
bullets[alloced++]=new T;
+ else
+ {
+ delete bullets[i];
+ bullets[i]=new T;
+ }
return i;
}
return -1;
diff --git a/src/core/player.cpp b/src/core/player.cpp
index 794bb5a..5cbc47e 100644
--- a/src/core/player.cpp
+++ b/src/core/player.cpp
@@ -35,6 +35,6 @@ void playerBase::update()
}
void playerBase::render()
{
- playerent->render(pos.x,pos.y,rot,0.7);
+ playerent->render(pos.x+8.4,pos.y+8.4,rot,0.7);
}
playerBase* player;
diff --git a/src/plugin/pluginmgr.hpp b/src/plugin/pluginmgr.hpp
new file mode 100644
index 0000000..e3220c1
--- /dev/null
+++ b/src/plugin/pluginmgr.hpp
@@ -0,0 +1,15 @@
+#ifndef PLUGINMGR_H
+#define PLUGINMGR_H
+class pluginManager
+{
+private:
+ char fn[256][256];
+ int fcnt;
+ char pluginFolder[256];
+public:
+ pluginManager();
+ void scanPlugin();
+ void loadPlugin(const char* filename);
+};
+#endif
+
diff --git a/src/plugin/pluginmgr_dl.cpp b/src/plugin/pluginmgr_dl.cpp
new file mode 100644
index 0000000..f3ab816
--- /dev/null
+++ b/src/plugin/pluginmgr_dl.cpp
@@ -0,0 +1,20 @@
+#include <dlfcn.h>
+#include <dirent.h>
+#include "pluginmgr.hpp"
+pluginManager::pluginManager()
+{
+ pluginFolder="./plugins";
+}
+void pluginManager::scanPlugin()
+{
+ DIR *dir;
+ struct dirent *file;
+ if(dir=opendir(pluginFolder))
+ {
+ while(file=readdir(dir))
+ //puts(file->d_name);
+ if(strcmp(file->d_name+strlen(file->d_name)-3,".so")==0)
+ strcpy(fn[fcnt++],file->d_name);
+ closedir(dir);
+ }
+}