![Smile :-)](./images/smilies/grayscale_smile.gif)
I hope I've fixed the screen-scrambling issue calc84maniac pointed out. I have also enlarged the level somewhat:
![Image](http://benryves.com/images/nostromo/bsp/2010.11.07/Overview-01.gif)
![Image](http://benryves.com/images/nostromo/bsp/2010.11.07/Overview-02.gif)
![Image](http://benryves.com/images/nostromo/bsp/2010.11.07/Overview-03.gif)
![Image](http://benryves.com/images/nostromo/bsp/2010.11.07/Overview-04.gif)
![Image](http://benryves.com/images/nostromo/bsp/2010.11.07/Overview-05.gif)
![Image](http://benryves.com/images/nostromo/bsp/2010.11.07/Overview-06.gif)
Moderator: benryves
sweet, i'll have to try it out later tonight to see if you were succesful!benryves wrote:I hope I've fixed the screen-scrambling issue calc84maniac pointed out. I have also enlarged the level somewhat:
Code: Select all
// Wall sprite scaling demo.
()
// Clear the screen.
cls(0x6495ED);
// Get source width and height.
src_w = 0, src_h = 0;
getpicsiz(&src_w,&src_h);
// Set destination width.
dest_w = 2 * abs(mousx - xres / 2);
// Set the destination heights.
dest_h_a = 2 * abs(mousy - yres / 2);
dest_h_b = dest_w;
if (mousx > xres / 2) {
s = dest_h_a; dest_h_a = dest_h_b; dest_h_b = s;
}
// Get height deltas.
dest_h_delta = dest_h_b - dest_h_a;
if (dest_h_delta > 0) {
dest_h_inc = +1;
} else {
dest_h_delta = -dest_h_delta;
dest_h_inc = -1;
}
// Initialise X counters.
read_x = 0;
error_x = dest_w;
// Initialise height counters.
dest_h = dest_h_a;
error_h = dest_w;
for(x = 0; x < dest_w; x++) {
// Initialise Y counters.
read_y = 0;
error_y = dest_h;
for (y = 0; y < dest_h; y++) {
// Sample the source pixel.
r = 0, g = 0, b = 0;
pic(read_x, read_y, &r, &g, &b);
// Plot the destination pixel.
setcol(&r, &g, &b);
setpix(x - dest_w / 2 + xres / 2, ceil(y - dest_h / 2 + yres / 2));
// Advance read pointer if required.
error_y -= src_h;
while (error_y < 0) {
read_y++;
error_y += dest_h;
}
}
// Advance read pointer if required.
error_x -= src_w;
while (error_x < 0) {
read_x++;
error_x += dest_w;
}
// Advance height if required.
error_h -= dest_h_delta;
while (error_h < 0) {
dest_h += dest_h_inc;
error_h += dest_w;
}
}
Hey, I still log in from time to time to see activity. Now I tend to visit Revsoft and Maxcoderz.benryves wrote:Heh, cheers. Someone has to log in to delete the spam bot accounts, after all.