Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Hooked more functions to VM.

  • Loading branch information...
commit ec0dfa27e888461ec85012fa23d5a26e30f0e813 1 parent b626864
@savask savask authored
View
14 src/virtualmachine/Syscalls.cpp
@@ -71,10 +71,16 @@ namespace vm
TRAPDEF(pmapData)
{
- int xarg, yarg;
- yarg = ARG(0).int4;
- xarg = ARG(1).int4;
+ Push<int4_t>(sim->pmap[ARG(1).int4][ARG(0).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
2  src/virtualmachine/Syscalls.inl
@@ -10,3 +10,5 @@ TRAPDEF(-8, print)
TRAPDEF(-9, partCreate)
TRAPDEF(-10, partChangeType)
TRAPDEF(-11, pmapData)
+TRAPDEF(-12, deletePart)
+TRAPDEF(-13, killPart)
View
10 tptlibrary/file.c
@@ -2,6 +2,14 @@
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;
}
View
2  tptlibrary/tpt_syscalls.asm
@@ -12,3 +12,5 @@ equ print -8
equ partCreate -9
equ partChangeType -10
equ pmapData -11
+equ deletePart -12
+equ killPart -13
View
2  tptlibrary/tpt_syscalls.h
@@ -14,5 +14,7 @@ void error(char * message);
int partCreate(int i, int x, int y, int type);
void partChangeType(int i, int x, int y, int type);
int pmapData(int x, int y);
+void deletePart(int x, int y, int flags);
+void killPart(int i);
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.