Originally Posted by
Delinquent
It's nice to see your always releasing useful things and pay attention to small details.
Appreciate Seven.
Thanks man appreciate it.
Originally Posted by
Devo
Thank you so much for this, will definitely come in handy.
You're welcome
Originally Posted by
leen12
Awesome Seven nice work thanks for the release this will come in very useful to the community
Thanks, you're welcome.
Originally Posted by
mige5
Cache sprite doesn't have anything to do with drawing the outline of sprites, iirc.
This method in Sprite class does that.
Code:
private void method349(int ai[], int ai1[], int j, int k, int l, int i1, int j1, int k1) {
int i;// was parameter
int l1 = -(l >> 2);
l = -(l & 3);
for (int i2 = -i1; i2 < 0; i2++) {
for (int j2 = l1; j2 < 0; j2++) {
i = ai1[j++];
if (i != 0 && i != -1) {
ai[k++] = i;
} else {
k++;
}
i = ai1[j++];
if (i != 0 && i != -1) {
ai[k++] = i;
} else {
k++;
}
i = ai1[j++];
if (i != 0 && i != -1) {
ai[k++] = i;
} else {
k++;
}
i = ai1[j++];
if (i != 0 && i != -1) {
ai[k++] = i;
} else {
k++;
}
}
for (int k2 = l; k2 < 0; k2++) {
i = ai1[j++];
if (i != 0 && i != -1) {
ai[k++] = i;
} else {
k++;
}
}
k += j1;
j += k1;
}
}
Refactored version
Code:
private void draw(int raster[], int[] image, int colour, int sourceIndex, int destIndex, int width, int height, int destStep,
int sourceStep) {
int minX = -(width >> 2);
width = -(width & 3);
for (int y = -height; y < 0; y++) {
for (int x = minX; x < 0; x++) {
colour = image[sourceIndex++];
if (colour != 0) {
raster[destIndex++] = colour;
} else {
destIndex++;
}
colour = image[sourceIndex++];
if (colour != 0) {
raster[destIndex++] = colour;
} else {
destIndex++;
}
colour = image[sourceIndex++];
if (colour != 0) {
raster[destIndex++] = colour;
} else {
destIndex++;
}
colour = image[sourceIndex++];
if (colour != 0) {
raster[destIndex++] = colour;
} else {
destIndex++;
}
}
for (int k2 = width; k2 < 0; k2++) {
colour = image[sourceIndex++];
if (colour != 0) {
raster[destIndex++] = colour;
} else {
destIndex++;
}
}
destIndex += destStep;
sourceIndex += sourceStep;
}
}
Just make sure when you're loading your cache sprites that method above is being called correctly.