Some work on adding new hooks.

This commit is contained in:
Savely Skresanov
2012-09-15 18:29:23 +07:00
parent 8a4d18df49
commit b626864293
6 changed files with 35 additions and 23 deletions

View File

@@ -353,4 +353,4 @@ namespace vm
Push<int4_t>(Pop<float4_t>()); Push<int4_t>(Pop<float4_t>());
return 0; return 0;
} }
} }

View File

@@ -68,4 +68,13 @@ namespace vm
{ {
sim->part_change_type(ARG(0).int4, ARG(1).int4, ARG(2).int4, ARG(3).int4); sim->part_change_type(ARG(0).int4, ARG(1).int4, ARG(2).int4, ARG(3).int4);
} }
}
TRAPDEF(pmapData)
{
int xarg, yarg;
yarg = ARG(0).int4;
xarg = ARG(1).int4;
Push<int4_t>(sim->pmap[yarg][xarg]);
}
}

View File

@@ -1,11 +1,12 @@
TRAPDEF(-104, sin) TRAPDEF(-1, sin)
TRAPDEF(-105, cos) TRAPDEF(-2, cos)
TRAPDEF(-106, atan2) TRAPDEF(-3, atan2)
TRAPDEF(-107, sqrt) TRAPDEF(-4, sqrt)
TRAPDEF(-108, floor) TRAPDEF(-5, floor)
TRAPDEF(-109, ceil) TRAPDEF(-6, ceil)
TRAPDEF(-110, error) TRAPDEF(-7, error)
TRAPDEF(-111, print) TRAPDEF(-8, print)
TRAPDEF(-112, partCreate) TRAPDEF(-9, partCreate)
TRAPDEF(-113, partChangeType) TRAPDEF(-10, partChangeType)
TRAPDEF(-11, pmapData)

View File

@@ -279,4 +279,4 @@ public:
}; };
}; };
} }

View File

@@ -1,13 +1,14 @@
code code
equ sin -104 equ sin -1
equ cos -105 equ cos -2
equ atan2 -106 equ atan2 -3
equ sqrt -107 equ sqrt -4
equ floor -108 equ floor -5
equ ceil -109 equ ceil -6
equ error -110 equ error -7
equ print -111 equ print -8
equ partCreate -112 equ partCreate -9
equ partChangeType -113 equ partChangeType -10
equ pmapData -11

View File

@@ -13,5 +13,6 @@ 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);
#endif #endif