stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/video linedraw.c


From: Jimmy Salmon
Subject: [Stratagus-CVS] stratagus/src/video linedraw.c
Date: Sun, 28 Sep 2003 23:03:14 -0000

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Jimmy Salmon <address@hidden>   03/09/28 19:00:52

Modified files:
        src/video      : linedraw.c 

Log message:
        Cleanup

Patches:
Index: stratagus/src/video/linedraw.c
diff -u stratagus/src/video/linedraw.c:1.37 stratagus/src/video/linedraw.c:1.38
--- stratagus/src/video/linedraw.c:1.37 Fri Jul 11 10:35:34 2003
+++ stratagus/src/video/linedraw.c      Sun Sep 28 19:00:52 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: linedraw.c,v 1.37 2003/07/11 14:35:34 n0body Exp $
+//     $Id: linedraw.c,v 1.38 2003/09/28 23:00:52 jsalmon3 Exp $
 
 //@{
 
@@ -62,501 +62,355 @@
 --     Variables
 ----------------------------------------------------------------------------*/
 
-    /**
-    ** Draw pixel unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    */
-global void (*VideoDrawPixel)(SysColors color,int x,int y);
-
-    /**
-    ** Draw 25% translucent pixel (Alpha=64) unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    */
-global void (*VideoDraw25TransPixel)(SysColors color,int x,int y);
-
-    /**
-    ** Draw 50% translucent pixel (Alpha=128) unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    */
-global void (*VideoDraw50TransPixel)(SysColors color,int x,int y);
-
-    /**
-    ** Draw 75% translucent pixel (Alpha=192) unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    */
-global void (*VideoDraw75TransPixel)(SysColors color,int x,int y);
-
-    /**
-    ** Draw translucent pixel unclipped.
-    **
-    **  All upfollowing translucent routines follow:
-    **  newcolor = ((oldcolor-color)*alpha)/255+color
-    **
-    **  FIXME: the following delivers better rounding, but is slower and can
-    **         not be calculate in an unsigned char (can deliver overflow):
-    **         newcolor = (oldcolor*alpha+color*(255-alpha)+127)/255
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param alpha    alpha value of pixel.
-    */
-global void (*VideoDrawTransPixel)(SysColors color,int x,int y,
-                                   unsigned char alpha);
-
-    /**
-    ** Draw pixel clipped to current clip setting.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    */
-global void (*VideoDrawPixelClip)(SysColors color,int x,int y);
-
-    /**
-    ** Draw vertical line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param height   height of line.
-    */
-global void (*VideoDrawVLine)(SysColors color,int x,int y
-       ,int height);
-
-    /**
-    ** Draw 25% translucent vertical line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param height   height of line.
-    */
-global void (*VideoDraw25TransVLine)(SysColors color,int x,int y
-       ,int height);
-
-    /**
-    ** Draw 50% translucent vertical line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param height   height of line.
-    */
-global void (*VideoDraw50TransVLine)(SysColors color,int x,int y
-       ,int height);
-
-    /**
-    ** Draw 75% translucent vertical line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param height   height of line.
-    */
-global void (*VideoDraw75TransVLine)(SysColors color,int x,int y
-       ,int height);
-
-    /**
-    ** Draw translucent vertical line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param height   height of line.
-    ** @param alpha    alpha value of pixel.
-    */
-global void (*VideoDrawTransVLine)(SysColors color,int x,int y
-       ,int height,unsigned char alpha);
-
-    /**
-    ** Draw horizontal line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param width    width of line.
-    */
-global void (*VideoDrawHLine)(SysColors color,int x,int y
-       ,int width);
-
-    /**
-    ** Draw 25% translucent horizontal line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param width    width of line.
-    */
-global void (*VideoDraw25TransHLine)(SysColors color,int x,int y
-       ,int width);
-
-    /**
-    ** Draw 50% translucent horizontal line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param width    width of line.
-    */
-global void (*VideoDraw50TransHLine)(SysColors color,int x,int y
-       ,int width);
-
-    /**
-    ** Draw 75% translucent horizontal line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param width    width of line.
-    */
-global void (*VideoDraw75TransHLine)(SysColors color,int x,int y
-       ,int width);
-
-    /**
-    ** Draw translucent horizontal line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param width    width of line.
-    ** @param alpha    alpha value of pixel.
-    */
-global void (*VideoDrawTransHLine)(SysColors color,int x,int y
-       ,int width,unsigned char alpha);
-
-    /**
-    ** Draw line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param sx       Source x coordinate on the screen
-    ** @param sy       Source y coordinate on the screen
-    ** @param dx       Destination x coordinate on the screen
-    ** @param dy       Destination y coordinate on the screen
-    */
-global void (*VideoDrawLine)(SysColors color,int sx,int sy,int dx,int dy);
-
-    /**
-    ** Draw 25% translucent line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param sx       Source x coordinate on the screen
-    ** @param sy       Source y coordinate on the screen
-    ** @param dx       Destination x coordinate on the screen
-    ** @param dy       Destination y coordinate on the screen
-    */
-global void (*VideoDraw25TransLine)(SysColors color,int sx,int sy
-       ,int dx,int dy);
+/**
+**     Draw pixel unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+*/
+global void (*VideoDrawPixel)(SysColors color, int x, int y);
 
-    /**
-    ** Draw 50% translucent line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param sx       Source x coordinate on the screen
-    ** @param sy       Source y coordinate on the screen
-    ** @param dx       Destination x coordinate on the screen
-    ** @param dy       Destination y coordinate on the screen
-    */
-global void (*VideoDraw50TransLine)(SysColors color,int sx,int sy
-       ,int dx,int dy);
+/**
+**     Draw 25% translucent pixel (Alpha = 64) unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+*/
+global void (*VideoDraw25TransPixel)(SysColors color, int x, int y);
 
-    /**
-    ** Draw 75% translucent line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param sx       Source x coordinate on the screen
-    ** @param sy       Source y coordinate on the screen
-    ** @param dx       Destination x coordinate on the screen
-    ** @param dy       Destination y coordinate on the screen
-    */
-global void (*VideoDraw75TransLine)(SysColors color,int sx,int sy
-       ,int dx,int dy);
+/**
+**     Draw 50% translucent pixel (Alpha = 128) unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+*/
+global void (*VideoDraw50TransPixel)(SysColors color, int x, int y);
 
-    /**
-    ** Draw translucent line unclipped.
-    **
-    ** @param color    Color index.
-    ** @param sx       Source x coordinate on the screen
-    ** @param sy       Source y coordinate on the screen
-    ** @param dx       Destination x coordinate on the screen
-    ** @param dy       Destination y coordinate on the screen
-    ** @param alpha    alpha value of pixel.
-    */
-global void (*VideoDrawTransLine)(SysColors color,int sx,int sy,int dx,int dy
-       ,unsigned char alpha);
+/**
+**     Draw 75% translucent pixel (Alpha = 192) unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+*/
+global void (*VideoDraw75TransPixel)(SysColors color, int x, int y);
 
-    /**
-    ** Draw rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoDrawRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw translucent pixel unclipped.
+**
+**  All upfollowing translucent routines follow:
+**  newcolor = ((oldcolor-color) * alpha)/255+color
+**
+**  FIXME: the following delivers better rounding, but is slower and can
+**         not be calculate in an unsigned char (can deliver overflow):
+**         newcolor = (oldcolor*alpha+color*(255 - alpha)+127)/255
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param alpha    alpha value of pixel.
+*/
+global void (*VideoDrawTransPixel)(SysColors color, int x, int y,
+    unsigned char alpha);
 
-    /**
-    ** Draw 25% translucent rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoDraw25TransRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw pixel clipped to current clip setting.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+*/
+global void (*VideoDrawPixelClip)(SysColors color, int x, int y);
 
-    /**
-    ** Draw 50% translucent rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoDraw50TransRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw vertical line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param height   height of line.
+*/
+global void (*VideoDrawVLine)(SysColors color, int x, int y, int height);
 
-    /**
-    ** Draw 75% translucent rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoDraw75TransRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw 25% translucent vertical line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param height   height of line.
+*/
+global void (*VideoDraw25TransVLine)(SysColors color, int x, int y, int 
height);
 
-    /**
-    ** Draw translucent rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    ** @param alpha    alpha value of pixel.
-    */
-global void (*VideoDrawTransRectangle)(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha);
+/**
+**     Draw 50% translucent vertical line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param height   height of line.
+*/
+global void (*VideoDraw50TransVLine)(SysColors color, int x, int y, int 
height);
 
-    /**
-    ** Fill rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoFillRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw 75% translucent vertical line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param height   height of line.
+*/
+global void (*VideoDraw75TransVLine)(SysColors color, int x, int y, int 
height);
 
-    /**
-    ** Draw 25% translucent filled rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoFill25TransRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw translucent vertical line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param height   height of line.
+**     @param alpha    alpha value of pixel.
+*/
+global void (*VideoDrawTransVLine)(SysColors color, int x, int y,
+    int height,unsigned char alpha);
 
-    /**
-    ** Draw 50% translucent filled rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoFill50TransRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw horizontal line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param width    width of line.
+*/
+global void (*VideoDrawHLine)(SysColors color, int x, int y, int width);
 
-    /**
-    ** Draw 75% translucent filled rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    */
-global void (*VideoFill75TransRectangle)(SysColors color,int x,int y
-       ,int w,int h);
+/**
+**     Draw 25% translucent horizontal line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param width    width of line.
+*/
+global void (*VideoDraw25TransHLine)(SysColors color, int x, int y, int width);
 
-    /**
-    ** Draw translucent filled rectangle.
-    **
-    ** @param color    Color index.
-    ** @param x        x coordinate on the screen
-    ** @param y        y coordinate on the screen
-    ** @param h        height of rectangle.
-    ** @param w        width of rectangle.
-    ** @param alpha    alpha value of pixel.
-    */
-global void (*VideoFillTransRectangle)(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha);
+/**
+**     Draw 50% translucent horizontal line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param width    width of line.
+*/
+global void (*VideoDraw50TransHLine)(SysColors color, int x, int y, int width);
 
-/*----------------------------------------------------------------------------
---     Local functions
-----------------------------------------------------------------------------*/
+/**
+**     Draw 75% translucent horizontal line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param width    width of line.
+*/
+global void (*VideoDraw75TransHLine)(SysColors color, int x, int y, int width);
 
-#ifdef DEBUG
+/**
+**     Draw translucent horizontal line unclipped.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param width    width of line.
+**     @param alpha    alpha value of pixel.
+*/
+global void (*VideoDrawTransHLine)(SysColors color, int x, int y,
+    int width,unsigned char alpha);
 
 /**
-**     Dump bits in debugger (DEBUG only)
+**     Draw line unclipped.
 **
-**     @param bits     bits to display
+**     @param color    Color index.
+**     @param sx       Source x coordinate on the screen
+**     @param sy       Source y coordinate on the screen
+**     @param dx       Destination x coordinate on the screen
+**     @param dy       Destination y coordinate on the screen
 */
-local void DebugBits(unsigned long bits)
-{
-    unsigned long i;
+global void (*VideoDrawLine)(SysColors color, int sx, int sy, int dx, int dy);
 
-    for (i = ((~(unsigned long)0) >> 1) + 1; i > 0; i >>= 1) {
-       if (bits & i) {
-           putc('1', stderr);
-       } else {
-           putc('0', stderr);
-       }
-    }
-    putc('\n', stderr);
-}
+/**
+**     Draw 25% translucent line unclipped.
+**
+**     @param color    Color index.
+**     @param sx       Source x coordinate on the screen
+**     @param sy       Source y coordinate on the screen
+**     @param dx       Destination x coordinate on the screen
+**     @param dy       Destination y coordinate on the screen
+*/
+global void (*VideoDraw25TransLine)(SysColors color, int sx, int sy,
+    int dx, int dy);
 
-#endif
+/**
+**     Draw 50% translucent line unclipped.
+**
+**     @param color    Color index.
+**     @param sx       Source x coordinate on the screen
+**     @param sy       Source y coordinate on the screen
+**     @param dx       Destination x coordinate on the screen
+**     @param dy       Destination y coordinate on the screen
+*/
+global void (*VideoDraw50TransLine)(SysColors color, int sx, int sy,
+    int dx, int dy);
 
-#if 0
+/**
+**     Draw 75% translucent line unclipped.
+**
+**     @param color    Color index.
+**     @param sx       Source x coordinate on the screen
+**     @param sy       Source y coordinate on the screen
+**     @param dx       Destination x coordinate on the screen
+**     @param dy       Destination y coordinate on the screen
+*/
+global void (*VideoDraw75TransLine)(SysColors color, int sx, int sy,
+    int dx, int dy);
 
-// ===========================================================================
-//     Color - unused!
-// ===========================================================================
+/**
+**     Draw translucent line unclipped.
+**
+**     @param color    Color index.
+**     @param sx       Source x coordinate on the screen
+**     @param sy       Source y coordinate on the screen
+**     @param dx       Destination x coordinate on the screen
+**     @param dy       Destination y coordinate on the screen
+**     @param alpha    alpha value of pixel.
+*/
+global void (*VideoDrawTransLine)(SysColors color, int sx, int sy,
+    int dx, int dy, unsigned char alpha);
 
 /**
-**     Calculate brightness from a given RGB color value
-**      ( UNUSED, move to video.c? )
+**     Draw rectangle.
 **
-**     @param r        Color Red-value.
-**     @param g        Color Green-value.
-**     @param b        Color Blue-value.
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
 */
-local unsigned char RGBtoBrightness(unsigned char r,
-                                   unsigned char g,
-                                   unsigned char b )
-{
-    unsigned int brightness;
-    // "The weights to compute true CIE luminance from linear red, green and 
blue
-    // (indicated without prime symbols), for the Rec.  709, are these:"
-    // brightness = 0.2125*r+0.7154*g+0.0721*b" (from Poynton's color FAQ)
-    brightness = (unsigned int)r*3+(unsigned int)g*10+(unsigned int)b;
-    return brightness/14;
-}
+global void (*VideoDrawRectangle)(SysColors color, int x, int y,
+    int w, int h);
 
 /**
-**     Calculate brightness upon a given RGB color value
-**      ( UNUSED, move to video.c? )
+**     Draw 25% translucent rectangle.
 **
-**     @param alpha    Brightness value
-**     @param r        Color Red-value.
-**     @param g        Color Green-value.
-**     @param b        Color Blue-value.
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
 */
-local void ScaleRGB(unsigned char alpha,
-                   unsigned char *r,
-                   unsigned char *g,
-                   unsigned char *b )
-{
-    unsigned long int f;
+global void (*VideoDraw25TransRectangle)(SysColors color, int x, int y,
+    int w, int h);
 
-    f = (*r * alpha * 3) >> 8; // could overflow with 0b10
-    if ( f & 0xFF00 )
-       f = 0xFF;
-    *r = f;
-    f = (*g * alpha * 10) >> 8; // could overflow with 0b101
-    if ( f & 0xFF00 )
-       f = 0xFF;
-    *g = f;
-    f = (*b * alpha) >> 8;
-    *b = f;
-}
+/**
+**     Draw 50% translucent rectangle.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
+*/
+global void (*VideoDraw50TransRectangle)(SysColors color, int x, int y,
+    int w, int h);
 
 /**
-**     Calculate intensity 0..15 from a given RGB color value
-**      FIXME: will not work, improve and move to video.c?
+**     Draw 75% translucent rectangle.
 **
-**     @param r        Color Red-value   in 0..15
-**     @param g        Color Green-value in 0..15
-**     @param b        Color Blue-value  in 0..15
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
 */
-local unsigned char rgb2intensity(unsigned char r,
-                                 unsigned char g,
-                                 unsigned char b )
-{
-    unsigned int i;
-    i = (r + g + b) / 3;
-    return i;
-}
+global void (*VideoDraw75TransRectangle)(SysColors color, int x, int y,
+    int w, int h);
 
 /**
-**     Convert IRGB to unsigned long RGB (for further calculation)
-**      ( UNUSED, move to video.c? )
+**     Draw translucent rectangle.
 **
-**     @param r        Color Red-value.
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
+**     @param alpha    alpha value of pixel.
+*/
+global void (*VideoDrawTransRectangle)(SysColors color, int x, int y,
+    int w, int h,unsigned char alpha);
+
+/**
+**     Fill rectangle.
 **
-**     |IIRR|GGBB| --> |0000|0000|RRRR|0000|00GG|GG00|0000|BBBB|
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
 */
-local unsigned long irgb2rgb( unsigned char irgb )
-{
-    unsigned long f;
+global void (*VideoFillRectangle)(SysColors color, int x, int y,
+    int w, int h);
 
-    f=(((irgb<<16)|(irgb<<8)|irgb)&0x00300C03)*(1+(irgb&0xC0));
-    return f;
-}
+/**
+**     Draw 25% translucent filled rectangle.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
+*/
+global void (*VideoFill25TransRectangle)(SysColors color, int x, int y,
+    int w, int h);
 
 /**
-**     Convert unsigned long RGB to IRGB
-**      FIXME: will not work, improve and move to video.c?
+**     Draw 50% translucent filled rectangle.
 **
-**     @param rbg      Color Red-value.
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
+*/
+global void (*VideoFill50TransRectangle)(SysColors color, int x, int y,
+    int w, int h);
+
+/**
+**     Draw 75% translucent filled rectangle.
 **
-**     |0000|0000|RRRR|0000|00GG|GG00|0000|BBBB| --> |IIRR|GGBB|
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
 */
-local unsigned char rgb2irgb( unsigned long rgb )
-{
-    unsigned char i, r, g, b;
+global void (*VideoFill75TransRectangle)(SysColors color, int x, int y,
+    int w, int h);
 
-    r=(rgb&0x00F00000)>>20;
-    g=(rgb&0x00003C00)>>10;
-    b=rgb&0x0000000F;
-    i=rgb2intensity( r, g, b );
-//  r=r%;
-//  g=g%;
-//  b=b%;
-    i=(i<<6)|(r<<4)|(g<<2)|b;
-    return i;
-}
+/**
+**     Draw translucent filled rectangle.
+**
+**     @param color    Color index.
+**     @param x        x coordinate on the screen
+**     @param y        y coordinate on the screen
+**     @param h        height of rectangle.
+**     @param w        width of rectangle.
+**     @param alpha    alpha value of pixel.
+*/
+global void (*VideoFillTransRectangle)(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha);
 
-#endif
 
 // ===========================================================================
 //     Pixel
@@ -569,9 +423,9 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixel8(SysColors color,int x,int y)
+local void DrawPixel8(SysColors color, int x, int y)
 {
-    VideoMemory8[x+y*VideoWidth]=Pixels8[color];
+    VideoMemory8[x + y * VideoWidth] = Pixels8[color];
 }
 
 /**
@@ -581,9 +435,9 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixel16(SysColors color,int x,int y)
+local void DrawPixel16(SysColors color, int x, int y)
 {
-    VideoMemory16[x+y*VideoWidth]=Pixels16[color];
+    VideoMemory16[x + y * VideoWidth] = Pixels16[color];
 }
 
 /**
@@ -593,9 +447,9 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixel24(SysColors color,int x,int y)
+local void DrawPixel24(SysColors color, int x, int y)
 {
-    VideoMemory24[x+y*VideoWidth]=Pixels24[color];
+    VideoMemory24[x + y * VideoWidth] = Pixels24[color];
 }
 
 /**
@@ -605,9 +459,9 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixel32(SysColors color,int x,int y)
+local void DrawPixel32(SysColors color, int x, int y)
 {
-    VideoMemory32[x+y*VideoWidth]=Pixels32[color];
+    VideoMemory32[x + y * VideoWidth] = Pixels32[color];
 }
 
 /**
@@ -618,19 +472,21 @@
 **     @param y        y coordinate on the screen
 */
 #ifdef USE_OPENGL
-local void DrawPixelOpenGL(SysColors color,int x,int y)
+local void DrawPixelOpenGL(SysColors color, int x, int y)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor3ub(r, g, b);
     glBegin(GL_POINTS);
-    glVertex2i(x, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -643,12 +499,12 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw25TransPixel8(SysColors color,int x,int y)
+local void Draw25TransPixel8(SysColors color, int x, int y)
 {
-    VMemType8 *p;
+    VMemType8* p;
 
-    p = VideoMemory8+x+y*VideoWidth;
-    *p = lookup25trans8[ (Pixels8[color]<<8) | *p ];
+    p = VideoMemory8 + x + y * VideoWidth;
+    *p = lookup25trans8[(Pixels8[color] << 8) | *p];
 }
 
 /**
@@ -658,20 +514,20 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw25TransPixel15(SysColors color,int x,int y)
+local void Draw25TransPixel15(SysColors color, int x, int y)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x03E07C1F)*3;
-    dp=*p;
-    dp=((dp<<16)|dp)&0x03E07C1F;
-    dp=((dp+sp)>>2)&0x03E07C1F;
-    *p=(dp>>16)|dp;
+    sp = (((sp << 16) | sp) & 0x03E07C1F) * 3;
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x03E07C1F;
+    dp = ((dp + sp) >> 2) & 0x03E07C1F;
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -681,20 +537,20 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw25TransPixel16(SysColors color,int x,int y)
+local void Draw25TransPixel16(SysColors color, int x, int y)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x07E0F81F)*3;
-    dp=*p;
-    dp=((dp<<16)|dp)&0x07E0F81F;
-    dp=((dp+sp)>>2)&0x07E0F81F;
-    *p=(dp>>16)|dp;
+    sp = (((sp << 16) | sp) & 0x07E0F81F) * 3;
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x07E0F81F;
+    dp = ((dp + sp) >> 2) & 0x07E0F81F;
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -704,10 +560,10 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw25TransPixel24(SysColors color,int x,int y)
+local void Draw25TransPixel24(SysColors color, int x, int y)
 {
 //FIXME: does 24bpp represents R|G|B?
-    VideoMemory24[x+y*VideoWidth]=Pixels24[color];
+    VideoMemory24[x + y * VideoWidth] = Pixels24[color];
 }
 
 /**
@@ -717,27 +573,27 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw25TransPixel32(SysColors color,int x,int y)
+local void Draw25TransPixel32(SysColors color, int x, int y)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
     unsigned long dp2;
 
-    sp1=Pixels32[color];
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=((sp1&0xFF00FF00)>>8)*3;
-    sp1=(sp1&0x00FF00FF)*3;
+    sp2 = ((sp1 & 0xFF00FF00) >> 8) * 3;
+    sp1 = (sp1 & 0x00FF00FF) * 3;
 
-    p=VideoMemory32+y*VideoWidth+x;
-    dp1=*p;
-    dp2=(dp1&0xFF00FF00)>>8;
-    dp1&=0x00FF00FF;
-
-    dp1=((dp1+sp1)>>2)&0x00FF00FF;
-    dp2=((dp2+sp2)>>2)&0x00FF00FF;
-    *p=(dp1|(dp2<<8));
+    p = VideoMemory32 + y * VideoWidth + x;
+    dp1 = *p;
+    dp2 = (dp1 & 0xFF00FF00) >> 8;
+    dp1 &= 0x00FF00FF;
+
+    dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+    dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+    *p = (dp1 | (dp2 << 8));
 }
 
 /**
@@ -748,19 +604,21 @@
 **     @param y        y coordinate on the screen
 */
 #ifdef USE_OPENGL
-local void Draw25TransPixelOpenGL(SysColors color,int x,int y)
+local void Draw25TransPixelOpenGL(SysColors color, int x, int y)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 192);
     glBegin(GL_POINTS);
