Remove pointer hacks from script and use standard load/store functions.
This commit is contained in:
@@ -7,10 +7,10 @@ main(con, ft, launchID) {
|
||||
int newPart;
|
||||
int drawCount;
|
||||
int dx, dy, idx;
|
||||
int partPtr;
|
||||
int vertPtr;
|
||||
int posx,posy;
|
||||
int c;
|
||||
int srcIdx;
|
||||
int dstIdx;
|
||||
|
||||
count = loadI32(con, 0, 1);
|
||||
touch = loadI32(con, 0, 2);
|
||||
@@ -53,36 +53,32 @@ main(con, ft, launchID) {
|
||||
storeI32(con, 2, 0, newPart);
|
||||
}
|
||||
|
||||
// Emulate intrinsic perf...
|
||||
partPtr = loadVp(con, 2, 4);
|
||||
vertPtr = loadVp(con, 1, 0);
|
||||
|
||||
drawCount = 0;
|
||||
for (ct=0; ct < count; ct++) {
|
||||
//int srcIdx = ct * 5 + 1;
|
||||
//int dstIdx = ct * 3 * 3;
|
||||
srcIdx = ct * 5 + 1;
|
||||
|
||||
dx = * (int* )(partPtr + 0); //loadEnvI32(con, 2, srcIdx);
|
||||
dy = * (int* )(partPtr + 4); //loadEnvI32(con, 2, srcIdx + 1);
|
||||
life = * (int* )(partPtr + 8); //loadEnvI32(con, 2, srcIdx + 2);
|
||||
posx = * (int* )(partPtr + 12); //loadEnvI32(con, 2, srcIdx + 3);
|
||||
posy = * (int* )(partPtr + 16); //loadEnvI32(con, 2, srcIdx + 4);
|
||||
dx = loadI32(con, 2, srcIdx);
|
||||
dy = loadI32(con, 2, srcIdx + 1);
|
||||
life = loadI32(con, 2, srcIdx + 2);
|
||||
posx = loadI32(con, 2, srcIdx + 3);
|
||||
posy = loadI32(con, 2, srcIdx + 4);
|
||||
|
||||
if (life) {
|
||||
if (posy < (480 << 16)) {
|
||||
dstIdx = ct * 3 * 3;
|
||||
c = 0xffafcf | ((life >> lifeShift) << 24);
|
||||
|
||||
* (int* )(vertPtr) = c; //storeEnvU32(con, 1, dstIdx, c);
|
||||
* (int* )(vertPtr + 4) = posx; //storeEnvI32(con, 1, dstIdx + 1, posx);
|
||||
* (int* )(vertPtr + 8) = posy; //storeEnvI32(con, 1, dstIdx + 2, posy);
|
||||
storeU32(con, 1, dstIdx, c);
|
||||
storeI32(con, 1, dstIdx + 1, posx);
|
||||
storeI32(con, 1, dstIdx + 2, posy);
|
||||
|
||||
* (int* )(vertPtr + 12) = c; //storeEnvU32(con, 1, dstIdx + 3, c);
|
||||
* (int* )(vertPtr + 16) = posx + 0x10000; //storeEnvI32(con, 1, dstIdx + 4, posx + 0x10000);
|
||||
* (int* )(vertPtr + 20) = posy + dy * 4; //storeEnvI32(con, 1, dstIdx + 5, posy);
|
||||
storeU32(con, 1, dstIdx + 3, c);
|
||||
storeI32(con, 1, dstIdx + 4, posx + 0x10000);
|
||||
storeI32(con, 1, dstIdx + 5, posy + dy * 4);
|
||||
|
||||
* (int* )(vertPtr + 24) = c; //storeEnvU32(con, 1, dstIdx + 6, c);
|
||||
* (int* )(vertPtr + 28) = posx - 0x10000; //storeEnvI32(con, 1, dstIdx + 7, posx + 0x0800);
|
||||
* (int* )(vertPtr + 32) = posy + dy * 4; //storeEnvI32(con, 1, dstIdx + 8, posy + 0x10000);
|
||||
storeU32(con, 1, dstIdx + 6, c);
|
||||
storeI32(con, 1, dstIdx + 7, posx - 0x10000);
|
||||
storeI32(con, 1, dstIdx + 8, posy + dy * 4);
|
||||
|
||||
vertPtr = vertPtr + 36;
|
||||
drawCount ++;
|
||||
@@ -97,14 +93,12 @@ main(con, ft, launchID) {
|
||||
dy = dy + 0x400;
|
||||
life --;
|
||||
|
||||
* (int* )(partPtr + 0) = dx; //storeEnvI32(con, 2, srcIdx, dx);
|
||||
* (int* )(partPtr + 4) = dy; //storeEnvI32(con, 2, srcIdx + 1, dy);
|
||||
* (int* )(partPtr + 8) = life; //storeEnvI32(con, 2, srcIdx + 2, life);
|
||||
* (int* )(partPtr + 12) = posx; //storeEnvI32(con, 2, srcIdx + 3, posx);
|
||||
* (int* )(partPtr + 16) = posy; //storeEnvI32(con, 2, srcIdx + 4, posy);
|
||||
//storeI32(con, 2, srcIdx, dx);
|
||||
storeI32(con, 2, srcIdx + 1, dy);
|
||||
storeI32(con, 2, srcIdx + 2, life);
|
||||
storeI32(con, 2, srcIdx + 3, posx);
|
||||
storeI32(con, 2, srcIdx + 4, posy);
|
||||
}
|
||||
|
||||
partPtr = partPtr + 20;
|
||||
}
|
||||
|
||||
drawTriangleArray(con, loadI32(con, 0, 5), drawCount);
|
||||
|
||||
Reference in New Issue
Block a user