words per minute
28
ThxXth
00:00
Speed
#include "includes.h"
// The rotator.
void Rotator(void)
{
u32 ix, iy;
u16 px, py, px2, py2, incx, incy;
u32 nMultiplier;
u8 *pScr;
SDL_LockSurface(gVar.pScreen);
// Incréments (rotation seule).
//incx = gVar.pCos[gVar.nRotoAngle];
//incy = gVar.pSin[gVar.nRotoAngle];
// Incréments (rotation et zoom).
nMultiplier = 0x08000 + ((0x0100 + gVar.pCos[(gVar.nRotoAngle + 128) & 0xFF]) << 9);
incx = (gVar.pCos[gVar.nRotoAngle] * nMultiplier) >> 16;
incy = (gVar.pSin[gVar.nRotoAngle] * nMultiplier) >> 16;
// Point de départ.
// x' = x cos f - y sin f
// y' = y cos f + x sin f
px = (128 << 8) - ((SCR_Width / 2) * incx - (SCR_Height/ 2) * incy);
py = (128 << 8) - ((SCR_Height/ 2) * incx + (SCR_Width / 2) * incy);
// Loop.
pScr = (u8 *)gVar.pScreen->pixels;
for (iy = 0; iy < SCR_Height; iy++)
{
px2 = px;
py2 = py;
for (ix = 0; ix < SCR_Width; ix++)
{
//*((u8 *)gVar.pScreen->pixels + (iy * SCR_Width) + ix) =
// *((u8 *)gVar.pPicture->pixels + ((py2 >> 8) << 8) + (px2 >> 8));
*pScr++ = *((u8 *)gVar.pPicture->pixels + ((py2 >> 8) << 8) + (px2 >> 8));
px2 += incx;
py2 += incy;
}
// incx++; // Déformation.
px -= incy;
py += incx;
}
gVar.nRotoAngle += 1;
SDL_UnlockSurface(gVar.pScreen);
}