[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/video sprite.c
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus/src/video sprite.c |
Date: |
Sat, 27 Sep 2003 21:52:08 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/09/27 21:52:07
Modified files:
src/video : sprite.c
Log message:
Cleanup
Patches:
Index: stratagus/src/video/sprite.c
diff -u stratagus/src/video/sprite.c:1.35 stratagus/src/video/sprite.c:1.36
--- stratagus/src/video/sprite.c:1.35 Fri Jul 11 10:35:34 2003
+++ stratagus/src/video/sprite.c Sat Sep 27 21:52:07 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sprite.c,v 1.35 2003/07/11 14:35:34 n0body Exp $
+// $Id: sprite.c,v 1.36 2003/09/28 01:52:07 jsalmon3 Exp $
//@{
@@ -54,10 +54,8 @@
local GraphicType GraphicSprite8Type; /// sprite type 8bit palette
local GraphicType GraphicSprite16Type; /// sprite type 16bit palette
-global void (*VideoDrawRawClip)( VMemType *pixels,
- const unsigned char *data,
- int x, int y,
- int w, int h );
+global void (*VideoDrawRawClip)(VMemType *pixels, const unsigned char *data,
+ int x, int y, int w, int h);
/*----------------------------------------------------------------------------
-- Local functions
@@ -99,7 +97,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-#define RLE_BLIT(bpp,sprite,frame,x,y) \
+#define RLE_BLIT(bpp, sprite, frame, x, y) \
do { \
const unsigned char* sp; \
unsigned w; \
@@ -110,29 +108,29 @@
const VMemType##bpp* pp; \
unsigned da; \
\
- pixels=(VMemType##bpp*)sprite->Pixels; \
- sp=((unsigned char**)sprite->Frames)[frame]; \
- w=sprite->Width; \
- da=VideoWidth-w; \
- dp=VideoMemory##bpp+x+y*VideoWidth; \
- ep=dp+VideoWidth*sprite->Height; \
+ pixels = (VMemType##bpp*)sprite->Pixels; \
+ sp = ((unsigned char**)sprite->Frames)[frame]; \
+ w = sprite->Width; \
+ da = VideoWidth-w; \
+ dp = VideoMemory##bpp + x + y * VideoWidth; \
+ ep = dp + VideoWidth * sprite->Height; \
\
do { \
- lp=dp+w; \
+ lp = dp + w; \
do { /* 1 line */ \
- dp+=*sp++; /* transparent # */ \
- pp=dp-1+*sp++; /* opaque # */ \
- while( dp<pp ) { /* unrolled */ \
- *dp++=pixels[*sp++]; \
- *dp++=pixels[*sp++]; \
+ dp += *sp++; /* transparent # */ \
+ pp = dp - 1 + *sp++; /* opaque # */ \
+ while (dp < pp) { /* unrolled */ \
+ *dp++ = pixels[*sp++]; \
+ *dp++ = pixels[*sp++]; \
} \
- if( dp<=pp ) { \
- *dp++=pixels[*sp++]; \
+ if (dp <= pp) { \
+ *dp++ = pixels[*sp++]; \
} \
- } while( dp<lp ); \
- dp+=da; \
- } while( dp<ep ); /* all lines */ \
- } while( 0 )
+ } while (dp < lp); \
+ dp += da; \
+ } while (dp < ep); /* all lines */ \
+ } while (0)
/**
** Draw 8bit graphic object unclipped into 8 bit framebuffer.
@@ -142,9 +140,9 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to8(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to8(const Graphic* sprite, unsigned frame, int x, int y)
{
- RLE_BLIT(8,sprite,frame,x,y);
+ RLE_BLIT(8, sprite, frame, x, y);
}
/**
@@ -155,9 +153,9 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to16(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to16(const Graphic* sprite, unsigned frame, int x, int y)
{
- RLE_BLIT(16,sprite,frame,x,y);
+ RLE_BLIT(16, sprite, frame, x, y);
}
/**
@@ -168,9 +166,9 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to24(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to24(const Graphic* sprite, unsigned frame, int x, int y)
{
- RLE_BLIT(24,sprite,frame,x,y);
+ RLE_BLIT(24, sprite, frame, x, y);
}
/**
@@ -181,9 +179,9 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to32(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to32(const Graphic* sprite, unsigned frame, int x, int y)
{
- RLE_BLIT(32,sprite,frame,x,y);
+ RLE_BLIT(32, sprite, frame, x, y);
}
/**
@@ -195,24 +193,27 @@
** @param y y coordinate on the screen
*/
#ifdef USE_OPENGL
-local void VideoDrawOpenGL(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDrawOpenGL(const Graphic* sprite, unsigned frame, int x, int y)
{
- GLint sx,ex,sy,ey;
-
- sx=x;
- ex=sx+sprite->Width;
- ey=VideoHeight-y;
- sy=ey-sprite->Height;
+ GLint sx;
+ GLint ex;
+ GLint sy;
+ GLint ey;
+
+ sx = x;
+ ex = sx + sprite->Width;
+ ey = VideoHeight - y;
+ sy = ey - sprite->Height;
glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]);
glBegin(GL_QUADS);
- glTexCoord2f(0.0f, 1.0f-sprite->TextureHeight);
+ glTexCoord2f(0.0f, 1.0f - sprite->TextureHeight);
glVertex2i(sx, sy);
glTexCoord2f(0.0f, 1.0f);
glVertex2i(sx, ey);
glTexCoord2f(sprite->TextureWidth, 1.0f);
glVertex2i(ex, ey);
- glTexCoord2f(sprite->TextureWidth, 1.0f-sprite->TextureHeight);
+ glTexCoord2f(sprite->TextureWidth, 1.0f - sprite->TextureHeight);
glVertex2i(ex, sy);
glEnd();
}
@@ -227,7 +228,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to8X(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to8X(const Graphic* sprite, unsigned frame, int x, int y)
{
const unsigned char* sp;
unsigned w;
@@ -238,27 +239,27 @@
const VMemType8* pixels;
unsigned da;
- pixels=(VMemType8*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
- w=sprite->Width;
- dp=VideoMemory8+x+y*VideoWidth+w-1;
- da=VideoWidth+w;
- ep=dp+VideoWidth*sprite->Height;
+ pixels = (VMemType8*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
+ w = sprite->Width;
+ dp = VideoMemory8 + x + y * VideoWidth + w - 1;
+ da = VideoWidth + w;
+ ep = dp + VideoWidth * sprite->Height;
do {
- lp=dp-w;
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) { // unrolled
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
- }
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
- }
- } while( dp>lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) { // unrolled
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
+ }
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
+ }
+ } while (dp > lp);
+ dp += da;
+ } while (dp < ep); // all lines
}
/**
@@ -270,7 +271,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to16X(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to16X(const Graphic* sprite, unsigned frame, int x, int y)
{
const unsigned char* sp;
unsigned w;
@@ -281,28 +282,28 @@
const VMemType16* pixels;
unsigned da;
- pixels=(VMemType16*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
- w=sprite->Width;
- dp=VideoMemory16+x+y*VideoWidth+w-1;
- da=VideoWidth+w;
- ep=dp+VideoWidth*sprite->Height;
+ pixels = (VMemType16*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
+ w = sprite->Width;
+ dp = VideoMemory16 + x + y * VideoWidth + w - 1;
+ da = VideoWidth + w;
+ ep = dp + VideoWidth * sprite->Height;
do {
- lp=dp-w;
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) { // unrolled
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
- }
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
- }
- } while( dp>lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) { // unrolled
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
+ }
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
+ }
+ } while (dp > lp);
+ dp += da;
+ } while (dp < ep); // all lines
}
/**
@@ -314,7 +315,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to24X(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to24X(const Graphic* sprite, unsigned frame, int x, int y)
{
const unsigned char* sp;
unsigned w;
@@ -325,28 +326,28 @@
const VMemType24* pixels;
unsigned da;
- pixels=(VMemType24*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
- w=sprite->Width;
- dp=VideoMemory24+x+y*VideoWidth+w-1;
- da=VideoWidth+w;
- ep=dp+VideoWidth*sprite->Height;
+ pixels = (VMemType24*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
+ w = sprite->Width;
+ dp = VideoMemory24 + x + y * VideoWidth + w - 1;
+ da = VideoWidth + w;
+ ep = dp + VideoWidth * sprite->Height;
do {
- lp=dp-w;
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) { // unrolled
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
- }
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
- }
- } while( dp>lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) { // unrolled
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
+ }
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
+ }
+ } while (dp > lp);
+ dp += da;
+ } while (dp < ep); // all lines
}
/**
@@ -358,7 +359,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to32X(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to32X(const Graphic* sprite, unsigned frame, int x, int y)
{
const unsigned char* sp;
unsigned w;
@@ -369,28 +370,28 @@
const VMemType32* pixels;
unsigned da;
- pixels=(VMemType32*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
- w=sprite->Width;
- dp=VideoMemory32+x+y*VideoWidth+w-1;
- da=VideoWidth+w;
- ep=dp+VideoWidth*sprite->Height;
+ pixels = (VMemType32*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
+ w = sprite->Width;
+ dp = VideoMemory32 + x + y * VideoWidth + w - 1;
+ da = VideoWidth + w;
+ ep = dp + VideoWidth * sprite->Height;
do {
- lp=dp-w;
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) { // unrolled
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
- }
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
- }
- } while( dp>lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) { // unrolled
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
+ }
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
+ }
+ } while (dp > lp);
+ dp += da;
+ } while (dp < ep); // all lines
}
/**
@@ -402,24 +403,27 @@
** @param y y coordinate on the screen
*/
#ifdef USE_OPENGL
-local void VideoDrawXOpenGL(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDrawXOpenGL(const Graphic* sprite, unsigned frame, int x, int
y)
{
- GLint sx,ex,sy,ey;
-
- sx=x;
- ex=sx+sprite->Width;
- ey=VideoHeight-y;
- sy=ey-sprite->Height;
+ GLint sx;
+ GLint ex;
+ GLint sy;
+ GLint ey;
+
+ sx = x;
+ ex = sx + sprite->Width;
+ ey = VideoHeight - y;
+ sy = ey - sprite->Height;
glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]);
glBegin(GL_QUADS);
- glTexCoord2f(0.0f, 1.0f-sprite->TextureHeight);
+ glTexCoord2f(0.0f, 1.0f - sprite->TextureHeight);
glVertex2i(sx, sy);
glTexCoord2f(0.0f, 1.0f);
glVertex2i(sx, ey);
glTexCoord2f(sprite->TextureWidth, 1.0f);
glVertex2i(ex, ey);
- glTexCoord2f(sprite->TextureWidth, 1.0f-sprite->TextureHeight);
+ glTexCoord2f(sprite->TextureWidth, 1.0f - sprite->TextureHeight);
glVertex2i(ex, sy);
glEnd();
}
@@ -433,7 +437,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to8Clip(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to8Clip(const Graphic* sprite, unsigned frame, int x, int
y)
{
int ox;
int ex;
@@ -453,111 +457,111 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType8*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType8*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory8+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory8 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- *dp++=pixels[*sp++];
- *dp++=pixels[*sp++];
- }
- if( dp<=pp ) {
- *dp++=pixels[*sp++];
- }
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ *dp++ = pixels[*sp++];
+ *dp++ = pixels[*sp++];
+ }
+ if (dp <= pp) {
+ *dp++ = pixels[*sp++];
+ }
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- *dp++=pixels[*sp++];
+ if (pp < lp) {
+ while (dp < pp) {
+ *dp++ = pixels[*sp++];
}
continue;
}
- while( dp<lp ) {
- *dp++=pixels[*sp++];
+ while (dp < lp) {
+ *dp++ = pixels[*sp++];
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -570,7 +574,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to16Clip(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to16Clip(const Graphic* sprite, unsigned frame, int x,
int y)
{
int ox;
int ex;
@@ -589,111 +593,111 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType16*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType16*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory16+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory16 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- *dp++=pixels[*sp++];
- *dp++=pixels[*sp++];
- }
- if( dp<=pp ) {
- *dp++=pixels[*sp++];
- }
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ *dp++ = pixels[*sp++];
+ *dp++ = pixels[*sp++];
+ }
+ if (dp <= pp) {
+ *dp++ = pixels[*sp++];
+ }
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- *dp++=pixels[*sp++];
+ if (pp < lp) {
+ while (dp < pp) {
+ *dp++ = pixels[*sp++];
}
continue;
}
- while( dp<lp ) {
- *dp++=pixels[*sp++];
+ while (dp < lp) {
+ *dp++ = pixels[*sp++];
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -706,7 +710,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to24Clip(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to24Clip(const Graphic* sprite, unsigned frame, int x,
int y)
{
int ox;
int ex;
@@ -725,111 +729,111 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType24*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType24*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory24+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory24 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- *dp++=pixels[*sp++];
- *dp++=pixels[*sp++];
- }
- if( dp<=pp ) {
- *dp++=pixels[*sp++];
- }
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ *dp++ = pixels[*sp++];
+ *dp++ = pixels[*sp++];
+ }
+ if (dp <= pp) {
+ *dp++ = pixels[*sp++];
+ }
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- *dp++=pixels[*sp++];
+ if (pp < lp) {
+ while (dp < pp) {
+ *dp++ = pixels[*sp++];
}
continue;
}
- while( dp<lp ) {
- *dp++=pixels[*sp++];
+ while (dp < lp) {
+ *dp++ = pixels[*sp++];
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -842,7 +846,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to32Clip(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to32Clip(const Graphic* sprite, unsigned frame, int x,
int y)
{
int ox;
int ex;
@@ -861,111 +865,111 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType32*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType32*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory32+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory32 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- *dp++=pixels[*sp++];
- *dp++=pixels[*sp++];
- }
- if( dp<=pp ) {
- *dp++=pixels[*sp++];
- }
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ *dp++ = pixels[*sp++];
+ *dp++ = pixels[*sp++];
+ }
+ if (dp <= pp) {
+ *dp++ = pixels[*sp++];
+ }
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- *dp++=pixels[*sp++];
+ if (pp < lp) {
+ while (dp < pp) {
+ *dp++ = pixels[*sp++];
}
continue;
}
- while( dp<lp ) {
- *dp++=pixels[*sp++];
+ while (dp < lp) {
+ *dp++ = pixels[*sp++];
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -979,29 +983,35 @@
** @param y y coordinate on the screen
*/
#ifdef USE_OPENGL
-local void VideoDrawClipOpenGL(const Graphic* sprite,unsigned frame,int x,int
y)
+local void VideoDrawClipOpenGL(const Graphic* sprite, unsigned frame, int x,
int y)
{
- GLint svx,evx,svy,evy;
- GLfloat stx,etx,sty,ety;
+ GLint svx;
+ GLint evx;
+ GLint svy;
+ GLint evy;
+ GLfloat stx;
+ GLfloat etx;
+ GLfloat sty;
+ GLfloat ety;
int ox;
int oy;
int ex;
int w;
int h;
- w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
-
- svx=x;
- evx=svx+w;
- evy=VideoHeight-y;
- svy=evy-h;
-
- stx=(GLfloat)ox/sprite->Width*sprite->TextureWidth;
- etx=(GLfloat)(ox+w)/sprite->Width*sprite->TextureWidth;
- ety=1.0f-(GLfloat)oy/sprite->Height*sprite->TextureHeight;
- sty=1.0f-(GLfloat)(oy+h)/sprite->Height*sprite->TextureHeight;
+ w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
+
+ svx = x;
+ evx = svx + w;
+ evy = VideoHeight - y;
+ svy = evy - h;
+
+ stx = (GLfloat)ox / sprite->Width * sprite->TextureWidth;
+ etx = (GLfloat)(ox + w) / sprite->Width * sprite->TextureWidth;
+ ety = 1.0f - (GLfloat)oy / sprite->Height * sprite->TextureHeight;
+ sty = 1.0f - (GLfloat)(oy + h) / sprite->Height * sprite->TextureHeight;
glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]);
glBegin(GL_QUADS);
@@ -1026,7 +1036,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to8ClipX(const Graphic* sprite,unsigned frame,int x,int y)
+local void VideoDraw8to8ClipX(const Graphic* sprite, unsigned frame, int x,
int y)
{
int ox;
int ex;
@@ -1045,110 +1055,110 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType8*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType8*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth+sw;
- dp=VideoMemory8+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
+ da = VideoWidth + sw;
+ dp = VideoMemory8 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
}
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=sw-w-ox;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= sw - w - ox;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+sw-w-ox;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + sw - w - ox;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- *dp--=pixels[*sp++];
+ if (pp > lp) {
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
}
continue;
}
- while( dp>lp ) {
- *dp--=pixels[*sp++];
+ while (dp > lp) {
+ *dp-- = pixels[*sp++];
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -1163,8 +1173,8 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to16ClipX(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDraw8to16ClipX(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
int ox;
int ex;
@@ -1184,110 +1194,110 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType16*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType16*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth+sw;
- dp=VideoMemory16+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
+ da = VideoWidth + sw;
+ dp = VideoMemory16 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
}
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=sw-w-ox;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= sw - w - ox;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+sw-w-ox;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + sw - w - ox;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- *dp--=pixels[*sp++];
+ if (pp > lp) {
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
}
continue;
}
- while( dp>lp ) {
- *dp--=pixels[*sp++];
+ while (dp > lp) {
+ *dp-- = pixels[*sp++];
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -1302,8 +1312,8 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to24ClipX(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDraw8to24ClipX(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
int ox;
int ex;
@@ -1322,110 +1332,110 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType24*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType24*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth+sw;
- dp=VideoMemory24+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
+ da = VideoWidth + sw;
+ dp = VideoMemory24 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
}
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=sw-w-ox;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= sw - w - ox;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+sw-w-ox;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + sw - w - ox;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- *dp--=pixels[*sp++];
+ if (pp > lp) {
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
}
continue;
}
- while( dp>lp ) {
- *dp--=pixels[*sp++];
+ while (dp > lp) {
+ *dp-- = pixels[*sp++];
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -1440,8 +1450,8 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to32ClipX(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDraw8to32ClipX(const Graphic* sprite, unsigned frame
+ , int x, int y)
{
int ex;
int ox;
@@ -1460,110 +1470,110 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType32*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType32*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth+sw;
- dp=VideoMemory32+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
+ da = VideoWidth + sw;
+ dp = VideoMemory32 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
}
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=ex;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= ex;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+ex;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + ex;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- *dp--=pixels[*sp++];
+ if (pp > lp) {
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
}
continue;
}
- while( dp>lp ) {
- *dp--=pixels[*sp++];
+ while (dp > lp) {
+ *dp-- = pixels[*sp++];
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -1578,37 +1588,43 @@
** @param y y coordinate on the screen
*/
#ifdef USE_OPENGL
-local void VideoDrawClipXOpenGL(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDrawClipXOpenGL(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
- GLint svx,evx,svy,evy;
- GLfloat stx,etx,sty,ety;
+ GLint svx;
+ GLint evx;
+ GLint svy;
+ GLint evy;
+ GLfloat stx;
+ GLfloat etx;
+ GLfloat sty;
+ GLfloat ety;
int ox;
int oy;
int ex;
int w;
int h;
- w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
-
- svx=x;
- evx=svx+w;
- evy=VideoHeight-y;
- svy=evy-h;
-
- if( w<sprite->Width ) {
- if( ox==0 ) {
- ox += sprite->Width-w;
+ w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
+
+ svx = x;
+ evx = svx + w;
+ evy = VideoHeight - y;
+ svy = evy - h;
+
+ if (w < sprite->Width) {
+ if (ox == 0) {
+ ox += sprite->Width - w;
} else {
ox = 0;
}
}
- stx=(GLfloat)ox/sprite->Width*sprite->TextureWidth;
- etx=(GLfloat)(ox+w)/sprite->Width*sprite->TextureWidth;
- ety=1.0f-(GLfloat)oy/sprite->Height*sprite->TextureHeight;
- sty=1.0f-(GLfloat)(oy+h)/sprite->Height*sprite->TextureHeight;
+ stx = (GLfloat)ox / sprite->Width * sprite->TextureWidth;
+ etx = (GLfloat)(ox + w) / sprite->Width * sprite->TextureWidth;
+ ety = 1.0f - (GLfloat)oy / sprite->Height * sprite->TextureHeight;
+ sty = 1.0f - (GLfloat)(oy + h) / sprite->Height * sprite->TextureHeight;
glBindTexture(GL_TEXTURE_2D, sprite->TextureNames[frame]);
glBegin(GL_QUADS);
@@ -1632,7 +1648,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to8ShadowClip(const Graphic* sprite,unsigned frame,int
x,int y)
+local void VideoDraw8to8ShadowClip(const Graphic* sprite, unsigned frame, int
x, int y)
{
int ox;
int ex;
@@ -1651,121 +1667,121 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType8*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType8*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory8+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory8 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- *dp=lookup50trans8[(Pixels8[ColorBlack]>>8)|*dp];
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ *dp = lookup50trans8[(Pixels8[ColorBlack] >> 8) | *dp];
++dp;
++sp;
- *dp=lookup50trans8[(Pixels8[ColorBlack]>>8)|*dp];
+ *dp = lookup50trans8[(Pixels8[ColorBlack] >> 8) | *dp];
++dp;
++sp;
}
- if( dp<=pp ) {
- *dp=lookup50trans8[(Pixels8[ColorBlack]>>8)|*dp];
+ if (dp <= pp) {
+ *dp = lookup50trans8[(Pixels8[ColorBlack] >> 8) | *dp];
++dp;
++sp;
}
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- *dp=lookup50trans8[(Pixels8[ColorBlack]>>8)|*dp];
+ if (pp < lp) {
+ while (dp < pp) {
+ *dp = lookup50trans8[(Pixels8[ColorBlack] >> 8) | *dp];
++dp;
++sp;
}
continue;
}
- while( dp<lp ) {
- *dp=lookup50trans8[(Pixels8[ColorBlack]>>8)|*dp];
+ while (dp < lp) {
+ *dp = lookup50trans8[(Pixels8[ColorBlack] >> 8) | *dp];
++dp;
++sp;
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -1778,7 +1794,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to16ShadowClip(const Graphic* sprite,unsigned frame,int
x,int y)
+local void VideoDraw8to16ShadowClip(const Graphic* sprite, unsigned frame, int
x, int y)
{
int ox;
int ex;
@@ -1799,132 +1815,132 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType16*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType16*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory16+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory16 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( VideoBpp==15 ) {
- mask=0x03E07C1F;
+ if (VideoBpp == 15) {
+ mask = 0x03E07C1F;
} else {
- mask=0x07E0F81F;
+ mask = 0x07E0F81F;
}
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp++=(dp1>>16)|dp1;
- ++sp;
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp++=(dp1>>16)|dp1;
- ++sp;
- }
- if( dp<=pp ) {
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp++=(dp1>>16)|dp1;
- ++sp;
- }
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp++ = (dp1 >> 16) | dp1;
+ ++sp;
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp++ = (dp1 >> 16) | dp1;
+ ++sp;
+ }
+ if (dp <= pp) {
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp++ = (dp1 >> 16) | dp1;
+ ++sp;
+ }
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp++=(dp1>>16)|dp1;
+ if (pp < lp) {
+ while (dp < pp) {
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp++ = (dp1 >> 16) | dp1;
++sp;
}
continue;
}
- while( dp<lp ) {
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp++=(dp1>>16)|dp1;
+ while (dp < lp) {
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp++ = (dp1 >> 16) | dp1;
++sp;
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -1937,7 +1953,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to24ShadowClip(const Graphic* sprite,unsigned frame,int
x,int y)
+local void VideoDraw8to24ShadowClip(const Graphic* sprite, unsigned frame, int
x, int y)
{
int ox;
int ex;
@@ -1956,111 +1972,111 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType24*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType24*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory24+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory24 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- *dp++=pixels[*sp++];
- *dp++=pixels[*sp++];
- }
- if( dp<=pp ) {
- *dp++=pixels[*sp++];
- }
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ *dp++ = pixels[*sp++];
+ *dp++ = pixels[*sp++];
+ }
+ if (dp <= pp) {
+ *dp++ = pixels[*sp++];
+ }
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- *dp++=pixels[*sp++];
+ if (pp < lp) {
+ while (dp < pp) {
+ *dp++ = pixels[*sp++];
}
continue;
}
- while( dp<lp ) {
- *dp++=pixels[*sp++];
+ while (dp < lp) {
+ *dp++ = pixels[*sp++];
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -2073,7 +2089,7 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to32ShadowClip(const Graphic* sprite,unsigned frame,int
x,int y)
+local void VideoDraw8to32ShadowClip(const Graphic* sprite, unsigned frame, int
x, int y)
{
int ox;
int ex;
@@ -2094,141 +2110,141 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType32*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType32*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines, if needed.
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth-sw;
- dp=VideoMemory32+x+y*VideoWidth;
- ep=dp+VideoWidth*h;
+ da = VideoWidth - sw;
+ dp = VideoMemory32 + x + y * VideoWidth;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
do {
- lp=dp+sw;
+ lp = dp + sw;
do { // 1 line
- dp+=*sp++; // transparent
- pp=dp-1+*sp++; // opaque
- while( dp<pp ) { // unroll
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp++=(dp1|(dp2<<8));
- ++sp;
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp++=(dp1|(dp2<<8));
- ++sp;
- }
- if( dp<=pp ) {
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp++=(dp1|(dp2<<8));
- ++sp;
- }
- } while( dp<lp );
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += *sp++; // transparent
+ pp = dp - 1 + *sp++; // opaque
+ while (dp < pp) { // unroll
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp++ = (dp1 | (dp2 << 8));
+ ++sp;
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp++ = (dp1 | (dp2 << 8));
+ ++sp;
+ }
+ if (dp <= pp) {
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp++ = (dp1 | (dp2 << 8));
+ ++sp;
+ }
+ } while (dp < lp);
+ dp += da;
+ } while (dp < ep); // all lines
} else { // Clip horizontal
- da+=ox;
+ da += ox;
do {
- lp=dp+w;
+ lp = dp + w;
//
// Clip left
//
- pp=dp-ox;
- for( ;; ) {
- pp+=*sp++; // transparent
- if( pp>=dp ) {
- dp=pp;
+ pp = dp - ox;
+ for (;;) {
+ pp += *sp++; // transparent
+ if (pp >= dp) {
+ dp = pp;
goto middle_trans;
}
- pp+=*sp; // opaque
- if( pp>=dp ) {
- sp+=*sp-(pp-dp)+1;
+ pp += *sp; // opaque
+ if (pp >= dp) {
+ sp += *sp - (pp - dp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp+=*sp++; // transparent
+ for (;;) {
+ dp += *sp++; // transparent
middle_trans:
- if( dp>=lp ) {
- lp+=sw-w-ox;
+ if (dp >= lp) {
+ lp += sw - w - ox;
goto right_trans;
}
- pp=dp+*sp++; // opaque
+ pp = dp + *sp++; // opaque
middle_pixel:
- if( pp<lp ) {
- while( dp<pp ) {
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp++=(dp1|(dp2<<8));
+ if (pp < lp) {
+ while (dp < pp) {
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp++ = (dp1 | (dp2 << 8));
++sp;
}
continue;
}
- while( dp<lp ) {
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp++=(dp1|(dp2<<8));
+ while (dp < lp) {
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp++ = (dp1 | (dp2 << 8));
++sp;
}
- sp+=pp-dp;
- dp=pp;
+ sp += pp - dp;
+ dp = pp;
break;
}
//
// Clip right
//
- lp+=sw-w-ox;
- while( dp<lp ) {
- dp+=*sp++; // transparent
+ lp += sw - w - ox;
+ while (dp < lp) {
+ dp += *sp++; // transparent
right_trans:
- dp+=*sp; // opaque
- sp+=*sp+1;
+ dp += *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
- } while( dp<ep ); // all lines
+ dp += da;
+ } while (dp < ep); // all lines
}
}
@@ -2242,8 +2258,8 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to8ShadowClipX(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDraw8to8ShadowClipX(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
int ex;
int ox;
@@ -2262,119 +2278,119 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType8*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType8*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
- }
-
- da=VideoWidth+sw;
- dp=VideoMemory8+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
-
- if( w==sw ) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
+ }
+
+ da = VideoWidth + sw;
+ dp = VideoMemory8 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
+
+ if (w == sw) { // Unclipped horizontal
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- *dp=lookup50trans8[(Pixels8[ColorBlack]<<8)|*dp];
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ *dp = lookup50trans8[(Pixels8[ColorBlack] << 8) | *dp];
--dp;
++sp;
- *dp=lookup50trans8[(Pixels8[ColorBlack]<<8)|*dp];
+ *dp = lookup50trans8[(Pixels8[ColorBlack] << 8) | *dp];
--dp;
++sp;
}
- if( dp>=pp ) {
- *dp=lookup50trans8[(Pixels8[ColorBlack]<<8)|*dp];
+ if (dp >= pp) {
+ *dp = lookup50trans8[(Pixels8[ColorBlack] << 8) | *dp];
--dp;
++sp;
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=sw-w-ox;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= sw - w - ox;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+sw-w-ox;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + sw - w - ox;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- *dp=lookup50trans8[(Pixels8[ColorBlack]<<8)|*dp];
+ if (pp > lp) {
+ while (dp > pp) {
+ *dp = lookup50trans8[(Pixels8[ColorBlack] << 8) | *dp];
--dp;
++sp;
}
continue;
}
- while( dp>lp ) {
- *dp=lookup50trans8[(Pixels8[ColorBlack]<<8)|*dp];
+ while (dp > lp) {
+ *dp = lookup50trans8[(Pixels8[ColorBlack] << 8) | *dp];
--dp;
++sp;
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -2389,8 +2405,8 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to16ShadowClipX(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDraw8to16ShadowClipX(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
int ex;
int ox;
@@ -2411,131 +2427,131 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType16*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType16*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth+sw;
- dp=VideoMemory16+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
+ da = VideoWidth + sw;
+ dp = VideoMemory16 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
- if( VideoBpp==15 ) {
- mask=0x03E07C1F;
+ if (VideoBpp == 15) {
+ mask = 0x03E07C1F;
} else {
- mask=0x07E0F81F;
+ mask = 0x07E0F81F;
}
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp--=(dp1>>16)|dp1;
- ++sp;
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp--=(dp1>>16)|dp1;
- ++sp;
- }
- if( dp>=pp ) {
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp--=(dp1>>16)|dp1;
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp-- = (dp1 >> 16) | dp1;
+ ++sp;
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp-- = (dp1 >> 16) | dp1;
+ ++sp;
+ }
+ if (dp >= pp) {
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp-- = (dp1 >> 16) | dp1;
++sp;
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=sw-w-ox;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= sw - w - ox;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+sw-w-ox;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + sw - w - ox;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp--=(dp1>>16)|dp1;
+ if (pp > lp) {
+ while (dp > pp) {
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp-- = (dp1 >> 16) | dp1;
++sp;
}
continue;
}
- while( dp>lp ) {
- dp1=*dp;
- dp1=((((dp1<<16)|dp1)&mask)>>1)&mask;
- *dp--=(dp1>>16)|dp1;
+ while (dp > lp) {
+ dp1 = *dp;
+ dp1 = ((((dp1 << 16) | dp1) & mask) >> 1) & mask;
+ *dp-- = (dp1 >> 16) | dp1;
++sp;
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -2550,8 +2566,8 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to24ShadowClipX(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDraw8to24ShadowClipX(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
int ex;
int ox;
@@ -2570,110 +2586,110 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType24*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType24*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth+sw;
- dp=VideoMemory24+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
+ da = VideoWidth + sw;
+ dp = VideoMemory24 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- *dp--=pixels[*sp++];
- *dp--=pixels[*sp++];
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
+ *dp-- = pixels[*sp++];
}
- if( dp>=pp ) {
- *dp--=pixels[*sp++];
+ if (dp >= pp) {
+ *dp-- = pixels[*sp++];
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=sw-w-ox;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= sw - w - ox;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+sw-w-ox;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + sw - w - ox;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- *dp--=pixels[*sp++];
+ if (pp > lp) {
+ while (dp > pp) {
+ *dp-- = pixels[*sp++];
}
continue;
}
- while( dp>lp ) {
- *dp--=pixels[*sp++];
+ while (dp > lp) {
+ *dp-- = pixels[*sp++];
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -2688,8 +2704,8 @@
** @param x x coordinate on the screen
** @param y y coordinate on the screen
*/
-local void VideoDraw8to32ShadowClipX(const Graphic* sprite,unsigned frame
- ,int x,int y)
+local void VideoDraw8to32ShadowClipX(const Graphic* sprite, unsigned frame,
+ int x, int y)
{
int ex;
int ox;
@@ -2710,140 +2726,140 @@
//
// reduce to visible range
//
- sw=w=sprite->Width;
- h=sprite->Height;
- CLIP_RECTANGLE_OFS(x,y,w,h,ox,oy,ex);
+ sw = w = sprite->Width;
+ h = sprite->Height;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ox, oy, ex);
//
// Draw the clipped sprite
//
- pixels=(VMemType32*)sprite->Pixels;
- sp=((unsigned char**)sprite->Frames)[frame];
+ pixels = (VMemType32*)sprite->Pixels;
+ sp = ((unsigned char**)sprite->Frames)[frame];
//
// Skip top lines
//
- while( oy-- ) {
- da=0;
+ while (oy--) {
+ da = 0;
do {
- da+=*sp++; // transparent
- da+=*sp; // opaque
- sp+=*sp+1;
- } while( da<sw );
+ da += *sp++; // transparent
+ da += *sp; // opaque
+ sp += *sp + 1;
+ } while (da < sw);
}
- da=VideoWidth+sw;
- dp=VideoMemory32+x+y*VideoWidth+w-1;
- ep=dp+VideoWidth*h;
+ da = VideoWidth + sw;
+ dp = VideoMemory32 + x + y * VideoWidth + w - 1;
+ ep = dp + VideoWidth * h;
- if( w==sw ) { // Unclipped horizontal
+ if (w == sw) { // Unclipped horizontal
- while( dp<ep ) { // all lines
- lp=dp-w;
+ while (dp < ep) { // all lines
+ lp = dp - w;
do { // 1 line
- dp-=*sp++; // transparent
- pp=dp+1-*sp++; // opaque
- while( dp>pp ) {
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp--=(dp1|(dp2<<8));
- ++sp;
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp--=(dp1|(dp2<<8));
- ++sp;
- }
- if( dp>=pp ) {
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp--=(dp1|(dp2<<8));
+ dp -= *sp++; // transparent
+ pp = dp + 1 - *sp++; // opaque
+ while (dp > pp) {
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp-- = (dp1 | (dp2 << 8));
+ ++sp;
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp-- = (dp1 | (dp2 << 8));
+ ++sp;
+ }
+ if (dp >= pp) {
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp-- = (dp1 | (dp2 << 8));
++sp;
}
- } while( dp>lp );
- dp+=da;
+ } while (dp > lp);
+ dp += da;
}
} else { // Clip horizontal
- da-=ex;
- while( dp<ep ) { // all lines
- lp=dp-w;
+ da -= ex;
+ while (dp < ep) { // all lines
+ lp = dp - w;
//
// Clip right side
//
- pp=dp+ex;
- for( ;; ) {
- pp-=*sp++; // transparent
- if( pp<=dp ) {
- dp=pp;
+ pp = dp + ex;
+ for (;;) {
+ pp -= *sp++; // transparent
+ if (pp <= dp) {
+ dp = pp;
goto middle_trans;
}
- pp-=*sp; // opaque
- if( pp<=dp ) {
- sp+=*sp-(dp-pp)+1;
+ pp -= *sp; // opaque
+ if (pp <= dp) {
+ sp += *sp - (dp - pp) + 1;
goto middle_pixel;
}
- sp+=*sp+1;
+ sp += *sp + 1;
}
//
// Draw middle
//
- for( ;; ) {
- dp-=*sp++; // transparent
+ for (;;) {
+ dp -= *sp++; // transparent
middle_trans:
- if( dp<=lp ) {
- lp-=ox;
+ if (dp <= lp) {
+ lp -= ox;
goto right_trans;
}
- pp=dp-*sp++; // opaque
+ pp = dp - *sp++; // opaque
middle_pixel:
- if( pp>lp ) {
- while( dp>pp ) {
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp--=(dp1|(dp2<<8));
+ if (pp > lp) {
+ while (dp > pp) {
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp-- = (dp1 | (dp2 << 8));
++sp;
}
continue;
}
- while( dp>lp ) {
- dp1=*dp;
- dp2=(dp1&0xFF00FF00)>>8;
- dp1&=0x00FF00FF;
- dp1=(dp1>>1)&0x00FF00FF;
- dp2=(dp2>>1)&0x00FF00FF;
- *dp--=(dp1|(dp2<<8));
+ while (dp > lp) {
+ dp1 = *dp;
+ dp2 = (dp1 & 0xFF00FF00) >> 8;
+ dp1 &= 0x00FF00FF;
+ dp1 = (dp1 >> 1) & 0x00FF00FF;
+ dp2 = (dp2 >> 1) & 0x00FF00FF;
+ *dp-- = (dp1 | (dp2 << 8));
++sp;
}
- sp+=dp-pp;
- dp=pp;
+ sp += dp - pp;
+ dp = pp;
break;
}
//
// Clip left side
//
- lp-=ox;
- while( dp>lp ) {
- dp-=*sp++; // transparent
+ lp -= ox;
+ while (dp > lp) {
+ dp -= *sp++; // transparent
right_trans:
- dp-=*sp; // opaque
- sp+=*sp+1;
+ dp -= *sp; // opaque
+ sp += *sp + 1;
}
- dp+=da;
+ dp += da;
}
}
@@ -2863,11 +2879,8 @@
**
** FIXME: make this faster..
*/
-global void VideoDrawRawXXClip( char *pixels,
- const unsigned char *data,
- int x, int y,
- int w, int h,
- char bytes )
+global void VideoDrawRawXXClip(char *pixels, const unsigned char *data,
+ int x, int y, int w, int h, char bytes)
{
char *dest;
int ofsx;
@@ -2876,13 +2889,13 @@
int nextline;
// Clip given rectangle area, keeping track of start- and end-offsets
- nextline=w;
- CLIP_RECTANGLE_OFS(x,y,w,h,ofsx,ofsy,skipx);
- data+=(ofsy*nextline)+ofsx;
- skipx+=ofsx;
+ nextline = w;
+ CLIP_RECTANGLE_OFS(x, y, w, h, ofsx, ofsy, skipx);
+ data += (ofsy * nextline) + ofsx;
+ skipx += ofsx;
// Draw the raw data, through the given palette
- dest = (char *)VideoMemory + (y * VideoWidth + x) * bytes;
+ dest = (char*)VideoMemory + (y * VideoWidth + x) * bytes;
nextline = (VideoWidth - w) * bytes;
do {
@@ -2890,13 +2903,13 @@
w2 = w;
do {
- memcpy( dest, pixels + *data++ * bytes, bytes );
- dest+=bytes;
- } while ( --w2 > 0 );
+ memcpy(dest, pixels + *data++ * bytes, bytes);
+ dest += bytes;
+ } while (--w2 > 0);
data += skipx;
dest += nextline;
- } while ( --h > 0 );
+ } while (--h > 0);
}
/**
@@ -2910,12 +2923,10 @@
** @param w width of above graphic data in pixels
** @param h height of above graphic data in pixels
*/
-local void VideoDrawRaw8Clip( VMemType *pixels,
- const unsigned char *data,
- int x, int y,
- int w, int h )
+local void VideoDrawRaw8Clip(VMemType *pixels, const unsigned char *data,
+ int x, int y, int w, int h)
{
- VideoDrawRawXXClip( (char *)pixels, data, x, y, w, h, sizeof(VMemType8) );
+ VideoDrawRawXXClip((char*)pixels, data, x, y, w, h, sizeof(VMemType8));
}
/**
@@ -2929,12 +2940,10 @@
** @param w width of above graphic data in pixels
** @param h height of above graphic data in pixels
*/
-local void VideoDrawRaw16Clip( VMemType *pixels,
- const unsigned char *data,
- int x, int y,
- int w, int h )
+local void VideoDrawRaw16Clip(VMemType *pixels, const unsigned char *data,
+ int x, int y, int w, int h)
{
- VideoDrawRawXXClip( (char *)pixels, data, x, y, w, h, sizeof(VMemType16) );
+ VideoDrawRawXXClip((char*)pixels, data, x, y, w, h, sizeof(VMemType16));
}
/**
@@ -2948,12 +2957,10 @@
** @param w width of above graphic data in pixels
** @param h height of above graphic data in pixels
*/
-local void VideoDrawRaw24Clip( VMemType *pixels,
- const unsigned char *data,
- int x, int y,
- int w, int h )
+local void VideoDrawRaw24Clip(VMemType *pixels, const unsigned char *data,
+ int x, int y, int w, int h)
{
- VideoDrawRawXXClip( (char *)pixels, data, x, y, w, h, sizeof(VMemType24) );
+ VideoDrawRawXXClip((char*)pixels, data, x, y, w, h, sizeof(VMemType24));
}
/**
@@ -2967,12 +2974,10 @@
** @param w width of above graphic data in pixels
** @param h height of above graphic data in pixels
*/
-local void VideoDrawRaw32Clip( VMemType *pixels,
- const unsigned char *data,
- int x, int y,
- int w, int h )
+local void VideoDrawRaw32Clip(VMemType *pixels, const unsigned char *data,
+ int x, int y, int w, int h)
{
- VideoDrawRawXXClip( (char *)pixels, data, x, y, w, h, sizeof(VMemType32) );
+ VideoDrawRawXXClip((char*)pixels, data, x, y, w, h, sizeof(VMemType32));
}
/**
@@ -2980,11 +2985,13 @@
*/
local void FreeSprite8(Graphic* graphic)
{
- IfDebug( AllocatedGraphicMemory-=graphic->Size );
- IfDebug( AllocatedGraphicMemory-=sizeof(Graphic) );
+#ifdef DEBUG
+ AllocatedGraphicMemory -= graphic->Size;
+ AllocatedGraphicMemory -= sizeof(Graphic);
+#endif
#ifdef USE_OPENGL
- if( graphic->NumTextureNames ) {
+ if (graphic->NumTextureNames) {
glDeleteTextures(graphic->NumTextureNames, graphic->TextureNames);
free(graphic->TextureNames);
}
@@ -3015,7 +3022,7 @@
**
** @see LoadGraphic
*/
-global Graphic* LoadSprite(const char* name,int width,int height)
+global Graphic* LoadSprite(const char* name, int width, int height)
{
Graphic* graphic;
#ifndef USE_OPENGL
@@ -3033,154 +3040,159 @@
#endif
int depth;
- graphic=LoadGraphic(name);
- if( !width ) {
- width=graphic->Width;
+ graphic = LoadGraphic(name);
+ if (!width) {
+ width = graphic->Width;
}
- if( !height ) {
- height=graphic->Height;
+ if (!height) {
+ height = graphic->Height;
}
- DebugCheck( width>graphic->Width || height>graphic->Height );
+ DebugCheck(width > graphic->Width || height > graphic->Height);
- depth=8;
+ depth = 8;
- if( ((graphic->Width/width)*width!=graphic->Width)
- || ((graphic->Height/height)*height!=graphic->Height) ) {
- fprintf(stderr,"Invalid graphic (width, height) %s\n",name);
- fprintf(stderr,"Expected: (%d,%d) Found: (%d,%d)",
- width,height,graphic->Width,graphic->Height);
+ if (((graphic->Width / width) * width != graphic->Width) ||
+ ((graphic->Height / height) * height != graphic->Height)) {
+ fprintf(stderr, "Invalid graphic (width, height) %s\n", name);
+ fprintf(stderr, "Expected: (%d,%d) Found: (%d,%d)",
+ width, height, graphic->Width, graphic->Height);
}
// Check if width and height fits.
- DebugCheck( ((graphic->Width/width)*width!=graphic->Width)
- || ((graphic->Height/height)*height!=graphic->Height) );
+ DebugCheck(((graphic->Width / width) * width != graphic->Width) ||
+ ((graphic->Height / height) * height != graphic->Height));
#ifdef USE_OPENGL
- MakeTexture(graphic,width,height);
- graphic->NumFrames=(graphic->Width/width)*(graphic->Height/height);
- graphic->GraphicWidth=graphic->Width;
- graphic->GraphicHeight=graphic->Height;
- graphic->Width=width;
- graphic->Height=height;
-
- if( depth==8 ) {
- graphic->Type=&GraphicSprite8Type;
- } else if( depth==16 ) {
- graphic->Type=&GraphicSprite16Type;
+ MakeTexture(graphic, width, height);
+ graphic->NumFrames = (graphic->Width / width) * (graphic->Height / height);
+ graphic->GraphicWidth = graphic->Width;
+ graphic->GraphicHeight = graphic->Height;
+ graphic->Width = width;
+ graphic->Height = height;
+
+ if (depth == 8) {
+ graphic->Type = &GraphicSprite8Type;
+ } else if (depth == 16) {
+ graphic->Type = &GraphicSprite16Type;
} else {
- fprintf(stderr,"Unsported image depth\n");
+ fprintf(stderr, "Unsported image depth\n");
ExitFatal(-1);
}
return graphic;
#else
- n=(graphic->Width/width)*(graphic->Height/height);
- DebugLevel3Fn("%dx%d in %dx%d = %d frames.\n"
- _C_ width _C_ height _C_ graphic->Width _C_ graphic->Height _C_ n);
+ n = (graphic->Width / width) * (graphic->Height / height);
+ DebugLevel3Fn("%dx%d in %dx%d = %d frames.\n" _C_ width _C_ height _C_
+ graphic->Width _C_ graphic->Height _C_ n);
//
// Allocate structure
//
- sprite=malloc(sizeof(Graphic));
- IfDebug( AllocatedGraphicMemory+=sizeof(Graphic) );
+ sprite = malloc(sizeof(Graphic));
+#ifdef DEBUG
+ AllocatedGraphicMemory += sizeof(Graphic);
+#endif
- if( !sprite ) {
- fprintf(stderr,"Out of memory\n");
+ if (!sprite) {
+ fprintf(stderr, "Out of memory\n");
ExitFatal(-1);
}
- if( depth==8 ) {
- sprite->Type=&GraphicSprite8Type;
- } else if( depth==16 ) {
- sprite->Type=&GraphicSprite16Type;
+ if (depth == 8) {
+ sprite->Type = &GraphicSprite8Type;
+ } else if (depth == 16) {
+ sprite->Type = &GraphicSprite16Type;
} else {
- fprintf(stderr,"Unsported image depth\n");
+ fprintf(stderr, "Unsported image depth\n");
ExitFatal(-1);
}
- sprite->Width=width;
- sprite->Height=height;
+ sprite->Width = width;
+ sprite->Height = height;
- sprite->NumFrames=n;
+ sprite->NumFrames = n;
- sprite->Palette=graphic->Palette;
- sprite->Pixels=graphic->Pixels; // WARNING: if not shared freed below!
+ sprite->Palette = graphic->Palette;
+ sprite->Pixels = graphic->Pixels; // WARNING: if not shared freed below!
- sprite->Size=0;
- sprite->Frames=NULL;
+ sprite->Size = 0;
+ sprite->Frames = NULL;
// Worst case is alternating opaque and transparent pixels
- data=malloc(n*sizeof(unsigned char*)
- +(graphic->Width/2+1)*3*graphic->Height);
+ data = malloc(n * sizeof(unsigned char*) +
+ (graphic->Width / 2 + 1) * 3 * graphic->Height);
// Pixel area
- dp=(unsigned char *)data+n*sizeof(unsigned char*);
+ dp = (unsigned char*)data + n * sizeof(unsigned char*);
//
// Compress all frames of the sprite.
//
- fl=graphic->Width/width;
- for( i=0; i<n; ++i ) { // each frame
- ((unsigned char**)data)[i]=dp;
- for( h=0; h<height; ++h ) { // each line
- sp=(const unsigned
char*)graphic->Frames+(i%fl)*width+((i/fl)*height+h)*graphic->Width;
-
- for (counter=w=0; w<width; ++w ) {
- if( *sp==255 || *sp==0) { // start
transparency
- ++sp;
- if( ++counter==256 ) {
- *dp++=255;
- *dp++=0;
- counter=1;
+ fl = graphic->Width / width;
+ for (i = 0; i < n; ++i) { // each frame
+ ((unsigned char**)data)[i] = dp;
+ for (h = 0; h < height; ++h) { // each line
+ sp = (const unsigned char*)graphic->Frames + (i % fl) * width +
+ ((i / fl) * height + h) * graphic->Width;
+
+ for (counter = w = 0; w < width; ++w) {
+ if (*sp == 255 || *sp == 0) { // start
transparency
+ ++sp;
+ if (++counter == 256) {
+ *dp++ = 255;
+ *dp++ = 0;
+ counter = 1;
}
continue;
}
- *dp++=counter;
+ *dp++ = counter;
- cp=dp++;
- counter=0;
- for( ; w<width; ++w ) { // opaque
- *dp++=*sp++;
- if( ++counter==255 ) {
- *cp=255;
- *dp++=0;
- cp=dp++;
- counter=0;
+ cp = dp++;
+ counter = 0;
+ for(; w < width; ++w) { // opaque
+ *dp++ = *sp++;
+ if (++counter == 255) {
+ *cp = 255;
+ *dp++ = 0;
+ cp = dp++;
+ counter = 0;
}
// ARI: FIXME: wrong position
- if( w+1!=width && (*sp==255 || *sp==0) ) { // end
transparency
+ if (w + 1 != width && (*sp == 255 || *sp == 0)) { // end
transparency
break;
}
}
- *cp=counter;
- counter=0;
+ *cp = counter;
+ counter = 0;
}
- if( counter ) {
- *dp++=counter;
- *dp++=0; // 1 byte more, 1 check less! (phantom
end transparency)
+ if (counter) {
+ *dp++ = counter;
+ *dp++ = 0; // 1 byte more, 1 check less! (phantom
end transparency)
}
}
}
- DebugLevel3Fn("\t%d => %d RLE compressed\n"
- _C_ graphic->Width*graphic->Height _C_ dp-data);
+ DebugLevel3Fn("\t%d => %d RLE compressed\n" _C_
+ graphic->Width * graphic->Height _C_ dp - data);
//
// Update to real length
//
- sprite->Frames=data;
- i=n*sizeof(unsigned char*)+dp-data;
- sprite->Size=i;
- dp=realloc(data,i);
- if( dp!=data ) { // shrink only - happens rarely
- for( h=0; h<n; ++h ) { // convert address
- ((unsigned char**)dp)[h]+=dp-data;
+ sprite->Frames = data;
+ i = n * sizeof(unsigned char*) + dp - data;
+ sprite->Size = i;
+ dp = realloc(data, i);
+ if (dp != data) { // shrink only - happens rarely
+ for (h = 0; h < n; ++h) { // convert address
+ ((unsigned char**)dp)[h] += dp - data;
}
- sprite->Frames=dp;
+ sprite->Frames = dp;
}
- IfDebug( CompressedGraphicMemory+=i; );
+#ifdef DEBUG
+ CompressedGraphicMemory += i;
+#endif
- graphic->Pixels=NULL; // We own now the shared pixels
+ graphic->Pixels = NULL; // We own now the shared pixels
VideoFree(graphic);
return sprite;
@@ -3193,54 +3205,54 @@
global void InitSprite(void)
{
#ifdef USE_OPENGL
- GraphicSprite8Type.Draw=VideoDrawOpenGL;
- GraphicSprite8Type.DrawClip=VideoDrawClipOpenGL;
- GraphicSprite8Type.DrawShadowClip=VideoDraw8to32ShadowClip;
- GraphicSprite8Type.DrawX=VideoDrawXOpenGL;
- GraphicSprite8Type.DrawClipX=VideoDrawClipXOpenGL;
- GraphicSprite8Type.DrawShadowClipX=VideoDraw8to32ShadowClipX;
- VideoDrawRawClip=VideoDrawRaw32Clip;
+ GraphicSprite8Type.Draw = VideoDrawOpenGL;
+ GraphicSprite8Type.DrawClip = VideoDrawClipOpenGL;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to32ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDrawXOpenGL;
+ GraphicSprite8Type.DrawClipX = VideoDrawClipXOpenGL;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to32ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw32Clip;
#else
- switch( VideoBpp ) {
+ switch (VideoBpp) {
case 8:
- GraphicSprite8Type.Draw=VideoDraw8to8;
- GraphicSprite8Type.DrawClip=VideoDraw8to8Clip;
- GraphicSprite8Type.DrawShadowClip=VideoDraw8to8ShadowClip;
- GraphicSprite8Type.DrawX=VideoDraw8to8X;
- GraphicSprite8Type.DrawClipX=VideoDraw8to8ClipX;
- GraphicSprite8Type.DrawShadowClipX=VideoDraw8to8ShadowClipX;
- VideoDrawRawClip=VideoDrawRaw8Clip;
+ GraphicSprite8Type.Draw = VideoDraw8to8;
+ GraphicSprite8Type.DrawClip = VideoDraw8to8Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to8ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to8X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to8ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to8ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw8Clip;
break;
case 15:
case 16:
- GraphicSprite8Type.Draw=VideoDraw8to16;
- GraphicSprite8Type.DrawClip=VideoDraw8to16Clip;
- GraphicSprite8Type.DrawShadowClip=VideoDraw8to16ShadowClip;
- GraphicSprite8Type.DrawX=VideoDraw8to16X;
- GraphicSprite8Type.DrawClipX=VideoDraw8to16ClipX;
- GraphicSprite8Type.DrawShadowClipX=VideoDraw8to16ShadowClipX;
- VideoDrawRawClip=VideoDrawRaw16Clip;
+ GraphicSprite8Type.Draw = VideoDraw8to16;
+ GraphicSprite8Type.DrawClip = VideoDraw8to16Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to16ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to16X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to16ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to16ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw16Clip;
break;
case 24:
- GraphicSprite8Type.Draw=VideoDraw8to24;
- GraphicSprite8Type.DrawClip=VideoDraw8to24Clip;
- GraphicSprite8Type.DrawShadowClip=VideoDraw8to24ShadowClip;
- GraphicSprite8Type.DrawX=VideoDraw8to24X;
- GraphicSprite8Type.DrawClipX=VideoDraw8to24ClipX;
- GraphicSprite8Type.DrawShadowClipX=VideoDraw8to24ShadowClipX;
- VideoDrawRawClip=VideoDrawRaw24Clip;
+ GraphicSprite8Type.Draw = VideoDraw8to24;
+ GraphicSprite8Type.DrawClip = VideoDraw8to24Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to24ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to24X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to24ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to24ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw24Clip;
break;
case 32:
- GraphicSprite8Type.Draw=VideoDraw8to32;
- GraphicSprite8Type.DrawClip=VideoDraw8to32Clip;
- GraphicSprite8Type.DrawShadowClip=VideoDraw8to32ShadowClip;
- GraphicSprite8Type.DrawX=VideoDraw8to32X;
- GraphicSprite8Type.DrawClipX=VideoDraw8to32ClipX;
- GraphicSprite8Type.DrawShadowClipX=VideoDraw8to32ShadowClipX;
- VideoDrawRawClip=VideoDrawRaw32Clip;
+ GraphicSprite8Type.Draw = VideoDraw8to32;
+ GraphicSprite8Type.DrawClip = VideoDraw8to32Clip;
+ GraphicSprite8Type.DrawShadowClip = VideoDraw8to32ShadowClip;
+ GraphicSprite8Type.DrawX = VideoDraw8to32X;
+ GraphicSprite8Type.DrawClipX = VideoDraw8to32ClipX;
+ GraphicSprite8Type.DrawShadowClipX = VideoDraw8to32ShadowClipX;
+ VideoDrawRawClip = VideoDrawRaw32Clip;
break;
default:
@@ -3249,7 +3261,7 @@
}
#endif
- GraphicSprite8Type.Free=FreeSprite8;
+ GraphicSprite8Type.Free = FreeSprite8;
}
//@}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src/video sprite.c,
Jimmy Salmon <=