-    glVertex2i(x, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -773,12 +631,12 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw50TransPixel8(SysColors color,int x,int y)
+local void Draw50TransPixel8(SysColors color, int x, int y)
 {
-    VMemType8 *p;
+    VMemType8* p;
 
-    p = VideoMemory8+x+y*VideoWidth;
-    *p = lookup50trans8[ (Pixels8[color]<<8) | *p ];
+    p = VideoMemory8 + x + y * VideoWidth;
+    *p = lookup50trans8[(Pixels8[color] << 8) | *p];
 }
 
 /**
@@ -788,19 +646,19 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw50TransPixel15(SysColors color,int x,int y)
+local void Draw50TransPixel15(SysColors color, int x, int y)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    dp=*p;
-    dp=((dp<<16)|dp)&0x03E07C1F;
-    dp=((dp+sp)>>1)&0x03E07C1F;
-    *p=(dp>>16)|dp;
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x03E07C1F;
+    dp = ((dp + sp) >> 1) & 0x03E07C1F;
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -810,19 +668,19 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw50TransPixel16(SysColors color,int x,int y)
+local void Draw50TransPixel16(SysColors color, int x, int y)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    dp=*p;
-    dp=((dp<<16)|dp)&0x07E0F81F;
-    dp=((dp+sp)>>1)&0x07E0F81F;
-    *p=(dp>>16)|dp;
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x07E0F81F;
+    dp = ((dp + sp) >> 1) & 0x07E0F81F;
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -832,10 +690,10 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw50TransPixel24(SysColors color,int x,int y)
+local void Draw50TransPixel24(SysColors color, int x, int y)
 {
 //FIXME: does 24bpp represents R|G|B?
-    VideoMemory24[x+y*VideoWidth]=Pixels24[color];
+    VideoMemory24[x + y * VideoWidth] = Pixels24[color];
 }
 
 /**
@@ -845,26 +703,26 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw50TransPixel32(SysColors color,int x,int y)
+local void Draw50TransPixel32(SysColors color, int x, int y)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
     unsigned long dp2;
 
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
-
-    p=VideoMemory32+y*VideoWidth+x;
-    dp1=*p;
-    dp2=(dp1&0xFF00FF00)>>8;
-    dp1&=0x00FF00FF;
-
-    dp1=((dp1+sp1)>>1)&0x00FF00FF;
-    dp2=((dp2+sp2)>>1)&0x00FF00FF;
-    *p=(dp1|(dp2<<8));
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
+
+    p = VideoMemory32 + y * VideoWidth + x;
+    dp1 = *p;
+    dp2 = (dp1 & 0xFF00FF00) >> 8;
+    dp1 &= 0x00FF00FF;
+
+    dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+    dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+    *p = (dp1 | (dp2 << 8));
 }
 
 /**
@@ -875,19 +733,21 @@
 **     @param y        y coordinate on the screen
 */
 #ifdef USE_OPENGL
-local void Draw50TransPixelOpenGL(SysColors color,int x,int y)
+local void Draw50TransPixelOpenGL(SysColors color, int x, int y)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 128);
     glBegin(GL_POINTS);
-    glVertex2i(x, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -900,12 +760,12 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw75TransPixel8(SysColors color,int x,int y)
+local void Draw75TransPixel8(SysColors color, int x, int y)
 {
-    VMemType8 *p;
+    VMemType8* p;
 
-    p = VideoMemory8+x+y*VideoWidth;
-    *p = lookup25trans8[ (*p<<8) | Pixels8[color] ];
+    p = VideoMemory8 + x + y * VideoWidth;
+    *p = lookup25trans8[(*p << 8) | Pixels8[color]];
 }
 
 /**
@@ -915,19 +775,19 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw75TransPixel15(SysColors color,int x,int y)
+local void Draw75TransPixel15(SysColors color, int x, int y)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    dp=*p;
-    dp=((dp<<16)|dp)&0x03E07C1F;
-    dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-    *p=(dp>>16)|dp;
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x03E07C1F;
+    dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -937,19 +797,19 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw75TransPixel16(SysColors color,int x,int y)
+local void Draw75TransPixel16(SysColors color, int x, int y)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    dp=*p;
-    dp=((dp<<16)|dp)&0x07E0F81F;
-    dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-    *p=(dp>>16)|dp;
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x07E0F81F;
+    dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -959,10 +819,10 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw75TransPixel24(SysColors color,int x,int y)
+local void Draw75TransPixel24(SysColors color, int x, int y)
 {
 //FIXME: does 24bpp represents R|G|B?
-    VideoMemory24[x+y*VideoWidth]=Pixels24[color];
+    VideoMemory24[x + y * VideoWidth] = Pixels24[color];
 }
 
 /**
@@ -972,26 +832,26 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void Draw75TransPixel32(SysColors color,int x,int y)
+local void Draw75TransPixel32(SysColors color, int x, int y)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
     unsigned long dp2;
 
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
-
-    p=VideoMemory32+y*VideoWidth+x;
-    dp1=*p;
-    dp2=(dp1&0xFF00FF00)>>8;
-    dp1&=0x00FF00FF;
-
-    dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-    dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-    *p=(dp1|(dp2<<8));
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
+
+    p = VideoMemory32 + y * VideoWidth + x;
+    dp1 = *p;
+    dp2 = (dp1 & 0xFF00FF00) >> 8;
+    dp1 &= 0x00FF00FF;
+
+    dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+    dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+    *p = (dp1 | (dp2 << 8));
 }
 
 /**
@@ -1002,19 +862,21 @@
 **     @param y        y coordinate on the screen
 */
 #ifdef USE_OPENGL
-local void Draw75TransPixelOpenGL(SysColors color,int x,int y)
+local void Draw75TransPixelOpenGL(SysColors color, int x, int y)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 64);
     glBegin(GL_POINTS);
