Hooked more functions to VM.

This commit is contained in:
Savely Skresanov 2012-09-15 21:31:55 +07:00
parent b626864293
commit ec0dfa27e8
5 changed files with 25 additions and 5 deletions

View File

@ -71,10 +71,16 @@ namespace vm
TRAPDEF(pmapData) TRAPDEF(pmapData)
{ {
int xarg, yarg; Push<int4_t>(sim->pmap[ARG(1).int4][ARG(0).int4]);
yarg = ARG(0).int4; }
xarg = ARG(1).int4;
Push<int4_t>(sim->pmap[yarg][xarg]); TRAPDEF(deletePart)
{
sim->delete_part(ARG(0).int4, ARG(1).int4, ARG(2).int4);
}
TRAPDEF(killPart)
{
sim->kill_part(ARG(0).int4);
} }
} }

View File

@ -10,3 +10,5 @@ TRAPDEF(-8, print)
TRAPDEF(-9, partCreate) TRAPDEF(-9, partCreate)
TRAPDEF(-10, partChangeType) TRAPDEF(-10, partChangeType)
TRAPDEF(-11, pmapData) TRAPDEF(-11, pmapData)
TRAPDEF(-12, deletePart)
TRAPDEF(-13, killPart)

View File

@ -2,6 +2,14 @@
int update_TEST(int i, int x, int y, int nt, int ss) int update_TEST(int i, int x, int y, int nt, int ss)
{ {
partCreate(-1, x, y-1, 2); int k, j, index;
for(k=-1; k<2; k++)
for(j=-1; j<2; j++)
{
index = pmapData(x+k, y+j);
if ((index&0xFF) == 2)
killPart(index>>8);
}
return 0; return 0;
} }

View File

@ -12,3 +12,5 @@ equ print -8
equ partCreate -9 equ partCreate -9
equ partChangeType -10 equ partChangeType -10
equ pmapData -11 equ pmapData -11
equ deletePart -12
equ killPart -13

View File

@ -14,5 +14,7 @@ void error(char * message);
int partCreate(int i, int x, int y, int type); int partCreate(int i, int x, int y, int type);
void partChangeType(int i, int x, int y, int type); void partChangeType(int i, int x, int y, int type);
int pmapData(int x, int y); int pmapData(int x, int y);
void deletePart(int x, int y, int flags);
void killPart(int i);
#endif #endif