diff options
| author | Savely Skresanov <savask@yandex.ru> | 2012-09-15 14:31:55 (GMT) |
|---|---|---|
| committer | Savely Skresanov <savask@yandex.ru> | 2012-09-15 14:34:27 (GMT) |
| commit | ec0dfa27e888461ec85012fa23d5a26e30f0e813 (patch) | |
| tree | 127dd057a10a8810ea14057d8da2e050655f3e1c | |
| parent | b626864293a5cb4717303245095c6d6f39c52f7d (diff) | |
| download | powder-ec0dfa27e888461ec85012fa23d5a26e30f0e813.zip powder-ec0dfa27e888461ec85012fa23d5a26e30f0e813.tar.gz | |
Hooked more functions to VM.
| -rw-r--r-- | src/virtualmachine/Syscalls.cpp | 14 | ||||
| -rw-r--r-- | src/virtualmachine/Syscalls.inl | 2 | ||||
| -rw-r--r-- | tptlibrary/file.c | 10 | ||||
| -rw-r--r-- | tptlibrary/tpt_syscalls.asm | 2 | ||||
| -rw-r--r-- | tptlibrary/tpt_syscalls.h | 2 |
5 files changed, 25 insertions, 5 deletions
diff --git a/src/virtualmachine/Syscalls.cpp b/src/virtualmachine/Syscalls.cpp index 692d4d0..876fe52 100644 --- a/src/virtualmachine/Syscalls.cpp +++ b/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); } } diff --git a/src/virtualmachine/Syscalls.inl b/src/virtualmachine/Syscalls.inl index 5281fb3..75455c1 100644 --- a/src/virtualmachine/Syscalls.inl +++ b/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) diff --git a/tptlibrary/file.c b/tptlibrary/file.c index b3ad278..67f2ca1 100644 --- a/tptlibrary/file.c +++ b/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; } diff --git a/tptlibrary/tpt_syscalls.asm b/tptlibrary/tpt_syscalls.asm index 2da2627..fd86585 100644 --- a/tptlibrary/tpt_syscalls.asm +++ b/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 diff --git a/tptlibrary/tpt_syscalls.h b/tptlibrary/tpt_syscalls.h index a3adf41..f72aeb5 100644 --- a/tptlibrary/tpt_syscalls.h +++ b/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 |
