aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-26 22:57:45 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-26 22:57:45 +0800
commit1981e9bc81e92f479c725e6ac60ff3bd419cefd0 (patch)
tree49074e0f7d4f75f659469ea9bf01cdcfa85a6f69 /src/core
parent3bd383baf6a17e734329e1fc677c7e86283db772 (diff)
downloadbullet-lab-remix-1981e9bc81e92f479c725e6ac60ff3bd419cefd0.tar.xz
Git and markdown sucks...
Diffstat (limited to 'src/core')
-rw-r--r--src/core/bullet.cpp1
-rw-r--r--src/core/vmrunner.cpp22
-rw-r--r--src/core/vmrunner.hpp4
3 files changed, 22 insertions, 5 deletions
diff --git a/src/core/bullet.cpp b/src/core/bullet.cpp
index 15cfef0..0bcf2d9 100644
--- a/src/core/bullet.cpp
+++ b/src/core/bullet.cpp
@@ -54,7 +54,6 @@ void bulletBonus::update()
{
if(!exist)return;
vel=vel+acc;
- if(vel.l()>velim&&velim>0)vel=velim*vel.getNormalized();
pos=pos-vel;
if((pos-player->pos).l()<9)exist=false;
diff --git a/src/core/vmrunner.cpp b/src/core/vmrunner.cpp
index 5569b1c..43fe1f5 100644
--- a/src/core/vmrunner.cpp
+++ b/src/core/vmrunner.cpp
@@ -95,7 +95,7 @@ int blrScriptVM::loadLSBFromMemory(const char *ptr,DWORD size)
if(!infunc)return 1;
infunc=0;
break;
- case 0x0F:
+ case 0x0F: case 0x25: case 0x26:
if(!infunc)return 1;
break;
case 0x01: case 0x0C: case 0x0D:
@@ -108,7 +108,7 @@ int blrScriptVM::loadLSBFromMemory(const char *ptr,DWORD size)
case 0x03: case 0x04: case 0x05:
case 0x06: case 0x07: case 0x08:
case 0x09: case 0x0A: case 0x0B:
- case 0x22: case 0x23:
+ case 0x22: case 0x23: case 0x24:
if(!infunc)return 1;
readPara(&inst[ic].para1);
readPara(&inst[ic].para2);
@@ -270,7 +270,24 @@ void blrScriptVM::vmRunFunction(const char *fncnym)
if(fetchData(inst[cur].para1).nez())
cur=fetchData(inst[cur].para2).i(),jmp=1;
break;
+ case 0x24:
+ if(fetchData(inst[cur].para1).nez())
+ {
+ lpjmp[lops]=cur;
+ lppos[lops++]=fetchData(inst[cur].para2);
+ }
+ else cur=fetchData(inst[cur].para2).i()+1,jmp=1;
+ break;
+ case 0x25:
+ if(!lops)throw;
+ cur=lppos[--lops]+1,jmp=1;
+ break;
+ case 0x26:
+ if(!lops)throw;
+ cur=lppos[--lops],jmp=1;
+ break;
}
+ if(cur==lppos[lops-1])cur=lpjmp[--lops],jmp=1;
if(!jmp)++cur;
}
}
@@ -283,6 +300,7 @@ void blrScriptVM::vmInit(unsigned int seed)
for(int i=0;i<10000;++i)ra[i].type=1,ia[i].type=0;
re=new smRandomEngine;
re->setSeed(seed);
+ lops=0;
}
void blrScriptVM::vmDeinit()
{
diff --git a/src/core/vmrunner.hpp b/src/core/vmrunner.hpp
index 502ac4a..75df767 100644
--- a/src/core/vmrunner.hpp
+++ b/src/core/vmrunner.hpp
@@ -28,7 +28,7 @@ private:
Idata ir[101],ia[10000];
Idata rr[103],ra[10000];
SInst inst[65537];
- int ic,fncnt,pinst;
+ int ic,fncnt,pinst,lops,lppos[8],lpjmp[8];
fncEntry fncent[8];
const unsigned char *sbyte,*cbyte;
DWORD fsize;
@@ -37,7 +37,7 @@ private:
Idata& fetchData(SPara para,bool forcerw=false);
public:
smRandomEngine* re;
- blrScriptVM(){ic=fncnt=pinst=0;}
+ blrScriptVM(){ic=fncnt=pinst=lops=0;}
int loadLSBFromMemory(const char* ptr,DWORD size);
int getInstCount();
void vmRunFunction(const char *fncnym);