-    glVertex2i(x, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -1028,25 +890,24 @@
 **     @param y        y coordinate on the screen
 **      @param alpha    alpha value of pixel.
 */
-local void DrawTransPixel8(SysColors color,int x,int y
-        ,unsigned char alpha)
+local void DrawTransPixel8(SysColors color, int x, int y,
+    unsigned char alpha)
 {
-    VMemType8 *p;
+    VMemType8* p;
 
-    p = VideoMemory8+x+y*VideoWidth;
-    switch ( ((unsigned int)alpha * 4) / 255 )
-    {
+    p = VideoMemory8 + x + y * VideoWidth;
+    switch (((unsigned int)alpha * 4) / 255) {
        case 0:
            *p = Pixels8[color];
            break;
        case 1:
-           *p = lookup25trans8[ (Pixels8[color]<<8) | *p ];
+           *p = lookup25trans8[(Pixels8[color] << 8) | *p];
            break;
        case 2:
-           *p = lookup50trans8[ (*p<<8) | Pixels8[color] ];
+           *p = lookup50trans8[(*p << 8) | Pixels8[color]];
            break;
        case 3:
-           *p = lookup25trans8[ (*p<<8) | Pixels8[color] ];
+           *p = lookup25trans8[(*p << 8) | Pixels8[color]];
            break;
        default:
            break;
@@ -1061,10 +922,10 @@
 **     @param y        y coordinate on the screen
 **      @param alpha    alpha value of pixel.
 */
-local void DrawNoTransPixel8(SysColors color,int x,int y
-        ,unsigned char alpha __attribute__((unused)))
+local void DrawNoTransPixel8(SysColors color, int x, int y,
+    unsigned char alpha __attribute__((unused)))
 {
-    DrawPixel8(color,x,y);
+    DrawPixel8(color, x, y);
 }
 
 /**
@@ -1084,21 +945,21 @@
 **  * alpha = |-GGGGGGGGGGSRRRRRRRRR-SBBBBBBBBB|
 ** newcolor = |------GGGGG-----RRRRR------BBBBB|
 */
-local void DrawTransPixel15(SysColors color,int x,int y
-        ,unsigned char alpha)
+local void DrawTransPixel15(SysColors color, int x, int y,
+    unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    alpha>>=3; //FIXME: only 5bits available between colors
-    dp=*p;
-    dp=((dp<<16)|dp)&0x03E07C1F;
-    dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F; //FIXME: alpha==256 unreached
-    *p=(dp>>16)|dp;
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    alpha >>= 3; //FIXME: only 5bits available between colors
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x03E07C1F;
+    dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F; //FIXME: alpha==256 
unreached
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -1119,21 +980,21 @@
 **  * alpha = |SGGGGGGGGGGSRRRRRRRRRSBBBBBBBBBB|
 ** newcolor = |-----GGGGGG-----RRRRR------BBBBB|
 */
-local void DrawTransPixel16(SysColors color,int x,int y
-        ,unsigned char alpha)
+local void DrawTransPixel16(SysColors color, int x, int y,
+    unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
 
-    p=VideoMemory16+x+y*VideoWidth;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    alpha>>=3; //FIXME: only 5bits available between colors
-    dp=*p;
-    dp=((dp<<16)|dp)&0x07E0F81F;
-    dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F; //FIXME: alpha==256 unreached
-    *p=(dp>>16)|dp;
+    p = VideoMemory16 + x + y * VideoWidth;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    alpha >>= 3; //FIXME: only 5bits available between colors
+    dp = *p;
+    dp = ((dp << 16) | dp) & 0x07E0F81F;
+    dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F; //FIXME: alpha==256 
unreached
+    *p = (dp >> 16) | dp;
 }
 
 /**
@@ -1144,11 +1005,11 @@
 **     @param y        y coordinate on the screen
 **      @param alpha    alpha value of pixel.
 */
-local void DrawTransPixel24(SysColors color,int x,int y
-        ,unsigned char alpha __attribute__((unused)))
+local void DrawTransPixel24(SysColors color, int x, int y,
+    unsigned char alpha __attribute__((unused)))
 {
 //FIXME: does 24bpp represents R|G|B?
-    VideoMemory24[x+y*VideoWidth]=Pixels24[color];
+    VideoMemory24[x + y * VideoWidth] = Pixels24[color];
 }
 
 /**
@@ -1175,28 +1036,28 @@
 **
 ** FIXME: alpha blending the A-value of 32bit may not be needed.. always 0
 */
-local void DrawTransPixel32(SysColors color,int x,int y
-        ,unsigned char alpha)
+local void DrawTransPixel32(SysColors color, int x, int y,
+    unsigned char alpha)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
     unsigned long dp2;
 
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
-
-    p=VideoMemory32+y*VideoWidth+x;
-    dp1=*p;
-    dp2=(dp1&0xFF00FF00)>>8;
-    dp1&=0x00FF00FF;
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
+
+    p = VideoMemory32 + y * VideoWidth + x;
+    dp1 = *p;
+    dp2 = (dp1 & 0xFF00FF00) >> 8;
+    dp1 &= 0x00FF00FF;
 
     //FIXME: alpha==256 unreached
-    dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-    dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-    *p=(dp1|(dp2<<8));
+    dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+    dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+    *p = (dp1 | (dp2 << 8));
 }
 
 /**
@@ -1208,19 +1069,22 @@
 **      @param alpha    alpha value of pixel.
 */
 #ifdef USE_OPENGL
-local void DrawTransPixelOpenGL(SysColors color,int x,int y,unsigned char 
alpha)
+local void DrawTransPixelOpenGL(SysColors color, int x, int y,
+    unsigned char alpha)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
-    glColor4ub(r, g, b, 255-alpha);
+    glColor4ub(r, g, b, 255 - alpha);
     glBegin(GL_POINTS);
-    glVertex2i(x, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -1233,13 +1097,13 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixelClip8(SysColors color,int x,int y)
+local void DrawPixelClip8(SysColors color, int x, int y)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoMemory8[x+y*VideoWidth]=Pixels8[color];
+    VideoMemory8[x + y * VideoWidth] = Pixels8[color];
 }
 
 /**
@@ -1249,13 +1113,13 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixelClip16(SysColors color,int x,int y)
+local void DrawPixelClip16(SysColors color, int x, int y)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoMemory16[x+y*VideoWidth]=Pixels16[color];
+    VideoMemory16[x + y * VideoWidth] = Pixels16[color];
 }
 
 /**
@@ -1265,13 +1129,13 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixelClip24(SysColors color,int x,int y)
+local void DrawPixelClip24(SysColors color, int x, int y)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoMemory24[x+y*VideoWidth]=Pixels24[color];
+    VideoMemory24[x + y * VideoWidth] = Pixels24[color];
 }
 
 /**
@@ -1281,13 +1145,13 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-local void DrawPixelClip32(SysColors color,int x,int y)
+local void DrawPixelClip32(SysColors color, int x, int y)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoMemory32[x+y*VideoWidth]=Pixels32[color];
+    VideoMemory32[x + y * VideoWidth] = Pixels32[color];
 }
 
 /**
@@ -1298,24 +1162,26 @@
 **     @param y        y coordinate on the screen
 */
 #ifdef USE_OPENGL
-local void DrawPixelClipOpenGL(SysColors color,int x,int y)
+local void DrawPixelClipOpenGL(SysColors color, int x, int y)
 {
     VMemType32 c;
-    GLubyte r,g,b;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
 
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
 
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor3ub(r, g, b);
     glBegin(GL_POINTS);
-    glVertex2i(x, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -1328,13 +1194,13 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-global void VideoDraw25TransPixelClip(SysColors color,int x,int y)
+global void VideoDraw25TransPixelClip(SysColors color, int x, int y)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoDraw25TransPixel(color,x,y);
+    VideoDraw25TransPixel(color, x, y);
 }
 
 /**
@@ -1344,13 +1210,13 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-global void VideoDraw50TransPixelClip(SysColors color,int x,int y)
+global void VideoDraw50TransPixelClip(SysColors color, int x, int y)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoDraw50TransPixel(color,x,y);
+    VideoDraw50TransPixel(color, x, y);
 }
 
 /**
@@ -1360,13 +1226,13 @@
 **     @param x        x coordinate on the screen
 **     @param y        y coordinate on the screen
 */
-global void VideoDraw75TransPixelClip(SysColors color,int x,int y)
+global void VideoDraw75TransPixelClip(SysColors color, int x, int y)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoDraw75TransPixel(color,x,y);
+    VideoDraw75TransPixel(color, x, y);
 }
 
 /**
@@ -1377,14 +1243,14 @@
 **     @param y        y coordinate on the screen
 **      @param alpha    alpha value of pixels.
 */
-global void VideoDrawTransPixelClip(SysColors color,int x,int y
-        ,unsigned char alpha)
+global void VideoDrawTransPixelClip(SysColors color, int x, int y,
+    unsigned char alpha)
 {
     // Clipping:
-    if( x<ClipX1 || x>ClipX2 || y<ClipY1 || y>ClipY2 ) {
+    if (x < ClipX1 || x > ClipX2 || y < ClipY1 || y > ClipY2) {
        return;
     }
-    VideoDrawTransPixel(color,x,y,alpha);
+    VideoDrawTransPixel(color, x, y, alpha);
 }
 
 // ===========================================================================
@@ -1399,20 +1265,20 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line.
 */
-local void DrawHLine8(SysColors color,int x,int y,int width)
+local void DrawHLine8(SysColors color, int x, int y, int width)
 {
     VMemType8* p;
     VMemType8* e;
     int w;
     unsigned f;
 
-    w=VideoWidth;
-    p=VideoMemory8+y*w+x;
-    e=p+width;
-    f=Pixels8[color];
+    w = VideoWidth;
+    p = VideoMemory8 + y * w + x;
+    e = p + width;
+    f = Pixels8[color];
 
-    while( p<e ) {                     // FIXME: better!
-       *p++=f;
+    while (p < e) {                    // FIXME: better!
+       *p++ = f;
     }
 }
 
@@ -1424,24 +1290,24 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void DrawHLine16(SysColors color,int x,int y,int width)
+local void DrawHLine16(SysColors color, int x, int y, int width)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     unsigned long f;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+width-1;
-    f=((unsigned long)Pixels16[color]<<16)|Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + width-1;
+    f = ((unsigned long)Pixels16[color] << 16) | Pixels16[color];
 
-    while( p<e ) {                     // draw 2 pixels
-       *((unsigned long*)p)++=f;
+    while (p < e) {                    // draw 2 pixels
+       *((unsigned long*)p)++ = f;
     }
 
-    if( p<=e ) {
-       *p=f;
+    if (p <= e) {
+       *p = f;
     }
 }
 
@@ -1453,20 +1319,20 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void DrawHLine24(SysColors color,int x,int y,int width)
+local void DrawHLine24(SysColors color, int x, int y, int width)
 {
     VMemType24* p;
     VMemType24* e;
     int w;
     VMemType24 f;
 
-    w=VideoWidth;
-    p=VideoMemory24+y*w+x;
-    e=p+width;
-    f=Pixels24[color];
+    w = VideoWidth;
+    p = VideoMemory24 + y * w + x;
+    e = p + width;
+    f = Pixels24[color];
 
-    while( p<e ) {
-       *p++=f;
+    while (p < e) {
+       *p++ = f;
     }
 }
 
@@ -1478,20 +1344,20 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void DrawHLine32(SysColors color,int x,int y,int width)
+local void DrawHLine32(SysColors color, int x, int y, int width)
 {
     VMemType32* p;
     VMemType32* e;
     int w;
     unsigned long f;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    e=p+width;
-    f=Pixels32[color];
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    e = p + width;
+    f = Pixels32[color];
 
-    while( p<e ) {
-       *p++=f;
+    while (p < e) {
+       *p++ = f;
     }
 }
 
@@ -1504,20 +1370,22 @@
 **     @param width    width of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void DrawHLineOpenGL(SysColors color,int x,int y,int width)
+local void DrawHLineOpenGL(SysColors color, int x, int y, int width)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor3ub(r, g, b);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+width, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + width, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -1531,18 +1399,19 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw25TransHLine8(SysColors color,int x,int y,int width)
+local void Draw25TransHLine8(SysColors color, int x, int y, int width)
 {
-    VMemType8 *p, *e;
+    VMemType8* p;
+    VMemType8* e;
     unsigned int c;
 
-    p=VideoMemory8+x+y*VideoWidth;
-    e=p+width;
-    c=Pixels8[color]<<8;
+    p = VideoMemory8 + x + y * VideoWidth;
+    e = p + width;
+    c = Pixels8[color] << 8;
 
-    while( p<e ) {
-      *p = lookup25trans8[ c | *p ];
-      ++p;
+    while (p < e) {
+       *p = lookup25trans8[c | *p];
+       ++p;
     }
 }
 
@@ -1554,27 +1423,27 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw25TransHLine15(SysColors color,int x,int y,int width)
+local void Draw25TransHLine15(SysColors color, int x, int y, int width)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     unsigned long sp;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+width;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + width;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x03E07C1F)*3;
+    sp = (((sp << 16) | sp) & 0x03E07C1F) * 3;
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-       dp=((dp+sp)>>2)&0x03E07C1F;
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+       dp = ((dp + sp) >> 2) & 0x03E07C1F;
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -1586,27 +1455,27 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw25TransHLine16(SysColors color,int x,int y,int width)
+local void Draw25TransHLine16(SysColors color, int x, int y, int width)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     unsigned long sp;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+width;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + width;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x07E0F81F)*3;
+    sp = (((sp << 16) | sp) & 0x07E0F81F) * 3;
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-       dp=((dp+sp)>>2)&0x07E0F81F;
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+       dp = ((dp + sp) >> 2) & 0x07E0F81F;
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -1618,10 +1487,10 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw25TransHLine24(SysColors color,int x,int y,int width)
+local void Draw25TransHLine24(SysColors color, int x, int y, int width)
 {
 // FIXME: does 24bpp holds R|G|B ?
-    DrawHLine24(color,x,y,width); // no trans functionaility for the moment :(
+    DrawHLine24(color, x, y, width); // no trans functionaility for the moment 
:(
 }
 
 /**
@@ -1632,30 +1501,33 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw25TransHLine32(SysColors color,int x,int y,int width)
+local void Draw25TransHLine32(SysColors color, int x, int y, int width)
 {
-    VMemType32 *p, *e;
-    unsigned long sp1, sp2;
+    VMemType32* p;
+    VMemType32* e;
+    unsigned long sp1;
+    unsigned long sp2;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    e=p+width;
-    sp1=Pixels32[color];
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    e = p + width;
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=((sp1&0xFF00FF00)>>8)*3;
-    sp1=(sp1&0x00FF00FF)*3;
+    sp2 = ((sp1 & 0xFF00FF00) >> 8) * 3;
+    sp1 = (sp1 & 0x00FF00FF) * 3;
 
-    while( p<e ) {
-        unsigned long dp1, dp2;
+    while (p < e) {
+        unsigned long dp1;
+       unsigned long dp2;
 
-        dp1=*p;
-        dp2=(dp1&0xFF00FF00)>>8;
-        dp1&=0x00FF00FF;
-
-        dp1=((dp1+sp1)>>2)&0x00FF00FF;
-        dp2=((dp2+sp2)>>2)&0x00FF00FF;
-        *p++=(dp1|(dp2<<8));
+        dp1 = *p;
+        dp2 = (dp1 & 0xFF00FF00) >> 8;
+        dp1 &= 0x00FF00FF;
+
+        dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+        dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+        *p++ = (dp1 | (dp2 << 8));
     }
 }
 
@@ -1668,20 +1540,22 @@
 **     @param width    width of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw25TransHLineOpenGL(SysColors color,int x,int y,int width)
+local void Draw25TransHLineOpenGL(SysColors color, int x, int y, int width)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 192);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+width, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + width, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -1695,18 +1569,19 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw50TransHLine8(SysColors color,int x,int y,int width)
+local void Draw50TransHLine8(SysColors color, int x, int y, int width)
 {
-    VMemType8 *p, *e;
+    VMemType8* p;
+    VMemType8* e;
     unsigned int c;
 
-    p=VideoMemory8+x+y*VideoWidth;
-    e=p+width;
-    c=Pixels8[color]<<8;
+    p = VideoMemory8 + x + y * VideoWidth;
+    e = p + width;
+    c = Pixels8[color] << 8;
 
-    while( p<e ) {
-      *p = lookup50trans8[ c | *p ];
-      ++p;
+    while (p < e) {
+       *p = lookup50trans8[c | *p];
+       ++p;
     }
 }
 
@@ -1718,26 +1593,26 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw50TransHLine15(SysColors color,int x,int y,int width)
+local void Draw50TransHLine15(SysColors color, int x, int y, int width)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     unsigned long sp;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+width;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + width;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-       dp=((dp+sp)>>1)&0x03E07C1F;
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+       dp = ((dp + sp) >> 1) & 0x03E07C1F;
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -1749,26 +1624,26 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw50TransHLine16(SysColors color,int x,int y,int width)
+local void Draw50TransHLine16(SysColors color, int x, int y, int width)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     unsigned long sp;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+width;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + width;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-       dp=((dp+sp)>>1)&0x07E0F81F;
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+       dp = ((dp + sp) >> 1) & 0x07E0F81F;
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -1780,10 +1655,10 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw50TransHLine24(SysColors color,int x,int y,int width)
+local void Draw50TransHLine24(SysColors color, int x, int y, int width)
 {
 // FIXME: does 24bpp holds R|G|B ?
-    DrawHLine24(color,x,y,width); // no trans functionaility for the moment :(
+    DrawHLine24(color, x, y, width); // no trans functionaility for the moment 
:(
 }
 
 /**
@@ -1794,29 +1669,29 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw50TransHLine32(SysColors color,int x,int y,int width)
+local void Draw50TransHLine32(SysColors color, int x, int y, int width)
 {
-    VMemType32 *p, *e;
+    VMemType32* p, *e;
     unsigned long sp1, sp2;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    e=p+width;
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    e = p + width;
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    while( p<e ) {
+    while (p < e) {
         unsigned long dp1, dp2;
 
-        dp1=*p;
-        dp2=(dp1&0xFF00FF00)>>8;
-        dp1&=0x00FF00FF;
-
-        dp1=((dp1+sp1)>>1)&0x00FF00FF;
-        dp2=((dp2+sp2)>>1)&0x00FF00FF;
-        *p++=(dp1|(dp2<<8));
+        dp1 = *p;
+        dp2 = (dp1 & 0xFF00FF00) >> 8;
+        dp1 &= 0x00FF00FF;
+
+        dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+        dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+        *p++ = (dp1 | (dp2 << 8));
     }
 }
 
@@ -1829,20 +1704,22 @@
 **     @param width    width of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw50TransHLineOpenGL(SysColors color,int x,int y,int width)
+local void Draw50TransHLineOpenGL(SysColors color, int x, int y, int width)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 128);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+width, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + width, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -1856,17 +1733,18 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw75TransHLine8(SysColors color,int x,int y,int width)
+local void Draw75TransHLine8(SysColors color, int x, int y, int width)
 {
-    VMemType8 *p, *e;
+    VMemType8* p;
+    VMemType8* e;
     unsigned int c;
 
-    p=VideoMemory8+x+y*VideoWidth;
-    e=p+width;
-    c=Pixels8[color];
+    p = VideoMemory8 + x + y * VideoWidth;
+    e = p + width;
+    c = Pixels8[color];
 
-    while( p<e ) {
-      *p = lookup25trans8[ (*p<<8) | c ];
+    while (p < e) {
+      *p = lookup25trans8[(*p << 8) | c];
       ++p;
     }
 }
@@ -1879,26 +1757,26 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw75TransHLine15(SysColors color,int x,int y,int width)
+local void Draw75TransHLine15(SysColors color, int x, int y, int width)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     unsigned long sp;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+width;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + width;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-       dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+       dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -1910,26 +1788,26 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw75TransHLine16(SysColors color,int x,int y,int width)
+local void Draw75TransHLine16(SysColors color, int x, int y, int width)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     unsigned long sp;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+width;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + width;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-       dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+       dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -1941,10 +1819,10 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw75TransHLine24(SysColors color,int x,int y,int width)
+local void Draw75TransHLine24(SysColors color, int x, int y, int width)
 {
 // FIXME: does 24bpp holds R|G|B ?
-    DrawHLine24(color,x,y,width); // no trans functionaility for the moment :(
+    DrawHLine24(color, x, y, width); // no trans functionaility for the moment 
:(
 }
 
 /**
@@ -1955,29 +1833,32 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-local void Draw75TransHLine32(SysColors color,int x,int y,int width)
+local void Draw75TransHLine32(SysColors color, int x, int y, int width)
 {
-    VMemType32 *p, *e;
-    unsigned long sp1, sp2;
+    VMemType32* p;
+    VMemType32* e;
+    unsigned long sp1;
+    unsigned long sp2;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    e=p+width;
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    e = p + width;
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    while( p<e ) {
-        unsigned long dp1, dp2;
+    while (p < e) {
+        unsigned long dp1;
+       unsigned long dp2;
 
-        dp1=*p;
-        dp2=(dp1&0xFF00FF00)>>8;
-        dp1&=0x00FF00FF;
-
-        dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-        dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-        *p++=(dp1|(dp2<<8));
+        dp1 = *p;
+        dp2 = (dp1 & 0xFF00FF00) >> 8;
+        dp1 &= 0x00FF00FF;
+
+        dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+        dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+        *p++ = (dp1 | (dp2 << 8));
     }
 }
 
@@ -1990,20 +1871,22 @@
 **     @param width    width of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw75TransHLineOpenGL(SysColors color,int x,int y,int width)
+local void Draw75TransHLineOpenGL(SysColors color, int x, int y, int width)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 64);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+width, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + width, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -2018,46 +1901,45 @@
 **     @param width    width of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransHLine8(SysColors color,int x,int y,int width
-        ,unsigned char alpha)
+local void DrawTransHLine8(SysColors color, int x, int y, int width,
+    unsigned char alpha)
 {
-    VMemType8 *p;
-    VMemType8 *e;
+    VMemType8* p;
+    VMemType8* e;
     unsigned c;
 
-    p=VideoMemory8+x+y*VideoWidth;
-    e=p+width;
-    c=Pixels8[color];
-
-    switch ( ((unsigned int)alpha * 4) / 255 )
-    {
-    case 0:
-      while( p<e ) {
-        *p++ = c;
-      }
-      break;
-    case 1:
-      while( p<e ) {
-        *p = lookup25trans8[ (*p<<8) | c ];
-       ++p;
-      }
-      break;
-    case 2:
-      c<<=8;
-      while( p<e ) {
-        *p = lookup50trans8[ c | *p ];
-       ++p;
-      }
-      break;
-    case 3:
-      c<<=8;
-      while( p<e ) {
-        *p = lookup25trans8[ c | *p ];
-       ++p;
-      }
-      break;
-    default:
-      break;
+    p = VideoMemory8 + x + y * VideoWidth;
+    e = p + width;
+    c = Pixels8[color];
+
+    switch (((unsigned int)alpha * 4) / 255) {
+       case 0:
+           while (p < e) {
+               *p++ = c;
+           }
+           break;
+       case 1:
+           while (p < e) {
+               *p = lookup25trans8[(*p << 8) | c];
+               ++p;
+           }
+           break;
+       case 2:
+           c <<= 8;
+           while (p < e) {
+               *p = lookup50trans8[c | *p];
+               ++p;
+           }
+           break;
+       case 3:
+           c <<= 8;
+           while (p < e) {
+               *p = lookup25trans8[c | *p];
+               ++p;
+           }
+           break;
+       default:
+           break;
     }
 }
 
@@ -2070,10 +1952,10 @@
 **     @param width    Line width in pixel
 **      @param alpha    alpha value of pixel
 */
-local void DrawNoTransHLine8(SysColors color,int x,int y,int width
-        ,unsigned char alpha __attribute__((unused)))
+local void DrawNoTransHLine8(SysColors color, int x, int y, int width,
+    unsigned char alpha __attribute__((unused)))
 {
-    DrawHLine8(color,x,y,width);
+    DrawHLine8(color, x, y, width);
 }
 
 /**
@@ -2085,27 +1967,27 @@
 **     @param width    width of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransHLine15(SysColors color,int x,int y,int width
-       ,unsigned char alpha)
+local void DrawTransHLine15(SysColors color, int x, int y, int width,
+    unsigned char alpha)
 {
-    VMemType16 *p;
-    VMemType16 *e;
+    VMemType16* p;
+    VMemType16* e;
     unsigned long sp;
 
-    p=VideoMemory16+y*VideoWidth+x;
-    e=p+width;
-    sp=Pixels16[color];
+    p = VideoMemory16 + y * VideoWidth + x;
+    e = p + width;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    alpha>>=3;                         // FIXME: only 5bits
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    alpha >>= 3;                               // FIXME: only 5bits
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-       dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F; //FIXME: alpha==256 unreached
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+       dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F; //FIXME: 
alpha==256 unreached
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -2118,27 +2000,27 @@
 **     @param width    width of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransHLine16(SysColors color,int x,int y,int width
-       ,unsigned char alpha)
+local void DrawTransHLine16(SysColors color, int x, int y, int width,
+    unsigned char alpha)
 {
-    VMemType16 *p;
-    VMemType16 *e;
+    VMemType16* p;
+    VMemType16* e;
     unsigned long sp;
 
-    p=VideoMemory16+y*VideoWidth+x;
-    e=p+width;
-    sp=Pixels16[color];
+    p = VideoMemory16 + y * VideoWidth + x;
+    e = p + width;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    alpha>>=3;                         // FIXME: only 5bits
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    alpha >>= 3;                               // FIXME: only 5bits
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-       dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F; //FIXME: alpha==256 unreached
-       *p++=(dp>>16)|dp;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+       dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F; //FIXME: 
alpha==256 unreached
+       *p++ = (dp >> 16) | dp;
     }
 }
 
@@ -2151,43 +2033,43 @@
 **     @param width    width of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransHLine24(SysColors color,int x,int y,int width
-       ,unsigned char alpha)
+local void DrawTransHLine24(SysColors color, int x, int y, int width,
+    unsigned char alpha)
 {
     VMemType24 c;
-    VMemType24 *p;
-    VMemType24 *e;
+    VMemType24* p;
+    VMemType24* e;
     unsigned spR;
     unsigned spG;
     unsigned spB;
 
-    p=VideoMemory24+y*VideoWidth+x;
-    e=p+width;
-    c=Pixels24[color];
-    spR=c.a;
-    spG=c.b;
-    spB=c.c;
+    p = VideoMemory24 + y * VideoWidth + x;
+    e = p + width;
+    c = Pixels24[color];
+    spR = c.a;
+    spG = c.b;
+    spB = c.c;
     // FIXME: untested; does 24bpp holds R|G|B ?
   //FIXME: alpha==256 unreached
 
-    while( p<e ) {
+    while (p < e) {
        unsigned int i;
 
-       c=*p;
+       c = *p;
 
-        i=c.a;
-        i=(((i-spR)*alpha)>>8)+spR;
-        c.a=i&0xFF;
+        i = c.a;
+        i = (((i - spR) * alpha) >> 8) + spR;
+        c.a = i & 0xFF;
 
-        i=c.b;
-        i=(((i-spG)*alpha)>>8)+spG;
-        c.b=i&0xFF;
+        i = c.b;
+        i = (((i - spG) * alpha) >> 8) + spG;
+        c.b = i & 0xFF;
 
-        i=c.c;
-        i=(((i-spB)*alpha)>>8)+spB;
-        c.c=i&0xFF;
+        i = c.c;
+        i = (((i - spB) * alpha) >> 8) + spB;
+        c.c = i & 0xFF;
 
-       *p++=c;
+       *p++ = c;
     }
 }
 
@@ -2200,55 +2082,55 @@
 **     @param width    width of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransHLine32(SysColors color,int x,int y,int width
-       ,unsigned char alpha)
+local void DrawTransHLine32(SysColors color, int x, int y, int width,
+    unsigned char alpha)
 {
-    VMemType32 *p;
-    VMemType32 *e;
+    VMemType32* p;
+    VMemType32* e;
     unsigned long sp1;
     unsigned long sp2;
 
-    p=VideoMemory32+y*VideoWidth+x;
-    e=p+width;
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    p = VideoMemory32 + y * VideoWidth + x;
+    e = p + width;
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    alpha>>=1;
+    alpha >>= 1;
 
-    while( p<e ) {
+    while (p < e) {
        unsigned long dp1;
        unsigned long dp2;
 
-       dp1=*p;
-       dp2=(dp1&0xFF00FF00)>>8;
-       dp1&=0x00FF00FF;
+       dp1 = *p;
+       dp2 = (dp1 & 0xFF00FF00) >> 8;
+       dp1 &= 0x00FF00FF;
 
         //FIXME: alpha==256 unreached
-        dp1=((((dp1-sp1)*alpha)>>7)+sp1)&0x00FF00FF;
-        dp2=((((dp2-sp2)*alpha)>>7)+sp2)&0x00FF00FF;
+        dp1 = ((((dp1 - sp1) * alpha) >> 7) + sp1) & 0x00FF00FF;
+        dp2 = ((((dp2 - sp2) * alpha) >> 7) + sp2) & 0x00FF00FF;
 
-       *p++=(dp1|(dp2<<8));
+       *p++ = (dp1 | (dp2 << 8));
     }
 }
 
-#define CLIP_HLINE(x,y,width) { \
-    if( y<ClipY1 || y>ClipY2 ) { \
-        return; \
+#define CLIP_HLINE(x, y, width) { \
+    if (y < ClipY1 || y > ClipY2) { \
+       return; \
     } \
-    if( x<ClipX1 ) { \
-        int f=ClipX1-x; \
-        if( width<=f ) { \
-            return; \
-        } \
-        width-=f; \
-        x=ClipX1; \
+    if (x < ClipX1) { \
+       int f = ClipX1 - x; \
+       if (width <= f) { \
+           return; \
+       } \
+       width -= f; \
+       x = ClipX1; \
     } \
-    if( (x+width)>ClipX2+1 ) { \
-        if( x>ClipX2 ) { \
-            return; \
-        } \
-        width=ClipX2-x+1; \
+    if ((x + width) > ClipX2 + 1) { \
+       if (x > ClipX2) { \
+           return; \
+       } \
+       width = ClipX2 - x + 1; \
     } \
 }
 
@@ -2262,20 +2144,23 @@
 **     @param alpha    alpha value of pixels.
 */
 #ifdef USE_OPENGL
-local void DrawTransHLineOpenGL(SysColors color,int x,int y,int width,unsigned 
char alpha)
+local void DrawTransHLineOpenGL(SysColors color, int x, int y, int width,
+    unsigned char alpha)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
-    glColor4ub(r, g, b, 255-alpha);
+    glColor4ub(r, g, b, 255 - alpha);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+width, VideoHeight-y);
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + width, VideoHeight - y);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -2288,10 +2173,10 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-global void VideoDrawHLineClip(SysColors color,int x,int y,int width)
+global void VideoDrawHLineClip(SysColors color, int x, int y, int width)
 {
-    CLIP_HLINE(x,y,width);
-    VideoDrawHLine(color,x,y,width);
+    CLIP_HLINE(x, y, width);
+    VideoDrawHLine(color, x, y, width);
 }
 
 /**
@@ -2302,10 +2187,10 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-global void VideoDraw25TransHLineClip(SysColors color,int x,int y,int width)
+global void VideoDraw25TransHLineClip(SysColors color, int x, int y, int width)
 {
-    CLIP_HLINE(x,y,width);
-    VideoDraw25TransHLine(color,x,y,width);
+    CLIP_HLINE(x, y, width);
+    VideoDraw25TransHLine(color, x, y, width);
 }
 
 /**
@@ -2316,10 +2201,10 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-global void VideoDraw50TransHLineClip(SysColors color,int x,int y,int width)
+global void VideoDraw50TransHLineClip(SysColors color, int x, int y, int width)
 {
-    CLIP_HLINE(x,y,width);
-    VideoDraw50TransHLine(color,x,y,width);
+    CLIP_HLINE(x, y, width);
+    VideoDraw50TransHLine(color, x, y, width);
 }
 
 /**
@@ -2330,10 +2215,10 @@
 **     @param y        y coordinate on the screen
 **     @param width    width of line (0=don't draw).
 */
-global void VideoDraw75TransHLineClip(SysColors color,int x,int y,int width)
+global void VideoDraw75TransHLineClip(SysColors color, int x, int y, int width)
 {
-    CLIP_HLINE(x,y,width);
-    VideoDraw75TransHLine(color,x,y,width);
+    CLIP_HLINE(x, y, width);
+    VideoDraw75TransHLine(color, x, y, width);
 }
 
 /**
@@ -2345,11 +2230,11 @@
 **     @param width    Width of line (0=don't draw)
 **     @param alpha    Alpha value of pixels
 */
-global void VideoDrawTransHLineClip(SysColors color,int x,int y,int width
-       ,unsigned char alpha)
+global void VideoDrawTransHLineClip(SysColors color, int x, int y, int width,
+    unsigned char alpha)
 {
-    CLIP_HLINE(x,y,width);
-    VideoDrawTransHLine(color,x,y,width,alpha);
+    CLIP_HLINE(x, y, width);
+    VideoDrawTransHLine(color, x, y, width,alpha);
 }
 
 // ===========================================================================
@@ -2364,20 +2249,20 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void DrawVLine8(SysColors color,int x,int y,int height)
+local void DrawVLine8(SysColors color, int x, int y, int height)
 {
     VMemType8* p;
     VMemType8* e;
     int w;
     int f;
 
-    w=VideoWidth;
-    p=VideoMemory8+y*w+x;
-    e=p+height*w;
-    f=Pixels8[color];
-    while( p<e ) {                     // FIXME: better
-       *p=f;
-       p+=w;
+    w = VideoWidth;
+    p = VideoMemory8 + y * w + x;
+    e = p + height * w;
+    f = Pixels8[color];
+    while (p < e) {                    // FIXME: better
+       *p = f;
+       p += w;
     }
 }
 
@@ -2389,20 +2274,20 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void DrawVLine16(SysColors color,int x,int y,int height)
+local void DrawVLine16(SysColors color, int x, int y, int height)
 {
     VMemType16* p;
     VMemType16* e;
     int w;
     int f;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    e=p+height*w;
-    f=Pixels16[color];
-    while( p<e ) {                     // FIXME: better
-       *p=f;
-       p+=w;
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    e = p + height * w;
+    f = Pixels16[color];
+    while (p < e) {                    // FIXME: better
+       *p = f;
+       p += w;
     }
 }
 
@@ -2414,20 +2299,20 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void DrawVLine24(SysColors color,int x,int y,int height)
+local void DrawVLine24(SysColors color, int x, int y, int height)
 {
     VMemType24* p;
     VMemType24* e;
     int w;
     VMemType24 f;
 
-    w=VideoWidth;
-    p=VideoMemory24+y*w+x;
-    e=p+height*w;
-    f=Pixels24[color];
-    while( p<e ) {                     // FIXME: better
-       *p=f;
-       p+=w;
+    w = VideoWidth;
+    p = VideoMemory24 + y * w + x;
+    e = p + height * w;
+    f = Pixels24[color];
+    while (p < e) {                    // FIXME: better
+       *p = f;
+       p += w;
     }
 }
 
@@ -2439,20 +2324,20 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void DrawVLine32(SysColors color,int x,int y,int height)
+local void DrawVLine32(SysColors color, int x, int y, int height)
 {
     VMemType32* p;
     VMemType32* e;
     int w;
     int f;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    e=p+height*w;
-    f=Pixels32[color];
-    while( p<e ) {                     // FIXME: better
-       *p=f;
-       p+=w;
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    e = p + height * w;
+    f = Pixels32[color];
+    while (p < e) {                    // FIXME: better
+       *p = f;
+       p += w;
     }
 }
 
@@ -2465,20 +2350,22 @@
 **     @param height   height of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void DrawVLineOpenGL(SysColors color,int x,int y,int height)
+local void DrawVLineOpenGL(SysColors color, int x, int y, int height)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor3ub(r, g, b);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+height));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + height));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -2492,18 +2379,18 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw25TransVLine8(SysColors color,int x,int y,int height)
+local void Draw25TransVLine8(SysColors color, int x, int y, int height)
 {
-    VMemType8 *p;
+    VMemType8* p;
     unsigned int c;
     int w;
 
     w = VideoWidth;
-    p = VideoMemory8+x+y*w;
-    c = Pixels8[color]<<8;
-    while( height-- ) {
-        *p = lookup25trans8[ c | *p ];
-        p+=w;
+    p = VideoMemory8 + x + y * w;
+    c = Pixels8[color] << 8;
+    while (height--) {
+        *p = lookup25trans8[c | *p];
+        p += w;
     }
 }
 
@@ -2515,26 +2402,26 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw25TransVLine15(SysColors color,int x,int y,int height)
+local void Draw25TransVLine15(SysColors color, int x, int y, int height)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x03E07C1F)*3;
+    sp = (((sp << 16) | sp) & 0x03E07C1F) * 3;
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-        dp=((dp+sp)>>2)&0x03E07C1F;
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+        dp = ((dp + sp) >> 2) & 0x03E07C1F;
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -2546,26 +2433,26 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw25TransVLine16(SysColors color,int x,int y,int height)
+local void Draw25TransVLine16(SysColors color, int x, int y, int height)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x07E0F81F)*3;
+    sp = (((sp << 16) | sp) & 0x07E0F81F) * 3;
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-        dp=((dp+sp)>>2)&0x07E0F81F;
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+        dp = ((dp + sp) >> 2) & 0x07E0F81F;
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -2577,10 +2464,10 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw25TransVLine24(SysColors color,int x,int y,int height)
+local void Draw25TransVLine24(SysColors color, int x, int y, int height)
 {
     // FIXME: does 24bpp holds R|G|B ?
-    DrawVLine24(color,x,y,height); // no trans functionaility for the moment :(
+    DrawVLine24(color, x, y, height); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -2591,31 +2478,31 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw25TransVLine32(SysColors color,int x,int y,int height)
+local void Draw25TransVLine32(SysColors color, int x, int y, int height)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1,sp2;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    sp1=Pixels32[color];
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=((sp1&0xFF00FF00)>>8)*3;
-    sp1=(sp1&0x00FF00FF)*3;
+    sp2 = ((sp1 & 0xFF00FF00) >> 8) * 3;
+    sp1 = (sp1 & 0x00FF00FF) * 3;
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp1, dp2;
 
-       dp1=*p;
-        dp2=(dp1&0xFF00FF00)>>8;
-        dp1&=0x00FF00FF;
-
-        dp1=((dp1+sp1)>>2)&0x00FF00FF;
-        dp2=((dp2+sp2)>>2)&0x00FF00FF;
-        *p=(dp1|(dp2<<8));
+       dp1 = *p;
+        dp2 = (dp1 & 0xFF00FF00) >> 8;
+        dp1 &= 0x00FF00FF;
+
+        dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+        dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+        *p = (dp1 | (dp2 << 8));
 
-        p+=w;
+        p += w;
     }
 }
 
@@ -2628,20 +2515,20 @@
 **     @param height   height of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw25TransVLineOpenGL(SysColors color,int x,int y,int height)
+local void Draw25TransVLineOpenGL(SysColors color, int x, int y, int height)
 {
     VMemType32 c;
     GLubyte r,g,b;
 
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 192);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+height));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + height));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -2655,18 +2542,18 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw50TransVLine8(SysColors color,int x,int y,int height)
+local void Draw50TransVLine8(SysColors color, int x, int y, int height)
 {
-    VMemType8 *p;
+    VMemType8* p;
     unsigned int c;
     int w;
 
     w = VideoWidth;
-    p = VideoMemory8+x+y*w;
-    c = Pixels8[color]<<8;
-    while( height-- ) {
-        *p = lookup50trans8[ c | *p ];
-        p+=w;
+    p = VideoMemory8 + x + y * w;
+    c = Pixels8[color] << 8;
+    while (height--) {
+        *p = lookup50trans8[c | *p];
+        p += w;
     }
 }
 
@@ -2678,25 +2565,25 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw50TransVLine15(SysColors color,int x,int y,int height)
+local void Draw50TransVLine15(SysColors color, int x, int y, int height)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-        dp=((dp+sp)>>1)&0x03E07C1F;
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+        dp = ((dp + sp) >> 1) & 0x03E07C1F;
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -2708,26 +2595,26 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw50TransVLine16(SysColors color,int x,int y,int height)
+local void Draw50TransVLine16(SysColors color, int x, int y, int height)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=((sp<<16)|sp)&0x07E0F81F;
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-        dp=((dp+sp)>>1)&0x07E0F81F;
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+        dp = ((dp + sp) >> 1) & 0x07E0F81F;
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -2739,10 +2626,10 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw50TransVLine24(SysColors color,int x,int y,int height)
+local void Draw50TransVLine24(SysColors color, int x, int y, int height)
 {
     // FIXME: does 24bpp holds R|G|B ?
-    DrawVLine24(color,x,y,height); // no trans functionaility for the moment :(
+    DrawVLine24(color, x, y, height); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -2753,30 +2640,32 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw50TransVLine32(SysColors color,int x,int y,int height)
+local void Draw50TransVLine32(SysColors color, int x, int y, int height)
 {
-    VMemType32 *p;
-    unsigned long sp1,sp2;
+    VMemType32* p;
+    unsigned long sp1;
+    unsigned long sp2;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    while( height-- ) {
-       unsigned long dp1, dp2;
+    while (height--) {
+       unsigned long dp1;
+       unsigned long dp2;
 
-       dp1=*p;
-        dp2=(dp1&0xFF00FF00)>>8;
-        dp1&=0x00FF00FF;
-
-        dp1=((dp1+sp1)>>1)&0x00FF00FF;
-        dp2=((dp2+sp2)>>1)&0x00FF00FF;
-        *p=(dp1|(dp2<<8));
+       dp1 = *p;
+        dp2 = (dp1 & 0xFF00FF00) >> 8;
+        dp1 &= 0x00FF00FF;
+
+        dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+        dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+        *p = (dp1 | (dp2 << 8));
 
-        p+=w;
+        p += w;
     }
 }
 
@@ -2789,20 +2678,22 @@
 **     @param height   height of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw50TransVLineOpenGL(SysColors color,int x,int y,int height)
+local void Draw50TransVLineOpenGL(SysColors color, int x, int y, int height)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 128);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+height));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + height));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -2816,18 +2707,18 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw75TransVLine8(SysColors color,int x,int y,int height)
+local void Draw75TransVLine8(SysColors color, int x, int y, int height)
 {
-    VMemType8 *p;
+    VMemType8* p;
     unsigned int c;
     int w;
 
     w = VideoWidth;
-    p = VideoMemory8+x+y*w;
+    p = VideoMemory8 + x + y * w;
     c = Pixels8[color];
-    while( height-- ) {
-        *p = lookup25trans8[ (*p<<8) | c ];
-        p+=w;
+    while (height--) {
+        *p = lookup25trans8[(*p << 8) | c];
+        p += w;
     }
 }
 
@@ -2839,26 +2730,26 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw75TransVLine15(SysColors color,int x,int y,int height)
+local void Draw75TransVLine15(SysColors color, int x, int y, int height)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=((sp<<16)|sp)&0x03E07C1F;
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-        dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+        dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -2870,26 +2761,26 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw75TransVLine16(SysColors color,int x,int y,int height)
+local void Draw75TransVLine16(SysColors color, int x, int y, int height)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=((sp<<16)|sp)&0x07E0F81F;
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-        dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+        dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -2901,10 +2792,10 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw75TransVLine24(SysColors color,int x,int y,int height)
+local void Draw75TransVLine24(SysColors color, int x, int y, int height)
 {
     // FIXME: does 24bpp holds R|G|B ?
-    DrawVLine24(color,x,y,height); // no trans functionaility for the moment :(
+    DrawVLine24(color, x, y, height); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -2915,30 +2806,32 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-local void Draw75TransVLine32(SysColors color,int x,int y,int height)
+local void Draw75TransVLine32(SysColors color, int x, int y, int height)
 {
-    VMemType32 *p;
-    unsigned long sp1,sp2;
+    VMemType32* p;
+    unsigned long sp1;
+    unsigned long sp2;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    while( height-- ) {
-       unsigned long dp1, dp2;
+    while (height--) {
+       unsigned long dp1;
+       unsigned long dp2;
 
-       dp1=*p;
-        dp2=(dp1&0xFF00FF00)>>8;
-        dp1&=0x00FF00FF;
-
-        dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-        dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-        *p=(dp1|(dp2<<8));
+       dp1 = *p;
+        dp2 = (dp1 & 0xFF00FF00) >> 8;
+        dp1 &= 0x00FF00FF;
+
+        dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+        dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+        *p = (dp1 | (dp2 << 8));
 
-        p+=w;
+        p += w;
     }
 }
 
@@ -2951,20 +2844,22 @@
 **     @param height   height of line (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw75TransVLineOpenGL(SysColors color,int x,int y,int height)
+local void Draw75TransVLineOpenGL(SysColors color, int x, int y, int height)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 64);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+height));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + height));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -2979,43 +2874,42 @@
 **     @param height   height of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransVLine8(SysColors color,int x,int y,int height
-        ,unsigned char alpha)
+local void DrawTransVLine8(SysColors color, int x, int y, int height,
+    unsigned char alpha)
 {
-    VMemType8 *p;
+    VMemType8* p;
     unsigned int c;
     int w;
 
     w = VideoWidth;
-    p = VideoMemory8+x+y*w;
+    p = VideoMemory8 + x + y * w;
     c = Pixels8[color];
 
-    switch ( ((unsigned int)alpha * 4) / 255 )
-    {
+    switch (((unsigned int)alpha * 4) / 255) {
        case 0:
-           while( height-- ) {
+           while (height--) {
                *p = c;
-               p+=w;
+               p += w;
            }
            break;
        case 1:
-           while( height-- ) {
-               *p = lookup25trans8[ (*p<<8) | c ];
-               p+=w;
+           while (height--) {
+               *p = lookup25trans8[(*p << 8) | c];
+               p += w;
            }
            break;
        case 2:
-           c<<=8;
-           while( height-- ) {
-               *p = lookup50trans8[ c | *p ];
-               p+=w;
+           c <<= 8;
+           while (height--) {
+               *p = lookup50trans8[c | *p];
+               p += w;
            }
            break;
        case 3:
-           c<<=8;
-           while( height-- ) {
-               *p = lookup25trans8[ c | *p ];
-               p+=w;
+           c <<= 8;
+           while (height--) {
+               *p = lookup25trans8[c | *p];
+               p += w;
            }
            break;
        default:
@@ -3032,10 +2926,10 @@
 **     @param height   Height = length of the line.
 **      @param alpha    alpha value of pixel.
 */
-local void DrawNoTransVLine8(SysColors color,int x,int y,int height
-        ,unsigned char alpha __attribute__((unused)))
+local void DrawNoTransVLine8(SysColors color, int x, int y, int height,
+    unsigned char alpha __attribute__((unused)))
 {
-    DrawVLine8(color,x,y,height);
+    DrawVLine8(color, x, y, height);
 }
 
 /**
@@ -3047,28 +2941,28 @@
 **     @param height   height of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransVLine15(SysColors color,int x,int y,int height
-       ,unsigned char alpha)
+local void DrawTransVLine15(SysColors color, int x, int y, int height,
+    unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    alpha>>=3;                         // FIXME: only 5bits
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    alpha >>= 3;                               // FIXME: only 5bits
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x03E07C1F;
-       dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F; //FIXME: alpha==256 unreached
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x03E07C1F;
+       dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F; //FIXME: 
alpha==256 unreached
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -3081,28 +2975,28 @@
 **     @param height   height of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransVLine16(SysColors color,int x,int y,int height
-       ,unsigned char alpha)
+local void DrawTransVLine16(SysColors color, int x, int y, int height,
+    unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory16+y*w+x;
-    sp=Pixels16[color];
+    w = VideoWidth;
+    p = VideoMemory16 + y * w + x;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    alpha>>=3;                         // FIXME: only 5bits
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    alpha >>= 3;                               // FIXME: only 5bits
 
-    while( height-- ) {
+    while (height--) {
        unsigned long dp;
 
-       dp=*p;
-       dp=((dp<<16)|dp)&0x07E0F81F;
-       dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F; //FIXME: alpha==256 unreached
-       *p=(dp>>16)|dp;
-        p+=w;
+       dp = *p;
+       dp = ((dp << 16) | dp) & 0x07E0F81F;
+       dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F; //FIXME: 
alpha==256 unreached
+       *p = (dp >> 16) | dp;
+        p += w;
     }
 }
 
@@ -3115,11 +3009,11 @@
 **     @param height   height of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransVLine24(SysColors color,int x,int y,int height
-       ,unsigned char alpha __attribute__((unused)))
+local void DrawTransVLine24(SysColors color, int x, int y, int height,
+    unsigned char alpha __attribute__((unused)))
 {
     // FIXME: does 24bpp holds R|G|B ?
-    DrawVLine24(color,x,y,height); // no trans functionaility for the moment :(
+    DrawVLine24(color, x, y, height); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -3131,52 +3025,54 @@
 **     @param height   height of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-local void DrawTransVLine32(SysColors color,int x,int y,int height
-       ,unsigned char alpha)
+local void DrawTransVLine32(SysColors color, int x, int y, int height,
+    unsigned char alpha)
 {
-    VMemType32 *p;
-    unsigned long sp1,sp2;
+    VMemType32* p;
+    unsigned long sp1;
+    unsigned long sp2;
     int w;
 
-    w=VideoWidth;
-    p=VideoMemory32+y*w+x;
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    w = VideoWidth;
+    p = VideoMemory32 + y * w + x;
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    while( height-- ) {
-       unsigned long dp1, dp2;
+    while (height--) {
+       unsigned long dp1;
+       unsigned long dp2;
 
-       dp1=*p;
-        dp2=(dp1&0xFF00FF00)>>8;
-        dp1&=0x00FF00FF;
+       dp1 = *p;
+        dp2 = (dp1 & 0xFF00FF00) >> 8;
+        dp1 &= 0x00FF00FF;
 
         //FIXME: alpha==256 unreached
-        dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-        dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-        *p=(dp1|(dp2<<8));
+        dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+        dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+        *p = (dp1 | (dp2 << 8));
 
-        p+=w;
+        p += w;
     }
 }
 
-#define CLIP_VLINE(x,y,width) { \
-    if( x<ClipX1 || x>ClipX2 ) { \
-        return; \
+#define CLIP_VLINE(x, y, width) { \
+    if (x < ClipX1 || x > ClipX2) { \
+       return; \
     } \
-    if( y<ClipY1 ) { \
-        int f=ClipY1-y; \
-        if( height<=f ) { \
-            return; \
-        } \
-        height-=f; \
-        y=ClipY1; \
+    if (y < ClipY1) { \
+       int f = ClipY1 - y; \
+       if (height <= f) { \
+           return; \
+       } \
+       height -= f; \
+       y = ClipY1; \
     } \
-    if( (y+height)>ClipY2+1 ) { \
-        if( y>ClipY2 ) { \
-            return; \
-        } \
-        height=ClipY2-y+1; \
+    if ((y + height) > ClipY2 + 1) { \
+       if (y > ClipY2) { \
+           return; \
+       } \
+       height = ClipY2 - y + 1; \
     } \
 }
 
@@ -3190,20 +3086,23 @@
 **     @param alpha    alpha value of pixels.
 */
 #ifdef USE_OPENGL
-local void DrawTransVLineOpenGL(SysColors color,int x,int y,int 
height,unsigned char alpha)
+local void DrawTransVLineOpenGL(SysColors color, int x, int y, int height,
+    unsigned char alpha)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
-    glColor4ub(r, g, b, 255-alpha);
+    glColor4ub(r, g, b, 255 - alpha);
     glBegin(GL_LINES);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+height));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + height));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -3217,10 +3116,10 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-global void VideoDrawVLineClip(SysColors color,int x,int y,int height)
+global void VideoDrawVLineClip(SysColors color, int x, int y, int height)
 {
-    CLIP_VLINE(x,y,height);
-    VideoDrawVLine(color,x,y,height);
+    CLIP_VLINE(x, y, height);
+    VideoDrawVLine(color, x, y, height);
 }
 
 /**
@@ -3231,11 +3130,11 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-global void VideoDraw25TransVLineClip(SysColors color,int x,int y,
-                                      int height)
+global void VideoDraw25TransVLineClip(SysColors color, int x, int y,
+    int height)
 {
-    CLIP_VLINE(x,y,height);
-    VideoDraw25TransVLine(color,x,y,height);
+    CLIP_VLINE(x, y, height);
+    VideoDraw25TransVLine(color, x, y, height);
 }
 
 /**
@@ -3246,11 +3145,11 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-global void VideoDraw50TransVLineClip(SysColors color,int x,int y,
-                                      int height)
+global void VideoDraw50TransVLineClip(SysColors color, int x, int y,
+    int height)
 {
-    CLIP_VLINE(x,y,height);
-    VideoDraw50TransVLine(color,x,y,height);
+    CLIP_VLINE(x, y, height);
+    VideoDraw50TransVLine(color, x, y, height);
 }
 
 /**
@@ -3261,11 +3160,11 @@
 **     @param y        y coordinate on the screen
 **     @param height   height of line (0=don't draw).
 */
-global void VideoDraw75TransVLineClip(SysColors color,int x,int y,
-                                      int height)
+global void VideoDraw75TransVLineClip(SysColors color, int x, int y,
+    int height)
 {
-    CLIP_VLINE(x,y,height);
-    VideoDraw75TransVLine(color,x,y,height);
+    CLIP_VLINE(x, y, height);
+    VideoDraw75TransVLine(color, x, y, height);
 }
 
 /**
@@ -3277,11 +3176,11 @@
 **     @param height   height of line (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-global void VideoDrawTransVLineClip(SysColors color,int x,int y,
-                                    int height,unsigned char alpha)
+global void VideoDrawTransVLineClip(SysColors color, int x, int y,
+    int height,unsigned char alpha)
 {
-    CLIP_VLINE(x,y,height);
-    VideoDrawTransVLine(color,x,y,height,alpha);
+    CLIP_VLINE(x, y, height);
+    VideoDrawTransVLine(color, x, y, height, alpha);
 }
 
 // ===========================================================================
@@ -3297,7 +3196,7 @@
 **     @param x2       Destination x coordinate on the screen
 **     @param y2       Destination y coordinate on the screen
 */
-local void DrawLine8(SysColors color,int x1,int y1,int x2,int y2)
+local void DrawLine8(SysColors color, int x1, int y1, int x2, int y2)
 {
     int d;
     int dx;
@@ -3307,84 +3206,84 @@
     int w;
     unsigned f;
 
-    if( x1==x2 ) {
-       if( y1<y2 ) {
-           DrawVLine8(color,x1,y1,y2-y1+1);
+    if (x1 == x2) {
+       if (y1<y2) {
+           DrawVLine8(color, x1, y1, y2 - y1 + 1);
        } else {
-           DrawVLine8(color,x2,y2,y1-y2+1);
+           DrawVLine8(color, x2, y2, y1 - y2 + 1);
        }
        return;
     }
-    if( y1==y2 ) {
-       if( x1<x2 ) {
-           DrawHLine8(color,x1,y1,x2-x1+1);
+    if (y1 == y2) {
+       if (x1 < x2) {
+           DrawHLine8(color, x1, y1, x2 - x1 + 1);
        } else {
-           DrawHLine8(color,x2,y2,x1-x2+1);
+           DrawHLine8(color, x2, y2, x1 - x2 + 1);
        }
        return;
     }
 
     // initialize
 
-    w=VideoWidth;
-    f=Pixels8[color];
+    w = VideoWidth;
+    f = Pixels8[color];
 
-    if( y1>y2 ) {              // exchange coordinates
-       x1^=x2; x2^=x1; x1^=x2;
-       y1^=y2; y2^=y1; y1^=y2;
-    }
-    dy=y2-y1;
-    xstep=1;
-    dx=x2-x1;
-    if( dx<0 ) {
-       dx=-dx;
-       xstep=-1;
-    }
-
-    p=VideoMemory8+w*y1+x1;
-    *p=f;
-
-    if( dx<dy ) {              // step in vertical direction
-       d=dy-1;
-       dx+=dx;
-       dy+=dy;
-       while( y1!=y2 ) {
+    if (y1 > y2) {             // exchange coordinates
+       x1 ^= x2; x2 ^= x1; x1 ^= x2;
+       y1 ^= y2; y2 ^= y1; y1 ^= y2;
+    }
+    dy = y2 - y1;
+    xstep = 1;
+    dx = x2 - x1;
+    if (dx < 0) {
+       dx = -dx;
+       xstep = -1;
+    }
+
+    p = VideoMemory8 + w * y1 + x1;
+    *p = f;
+
+    if (dx < dy) {             // step in vertical direction
+       d = dy - 1;
+       dx += dx;
+       dy += dy;
+       while (y1 != y2) {
            y1++;
-           p+=w;
-           d-=dx;
-           if( d<0 ) {
-               d+=dy;
-               p+=xstep;
+           p += w;
+           d -= dx;
+           if (d < 0) {
+               d += dy;
+               p += xstep;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    if( dx>dy ) {              // step in horizontal direction
-       d=dx-1;
-       dx+=dx;
-       dy+=dy;
-
-       while( x1!=x2 ) {
-           x1+=xstep;
-           p+=xstep;
-           d-=dy;
-           if( d<0 ) {
-               d+=dx;
-               p+=w;
+    if (dx > dy) {             // step in horizontal direction
+       d = dx - 1;
+       dx += dx;
+       dy += dy;
+
+       while (x1 != x2) {
+           x1 += xstep;
+           p += xstep;
+           d -= dy;
+           if (d < 0) {
+               d += dx;
+               p += w;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    while( y1!=y2) {                   // diagonal line
-       //x1+=xstep;
-       p+=xstep;
+    while (y1 != y2) {                 // diagonal line
+       //x1 += xstep;
+       p += xstep;
        y1++;
-       p+=w;
-       *p=f;
+       p += w;
+       *p = f;
     }
 }
 
@@ -3397,7 +3296,7 @@
 **     @param x2       Destination x coordinate on the screen
 **     @param y2       Destination y coordinate on the screen
 */
-local void DrawLine16(SysColors color,int x1,int y1,int x2,int y2)
+local void DrawLine16(SysColors color, int x1, int y1, int x2, int y2)
 {
     int d;
     int dx;
@@ -3407,84 +3306,84 @@
     int w;
     unsigned f;
 
-    if( x1==x2 ) {
-       if( y1<y2 ) {
-           DrawVLine16(color,x1,y1,y2-y1+1);
+    if (x1 == x2) {
+       if (y1 < y2) {
+           DrawVLine16(color, x1, y1, y2 - y1 + 1);
        } else {
-           DrawVLine16(color,x2,y2,y1-y2+1);
+           DrawVLine16(color, x2, y2, y1 - y2 + 1);
        }
        return;
     }
-    if( y1==y2 ) {
-       if( x1<x2 ) {
-           DrawHLine16(color,x1,y1,x2-x1+1);
+    if (y1 == y2) {
+       if (x1 < x2) {
+           DrawHLine16(color, x1, y1, x2 - x1 + 1);
        } else {
-           DrawHLine16(color,x2,y2,x1-x2+1);
+           DrawHLine16(color, x2, y2, x1 - x2 + 1);
        }
        return;
     }
 
     // initialize
 
-    w=VideoWidth;
-    f=Pixels16[color];
+    w = VideoWidth;
+    f = Pixels16[color];
 
-    if( y1>y2 ) {              // exchange coordinates
-       x1^=x2; x2^=x1; x1^=x2;
-       y1^=y2; y2^=y1; y1^=y2;
-    }
-    dy=y2-y1;
-    xstep=1;
-    dx=x2-x1;
-    if( dx<0 ) {
-       dx=-dx;
-       xstep=-1;
-    }
-
-    p=VideoMemory16+w*y1+x1;
-    *p=f;
-
-    if( dx<dy ) {              // step in vertical direction
-       d=dy-1;
-       dx+=dx;
-       dy+=dy;
-       while( y1!=y2 ) {
+    if (y1 > y2) {             // exchange coordinates
+       x1 ^= x2; x2 ^= x1; x1 ^= x2;
+       y1 ^= y2; y2 ^= y1; y1 ^= y2;
+    }
+    dy = y2 - y1;
+    xstep = 1;
+    dx = x2 - x1;
+    if (dx < 0) {
+       dx = -dx;
+       xstep = -1;
+    }
+
+    p = VideoMemory16 + w * y1 + x1;
+    *p = f;
+
+    if (dx < dy) {             // step in vertical direction
+       d = dy - 1;
+       dx += dx;
+       dy += dy;
+       while (y1 != y2) {
            y1++;
-           p+=w;
-           d-=dx;
-           if( d<0 ) {
-               d+=dy;
-               p+=xstep;
+           p += w;
+           d -= dx;
+           if (d < 0) {
+               d += dy;
+               p += xstep;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    if( dx>dy ) {              // step in horizontal direction
-       d=dx-1;
-       dx+=dx;
-       dy+=dy;
-
-       while( x1!=x2 ) {
-           x1+=xstep;
-           p+=xstep;
-           d-=dy;
-           if( d<0 ) {
-               d+=dx;
-               p+=w;
+    if (dx > dy) {             // step in horizontal direction
+       d = dx - 1;
+       dx += dx;
+       dy += dy;
+
+       while (x1 != x2) {
+           x1 += xstep;
+           p += xstep;
+           d -= dy;
+           if (d < 0) {
+               d += dx;
+               p += w;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    while( y1!=y2) {                   // diagonal line
-       //x1+=xstep;
-       p+=xstep;
+    while (y1 != y2) {                 // diagonal line
+       //x1 += xstep;
+       p += xstep;
        y1++;
-       p+=w;
-       *p=f;
+       p += w;
+       *p = f;
     }
 }
 
@@ -3497,7 +3396,7 @@
 **     @param x2       Destination x coordinate on the screen
 **     @param y2       Destination y coordinate on the screen
 */
-local void DrawLine24(SysColors color,int x1,int y1,int x2,int y2)
+local void DrawLine24(SysColors color, int x1, int y1, int x2, int y2)
 {
     int d;
     int dx;
@@ -3507,84 +3406,84 @@
     int w;
     VMemType24 f;
 
-    if( x1==x2 ) {
-       if( y1<y2 ) {
-           DrawVLine24(color,x1,y1,y2-y1+1);
+    if (x1 == x2) {
+       if (y1<y2) {
+           DrawVLine24(color, x1, y1, y2 - y1 + 1);
        } else {
-           DrawVLine24(color,x2,y2,y1-y2+1);
+           DrawVLine24(color, x2, y2, y1 - y2 + 1);
        }
        return;
     }
-    if( y1==y2 ) {
-       if( x1<x2 ) {
-           DrawHLine24(color,x1,y1,x2-x1+1);
+    if (y1 == y2) {
+       if (x1 < x2) {
+           DrawHLine24(color, x1, y1, x2 - x1 + 1);
        } else {
-           DrawHLine24(color,x2,y2,x1-x2+1);
+           DrawHLine24(color, x2, y2, x1 - x2 + 1);
        }
        return;
     }
 
     // initialize
 
-    w=VideoWidth;
-    f=Pixels24[color];
+    w = VideoWidth;
+    f = Pixels24[color];
 
-    if( y1>y2 ) {              // exchange coordinates
-       x1^=x2; x2^=x1; x1^=x2;
-       y1^=y2; y2^=y1; y1^=y2;
-    }
-    dy=y2-y1;
-    xstep=1;
-    dx=x2-x1;
-    if( dx<0 ) {
-       dx=-dx;
-       xstep=-1;
-    }
-
-    p=VideoMemory24+w*y1+x1;
-    *p=f;
-
-    if( dx<dy ) {              // step in vertical direction
-       d=dy-1;
-       dx+=dx;
-       dy+=dy;
-       while( y1!=y2 ) {
+    if (y1 > y2) {             // exchange coordinates
+       x1 ^= x2; x2 ^= x1; x1 ^= x2;
+       y1 ^= y2; y2 ^= y1; y1 ^= y2;
+    }
+    dy = y2 - y1;
+    xstep = 1;
+    dx = x2 - x1;
+    if (dx < 0) {
+       dx = -dx;
+       xstep = -1;
+    }
+
+    p = VideoMemory24 + w * y1 + x1;
+    *p = f;
+
+    if (dx < dy) {             // step in vertical direction
+       d = dy - 1;
+       dx += dx;
+       dy += dy;
+       while (y1 != y2) {
            y1++;
-           p+=w;
-           d-=dx;
-           if( d<0 ) {
-               d+=dy;
-               p+=xstep;
+           p += w;
+           d -= dx;
+           if (d < 0) {
+               d += dy;
+               p += xstep;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    if( dx>dy ) {              // step in horizontal direction
-       d=dx-1;
-       dx+=dx;
-       dy+=dy;
-
-       while( x1!=x2 ) {
-           x1+=xstep;
-           p+=xstep;
-           d-=dy;
-           if( d<0 ) {
-               d+=dx;
-               p+=w;
+    if (dx > dy) {             // step in horizontal direction
+       d = dx - 1;
+       dx += dx;
+       dy += dy;
+
+       while (x1 != x2) {
+           x1 += xstep;
+           p += xstep;
+           d -= dy;
+           if (d < 0) {
+               d += dx;
+               p += w;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    while( y1!=y2) {                   // diagonal line
-       //x1+=xstep;
-       p+=xstep;
+    while (y1 != y2) {                 // diagonal line
+       //x1 += xstep;
+       p += xstep;
        y1++;
-       p+=w;
-       *p=f;
+       p += w;
+       *p = f;
     }
 }
 
@@ -3597,7 +3496,7 @@
 **     @param x2       Destination x coordinate on the screen
 **     @param y2       Destination y coordinate on the screen
 */
-local void DrawLine32(SysColors color,int x1,int y1,int x2,int y2)
+local void DrawLine32(SysColors color, int x1, int y1, int x2, int y2)
 {
     int d;
     int dx;
@@ -3607,84 +3506,84 @@
     int w;
     unsigned f;
 
-    if( x1==x2 ) {
-       if( y1<y2 ) {
-           DrawVLine32(color,x1,y1,y2-y1+1);
+    if (x1 == x2) {
+       if (y1 < y2) {
+           DrawVLine32(color, x1, y1, y2 - y1 + 1);
        } else {
-           DrawVLine32(color,x2,y2,y1-y2+1);
+           DrawVLine32(color, x2, y2, y1 - y2 + 1);
        }
        return;
     }
-    if( y1==y2 ) {
-       if( x1<x2 ) {
-           DrawHLine32(color,x1,y1,x2-x1+1);
+    if (y1 == y2) {
+       if (x1 < x2) {
+           DrawHLine32(color, x1, y1, x2 - x1 + 1);
        } else {
-           DrawHLine32(color,x2,y2,x1-x2+1);
+           DrawHLine32(color, x2, y2, x1 - x2 + 1);
        }
        return;
     }
 
     // initialize
 
-    w=VideoWidth;
-    f=Pixels32[color];
+    w = VideoWidth;
+    f = Pixels32[color];
 
-    if( y1>y2 ) {              // exchange coordinates
-       x1^=x2; x2^=x1; x1^=x2;
-       y1^=y2; y2^=y1; y1^=y2;
-    }
-    dy=y2-y1;
-    xstep=1;
-    dx=x2-x1;
-    if( dx<0 ) {
-       dx=-dx;
-       xstep=-1;
-    }
-
-    p=VideoMemory32+w*y1+x1;
-    *p=f;
-
-    if( dx<dy ) {              // step in vertical direction
-       d=dy-1;
-       dx+=dx;
-       dy+=dy;
-       while( y1!=y2 ) {
+    if (y1 > y2) {             // exchange coordinates
+       x1 ^= x2; x2 ^= x1; x1 ^= x2;
+       y1 ^= y2; y2 ^= y1; y1 ^= y2;
+    }
+    dy = y2 - y1;
+    xstep = 1;
+    dx = x2 - x1;
+    if (dx < 0) {
+       dx = -dx;
+       xstep = -1;
+    }
+
+    p = VideoMemory32 + w * y1 + x1;
+    *p = f;
+
+    if (dx < dy) {             // step in vertical direction
+       d = dy - 1;
+       dx += dx;
+       dy += dy;
+       while (y1 != y2) {
            y1++;
-           p+=w;
-           d-=dx;
-           if( d<0 ) {
-               d+=dy;
-               p+=xstep;
+           p += w;
+           d -= dx;
+           if (d < 0) {
+               d += dy;
+               p += xstep;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    if( dx>dy ) {              // step in horizontal direction
-       d=dx-1;
-       dx+=dx;
-       dy+=dy;
-
-       while( x1!=x2 ) {
-           x1+=xstep;
-           p+=xstep;
-           d-=dy;
-           if( d<0 ) {
-               d+=dx;
-               p+=w;
+    if (dx > dy) {             // step in horizontal direction
+       d = dx - 1;
+       dx += dx;
+       dy += dy;
+
+       while (x1 != x2) {
+           x1 += xstep;
+           p += xstep;
+           d -= dy;
+           if (d < 0) {
+               d += dx;
+               p += w;
            }
-           *p=f;
+           *p = f;
        }
        return;
     }
 
-    while( y1!=y2) {                   // diagonal line
-       //x1+=xstep;
-       p+=xstep;
+    while (y1 != y2) {                 // diagonal line
+       //x1 += xstep;
+       p += xstep;
        y1++;
-       p+=w;
-       *p=f;
+       p += w;
+       *p = f;
     }
 }
 
@@ -3698,20 +3597,22 @@
 **     @param y2       Destination y coordinate on the screen
 */
 #ifdef USE_OPENGL
-local void DrawLineOpenGL(SysColors color,int x1,int y1,int x2,int y2)
+local void DrawLineOpenGL(SysColors color, int x1, int y1, int x2, int y2)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor3ub(r, g, b);
     glBegin(GL_LINES);
-    glVertex2i(x1, VideoHeight-y1);
-    glVertex2i(x2, VideoHeight-y2);
+    glVertex2i(x1, VideoHeight - y1);
+    glVertex2i(x2, VideoHeight - y2);
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -3724,21 +3625,21 @@
 **     @param x        pixel's x position (not restricted to screen width)
 **     @param y        pixel's y position (not restricted to screen height)
 */
-static ClipCode ClipCodeLine( int x, int y )
+static ClipCode ClipCodeLine(int x, int y)
 {
     ClipCode result;
 
-    if ( y < ClipY1 ) {
+    if (y < ClipY1) {
        result = ClipCodeAbove;
-    } else if ( y > ClipY2 ) {
+    } else if (y > ClipY2) {
        result = ClipCodeBelow;
     } else {
        result = ClipCodeInside;
     }
 
-    if ( x < ClipX1 ) {
+    if (x < ClipX1) {
        result |= ClipCodeLeft;
-    } else if ( x > ClipX2 ) {
+    } else if (x > ClipX2) {
        result |= ClipCodeRight;
     }
 
@@ -3752,7 +3653,7 @@
 **     @param code1    ClipCode of one point of line
 **     @param code2    ClipCode of second point of line
 */
-static ClipCode LineIsUnclippedOnSameSide( int code1, int code2 )
+static ClipCode LineIsUnclippedOnSameSide(int code1, int code2)
 {
    return code1 & code2;
 }
@@ -3764,7 +3665,7 @@
 **     @param code1    ClipCode of one point of line
 **     @param code2    ClipCode of second point of line
 */
-static ClipCode LineIsUnclipped( int code1, int code2 )
+static ClipCode LineIsUnclipped(int code1, int code2)
 {
    return code1 | code2;
 }
@@ -3781,7 +3682,7 @@
 **     @param x2       Destination x coordinate on the screen
 **     @param y2       Destination y coordinate on the screen
 */
-global void VideoDrawLineClip(SysColors color,int x1,int y1,int x2,int y2)
+global void VideoDrawLineClip(SysColors color, int x1, int y1, int x2, int y2)
 /* Based on Sutherland-Cohen clipping technique */
 {
     ClipCode code1;
@@ -3789,40 +3690,35 @@
     int temp;
 
 // Make sure coordinates or on/in clipped rectangle
-    while ( code1 = ClipCodeLine( x1, y1 ),
-            code2 = ClipCodeLine( x2, y2 ),
-            LineIsUnclipped( code1, code2 ) )
-    {
-      if ( LineIsUnclippedOnSameSide( code1, code2 ) )
-        return;
-
-      if ( !code1 )
-      {   temp=x1; x1=x2; x2=temp;
-          temp=y1; y1=y2; y2=temp;
-          code1 = code2;
-      }
-
-      if ( code1 & ClipCodeAbove )
-      {
-          temp=ClipY1;
-          x1 += (int)(((long)(temp-y1)*(x2-x1))/(y2-y1));  
-          y1 = temp;
-      } else if ( code1 & ClipCodeBelow )
-      {
-          temp=ClipY2;
-          x1 += (int)(((long)(temp-y1)*(x2-x1))/(y2-y1));
-          y1 = temp;
-      } else if( code1 & ClipCodeLeft )
-      {
-          temp=ClipX1;
-          y1 += (int)(((long)(temp-x1)*(y2-y1))/(x2-x1));
-          x1 = temp;
-      } else /* code1 & ClipCodeRight */
-      {
-          temp=ClipX2;
-          y1 += (int)(((long)(temp-x1)*(y2-y1))/(x2-x1));
-          x1 = temp;
-      }
+    while (code1 = ClipCodeLine(x1, y1), code2 = ClipCodeLine(x2, y2),
+           LineIsUnclipped(code1, code2)) {
+       if (LineIsUnclippedOnSameSide(code1, code2)) {
+           return;
+       }
+
+       if (!code1) {
+           temp = x1; x1 = x2; x2 = temp;
+           temp = y1; y1 = y2; y2 = temp;
+           code1 = code2;
+       }
+
+       if (code1 & ClipCodeAbove) {
+           temp = ClipY1;
+           x1 += (int)(((long)(temp - y1) * (x2 - x1)) / (y2 - y1));
+           y1 = temp;
+       } else if (code1 & ClipCodeBelow) {
+           temp = ClipY2;
+           x1 += (int)(((long)(temp - y1) * (x2 - x1)) / (y2 - y1));
+           y1 = temp;
+       } else if (code1 & ClipCodeLeft) {
+           temp = ClipX1;
+           y1 += (int)(((long)(temp - x1) * (y2 - y1)) / (x2 - x1));
+           x1 = temp;
+       } else {  /* code1 & ClipCodeRight */
+           temp = ClipX2;
+           y1 += (int)(((long)(temp - x1) * (y2 - y1)) / (x2 - x1));
+           x1 = temp;
+       }
     }
 
 //Draw line based on clipped coordinates
@@ -3830,9 +3726,9 @@
 //       direction vector might be slightly off. Somehow, the sub-pixel
 //       position(s) on the clipped retangle should be denoted to the line
 //       drawing routine.. 
-    DebugCheck( x1<ClipX1||x2<ClipX1||x1>ClipX2||x2>ClipX2||
-                y1<ClipY1||y2<ClipY1||y1>ClipY2||y2>ClipY2 );
-    VideoDrawLine( color, x1, y1, x2, y2 );
+    DebugCheck(x1 < ClipX1 || x2 < ClipX1 || x1 > ClipX2 || x2 > ClipX2 ||
+       y1 < ClipY1 || y2 < ClipY1 || y1 > ClipY2 || y2 > ClipY2);
+    VideoDrawLine(color, x1, y1, x2, y2);
 }
 
 // ===========================================================================
@@ -3848,29 +3744,30 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawRectangle8(SysColors color, int x, int y, int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     VMemType8 f;
     int swidth;
     int ofs;
 
-    f=Pixels8[color];
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    if ( h && (ofs=w) ) {
-       do *p++=f; // Draw top horizontal line, FIXME: 4 bytes in one go
-       while( --ofs );
-       if ( --h ) {
-           p+=(swidth-w);
-           ofs=w-1;
-           while( --h ) { // Draw vertical line(s)
-               p[ofs]=*p=f; //FIXME: draws pixel twice for w==1 :(
-               p+=swidth;
+    f = Pixels8[color];
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    if (h && (ofs = w)) {
+       do {
+           *p++ = f; // Draw top horizontal line, FIXME: 4 bytes in one go
+       } while (--ofs);
+       if (--h) {
+           p += (swidth - w);
+           ofs = w - 1;
+           while (--h) { // Draw vertical line(s)
+               p[ofs] = *p = f; //FIXME: draws pixel twice for w == 1 :(
+               p += swidth;
            }
-           do *p++=f; // Draw bottom horizontal line, FIXME: 4 bytes in one go
-           while( ofs-- );
+           do {
+               *p++ = f; // Draw bottom horizontal line, FIXME: 4 bytes in one 
go
+           } while (ofs--);
        }
     }
 }
@@ -3884,27 +3781,30 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawRectangle16(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p, f;
-    int swidth, ofs;
+    VMemType16* p;
+    VMemType16 f;
+    int swidth;
+    int ofs;
 
-    f=Pixels16[color];
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    if ( h && (ofs=w) ) {
-       do *p++=f; // Draw top horizontal line
-       while( --ofs );
-       if ( --h ) {
-           p+=(swidth-w);
-           ofs=w-1;
-           while( --h ) { // Draw vertical line(s)
-               p[ofs]=*p=f; //FIXME: draws pixel twice for w==1 :(
-               p+=swidth;
+    f = Pixels16[color];
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    if (h && (ofs = w)) {
+       do {
+           *p++ = f; // Draw top horizontal line
+       } while (--ofs);
+       if (--h) {
+           p += (swidth - w);
+           ofs = w - 1;
+           while (--h) { // Draw vertical line(s)
+               p[ofs] = *p = f; //FIXME: draws pixel twice for w == 1 :(
+               p += swidth;
            }
-           do *p++=f; // Draw bottom horizontal line
-           while( ofs-- );
+           do {
+               *p++ = f; // Draw bottom horizontal line
+           } while (ofs--);
        }
     }
 }
@@ -3918,29 +3818,31 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawRectangle24(SysColors color, int x, int y
+       , int w, int h)
 {
-    VMemType24 *p;
+    VMemType24* p;
     VMemType24 f;
     int swidth;
     int ofs;
 
-    f=Pixels24[color];
-    swidth=VideoWidth;
-    p=VideoMemory24+y*swidth+x;
-    if ( h && (ofs=w) ) {
-       do *p++=f; // Draw top horizontal line
-       while( --ofs );
-       if ( --h ) {
-           p+=(swidth-w);
-           ofs=w-1;
-           while( --h ) { // Draw vertical line(s)
-               p[ofs]=*p=f; //FIXME: draws pixel twice for w==1 :(
-               p+=swidth;
+    f = Pixels24[color];
+    swidth = VideoWidth;
+    p = VideoMemory24 + y * swidth + x;
+    if (h && (ofs = w)) {
+       do {
+           *p++ = f; // Draw top horizontal line
+       } while (--ofs);
+       if (--h) {
+           p += (swidth - w);
+           ofs = w - 1;
+           while (--h) { // Draw vertical line(s)
+               p[ofs] = *p = f; //FIXME: draws pixel twice for w == 1 :(
+               p += swidth;
            }
-           do *p++=f; // Draw bottom horizontal line
-           while( ofs-- );
+           do {
+               *p++ = f; // Draw bottom horizontal line
+           } while (ofs--);
        }
     }
 }
@@ -3954,29 +3856,31 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawRectangle32(SysColors color, int x, int y
+       , int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     VMemType32 f;
     int swidth;
     int ofs;
 
-    f=Pixels32[color];
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    if ( h && (ofs=w) ) {
-       do *p++=f; // Draw top horizontal line
-       while( --ofs );
-       if ( --h ) {
-           p+=(swidth-w);
-           ofs=w-1;
-           while( --h ) { // Draw vertical line(s)
-               p[ofs]=*p=f; //FIXME: draws pixel twice for w==1 :(
-               p+=swidth;
+    f = Pixels32[color];
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    if (h && (ofs = w)) {
+       do {
+           *p++ = f; // Draw top horizontal line
+       } while (--ofs);
+       if (--h) {
+           p += (swidth - w);
+           ofs = w - 1;
+           while (--h) { // Draw vertical line(s)
+               p[ofs] = *p = f; //FIXME: draws pixel twice for w == 1 :(
+               p += swidth;
            }
-           do *p++=f; // Draw bottom horizontal line
-           while( ofs-- );
+           do {
+               *p++ = f; // Draw bottom horizontal line
+           } while (ofs--);
        }
     }
 }
@@ -3991,23 +3895,24 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void DrawRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawRectangleOpenGL(SysColors color, int x, int y, int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor3ub(r, g, b);
     glBegin(GL_LINE_LOOP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-(y+h));
-    glVertex2i(x, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - (y + h));
+    glVertex2i(x, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -4022,42 +3927,41 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw25TransRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw25TransRectangle8(SysColors color, int x, int y, int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     int swidth;
     int ofs;
     unsigned c;
 
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    c=Pixels8[color]<<8;
-    if ( h && (ofs=w) ) {
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    c = Pixels8[color] << 8;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           *p = lookup25trans8[ c | *p ];
+           *p = lookup25trans8[c | *p];
            ++p;
-       } while( --ofs );
+       } while (--ofs);
 
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   p[ofs] = lookup25trans8[ c | p[ofs] ];
-                   *p = lookup25trans8[ c | *p ];
-                   p+=swidth;
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   p[ofs] = lookup25trans8[c | p[ofs]];
+                   *p = lookup25trans8[c | *p];
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   *p = lookup25trans8[ c | *p ];
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   *p = lookup25trans8[c | *p];
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               *p = lookup25trans8[ c | *p ];
+               *p = lookup25trans8[c | *p];
                ++p;
-           } while( ofs-- );
+           } while (ofs--);
        }
     }
 }
@@ -4071,60 +3975,59 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw25TransRectangle15(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw25TransRectangle15(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x03E07C1F)*3;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    sp = (((sp << 16) | sp) & 0x03E07C1F) * 3;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x03E07C1F;
-           dp=((dp+sp)>>2)&0x03E07C1F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((dp+sp)>>2)&0x03E07C1F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((dp+sp)>>2)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x03E07C1F;
+           dp = ((dp + sp) >> 2) & 0x03E07C1F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((dp + sp) >> 2) & 0x03E07C1F;
+                   p[ofs]=(dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((dp + sp) >> 2) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((dp+sp)>>2)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((dp + sp) >> 2) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x03E07C1F;
-               dp=((dp+sp)>>2)&0x03E07C1F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x03E07C1F;
+               dp = ((dp + sp) >> 2) & 0x03E07C1F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -4138,60 +4041,59 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw25TransRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw25TransRectangle16(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x07E0F81F)*3;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    sp = (((sp << 16) | sp) & 0x07E0F81F) * 3;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x07E0F81F;
-           dp=((dp+sp)>>2)&0x07E0F81F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((dp+sp)>>2)&0x07E0F81F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((dp+sp)>>2)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x07E0F81F;
+           dp = ((dp + sp) >> 2) & 0x07E0F81F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((dp + sp) >> 2) & 0x07E0F81F;
+                   p[ofs]=(dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((dp + sp) >> 2) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((dp+sp)>>2)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((dp + sp) >> 2) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=((dp+sp)>>2)&0x07E0F81F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = ((dp + sp) >> 2) & 0x07E0F81F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -4205,11 +4107,10 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw25TransRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw25TransRectangle24(SysColors color, int x, int y, int w, int h)
 {
 //FIXME: does 24bpp represents R|G|B?
-    DrawRectangle24(color,x,y,w,h); // no trans functionaility for the moment 
:(
+    DrawRectangle24(color, x, y, w, h); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -4221,10 +4122,9 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw25TransRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw25TransRectangle32(SysColors color, int x, int y, int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
@@ -4232,63 +4132,63 @@
     int swidth;
     int ofs;
 
-    sp1=Pixels32[color];
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=((sp1&0xFF00FF00)>>8)*3;
-    sp1=(sp1&0x00FF00FF)*3;
+    sp2 = ((sp1 & 0xFF00FF00) >> 8) * 3;
+    sp1 = (sp1 & 0x00FF00FF) * 3;
 
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp1=*p;
-           dp2=(dp1&0xFF00FF00)>>8;
-           dp1&=0x00FF00FF;
-           dp1=((dp1+sp1)>>2)&0x00FF00FF;
-           dp2=((dp2+sp2)>>2)&0x00FF00FF;
-           *p++=(dp1|(dp2<<8));
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp1=p[ofs];
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((dp1+sp1)>>2)&0x00FF00FF;
-                   dp2=((dp2+sp2)>>2)&0x00FF00FF;
-                   p[ofs]=(dp1|(dp2<<8));
-
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((dp1+sp1)>>2)&0x00FF00FF;
-                   dp2=((dp2+sp2)>>2)&0x00FF00FF;
-                   *p=(dp1|(dp2<<8));
+           dp1 = *p;
+           dp2 = (dp1 & 0xFF00FF00) >> 8;
+           dp1 &= 0x00FF00FF;
+           dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+           dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+           *p++ = (dp1 | (dp2 << 8));
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp1 = p[ofs];
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+                   dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+                   p[ofs] = (dp1 | (dp2 << 8));
+
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+                   dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+                   *p = (dp1 | (dp2 << 8));
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((dp1+sp1)>>2)&0x00FF00FF;
-                   dp2=((dp2+sp2)>>2)&0x00FF00FF;
-                   *p++=(dp1|(dp2<<8));
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+                   dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+                   *p++ = (dp1 | (dp2 << 8));
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
-               dp1=((dp1+sp1)>>2)&0x00FF00FF;
-               dp2=((dp2+sp2)>>2)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while( ofs-- );
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
+               dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+               dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (ofs--);
        }
     }
 }
@@ -4303,23 +4203,25 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw25TransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw25TransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 192);
     glBegin(GL_LINE_LOOP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-(y+h));
-    glVertex2i(x, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - (y + h));
+    glVertex2i(x, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -4334,42 +4236,41 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw50TransRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw50TransRectangle8(SysColors color, int x, int y, int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     int swidth;
     int ofs;
     unsigned c;
 
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    c=Pixels8[color]<<8;
-    if ( h && (ofs=w) ) {
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    c = Pixels8[color] << 8;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           *p = lookup50trans8[ c | *p ];
+           *p = lookup50trans8[c | *p];
            ++p;
-       } while( --ofs );
+       } while (--ofs);
 
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   p[ofs] = lookup50trans8[ c | p[ofs] ];
-                   *p = lookup50trans8[ c | *p ];
-                   p+=swidth;
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   p[ofs] = lookup50trans8[c | p[ofs]];
+                   *p = lookup50trans8[c | *p];
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   *p = lookup50trans8[ c | *p ];
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   *p = lookup50trans8[c | *p];
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               *p = lookup50trans8[ c | *p ];
+               *p = lookup50trans8[c | *p];
                ++p;
-           } while( ofs-- );
+           } while (ofs--);
        }
     }
 }
@@ -4383,59 +4284,58 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw50TransRectangle15(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw50TransRectangle15(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x03E07C1F;
-           dp=((dp+sp)>>1)&0x03E07C1F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((dp+sp)>>1)&0x03E07C1F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((dp+sp)>>1)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x03E07C1F;
+           dp = ((dp + sp) >> 1) & 0x03E07C1F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((dp + sp) >> 1) & 0x03E07C1F;
+                   p[ofs] = (dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((dp + sp) >> 1) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((dp+sp)>>1)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((dp + sp) >> 1) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x03E07C1F;
-               dp=((dp+sp)>>1)&0x03E07C1F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x03E07C1F;
+               dp = ((dp + sp) >> 1) & 0x03E07C1F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -4449,59 +4349,58 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw50TransRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw50TransRectangle16(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x07E0F81F;
-           dp=((dp+sp)>>1)&0x07E0F81F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((dp+sp)>>1)&0x07E0F81F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((dp+sp)>>1)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x07E0F81F;
+           dp = ((dp + sp) >> 1) & 0x07E0F81F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((dp + sp) >> 1) & 0x07E0F81F;
+                   p[ofs] = (dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((dp + sp) >> 1) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((dp+sp)>>1)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((dp + sp) >> 1) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=((dp+sp)>>1)&0x07E0F81F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = ((dp + sp) >> 1) & 0x07E0F81F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -4515,11 +4414,10 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw50TransRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw50TransRectangle24(SysColors color, int x, int y, int w, int h)
 {
 //FIXME: does 24bpp represents R|G|B?
-    DrawRectangle24(color,x,y,w,h); // no trans functionaility for the moment 
:(
+    DrawRectangle24(color, x, y, w, h); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -4531,10 +4429,9 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw50TransRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw50TransRectangle32(SysColors color, int x, int y, int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
@@ -4542,63 +4439,63 @@
     int swidth;
     int ofs;
 
-    sp1=Pixels32[color];
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp1=*p;
-           dp2=(dp1&0xFF00FF00)>>8;
-           dp1&=0x00FF00FF;
-           dp1=((dp1+sp1)>>1)&0x00FF00FF;
-           dp2=((dp2+sp2)>>1)&0x00FF00FF;
-           *p++=(dp1|(dp2<<8));
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp1=p[ofs];
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((dp1+sp1)>>1)&0x00FF00FF;
-                   dp2=((dp2+sp2)>>1)&0x00FF00FF;
-                   p[ofs]=(dp1|(dp2<<8));
-
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((dp1+sp1)>>1)&0x00FF00FF;
-                   dp2=((dp2+sp2)>>1)&0x00FF00FF;
-                   *p=(dp1|(dp2<<8));
+           dp1 = *p;
+           dp2 = (dp1 & 0xFF00FF00) >> 8;
+           dp1 &= 0x00FF00FF;
+           dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+           dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+           *p++ = (dp1 | (dp2 << 8));
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp1 = p[ofs];
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+                   dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+                   p[ofs] = (dp1 | (dp2 << 8));
+
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+                   dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+                   *p = (dp1 | (dp2 << 8));
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((dp1+sp1)>>1)&0x00FF00FF;
-                   dp2=((dp2+sp2)>>1)&0x00FF00FF;
-                   *p++=(dp1|(dp2<<8));
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+                   dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+                   *p++ = (dp1 | (dp2 << 8));
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
-               dp1=((dp1+sp1)>>1)&0x00FF00FF;
-               dp2=((dp2+sp2)>>1)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while( ofs-- );
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
+               dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+               dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (ofs--);
        }
     }
 }
@@ -4613,23 +4510,25 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw50TransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw50TransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 128);
     glBegin(GL_LINE_LOOP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-(y+h));
-    glVertex2i(x, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - (y + h));
+    glVertex2i(x, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -4644,41 +4543,40 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw75TransRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw75TransRectangle8(SysColors color, int x, int y, int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     int swidth;
     int ofs;
     unsigned c;
 
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    c=Pixels8[color];
-    if ( h && (ofs=w) ) {
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    c = Pixels8[color];
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           *p = lookup25trans8[ (*p<<8) | c ];
+           *p = lookup25trans8[(*p << 8) | c];
            ++p;
-       } while( --ofs );
+       } while (--ofs);
 
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   p[ofs] = lookup25trans8[ (p[ofs]<<8) | c ];
-                   *p = lookup25trans8[ (*p<<8) | c ];
-                   p+=swidth;
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   p[ofs] = lookup25trans8[(p[ofs] << 8) | c];
+                   *p = lookup25trans8[(*p << 8) | c];
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   *p = lookup25trans8[ (*p<<8) | c ];
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   *p = lookup25trans8[(*p << 8) | c];
+                   p += swidth;
                }
 
                do { // Draw bottom horizontal line
-                   *p = lookup25trans8[ (*p<<8) | c ];
+                   *p = lookup25trans8[(*p << 8) | c];
                    ++p;
-               } while( ofs-- );
+               } while (ofs--);
            }
        }
     }
@@ -4693,59 +4591,58 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw75TransRectangle15(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw75TransRectangle15(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x03E07C1F;
-           dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x03E07C1F;
+           dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+                   p[ofs] = (dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x03E07C1F;
-               dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x03E07C1F;
+               dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -4759,59 +4656,58 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw75TransRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw75TransRectangle16(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x07E0F81F;
-           dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x07E0F81F;
+           dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+                   p[ofs] = (dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -4825,11 +4721,10 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw75TransRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw75TransRectangle24(SysColors color, int x, int y, int w, int h)
 {
 //FIXME: does 24bpp represents R|G|B?
-    DrawRectangle24(color,x,y,w,h); // no trans functionaility for the moment 
:(
+    DrawRectangle24(color, x, y, w, h); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -4841,10 +4736,9 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void Draw75TransRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw75TransRectangle32(SysColors color, int x, int y, int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
@@ -4852,63 +4746,63 @@
     int swidth;
     int ofs;
 
-    sp1=Pixels32[color];
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp1=*p;
-           dp2=(dp1&0xFF00FF00)>>8;
-           dp1&=0x00FF00FF;
-           dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-           dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-           *p++=(dp1|(dp2<<8));
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp1=p[ofs];
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-                   dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-                   p[ofs]=(dp1|(dp2<<8));
-
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-                   dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-                   *p=(dp1|(dp2<<8));
+           dp1 = *p;
+           dp2 = (dp1 & 0xFF00FF00) >> 8;
+           dp1 &= 0x00FF00FF;
+           dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+           dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+           *p++ = (dp1 | (dp2 << 8));
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp1 = p[ofs];
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+                   dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+                   p[ofs] = (dp1 | (dp2 << 8));
+
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+                   dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+                   *p = (dp1 | (dp2 << 8));
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-                   dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-                   *p++=(dp1|(dp2<<8));
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+                   dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+                   *p++ = (dp1 | (dp2 << 8));
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
-               dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-               dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while( ofs-- );
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
+               dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+               dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (ofs--);
        }
     }
 }
@@ -4923,23 +4817,25 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void Draw75TransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void Draw75TransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 64);
     glBegin(GL_LINE_LOOP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-(y+h));
-    glVertex2i(x, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - (y + h));
+    glVertex2i(x, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -4955,22 +4851,21 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawTransRectangle8(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawTransRectangle8(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
-    switch ( ((unsigned int)alpha * 4) / 255 )
-    {
+    switch (((unsigned int)alpha * 4) / 255) {
        case 0:
-           DrawRectangle8(color,x,y,w,h);
+           DrawRectangle8(color, x, y, w, h);
            break;
        case 1:
-           Draw25TransRectangle8(color,x,y,w,h);
+           Draw25TransRectangle8(color, x, y, w, h);
            break;
        case 2:
-           Draw50TransRectangle8(color,x,y,w,h);
+           Draw50TransRectangle8(color, x, y, w, h);
            break;
        case 3:
-           Draw75TransRectangle8(color,x,y,w,h);
+           Draw75TransRectangle8(color, x, y, w, h);
            break;
        default:
            break;
@@ -4987,10 +4882,10 @@
 **     @param h        Height in pixel of the rectangle
 **      @param alpha    Alpha value of pixel
 */
-local void DrawNoTransRectangle8(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha __attribute__((unused)))
+local void DrawNoTransRectangle8(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha __attribute__((unused)))
 {
-    DrawRectangle8(color,x,y,w,h);
+    DrawRectangle8(color, x, y, w, h);
 }
 
 /**
@@ -5003,61 +4898,61 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawTransRectangle15(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawTransRectangle15(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
     //FIXME: alpha==256 unreached
-    alpha>>=3;                          //FIXME: only 5bits
-    if ( h && (ofs=w) ) {
+    alpha >>= 3;                          //FIXME: only 5bits
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x03E07C1F;
-           dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x03E07C1F;
+           dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F;
+                   p[ofs] = (dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x03E07C1F;
-                   dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x03E07C1F;
+                   dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x03E07C1F;
-               dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x03E07C1F;
+               dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -5072,61 +4967,61 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawTransRectangle16(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawTransRectangle16(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     unsigned long dp;
     int swidth;
     int ofs;
 
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
     //FIXME: alpha==256 unreached
-    alpha>>=3;                          //FIXME: only 5bits
-    if ( h && (ofs=w) ) {
+    alpha >>= 3;                          //FIXME: only 5bits
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp=*p;
-           dp=((dp<<16)|dp)&0x07E0F81F;
-           dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F;
-           *p++=(dp>>16)|dp;
-       } while( --ofs );
-
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp=p[ofs];
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F;
-                   p[ofs]=(dp>>16)|dp;
-
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
+           dp = *p;
+           dp = ((dp << 16) | dp) & 0x07E0F81F;
+           dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F;
+           *p++ = (dp >> 16) | dp;
+       } while (--ofs);
+
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp = p[ofs];
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F;
+                   p[ofs] = (dp >> 16) | dp;
+
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp=*p;
-                   dp=((dp<<16)|dp)&0x07E0F81F;
-                   dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F;
-                   *p=(dp>>16)|dp;
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp = *p;
+                   dp = ((dp << 16) | dp) & 0x07E0F81F;
+                   dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F;
+                   *p = (dp >> 16) | dp;
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp=*p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F;
-               *p++=(dp>>16)|dp;
-           } while( ofs-- );
+               dp = *p;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F;
+               *p++ = (dp >> 16) | dp;
+           } while (ofs--);
        }
     }
 }
@@ -5141,11 +5036,11 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawTransRectangle24(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha __attribute__((unused)))
+local void DrawTransRectangle24(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha __attribute__((unused)))
 {
 //FIXME: does 24bpp represents R|G|B?
-    DrawRectangle24(color,x,y,w,h); // no trans functionaility for the moment 
:(
+    DrawRectangle24(color, x, y, w, h); // no trans functionaility for the 
moment :(
 }
 
 /**
@@ -5158,10 +5053,10 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawTransRectangle32(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawTransRectangle32(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     unsigned long dp1;
@@ -5169,63 +5064,63 @@
     int swidth;
     int ofs;
 
-    sp1=Pixels32[color];
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
 
     //FIXME: alpha==256 unreached
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    if ( h && (ofs=w) ) {
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    if (h && (ofs = w)) {
        do { // Draw top horizontal line
-           dp1=*p;
-           dp2=(dp1&0xFF00FF00)>>8;
-           dp1&=0x00FF00FF;
-           dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-           dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-           *p++=(dp1|(dp2<<8));
-       } while( --ofs );
-       if ( --h ) {
-           p+=(swidth-w);
-           if ((ofs=w-1)) {
-               while( --h ) { // Draw two vertical lines
-                   dp1=p[ofs];
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-                   dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-                   p[ofs]=(dp1|(dp2<<8));
-
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-                   dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-                   *p=(dp1|(dp2<<8));
+           dp1 = *p;
+           dp2 = (dp1 & 0xFF00FF00) >> 8;
+           dp1 &= 0x00FF00FF;
+           dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+           dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+           *p++ = (dp1 | (dp2 << 8));
+       } while (--ofs);
+       if (--h) {
+           p += (swidth - w);
+           if ((ofs = w - 1)) {
+               while (--h) { // Draw two vertical lines
+                   dp1 = p[ofs];
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+                   dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+                   p[ofs] = (dp1 | (dp2 << 8));
+
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+                   dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+                   *p = (dp1 | (dp2 << 8));
 
-                   p+=swidth;
+                   p += swidth;
                }
            } else {
-               while( --h ) { // Draw one vertical line
-                   dp1=*p;
-                   dp2=(dp1&0xFF00FF00)>>8;
-                   dp1&=0x00FF00FF;
-                   dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-                   dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-                   *p=(dp1|(dp2<<8));
-                   p+=swidth;
+               while (--h) { // Draw one vertical line
+                   dp1 = *p;
+                   dp2 = (dp1 & 0xFF00FF00) >> 8;
+                   dp1 &= 0x00FF00FF;
+                   dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+                   dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+                   *p = (dp1 | (dp2 << 8));
+                   p += swidth;
                }
            }
 
            do { // Draw bottom horizontal line
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
-               dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-               dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while( ofs-- );
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
+               dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+               dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (ofs--);
        }
     }
 }
@@ -5241,23 +5136,25 @@
 **      @param alpha    alpha value of pixel.
 */
 #ifdef USE_OPENGL
-local void DrawTransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawTransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
-    glColor4ub(r, g, b, 255-alpha);
+    glColor4ub(r, g, b, 255 - alpha);
     glBegin(GL_LINE_LOOP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-(y+h));
-    glVertex2i(x, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - (y + h));
+    glVertex2i(x, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -5272,15 +5169,15 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoDrawRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoDrawRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
     #define _x              x
     #define _y              y
     #define _w              w
     #define _h              h
-    #define _hline(x,y,w)   VideoDrawHLine(color,x,y,w)
-    #define _vline(x,y,h)   VideoDrawVLine(color,x,y,h)
+    #define _hline(x, y,w)   VideoDrawHLine(color, x, y,w)
+    #define _vline(x, y,h)   VideoDrawVLine(color, x, y,h)
 
     #include "_clip_rectangle"
 
@@ -5301,15 +5198,15 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoDraw25TransRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoDraw25TransRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
     #define _x              x
     #define _y              y
     #define _w              w
     #define _h              h
-    #define _hline(x,y,w)   VideoDraw25TransHLine(color,x,y,w)
-    #define _vline(x,y,h)   VideoDraw25TransVLine(color,x,y,h)
+    #define _hline(x, y,w)   VideoDraw25TransHLine(color, x, y,w)
+    #define _vline(x, y,h)   VideoDraw25TransVLine(color, x, y,h)
 
     #include "_clip_rectangle"
 
@@ -5330,15 +5227,15 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoDraw50TransRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoDraw50TransRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
     #define _x              x
     #define _y              y
     #define _w              w
     #define _h              h
-    #define _hline(x,y,w)   VideoDraw50TransHLine(color,x,y,w)
-    #define _vline(x,y,h)   VideoDraw50TransVLine(color,x,y,h)
+    #define _hline(x, y,w)   VideoDraw50TransHLine(color, x, y,w)
+    #define _vline(x, y,h)   VideoDraw50TransVLine(color, x, y,h)
 
     #include "_clip_rectangle"
 
@@ -5359,15 +5256,15 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoDraw75TransRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoDraw75TransRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
     #define _x              x
     #define _y              y
     #define _w              w
     #define _h              h
-    #define _hline(x,y,w)   VideoDraw75TransHLine(color,x,y,w)
-    #define _vline(x,y,h)   VideoDraw75TransVLine(color,x,y,h)
+    #define _hline(x, y,w)   VideoDraw75TransHLine(color, x, y,w)
+    #define _vline(x, y,h)   VideoDraw75TransVLine(color, x, y,h)
 
     #include "_clip_rectangle"
 
@@ -5389,15 +5286,15 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-global void VideoDrawTransRectangleClip(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+global void VideoDrawTransRectangleClip(SysColors color, int x, int y,
+    int w, int h,unsigned char alpha)
 {
     #define _x              x
     #define _y              y
     #define _w              w
     #define _h              h
-    #define _hline(x,y,w)   VideoDrawTransHLine(color,x,y,w,alpha)
-    #define _vline(x,y,h)   VideoDrawTransVLine(color,x,y,h,alpha)
+    #define _hline(x, y,w)   VideoDrawTransHLine(color, x, y,w,alpha)
+    #define _vline(x, y,h)   VideoDrawTransVLine(color, x, y,h,alpha)
 
     #include "_clip_rectangle"
 
@@ -5423,7 +5320,7 @@
 **     @param y        Center y coordinate on the screen
 **     @param r        radius of circle
 */
-global void VideoDrawCircle(SysColors color,int x,int y,int r)
+global void VideoDrawCircle(SysColors color, int x, int y, int r)
 {
     int cx;
     int cy;
@@ -5431,48 +5328,47 @@
     int d_e;
     int d_se;
 
-    cx=0;
-    cy=r;
-    df=1-r;
-    d_e=3;
-    d_se=-2*r+5;
+    cx = 0;
+    cy = r;
+    df = 1 - r;
+    d_e = 3;
+    d_se = -2 * r + 5;
 
     // FIXME: could much improved :)
     do {
-       if( cx==0 ) {
-           VideoDrawPixel(color,x,y+cy);
-           VideoDrawPixel(color,x,y-cy);
-           VideoDrawPixel(color,x+cy,y);
-           VideoDrawPixel(color,x-cy,y);
-       } else if ( cx==cy ) {
-           DebugCheck( cx==0 || cy==0 );
-           VideoDrawPixel(color,x+cx,y+cy);
-           VideoDrawPixel(color,x-cx,y+cy);
-           VideoDrawPixel(color,x+cx,y-cy);
-           VideoDrawPixel(color,x-cx,y-cy);
-       } else if ( cx<cy ) {
-           DebugCheck( cx==0 || cy==0 );
-           VideoDrawPixel(color,x+cx,y+cy);
-           VideoDrawPixel(color,x+cx,y-cy);
-           VideoDrawPixel(color,x+cy,y+cx);
-           VideoDrawPixel(color,x+cy,y-cx);
-           VideoDrawPixel(color,x-cx,y+cy);
-           VideoDrawPixel(color,x-cx,y-cy);
-           VideoDrawPixel(color,x-cy,y+cx);
-           VideoDrawPixel(color,x-cy,y-cx);
-       }
-       if( df<0 ) {
-           df+=d_e;
-           d_se+=2;
+       if (cx == 0) {
+           VideoDrawPixel(color, x, y + cy);
+           VideoDrawPixel(color, x, y - cy);
+           VideoDrawPixel(color, x + cy, y);
+           VideoDrawPixel(color, x - cy, y);
+       } else if (cx == cy) {
+           DebugCheck(cx == 0 || cy == 0);
+           VideoDrawPixel(color,x + cx, y + cy);
+           VideoDrawPixel(color,x - cx, y + cy);
+           VideoDrawPixel(color,x + cx, y - cy);
+           VideoDrawPixel(color,x - cx, y - cy);
+       } else if (cx < cy) {
+           DebugCheck(cx == 0 || cy == 0);
+           VideoDrawPixel(color, x + cx, y + cy);
+           VideoDrawPixel(color, x + cx, y - cy);
+           VideoDrawPixel(color, x + cy, y + cx);
+           VideoDrawPixel(color, x + cy, y - cx);
+           VideoDrawPixel(color, x - cx, y + cy);
+           VideoDrawPixel(color, x - cx, y - cy);
+           VideoDrawPixel(color, x - cy, y + cx);
+           VideoDrawPixel(color, x - cy, y - cx);
+       }
+       if (df < 0) {
+           df += d_e;
+           d_se += 2;
        } else {
-           df+=d_se;
-           d_se+=4;
+           df += d_se;
+           d_se += 4;
            cy--;
        }
-       d_e+=2;
+       d_e += 2;
        cx++;
-
-    } while( cx <= cy );
+    } while (cx <= cy);
 }
 
 /**
@@ -5483,7 +5379,7 @@
 **     @param y        Center y coordinate on the screen
 **     @param r        radius of circle
 */
-global void VideoDrawCircleClip(SysColors color,int x,int y,int r)
+global void VideoDrawCircleClip(SysColors color, int x, int y, int r)
 {
     int cx;
     int cy;
@@ -5491,47 +5387,47 @@
     int d_e;
     int d_se;
 
-    cx=0;
-    cy=r;
-    df=1-r;
-    d_e=3;
-    d_se=-2*r+5;
+    cx = 0;
+    cy = r;
+    df = 1 - r;
+    d_e = 3;
+    d_se = -2 * r + 5;
 
     // FIXME: could much improved :)
     do {
-       if( cx==0 ) {
-           VideoDrawPixelClip(color,x,y+cy);
-           VideoDrawPixelClip(color,x,y-cy);
-           VideoDrawPixelClip(color,x+cy,y);
-           VideoDrawPixelClip(color,x-cy,y);
-       } else if ( cx==cy ) {
-           DebugCheck( cx==0 || cy==0 );
-           VideoDrawPixelClip(color,x+cx,y+cy);
-           VideoDrawPixelClip(color,x-cx,y+cy);
-           VideoDrawPixelClip(color,x+cx,y-cy);
-           VideoDrawPixelClip(color,x-cx,y-cy);
-       } else if ( cx<cy ) {
-           DebugCheck( cx==0 || cy==0 );
-           VideoDrawPixelClip(color,x+cx,y+cy);
-           VideoDrawPixelClip(color,x+cx,y-cy);
-           VideoDrawPixelClip(color,x+cy,y+cx);
-           VideoDrawPixelClip(color,x+cy,y-cx);
-           VideoDrawPixelClip(color,x-cx,y+cy);
-           VideoDrawPixelClip(color,x-cx,y-cy);
-           VideoDrawPixelClip(color,x-cy,y+cx);
-           VideoDrawPixelClip(color,x-cy,y-cx);
-       }
-       if( df<0 ) {
-           df+=d_e;
-           d_se+=2;
+       if (cx == 0) {
+           VideoDrawPixelClip(color, x, y + cy);
+           VideoDrawPixelClip(color, x, y - cy);
+           VideoDrawPixelClip(color, x + cy, y);
+           VideoDrawPixelClip(color, x - cy, y);
+       } else if (cx == cy) {
+           DebugCheck(cx == 0 || cy == 0);
+           VideoDrawPixelClip(color, x + cx, y + cy);
+           VideoDrawPixelClip(color, x - cx, y + cy);
+           VideoDrawPixelClip(color, x + cx, y - cy);
+           VideoDrawPixelClip(color, x - cx, y - cy);
+       } else if (cx < cy) {
+           DebugCheck(cx == 0 || cy == 0);
+           VideoDrawPixelClip(color, x + cx, y + cy);
+           VideoDrawPixelClip(color, x + cx, y - cy);
+           VideoDrawPixelClip(color, x + cy, y + cx);
+           VideoDrawPixelClip(color, x + cy, y - cx);
+           VideoDrawPixelClip(color, x - cx, y + cy);
+           VideoDrawPixelClip(color, x - cx, y - cy);
+           VideoDrawPixelClip(color, x - cy, y + cx);
+           VideoDrawPixelClip(color, x - cy, y - cx);
+       }
+       if (df < 0) {
+           df += d_e;
+           d_se += 2;
        } else {
-           df+=d_se;
-           d_se+=4;
+           df += d_se;
+           d_se += 4;
            cy--;
        }
-       d_e+=2;
+       d_e += 2;
        cx++;
-    } while( cx <= cy );
+    } while (cx <= cy);
 }
 
 // ===========================================================================
@@ -5547,25 +5443,24 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFillRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFillRectangle8(SysColors color, int x, int y, int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     VMemType8 f;
     int swidth;
     int i;
 
-    f=Pixels8[color];
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    swidth-=w;
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    f = Pixels8[color];
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    swidth -= w;
+    if (w) {
+       while (h--) {
+           i = w;
            do {
-               *p++=f;
-           } while ( --i );
-           p+=swidth;
+               *p++ = f;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5579,25 +5474,24 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFillRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFillRectangle16(SysColors color, int x, int y, int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     VMemType16 f;
     int swidth;
     int i;
 
-    f=Pixels16[color];
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    f = Pixels16[color];
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    if (w) {
+       while (h--) {
+           i = w;
            do {
-               *p++=f;
-           } while ( --i );
-           p+=swidth;
+               *p++ = f;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5611,25 +5505,24 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFillRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFillRectangle24(SysColors color, int x, int y, int w, int h)
 {
-    VMemType24 *p;
+    VMemType24* p;
     VMemType24 f;
     int swidth;
     int i;
 
-    f=Pixels24[color];
-    swidth=VideoWidth;
-    p=VideoMemory24+y*swidth+x;
-    swidth-=w;
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    f = Pixels24[color];
+    swidth = VideoWidth;
+    p = VideoMemory24 + y * swidth + x;
+    swidth -= w;
+    if (w) {
+       while (h--) {
+           i = w;
            do {
-               *p++=f;
-           } while ( --i );
-           p+=swidth;
+               *p++ = f;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5643,25 +5536,24 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFillRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFillRectangle32(SysColors color, int x, int y, int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     VMemType32 f;
     int swidth;
     int i;
 
-    f=Pixels32[color];
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    swidth-=w;
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    f = Pixels32[color];
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    swidth -= w;
+    if (w) {
+       while (h--) {
+           i = w;
            do {
-               *p++=f;
-           } while ( --i );
-           p+=swidth;
+               *p++ = f;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5676,23 +5568,25 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void DrawFillRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFillRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor3ub(r, g, b);
     glBegin(GL_TRIANGLE_STRIP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+h));
-    glVertex2i(x+w, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + h));
+    glVertex2i(x + w, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -5707,27 +5601,27 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill25TransRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill25TransRectangle8(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     int i;
     int swidth;
     unsigned c;
 
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    swidth-=w;
-    c=Pixels8[color]<<8;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    swidth -= w;
+    c = Pixels8[color] << 8;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
-               *p = lookup25trans8[ c | *p ];
+               *p = lookup25trans8[c | *p];
                ++p;
-           } while ( --i );
-           p+=swidth;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5741,32 +5635,32 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill25TransRectangle15(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill25TransRectangle15(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x03E07C1F)*3;
+    sp = (((sp << 16) | sp) & 0x03E07C1F) * 3;
 
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x03E07C1F;
-               dp=((dp+sp)>>2)&0x03E07C1F;
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x03E07C1F;
+               dp = ((dp + sp) >> 2) & 0x03E07C1F;
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5780,32 +5674,32 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill25TransRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill25TransRectangle16(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
     // FIXME: pre multiply?
-    sp=(((sp<<16)|sp)&0x07E0F81F)*3;
+    sp = (((sp << 16) | sp) & 0x07E0F81F) * 3;
 
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=((dp+sp)>>2)&0x07E0F81F;
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = ((dp + sp) >> 2) & 0x07E0F81F;
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5819,11 +5713,11 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill25TransRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill25TransRectangle24(SysColors color, int x, int y,
+    int w, int h)
 {
 // FIXME: does 24bpp holds R|G|B ?
-    DrawFillRectangle24(color,x,y,w,h); // no trans functionaility :(
+    DrawFillRectangle24(color, x, y, w, h); // no trans functionaility :(
 }
 
 /**
@@ -5835,40 +5729,40 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill25TransRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill25TransRectangle32(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    swidth-=w;
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    swidth -= w;
 
-    sp1=Pixels32[color];
+    sp1 = Pixels32[color];
     // FIXME: pre multiply?
-    sp2=((sp1&0xFF00FF00)>>8)*3;
-    sp1=(sp1&0x00FF00FF)*3;
+    sp2 = ((sp1 & 0xFF00FF00) >> 8) * 3;
+    sp1 = (sp1 & 0x00FF00FF) * 3;
 
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp1;
                unsigned long dp2;
 
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
-
-               dp1=((dp1+sp1)>>2)&0x00FF00FF;
-               dp2=((dp2+sp2)>>2)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while ( --i );
-           p+=swidth;
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
+
+               dp1 = ((dp1 + sp1) >> 2) & 0x00FF00FF;
+               dp2 = ((dp2 + sp2) >> 2) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5883,23 +5777,25 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void DrawFill25TransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill25TransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 192);
     glBegin(GL_TRIANGLE_STRIP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+h));
-    glVertex2i(x+w, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + h));
+    glVertex2i(x + w, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -5914,27 +5810,27 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill50TransRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill50TransRectangle8(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     int i;
     int swidth;
     unsigned c;
 
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    swidth-=w;
-    c=Pixels8[color]<<8;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    swidth -= w;
+    c = Pixels8[color] << 8;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
-               *p = lookup50trans8[ c | *p ];
+               *p = lookup50trans8[c | *p];
                ++p;
-           } while ( --i );
-           p+=swidth;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5948,31 +5844,31 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill50TransRectangle15(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill50TransRectangle15(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x03E07C1F;
-               dp=((dp+sp)>>1)&0x03E07C1F;
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x03E07C1F;
+               dp = ((dp + sp) >> 1) & 0x03E07C1F;
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -5986,31 +5882,31 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill50TransRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill50TransRectangle16(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=((dp+sp)>>1)&0x07E0F81F;
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = ((dp + sp) >> 1) & 0x07E0F81F;
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6024,11 +5920,11 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill50TransRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill50TransRectangle24(SysColors color, int x, int y,
+    int w, int h)
 {
 // FIXME: how does 24bpp represents RGB ?
-    DrawFillRectangle24(color,x,y,w,h); // no trans functionaility :(
+    DrawFillRectangle24(color, x, y, w, h); // no trans functionaility :(
 }
 
 /**
@@ -6040,39 +5936,39 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill50TransRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill50TransRectangle32(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    swidth-=w;
-
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    swidth -= w;
+
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp1;
                unsigned long dp2;
 
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
-
-               dp1=((dp1+sp1)>>1)&0x00FF00FF;
-               dp2=((dp2+sp2)>>1)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while ( --i );
-           p+=swidth;
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
+
+               dp1 = ((dp1 + sp1) >> 1) & 0x00FF00FF;
+               dp2 = ((dp2 + sp2) >> 1) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6087,23 +5983,25 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void DrawFill50TransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill50TransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 128);
     glBegin(GL_TRIANGLE_STRIP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+h));
-    glVertex2i(x+w, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + h));
+    glVertex2i(x + w, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -6118,27 +6016,27 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill75TransRectangle8(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill75TransRectangle8(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType8 *p;
+    VMemType8* p;
     int i;
     int swidth;
     unsigned c;
 
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    swidth-=w;
-    c=Pixels8[color];
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    swidth -= w;
+    c = Pixels8[color];
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
-               *p = lookup25trans8[ (*p<<8) | c ];
+               *p = lookup25trans8[(*p << 8) | c];
                ++p;
-           } while ( --i );
-           p+=swidth;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6152,31 +6050,31 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill75TransRectangle15(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill75TransRectangle15(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x03E07C1F;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x03E07C1F;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x03E07C1F;
-               dp=(((dp<<1)+dp+sp)>>2)&0x03E07C1F;
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x03E07C1F;
+               dp = (((dp << 1) + dp + sp) >> 2) & 0x03E07C1F;
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6190,31 +6088,31 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill75TransRectangle16(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill75TransRectangle16(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=(((dp<<1)+dp+sp)>>2)&0x07E0F81F;
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = (((dp << 1) + dp + sp) >> 2) & 0x07E0F81F;
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6228,11 +6126,11 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill75TransRectangle24(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill75TransRectangle24(SysColors color, int x, int y,
+    int w, int h)
 {
 // FIXME: does 24bpp holds R|G|B ?
-    DrawFillRectangle24(color,x,y,w,h); // no trans functionaility :(
+    DrawFillRectangle24(color, x, y, w, h); // no trans functionaility :(
 }
 
 /**
@@ -6244,39 +6142,39 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-local void DrawFill75TransRectangle32(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill75TransRectangle32(SysColors color, int x, int y,
+    int w, int h)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    swidth-=w;
-
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    swidth -= w;
+
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp1;
                unsigned long dp2;
 
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
-
-               dp1=(((dp1<<1)+dp1+sp1)>>2)&0x00FF00FF;
-               dp2=(((dp2<<1)+dp2+sp2)>>2)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while ( --i );
-           p+=swidth;
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
+
+               dp1 = (((dp1 << 1) + dp1 + sp1) >> 2) & 0x00FF00FF;
+               dp2 = (((dp2 << 1) + dp2 + sp2) >> 2) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6291,23 +6189,25 @@
 **     @param w        width of rectangle (0=don't draw).
 */
 #ifdef USE_OPENGL
-local void DrawFill75TransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h)
+local void DrawFill75TransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    Glubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
     glColor4ub(r, g, b, 64);
     glBegin(GL_TRIANGLE_STRIP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+h));
-    glVertex2i(x+w, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + h));
+    glVertex2i(x + w, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -6323,62 +6223,61 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawFillTransRectangle8(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawFillTransRectangle8(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
-    VMemType8 *p;
+    VMemType8* p;
     int i;
     int swidth;
     unsigned c;
 
-    swidth=VideoWidth;
-    p=VideoMemory8+y*swidth+x;
-    swidth-=w;
-    c=Pixels8[color];
-
-    if ( w ) {
-       switch ( ((unsigned int)alpha * 4) / 255 )
-       {
+    swidth = VideoWidth;
+    p = VideoMemory8 + y * swidth + x;
+    swidth -= w;
+    c = Pixels8[color];
+
+    if (w) {
+       switch (((unsigned int)alpha * 4) / 255) {
            case 0:
-               while( h-- ) {
-                   i=w;
+               while (h--) {
+                   i = w;
                    do {
                        *p = c;
                        ++p;
-                   } while ( --i );
-                   p+=swidth;
+                   } while (--i);
+                   p += swidth;
                }
                break;
            case 1:
-               c<<=8;
-               while( h-- ) {
-                   i=w;
+               c <<= 8;
+               while (h--) {
+                   i = w;
                    do {
-                       *p = lookup25trans8[ *p | c ];
+                       *p = lookup25trans8[*p | c];
                        ++p;
-                   } while ( --i );
-                   p+=swidth;
+                   } while (--i);
+                   p += swidth;
                }
                break;
            case 2:
-               c<<=8;
-               while( h-- ) {
-                   i=w;
+               c <<= 8;
+               while (h--) {
+                   i = w;
                    do {
-                       *p = lookup50trans8[ *p | c ];
+                       *p = lookup50trans8[*p | c];
                        ++p;
-                   } while ( --i );
-                   p+=swidth;
+                   } while (--i);
+                   p += swidth;
                }
                break;
            case 3:
-               while( h-- ) {
-                   i=w;
+               while (h--) {
+                   i = w;
                    do {
-                       *p = lookup25trans8[ (*p<<8) | c ];
+                       *p = lookup25trans8[(*p << 8) | c];
                        ++p;
-                   } while ( --i );
-                   p+=swidth;
+                   } while (--i);
+                   p += swidth;
                }
                break;
            default:
@@ -6397,10 +6296,10 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawFillNoTransRectangle8(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha __attribute__((unused)))
+local void DrawFillNoTransRectangle8(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha __attribute__((unused)))
 {
-    DrawFillRectangle8(color,x,y,w,h);
+    DrawFillRectangle8(color, x, y, w, h);
 }
 
 /**
@@ -6413,32 +6312,32 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawFillTransRectangle15(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawFillTransRectangle15(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    alpha>>=3;                          //FIXME: only 5bits
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    alpha >>= 3;                          //FIXME: only 5bits
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=((((dp-sp)*alpha)>>5)+sp)&0x03E07C1F; //FIXME: alpha==256 
unreached
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x03E07C1F; //FIXME: 
alpha==256 unreached
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6453,32 +6352,32 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawFillTransRectangle16(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawFillTransRectangle16(SysColors color, int x, int y,
+    int w, int h,unsigned char alpha)
 {
-    VMemType16 *p;
+    VMemType16* p;
     unsigned long sp;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory16+y*swidth+x;
-    swidth-=w;
-    sp=Pixels16[color];
-    sp=((sp<<16)|sp)&0x07E0F81F;
-    alpha>>=3;                          //FIXME: only 5bits
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory16 + y * swidth + x;
+    swidth -= w;
+    sp = Pixels16[color];
+    sp = ((sp << 16) | sp) & 0x07E0F81F;
+    alpha >>= 3;                          //FIXME: only 5bits
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp;
                dp = *p;
-               dp=((dp<<16)|dp)&0x07E0F81F;
-               dp=((((dp-sp)*alpha)>>5)+sp)&0x07E0F81F; //FIXME: alpha==256 
unreached
-               *p++=(dp>>16)|dp;
-           } while ( --i );
-           p+=swidth;
+               dp = ((dp << 16) | dp) & 0x07E0F81F;
+               dp = ((((dp - sp) * alpha) >> 5) + sp) & 0x07E0F81F; //FIXME: 
alpha==256 unreached
+               *p++ = (dp >> 16) | dp;
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6493,11 +6392,11 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawFillTransRectangle24(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha __attribute__((unused)))
+local void DrawFillTransRectangle24(SysColors color, int x, int y,
+    int w, int h,unsigned char alpha __attribute__((unused)))
 {
 //FIXME: does 24bpp represents R|G|B?
-    DrawFillRectangle24(color,x,y,w,h); // no trans functionaility :(
+    DrawFillRectangle24(color, x, y, w, h); // no trans functionaility :(
 }
 
 /**
@@ -6510,40 +6409,40 @@
 **     @param w        width of rectangle (0=don't draw).
 **      @param alpha    alpha value of pixel.
 */
-local void DrawFillTransRectangle32(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawFillTransRectangle32(SysColors color, int x, int y,
+    int w, int h,unsigned char alpha)
 {
-    VMemType32 *p;
+    VMemType32* p;
     unsigned long sp1;
     unsigned long sp2;
     int i;
     int swidth;
 
-    swidth=VideoWidth;
-    p=VideoMemory32+y*swidth+x;
-    swidth-=w;
-
-    sp1=Pixels32[color];
-    sp2=(sp1&0xFF00FF00)>>8;
-    sp1&=0x00FF00FF;
-
-    if ( w ) {
-       while( h-- ) {
-           i=w;
+    swidth = VideoWidth;
+    p = VideoMemory32 + y * swidth + x;
+    swidth -= w;
+
+    sp1 = Pixels32[color];
+    sp2 = (sp1 & 0xFF00FF00) >> 8;
+    sp1 &= 0x00FF00FF;
+
+    if (w) {
+       while (h--) {
+           i = w;
            do {
                unsigned long dp1;
                unsigned long dp2;
 
-               dp1=*p;
-               dp2=(dp1&0xFF00FF00)>>8;
-               dp1&=0x00FF00FF;
+               dp1 = *p;
+               dp2 = (dp1 & 0xFF00FF00) >> 8;
+               dp1 &= 0x00FF00FF;
 
                //FIXME: alpha==256 unreached
-               dp1=((((dp1-sp1)*alpha)>>8)+sp1)&0x00FF00FF;
-               dp2=((((dp2-sp2)*alpha)>>8)+sp2)&0x00FF00FF;
-               *p++=(dp1|(dp2<<8));
-           } while ( --i );
-           p+=swidth;
+               dp1 = ((((dp1-sp1) * alpha) >> 8) + sp1) & 0x00FF00FF;
+               dp2 = ((((dp2-sp2) * alpha) >> 8) + sp2) & 0x00FF00FF;
+               *p++ = (dp1 | (dp2 << 8));
+           } while (--i);
+           p += swidth;
        }
     }
 }
@@ -6559,23 +6458,25 @@
 **      @param alpha    alpha value of pixel.
 */
 #ifdef USE_OPENGL
-local void DrawFillTransRectangleOpenGL(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+local void DrawFillTransRectangleOpenGL(SysColors color, int x, int y,
+    int w, int h,unsigned char alpha)
 {
     VMemType32 c;
-    GLubyte r,g,b;
-
-    c=Pixels32[color];
-    r=(c>>16)&0xff;
-    g=(c>>8)&0xff;
-    b=(c>>0)&0xff;
+    GLubyte r;
+    GLubyte g;
+    GLubyte b;
+
+    c = Pixels32[color];
+    r = (c >> 16) & 0xff;
+    g = (c >> 8) & 0xff;
+    b = (c >> 0) & 0xff;
     glDisable(GL_TEXTURE_2D);
-    glColor4ub(r, g, b, 255-alpha);
+    glColor4ub(r, g, b, 255 - alpha);
     glBegin(GL_TRIANGLE_STRIP);
-    glVertex2i(x, VideoHeight-y);
-    glVertex2i(x+w, VideoHeight-y);
-    glVertex2i(x, VideoHeight-(y+h));
-    glVertex2i(x+w, VideoHeight-(y+h));
+    glVertex2i(x, VideoHeight - y);
+    glVertex2i(x + w, VideoHeight - y);
+    glVertex2i(x, VideoHeight - (y + h));
+    glVertex2i(x + w, VideoHeight - (y + h));
     glEnd();
     glEnable(GL_TEXTURE_2D);
 }
@@ -6590,11 +6491,11 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoFillRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoFillRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
-    CLIP_RECTANGLE(x,y,w,h);
-    VideoFillRectangle(color,x,y,w,h);
+    CLIP_RECTANGLE(x, y, w, h);
+    VideoFillRectangle(color, x, y, w, h);
 }
 
 /**
@@ -6606,11 +6507,11 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoFill25TransRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoFill25TransRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
-    CLIP_RECTANGLE(x,y,w,h);
-    VideoFill25TransRectangle(color,x,y,w,h);
+    CLIP_RECTANGLE(x, y, w, h);
+    VideoFill25TransRectangle(color, x, y, w, h);
 }
 
 /**
@@ -6622,11 +6523,11 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoFill50TransRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoFill50TransRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
-    CLIP_RECTANGLE(x,y,w,h);
-    VideoFill50TransRectangle(color,x,y,w,h);
+    CLIP_RECTANGLE(x, y, w, h);
+    VideoFill50TransRectangle(color, x, y, w, h);
 }
 
 /**
@@ -6638,11 +6539,11 @@
 **     @param h        height of rectangle (0=don't draw).
 **     @param w        width of rectangle (0=don't draw).
 */
-global void VideoFill75TransRectangleClip(SysColors color,int x,int y
-       ,int w,int h)
+global void VideoFill75TransRectangleClip(SysColors color, int x, int y,
+    int w, int h)
 {
-    CLIP_RECTANGLE(x,y,w,h);
-    VideoFill75TransRectangle(color,x,y,w,h);
+    CLIP_RECTANGLE(x, y, w, h);
+    VideoFill75TransRectangle(color, x, y, w, h);
 }
 
 /**
@@ -6655,11 +6556,11 @@
 **     @param w        width of rectangle (0=don't draw).
 **     @param alpha    alpha value of pixels.
 */
-global void VideoFillTransRectangleClip(SysColors color,int x,int y
-       ,int w,int h,unsigned char alpha)
+global void VideoFillTransRectangleClip(SysColors color, int x, int y,
+    int w, int h, unsigned char alpha)
 {
-    CLIP_RECTANGLE(x,y,w,h);
-    VideoFillTransRectangle(color,x,y,w,h,alpha);
+    CLIP_RECTANGLE(x, y, w, h);
+    VideoFillTransRectangle(color, x, y, w, h,alpha);
 }
 
 // ===========================================================================
@@ -6674,7 +6575,7 @@
 **     @param y        Center y coordinate on the screen
 **     @param r        radius of circle
 */
-global void VideoFillCircleClip(SysColors color,int x,int y,int r)
+global void VideoFillCircleClip(SysColors color, int x, int y, int r)
 {
     int cx;
     int cy;
@@ -6682,34 +6583,34 @@
     int d_e;
     int d_se;
 
-    cx=0;
-    cy=r;
-    df=1-r;
-    d_e=3;
-    d_se=-2*r+5;
+    cx = 0;
+    cy = r;
+    df = 1 - r;
+    d_e = 3;
+    d_se = -2 * r + 5;
 
     // FIXME: could much improved :)
     do {
-       VideoDrawHLineClip(color,x-cy,y-cx,1+cy*2);
-       if( cx ) {
-           VideoDrawHLineClip(color,x-cy,y+cx,1+cy*2);
-       }
-       if( df<0 ) {
-           df+=d_e;
-           d_se+=2;
+       VideoDrawHLineClip(color, x - cy, y - cx, 1 + cy * 2);
+       if (cx) {
+           VideoDrawHLineClip(color, x - cy, y + cx, 1 + cy * 2);
+       }
+       if (df < 0) {
+           df += d_e;
+           d_se += 2;
        } else {
-           if( cx!=cy ) {
-               VideoDrawHLineClip(color,x-cx,y-cy,1+cx*2);
-               VideoDrawHLineClip(color,x-cx,y+cy,1+cx*2);
+           if (cx != cy) {
+               VideoDrawHLineClip(color, x - cx, y - cy, 1 + cx * 2);
+               VideoDrawHLineClip(color, x - cx, y + cy, 1 + cx * 2);
            }
-           df+=d_se;
-           d_se+=4;
+           df += d_se;
+           d_se += 4;
            cy--;
        }
-       d_e+=2;
+       d_e += 2;
        cx++;
 
-    } while( cx <= cy );
+    } while (cx <= cy);
 }
 
 /**
@@ -6720,7 +6621,7 @@
 **     @param y        Center y coordinate on the screen
 **     @param r        radius of circle
 */
-global void VideoFill25TransCircleClip(SysColors color,int x,int y,int r)
+global void VideoFill25TransCircleClip(SysColors color, int x, int y, int r)
 {
     int cx;
     int cy;
@@ -6728,34 +6629,34 @@
     int d_e;
     int d_se;
 
-    cx=0;
-    cy=r;
-    df=1-r;
-    d_e=3;
-    d_se=-2*r+5;
+    cx = 0;
+    cy = r;
+    df = 1 - r;
+    d_e = 3;
+    d_se = -2 * r + 5;
 
     // FIXME: could much improved :)
     do {
-       VideoDraw25TransHLineClip(color,x-cy,y-cx,1+cy*2);
-       if( cx ) {
-           VideoDraw25TransHLineClip(color,x-cy,y+cx,1+cy*2);
-       }
-       if( df<0 ) {
-           df+=d_e;
-           d_se+=2;
+       VideoDraw25TransHLineClip(color, x - cy, y - cx, 1 + cy * 2);
+       if (cx) {
+           VideoDraw25TransHLineClip(color, x - cy, y + cx, 1 + cy * 2);
+       }
+       if (df < 0) {
+           df += d_e;
+           d_se += 2;
        } else {
-           if( cx!=cy ) {
-               VideoDraw25TransHLineClip(color,x-cx,y-cy,1+cx*2);
-               VideoDraw25TransHLineClip(color,x-cx,y+cy,1+cx*2);
+           if (cx!=cy) {
+               VideoDraw25TransHLineClip(color, x - cx, y - cy, 1 + cx * 2);
+               VideoDraw25TransHLineClip(color, x - cx, y + cy, 1 + cx * 2);
            }
-           df+=d_se;
-           d_se+=4;
+           df += d_se;
+           d_se += 4;
            cy--;
        }
-       d_e+=2;
+       d_e += 2;
        cx++;
 
-    } while( cx <= cy );
+    } while (cx <= cy);
 }
 
 /**
@@ -6766,7 +6667,7 @@
 **     @param y        Center y coordinate on the screen
 **     @param r        radius of circle
 */
-global void VideoFill50TransCircleClip(SysColors color,int x,int y,int r)
+global void VideoFill50TransCircleClip(SysColors color, int x, int y, int r)
 {
     int cx;
     int cy;
@@ -6774,34 +6675,34 @@
     int d_e;
     int d_se;
 
-    cx=0;
-    cy=r;
-    df=1-r;
-    d_e=3;
-    d_se=-2*r+5;
+    cx = 0;
+    cy = r;
+    df = 1 - r;
+    d_e = 3;
+    d_se = -2 * r + 5;
 
     // FIXME: could much improved :)
     do {
-       VideoDraw50TransHLineClip(color,x-cy,y-cx,1+cy*2);
-       if( cx ) {
-           VideoDraw50TransHLineClip(color,x-cy,y+cx,1+cy*2);
-       }
-       if( df<0 ) {
-           df+=d_e;
-           d_se+=2;
+       VideoDraw50TransHLineClip(color, x - cy, y - cx, 1 + cy * 2);
+       if (cx) {
+           VideoDraw50TransHLineClip(color, x - cy, y + cx, 1 + cy * 2);
+       }
+       if (df < 0) {
+           df += d_e;
+           d_se += 2;
        } else {
-           if( cx!=cy ) {
-               VideoDraw50TransHLineClip(color,x-cx,y-cy,1+cx*2);
-               VideoDraw50TransHLineClip(color,x-cx,y+cy,1+cx*2);
+           if (cx != cy) {
+               VideoDraw50TransHLineClip(color, x - cx, y - cy, 1 + cx * 2);
+               VideoDraw50TransHLineClip(color, x - cx, y + cy, 1 + cx * 2);
            }
-           df+=d_se;
-           d_se+=4;
+           df += d_se;
+           d_se += 4;
            cy--;
        }
-       d_e+=2;
+       d_e += 2;
        cx++;
 
-    } while( cx <= cy );
+    } while (cx <= cy);
 }
 
 /**
@@ -6812,7 +6713,7 @@
 **     @param y        Center y coordinate on the screen
 **     @param r        radius of circle
 */
-global void VideoFill75TransCircleClip(SysColors color,int x,int y,int r)
+global void VideoFill75TransCircleClip(SysColors color, int x, int y, int r)
 {
     int cx;
     int cy;
@@ -6820,34 +6721,34 @@
     int d_e;
     int d_se;
 
-    cx=0;
-    cy=r;
-    df=1-r;
-    d_e=3;
-    d_se=-2*r+5;
+    cx = 0;
+    cy = r;
+    df = 1 - r;
+    d_e = 3;
+    d_se = -2 * r + 5;
 
     // FIXME: could much improved :)
     do {
-       VideoDraw75TransHLineClip(color,x-cy,y-cx,1+cy*2);
-       if( cx ) {
-           VideoDraw75TransHLineClip(color,x-cy,y+cx,1+cy*2);
-       }
-       if( df<0 ) {
-           df+=d_e;
-           d_se+=2;
+       VideoDraw75TransHLineClip(color, x - cy, y - cx, 1 + cy * 2);
+       if (cx) {
+           VideoDraw75TransHLineClip(color, x - cy, y + cx, 1 + cy * 2);
+       }
+       if (df < 0) {
+           df += d_e;
+           d_se += 2;
        } else {
-           if( cx!=cy ) {
-               VideoDraw75TransHLineClip(color,x-cx,y-cy,1+cx*2);
-               VideoDraw75TransHLineClip(color,x-cx,y+cy,1+cx*2);
+           if (cx != cy) {
+               VideoDraw75TransHLineClip(color, x - cx, y - cy, 1 + cx * 2);
+               VideoDraw75TransHLineClip(color, x - cx, y + cy, 1 + cx * 2);
            }
-           df+=d_se;
-           d_se+=4;
+           df += d_se;
+           d_se += 4;
            cy--;
        }
-       d_e+=2;
+       d_e += 2;
        cx++;
 
-    } while( cx <= cy );
+    } while (cx <= cy);
 }
 
 /*----------------------------------------------------------------------------
@@ -6888,10 +6789,9 @@
     VideoFill75TransRectangle = DrawFill75TransRectangleOpenGL;
     VideoFillTransRectangle   = DrawFillTransRectangleOpenGL;
 #else
-    switch( VideoBpp ) {
+    switch (VideoBpp) {
        case 8:
-            if ( lookup25trans8 && lookup50trans8 )
-            {
+            if (lookup25trans8 && lookup50trans8) {
              VideoDrawPixel            = DrawPixel8;
              VideoDraw25TransPixel     = Draw25TransPixel8;
              VideoDraw50TransPixel     = Draw50TransPixel8;
@@ -6919,10 +6819,8 @@
              VideoFill50TransRectangle = DrawFill50TransRectangle8;
              VideoFill75TransRectangle = DrawFill75TransRectangle8;
              VideoFillTransRectangle   = DrawFillTransRectangle8;
-            }
-            else
-            {
-              printf( "(transparency support disabled)\n" );
+            } else {
+              printf("(transparency support disabled)\n");
              VideoDrawPixel            =
              VideoDraw25TransPixel     =
              VideoDraw50TransPixel     =
@@ -7104,149 +7002,164 @@
     int i;
     int j;
 
-    x=y=i=j=0;
+    x = y = i = j = 0;
     //Should not show anything (segmentation fault when not properly clipped)
-    VideoDrawPixelClip(ColorRed,-1,0);
-    VideoDrawPixelClip(ColorRed,0,-1);
-    VideoDrawPixelClip(ColorRed,VideoWidth,0);
-    VideoDrawPixelClip(ColorRed,0,VideoHeight);
-    VideoDraw25TransPixelClip(ColorRed,-1,0);
-    VideoDraw25TransPixelClip(ColorRed,0,-1);
-    VideoDraw25TransPixelClip(ColorRed,VideoWidth,0);
-    VideoDraw25TransPixelClip(ColorRed,0,VideoHeight);
-    VideoDraw50TransPixelClip(ColorRed,-1,0);
-    VideoDraw50TransPixelClip(ColorRed,0,-1);
-    VideoDraw50TransPixelClip(ColorRed,VideoWidth,0);
-    VideoDraw50TransPixelClip(ColorRed,0,VideoHeight);
-    VideoDraw75TransPixelClip(ColorRed,-1,0);
-    VideoDraw75TransPixelClip(ColorRed,0,-1);
-    VideoDraw75TransPixelClip(ColorRed,VideoWidth,0);
-    VideoDraw75TransPixelClip(ColorRed,0,VideoHeight);
-    VideoDrawTransPixelClip(ColorRed,-1,0,0);
-    VideoDrawTransPixelClip(ColorRed,0,-1,0);
-    VideoDrawTransPixelClip(ColorRed,VideoWidth,0,0);
-    VideoDrawTransPixelClip(ColorRed,0,VideoHeight,0);
+    VideoDrawPixelClip(ColorRed, -1, 0);
+    VideoDrawPixelClip(ColorRed, 0, -1);
+    VideoDrawPixelClip(ColorRed, VideoWidth, 0);
+    VideoDrawPixelClip(ColorRed, 0, VideoHeight);
+    VideoDraw25TransPixelClip(ColorRed, -1, 0);
+    VideoDraw25TransPixelClip(ColorRed, 0, -1);
+    VideoDraw25TransPixelClip(ColorRed, VideoWidth, 0);
+    VideoDraw25TransPixelClip(ColorRed, 0, VideoHeight);
+    VideoDraw50TransPixelClip(ColorRed, -1, 0);
+    VideoDraw50TransPixelClip(ColorRed, 0, -1);
+    VideoDraw50TransPixelClip(ColorRed, VideoWidth, 0);
+    VideoDraw50TransPixelClip(ColorRed, 0, VideoHeight);
+    VideoDraw75TransPixelClip(ColorRed, -1, 0);
+    VideoDraw75TransPixelClip(ColorRed, 0, -1);
+    VideoDraw75TransPixelClip(ColorRed, VideoWidth, 0);
+    VideoDraw75TransPixelClip(ColorRed, 0, VideoHeight);
+    VideoDrawTransPixelClip(ColorRed, -1, 0, 0);
+    VideoDrawTransPixelClip(ColorRed, 0, -1, 0);
+    VideoDrawTransPixelClip(ColorRed, VideoWidth, 0, 0);
+    VideoDrawTransPixelClip(ColorRed, 0, VideoHeight, 0);
 
     //Should show blue area getting transparent from left-to-right
-    for (y=0;y<50;y++)
-       for (x=0;x<50;x++)
-           VideoDrawPixel(ColorBlue,x,y);
-    for (y=0;y<50;y++)
-       for (x=50;x<100;x++)
-           VideoDraw25TransPixel(ColorBlue,x,y);
-    for (y=0;y<50;y++)
-       for (x=100;x<150;x++)
-           VideoDraw50TransPixel(ColorBlue,x,y);
-    for (y=0;y<50;y++)
-       for (x=150;x<200;x++)
-           VideoDraw75TransPixel(ColorBlue,x,y);
-    for (y=50;y<100;y++)
-       for (x=0;x<256;x++)
-           VideoDrawTransPixel(ColorBlue,x,y,x);
+    for (y = 0; y < 50; ++y) {
+       for (x = 0; x < 50; ++x) {
+           VideoDrawPixel(ColorBlue, x, y);
+       }
+    }
+    for (y = 0; y < 50; ++y) {
+       for (x = 50; x < 100; ++x) {
+           VideoDraw25TransPixel(ColorBlue, x, y);
+       }
+    }
+    for (y = 0; y < 50; ++y) {
+       for (x = 100; x < 150; ++x) {
+           VideoDraw50TransPixel(ColorBlue, x, y);
+       }
+    }
+    for (y = 0; y < 50; ++y) {
+       for (x = 150; x < 200; ++x) {
+           VideoDraw75TransPixel(ColorBlue, x, y);
+       }
+    }
+    for (y = 50; y < 100; ++y) {
+       for (x = 0; x < 256; ++x) {
+           VideoDrawTransPixel(ColorBlue, x, y, x);
+       }
+    }
 
     // Should show blue+red horizontal bars just below above drawpixel tests
     //getting transparent from top-to-bottom. Clipping should prevent 
segm.fault
-    for (y=0;y<10;y++) {
-       VideoDrawHLine(ColorBlue,0,y+100,VideoWidth-1);
-       VideoDrawHLineClip(ColorRed,-100,-1,VideoWidth+200);
-       VideoDrawHLineClip(ColorRed,-100,VideoHeight,VideoWidth+200);
-       VideoDrawHLineClip(ColorRed,-100,y+110,VideoWidth+200);
-       VideoDraw25TransHLine(ColorBlue,0,y+120,VideoWidth-1);
-       VideoDraw25TransHLineClip(ColorRed,-100,-1,VideoWidth+200);
-       VideoDraw25TransHLineClip(ColorRed,-100,VideoHeight,VideoWidth+200);
-       VideoDraw25TransHLineClip(ColorRed,-100,y+130,VideoWidth+200);
-       VideoDraw50TransHLine(ColorBlue,0,y+140,VideoWidth-1);
-       VideoDraw50TransHLineClip(ColorRed,-100,-1,VideoWidth+200);
-       VideoDraw50TransHLineClip(ColorRed,-100,VideoHeight,VideoWidth+200);
-       VideoDraw50TransHLineClip(ColorRed,-100,y+150,VideoWidth+200);
-       VideoDraw75TransHLine(ColorBlue,0,y+160,VideoWidth-1);
-       VideoDraw75TransHLineClip(ColorRed,-100,-1,VideoWidth+200);
-       VideoDraw75TransHLineClip(ColorRed,-100,VideoHeight,VideoWidth+200);
-       VideoDraw75TransHLineClip(ColorRed,-100,y+170,VideoWidth+200);
-    }
-    for (y=0;y<64;y++) {
-       VideoDrawTransHLine(ColorBlue,0,y+180,VideoWidth-1,y*4);
-       VideoDrawTransHLineClip(ColorRed,-100,-1,VideoWidth+200,y*4);
-       VideoDrawTransHLineClip(ColorRed,-100,VideoHeight,VideoWidth+200,y*4);
-       
VideoDrawTransHLineClip(ColorRed,-100,y+180+64+6+6,VideoWidth+200,(63-y)*4);
+    for (y = 0; y < 10; ++y) {
+       VideoDrawHLine(ColorBlue, 0, y + 100, VideoWidth - 1);
+       VideoDrawHLineClip(ColorRed, -100, -1, VideoWidth + 200);
+       VideoDrawHLineClip(ColorRed, -100, VideoHeight, VideoWidth + 200);
+       VideoDrawHLineClip(ColorRed, -100, y + 110, VideoWidth + 200);
+       VideoDraw25TransHLine(ColorBlue, 0, y + 120, VideoWidth - 1);
+       VideoDraw25TransHLineClip(ColorRed, -100, -1, VideoWidth + 200);
+       VideoDraw25TransHLineClip(ColorRed, -100, VideoHeight, VideoWidth + 
200);
+       VideoDraw25TransHLineClip(ColorRed, -100, y + 130, VideoWidth + 200);
+       VideoDraw50TransHLine(ColorBlue, 0, y + 140, VideoWidth - 1);
+       VideoDraw50TransHLineClip(ColorRed, -100, -1, VideoWidth + 200);
+       VideoDraw50TransHLineClip(ColorRed, -100, VideoHeight, VideoWidth + 
200);
+       VideoDraw50TransHLineClip(ColorRed, -100, y + 150, VideoWidth + 200);
+       VideoDraw75TransHLine(ColorBlue, 0, y + 160, VideoWidth - 1);
+       VideoDraw75TransHLineClip(ColorRed, -100, -1, VideoWidth + 200);
+       VideoDraw75TransHLineClip(ColorRed, -100, VideoHeight, VideoWidth + 
200);
+       VideoDraw75TransHLineClip(ColorRed, -100, y + 170, VideoWidth + 200);
+    }
+    for (y = 0; y < 64; ++y) {
+       VideoDrawTransHLine(ColorBlue, 0, y + 180, VideoWidth - 1, y * 4);
+       VideoDrawTransHLineClip(ColorRed, -100, -1, VideoWidth + 200, y * 4);
+       VideoDrawTransHLineClip(ColorRed, -100, VideoHeight, VideoWidth + 200, 
y * 4);
+       VideoDrawTransHLineClip(ColorRed, -100, y + 180 + 64 + 6 + 6, 
VideoWidth + 200, (63 - y) * 4);
     }
 
     // Should show blue+red vertical bars at the right of the screen
     //getting transparent from left-to-right. Clipping should prevent 
segm.fault
-    i = ((VideoWidth-70-70-50)/10)*10; // starting grid pos for two colums
-    for (x=0;x<64;x++) {
-       VideoDrawTransVLine(ColorBlue,i+x,0,VideoHeight-1,x*4);
-       VideoDrawTransVLineClip(ColorRed,-1,-100,VideoHeight+200,x*4);
-       VideoDrawTransVLineClip(ColorRed,VideoWidth,-100,VideoHeight+200,x*4);
-       VideoDrawTransVLineClip(ColorRed,i+76+x,-100,VideoHeight+200,(63-x)*4);
-    }
-    i -= 4*2*10;
-    for (x=0;x<10;x++) {
-       VideoDrawVLine(ColorBlue,i+x,0,VideoHeight-1);
-       VideoDrawVLineClip(ColorRed,-1,-100,VideoHeight+200);
-       VideoDrawVLineClip(ColorRed,VideoWidth,-100,VideoHeight+200);
-       VideoDrawVLineClip(ColorRed,i+x+10,-100,VideoHeight+200);
-       VideoDraw25TransVLine(ColorBlue,i+x+20,0,VideoHeight-1);
-       VideoDraw25TransVLineClip(ColorRed,-1,-100,VideoHeight+200);
-       VideoDraw25TransVLineClip(ColorRed,VideoWidth,-100,VideoHeight+200);
-       VideoDraw25TransVLineClip(ColorRed,i+x+30,-100,VideoHeight+200);
-       VideoDraw50TransVLine(ColorBlue,i+x+40,0,VideoHeight-1);
-       VideoDraw50TransVLineClip(ColorRed,-1,-100,VideoHeight+200);
-       VideoDraw50TransVLineClip(ColorRed,VideoWidth,-100,VideoHeight+200);
-       VideoDraw50TransVLineClip(ColorRed,i+x+50,-100,VideoHeight+200);
-       VideoDraw75TransVLine(ColorBlue,i+x+60,0,VideoHeight-1);
-       VideoDraw75TransVLineClip(ColorRed,-1,-100,VideoHeight+200);
-       VideoDraw75TransVLineClip(ColorRed,VideoWidth,-100,VideoHeight+200);
-       VideoDraw75TransVLineClip(ColorRed,i+x+70,-100,VideoHeight+200);
+    i = ((VideoWidth - 70 - 70 - 50) / 10) * 10; // starting grid pos for two 
colums
+    for (x = 0; x < 64; ++x) {
+       VideoDrawTransVLine(ColorBlue, i + x, 0, VideoHeight - 1, x * 4);
+       VideoDrawTransVLineClip(ColorRed, -1, -100, VideoHeight + 200, x * 4);
+       VideoDrawTransVLineClip(ColorRed, VideoWidth, -100, VideoHeight + 200,x 
* 4);
+       VideoDrawTransVLineClip(ColorRed, i + 76 + x, -100, VideoHeight + 
200,(63 - x) * 4);
+    }
+    i -= 4 * 2 * 10;
+    for (x = 0; x < 10; ++x) {
+       VideoDrawVLine(ColorBlue, i + x, 0, VideoHeight - 1);
+       VideoDrawVLineClip(ColorRed, -1, -100, VideoHeight + 200);
+       VideoDrawVLineClip(ColorRed, VideoWidth, -100, VideoHeight + 200);
+       VideoDrawVLineClip(ColorRed, i + x + 10, -100, VideoHeight + 200);
+       VideoDraw25TransVLine(ColorBlue, i + x + 20, 0, VideoHeight - 1);
+       VideoDraw25TransVLineClip(ColorRed, -1, -100, VideoHeight + 200);
+       VideoDraw25TransVLineClip(ColorRed, VideoWidth, -100, VideoHeight + 
200);
+       VideoDraw25TransVLineClip(ColorRed, i + x + 30, -100, VideoHeight + 
200);
+       VideoDraw50TransVLine(ColorBlue, i + x + 40, 0, VideoHeight-1);
+       VideoDraw50TransVLineClip(ColorRed, -1, -100, VideoHeight + 200);
+       VideoDraw50TransVLineClip(ColorRed, VideoWidth, -100, VideoHeight + 
200);
+       VideoDraw50TransVLineClip(ColorRed, i + x + 50, -100, VideoHeight + 
200);
+       VideoDraw75TransVLine(ColorBlue, i + x + 60,0, VideoHeight-1);
+       VideoDraw75TransVLineClip(ColorRed,-1, -100, VideoHeight + 200);
+       VideoDraw75TransVLineClip(ColorRed, VideoWidth, -100, VideoHeight + 
200);
+       VideoDraw75TransVLineClip(ColorRed, i + x + 70, -100, VideoHeight + 
200);
     }
 
     //Should show filled rectangles in screen's top-right corners
-    VideoFillRectangleClip(ColorGray,VideoWidth-30,-20,60,40);
-    VideoFill25TransRectangleClip(ColorBlue,VideoWidth-29,-19,58,38);
-    VideoFill50TransRectangleClip(ColorRed,VideoWidth-28,-18,56,36);
-    VideoFill75TransRectangleClip(ColorGreen,VideoWidth-27,-17,54,34);
-    VideoFillTransRectangleClip(ColorBlue,VideoWidth-26,-16,52,32,64);
+    VideoFillRectangleClip(ColorGray, VideoWidth - 30, -20, 60, 40);
+    VideoFill25TransRectangleClip(ColorBlue, VideoWidth - 29, -19, 58, 38);
+    VideoFill50TransRectangleClip(ColorRed, VideoWidth - 28, -18, 56, 36);
+    VideoFill75TransRectangleClip(ColorGreen, VideoWidth - 27, -17, 54, 34);
+    VideoFillTransRectangleClip(ColorBlue, VideoWidth - 26, -16, 52, 32, 64);
 
     //Should show red area in lower-left getting transparent from left-to-right
-    i = ((VideoHeight-20)/10)*10; // starting grid pos for two colums
-    VideoFillRectangle(ColorRed,0,i,50,20);
-    VideoFill25TransRectangle(ColorRed,50,i,50,20);
-    VideoFill50TransRectangle(ColorRed,100,i,50,20);
-    VideoFill75TransRectangle(ColorRed,150,i,50,20);
+    i = ((VideoHeight - 20) / 10) * 10; // starting grid pos for two colums
+    VideoFillRectangle(ColorRed, 0, i, 50, 20);
+    VideoFill25TransRectangle(ColorRed, 50, i, 50, 20);
+    VideoFill50TransRectangle(ColorRed, 100, i, 50, 20);
+    VideoFill75TransRectangle(ColorRed, 150, i, 50, 20);
     i -= 20;
-    for (x=0;x<256;x++)
-       VideoFillTransRectangle(ColorRed,x,i,1,20,x);
+    for (x = 0; x < 256; ++x) {
+       VideoFillTransRectangle(ColorRed, x, i, 1, 20, x);
+    }
 
     //Should show red/green/blue rectangles in lower-left transparent from
     //left-to-right
     i -= 20;
-    for (x=0;x<10;x++) {
-       VideoDrawRectangle(ColorBlue,x,i+x,50-2*x,20-2*x);
-       VideoDraw25TransRectangle(ColorBlue,50+x,i+x,50-2*x,20-2*x);
-       VideoDraw50TransRectangle(ColorBlue,100+x,i+x,50-2*x,20-2*x);
-       VideoDraw75TransRectangle(ColorBlue,150+x,i+x,50-2*x,20-2*x);
+    for (x = 0; x < 10; ++x) {
+       VideoDrawRectangle(ColorBlue, x, i + x, 50 - 2 * x, 20 - 2 * x);
+       VideoDraw25TransRectangle(ColorBlue, 50 + x, i + x, 50 - 2 * x, 20 - 2 
* x);
+       VideoDraw50TransRectangle(ColorBlue, 100 + x, i + x, 50 - 2 * x, 20 - 2 
* x);
+       VideoDraw75TransRectangle(ColorBlue, 150 + x, i + x, 50 - 2 * x, 20 - 2 
* x);
     }
     i -= 20;
-    for (x=0;x<256;x++)
-       VideoDrawTransRectangle(ColorGreen,x,i,1,20,x);
+    for (x = 0;x < 256; ++x) {
+       VideoDrawTransRectangle(ColorGreen, x, i, 1, 20, x);
+    }
     i -= 20;
-    for (x=0;x<128;x++)
-       VideoDrawTransRectangle(ColorRed,2*x,i,2,20,x*2);
+    for (x = 0; x < 128; ++x) {
+       VideoDrawTransRectangle(ColorRed, 2 * x, i, 2, 20, x * 2);
+    }
 
     //Should show rectangles in screen's bottom-right corners
-    VideoDrawRectangleClip(ColorGray,VideoWidth-30,VideoHeight-20,60,40);
-    
VideoDraw25TransRectangleClip(ColorBlue,VideoWidth-29,VideoHeight-19,58,38);
-    VideoDraw50TransRectangleClip(ColorRed,VideoWidth-28,VideoHeight-18,56,36);
-    
VideoDraw75TransRectangleClip(ColorGreen,VideoWidth-27,VideoHeight-17,54,34);
-    
VideoDrawTransRectangleClip(ColorBlue,VideoWidth-26,VideoHeight-16,52,32,64);
+    VideoDrawRectangleClip(ColorGray, VideoWidth - 30, VideoHeight - 20, 60, 
40);
+    VideoDraw25TransRectangleClip(ColorBlue, VideoWidth - 29, VideoHeight - 
19, 58, 38);
+    VideoDraw50TransRectangleClip(ColorRed, VideoWidth - 28, VideoHeight - 18, 
56, 36);
+    VideoDraw75TransRectangleClip(ColorGreen, VideoWidth - 27, VideoHeight - 
17, 54, 34);
+    VideoDrawTransRectangleClip(ColorBlue, VideoWidth - 26, VideoHeight - 16, 
52, 32, 64);
 
     //Display grid of 10x10 (to detect errors more easier)
-    for (y=0;y<VideoHeight;y+=10)
-       for (x=0;x<VideoWidth;x+=10)
-       VideoDrawPixel(ColorWhite,x,y);
+    for (y = 0; y < VideoHeight; y += 10) {
+       for (x = 0; x < VideoWidth; x += 10) {
+           VideoDrawPixel(ColorWhite, x, y);
+       }
+    }
 
     //Should show white pixel in lower-right corner (not prevented by 
clippingi)
-    VideoDrawPixelClip(ColorWhite,VideoWidth-1,VideoHeight-1);
+    VideoDrawPixelClip(ColorWhite, VideoWidth - 1, VideoHeight - 1);
 }
 
 /**
@@ -7258,25 +7171,29 @@
     int x;
     int y;
 
-    for (i=0;i<32;i++)
-       for (y=0;y<32;y++)
-           for (x=0;x<32;x++) {
+    for (i = 0; i < 32; ++i) {
+       for (y = 0; y < 32; ++y) {
+           for (x = 0; x < 32; ++x) {
                int a;
                int b;
-               a=(x+(i%10)*32)*2;
-               b=(y+(i/10)*32)*2;
+               a = (x + (i % 10) * 32) * 2;
+               b = (y + (i / 10) * 32) * 2;
                VideoMemory8[a+b*VideoWidth] =
-               VideoMemory8[a+1+b*VideoWidth] =
-               VideoMemory8[a+(b+1)*VideoWidth] =
-               VideoMemory8[a+1+(b+1)*VideoWidth] =
-               colorcube8[ (i<<10)|(y<<5)|x ];
+                   VideoMemory8[a + 1 + b * VideoWidth] =
+                   VideoMemory8[a + (b + 1) * VideoWidth] =
+                   VideoMemory8[a + 1 + (b + 1) * VideoWidth] =
+                   colorcube8[(i << 10) | (y << 5) | x];
            }
-    for (i=0;i<256;i++)
-       VideoMemory8[i+400*VideoWidth] =
-       VideoMemory8[i+401*VideoWidth] = i;
-    for (i=0;i<256;i++)
-       VideoMemory8[i+403*VideoWidth] =
-       VideoMemory8[i+404*VideoWidth] = Pixels8[ i ];
+       }
+    }
+    for (i = 0; i < 256; ++i) {
+       VideoMemory8[i + 400 * VideoWidth] =
+           VideoMemory8[i + 401 * VideoWidth] = i;
+    }
+    for (i = 0; i < 256; ++i) {
+       VideoMemory8[i + 403 * VideoWidth] =
+           VideoMemory8[i + 404 * VideoWidth] = Pixels8[i];
+    }
 }
 
 /**
@@ -7293,40 +7210,51 @@
     int j;
 
     /* ClearScreen */
-    for ( y=0;y<VideoHeight;y++)
-       for ( x=0;x<VideoWidth;x++)
-           VideoDrawPixel(ColorBlack,x,y);
+    for (y = 0; y < VideoHeight; ++y) {
+       for (x = 0; x < VideoWidth; ++x) {
+           VideoDrawPixel(ColorBlack, x, y);
+       }
+    }
 
     /* draw lines in each possible direction
     y = VideoHeight < VideoWidth ? VideoHeight : VideoWidth;
-    for ( x=0;x<y;x+=10)
-       VideoDrawLine(ColorBlue,0,x,y-x-1,0);
+    for (x = 0; x < y; x += 10) {
+       VideoDrawLine(ColorBlue, 0, x, y - x - 1, 0);
+    }
     */
-    i = (VideoWidth/10)*10;
-    j = (VideoHeight/10)*10;
-    for ( x=0;x<=i;x+=10)
-       VideoDrawLine(ColorBlue,0,0,x,j);
-    for ( y=0;y<=j;y+=10)
-       VideoDrawLine(ColorBlue,0,0,i,y);
-
-    SetClipping( 20, 20, (VideoWidth/10)*10-20, (VideoHeight/10)*10-20 );
-    for ( x=0;x<=i;x+=10)
-       VideoDrawLineClip(ColorRed,0,0,x,j);
-    for ( y=0;y<=j;y+=10)
-       VideoDrawLineClip(ColorRed,0,0,i,y);
+    i = (VideoWidth / 10) * 10;
+    j = (VideoHeight / 10) * 10;
+    for (x = 0; x <= i; x += 10) {
+       VideoDrawLine(ColorBlue, 0, 0, x, j);
+    }
+    for (y = 0; y <= j; y += 10) {
+       VideoDrawLine(ColorBlue, 0, 0, i, y);
+    }
+
+    SetClipping(20, 20, (VideoWidth / 10) * 10 - 20, (VideoHeight / 10) * 10 - 
20);
+    for (x = 0; x <= i; x += 10) {
+       VideoDrawLineClip(ColorRed, 0, 0, x, j);
+    }
+    for (y = 0; y <= j; y += 10) {
+       VideoDrawLineClip(ColorRed, 0, 0, i, y);
+    }
     /*
-    i = (VideoWidth/10)*10+15;
-    j = (VideoHeight/10)*10+15;
-    for ( x=i;x>=-15;x-=10)
-       VideoDrawLineClip(ColorRed,i,0,x,j);
-    for ( y=j;y>=-15;y-=10)
-       VideoDrawLineClip(ColorRed,i,0,-15,y);
+    i = (VideoWidth / 10) * 10 + 15;
+    j = (VideoHeight / 10) * 10 + 15;
+    for (x = i; x >= -15; x -= 10) {
+       VideoDrawLineClip(ColorRed, i, 0, x, j);
+    }
+    for (y = j; y >= -15; y -= 10) {
+       VideoDrawLineClip(ColorRed, i, 0, -15, y);
+    }
     */
 
     /* Display grid of 10x10 (to detect errors more easier) */
-    for (y=0;y<VideoHeight;y+=10)
-       for (x=0;x<VideoWidth;x+=10)
-           VideoDrawPixel(ColorWhite,x,y);
+    for (y = 0; y < VideoHeight; y += 10) {
+       for (x = 0; x < VideoWidth; x += 10) {
+           VideoDrawPixel(ColorWhite, x, y);
+       }
+    }
 }
 
 #endif // } DEBUG




reply via email to

[Prev in Thread] Current Thread [Next in Thread]