DEADSOFTWARE

headers describes that c-files implements
[flatwaifu.git] / src / vga.c
index 0d16859efde217bd07cc56e0da4dfda6a726744a..8347b3ae55c0400becdbd67cb796e6d6b8ad60fe 100644 (file)
--- a/src/vga.c
+++ b/src/vga.c
 
 
 // адрес экранного буфера
-unsigned char *scra;
+//unsigned char *scra;
 
 // виртуальный экран
-unsigned char scrbuf[64000];
-
+//unsigned char scrbuf[64000];
 
 int SCRW = 800;
 int SCRH = 600;
-
-SDL_Surface* screen = NULL;
-
-int cx1,cx2,cy1,cy2;
-
 char fullscreen = OFF;
 
 byte bright[256];
 byte mixmap[256][256];
 byte clrmap[256*12];
 
+static SDL_Surface* screen = NULL;
+static int cx1,cx2,cy1,cy2;
 static byte flametab[16] = {
   0xBC,0xBA,0xB8,0xB6,0xB4,0xB2,0xB0,0xD5,0xD6,0xD7,0xA1,0xA0,0xE3,0xE2,0xE1,0xE0
 };
-
-extern void *walp[256];
+static int offx = 0;
+static int offy = 0;
 
 #define HQ 2
 
@@ -76,8 +72,7 @@ vgaimg *V_loadvgaimg (char *name) {
   return V_getvgaimg(F_getresid(name));
 }
 
-short V_init(void)
-{
+short V_init (void) {
     Uint32 flags = SDL_SWSURFACE|SDL_DOUBLEBUF|SDL_HWPALETTE;
     if (fullscreen) flags = flags | SDL_FULLSCREEN;
     screen = SDL_SetVideoMode(SCRW, SCRH, 8, flags);
@@ -88,13 +83,11 @@ short V_init(void)
 }
 
 // переключение в текстовый режим
-void V_done(void)
-{
+void V_done (void) {
     SDL_Quit();
 }
 
-void draw_rect (int x, int y, int w, int h, int c)
-{
+static void draw_rect (int x, int y, int w, int h, int c) {
     SDL_Rect dstrect;
     dstrect.x = x*HQ;
     dstrect.y = y*HQ;
@@ -104,8 +97,7 @@ void draw_rect (int x, int y, int w, int h, int c)
 }
 
 // установить область вывода
-void V_setrect(short x,short w,short y,short h)
-{
+void V_setrect (short x,short w,short y,short h) {
     SDL_Rect r;
     r.x=x*HQ;
     r.y=y*HQ;
@@ -123,8 +115,7 @@ void V_setrect(short x,short w,short y,short h)
     if (cy2>=SCRH) cy2=SCRH-1;
 }
 
-void putpixel(int x, int y, Uint8 color)
-{
+static void putpixel (int x, int y, Uint8 color) {
     if(x>=cx1 && x<=cx2 && y>=cy1 && y<=cy2) {
         x*=HQ;
         y*=HQ;
@@ -137,8 +128,7 @@ void putpixel(int x, int y, Uint8 color)
     }
 }
 
-byte getpixel(int x, int y)
-{
+static byte getpixel (int x, int y) {
     if(x>=cx1 && x<=cx2 && y>=cy1 && y<=cy2) {
         x*=HQ;
         y*=HQ;
@@ -147,29 +137,22 @@ byte getpixel(int x, int y)
     return 0;
 }
 
-void mappixel(int x,int y,byte* cmap)
-{
+static void mappixel (int x, int y, byte* cmap) {
     byte c = getpixel(x,y);
     putpixel(x,y,cmap[c]);
 }
 
-int offx = 0;
-int offy = 0;
-
-void V_center(int f)
-{
+void V_center (int f) {
     if (f) V_offset(SCRW/2-320/2, SCRH/2-200/2);
     else V_offset(0, 0);
 }
 
-void V_offset(int ox, int oy)
-{
+void V_offset (int ox, int oy) {
     offx=ox;
     offy=oy;
 }
 
-void draw_spr(short x,short y,vgaimg *i, int d, int c)
-{
+static void draw_spr (short x, short y, vgaimg *i, int d, int c) {
     if (i==NULL) return;
     x += offx;
     y += offy;
@@ -194,36 +177,30 @@ void draw_spr(short x,short y,vgaimg *i, int d, int c)
     }
 }
 
-void V_rotspr (int x, int y, vgaimg* i, int d)
-{
+void V_rotspr (int x, int y, vgaimg* i, int d) {
     x+=i->w*((d&1)?1:0);
     y+=i->h*((d&2)?1:0);
     draw_spr(x,y,i,d,0);
 }
 
-void V_pic(short x,short y,vgaimg *i)
-{
-    draw_spr(x,y,i, 0, 0);
+void V_pic (short x, short y, vgaimg *i) {
+    draw_spr(x, y, i, 0, 0);
 }
 
-void V_manspr(int x,int y,void *p, unsigned char c)
-{
-    draw_spr(x,y,p, 0, c);
+void V_manspr (int x, int y, void *p, unsigned char c) {
+    draw_spr(x, y, p, 0, c);
 }
 
-void V_manspr2(int x,int y,void *p, unsigned char c)
-{
-    draw_spr(x,y,p, 1, c);
+void V_manspr2(int x,int y,void *p, unsigned char c) {
+    draw_spr(x, y, p, 1, c);
 }
 
 // вывести точку цвета c в координатах (x,y)
-void V_dot(short x,short y, unsigned char c)
-{
+void V_dot (short x,short y, unsigned char c) {
     putpixel(x,y,c);
 }
 
-void smoke_sprf(int x, int y, byte c)
-{
+void smoke_sprf (int x, int y, byte c) {
     byte t = getpixel(x,y);
     c = c + bright[t];
     c += 0x60;
@@ -231,15 +208,13 @@ void smoke_sprf(int x, int y, byte c)
     putpixel(x,y,mixmap[c][t]);
 }
 
-void flame_sprf(int x, int y, byte c)
-{
+void flame_sprf (int x, int y, byte c) {
     byte t = getpixel(x,y);
     c = c + bright[t];
     putpixel(x,y,flametab[c]);
 }
 
-void V_sprf(short x,short y,vgaimg *i,spr_f *f)
-{
+void V_sprf (short x,short y,vgaimg *i,spr_f *f) {
     if (i==NULL) return;
     x-=i->sx;
     y-=i->sy;
@@ -256,30 +231,20 @@ void V_sprf(short x,short y,vgaimg *i,spr_f *f)
     }
 }
 
-void V_spr(short x,short y,vgaimg *i)
-{
-    draw_spr(x,y,i,0, 0);
+void V_spr (short x, short y, vgaimg *i) {
+    draw_spr(x, y, i, 0, 0);
 }
 
-void V_spr2(short x,short y,vgaimg *i)
-{
+void V_spr2 (short x, short y, vgaimg *i) {
     draw_spr(x,y,i,1,0);
 }
 
-void V_clr(short x,short w,short y,short h,unsigned char c)
-{
-    draw_rect(x,y,w,h, c);
-}
-
-// установить палитру из массива p
-void VP_setall(void *p)
-{
-    VP_set(p, 0, 256);
+void V_clr (short x, short w, short y, short h, unsigned char c) {
+    draw_rect(x, y, w, h, c);
 }
 
 // установить n цветов, начиная с f, из массива p
-void VP_set(void *p,short f,short n)
-{
+static void VP_set (void *p, short f, short n) {
     byte *ptr = (byte*)p;
     SDL_Color colors[256];
     int i;
@@ -293,22 +258,24 @@ void VP_set(void *p,short f,short n)
     SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, f, n);
 }
 
+// установить палитру из массива p
+void VP_setall (void *p) {
+    VP_set(p, 0, 256);
+}
+
 // установить адрес экранного буфера
 // NULL - реальный экран
-void V_setscr(void *p)
-{
+void V_setscr (void *p) {
     if (screen) SDL_Flip(screen);
 }
 
 // скопировать прямоугольник на экран
-void V_copytoscr(short x,short w,short y,short h)
-{
+void V_copytoscr (short x, short w, short y, short h) {
     x*=HQ; y*=HQ; w*=HQ; h*=HQ;
     SDL_UpdateRect(screen, x, y, w, h);
 }
 
-void V_maptoscr(int x,int w,int y,int h,void *cmap)
-{
+void V_maptoscr (int x, int w, int y, int h, void *cmap) {
     int cx,cy;
     for (cx=x; cx<x+w; cx++)
         for (cy=y; cy<y+h; cy++)
@@ -316,16 +283,14 @@ void V_maptoscr(int x,int w,int y,int h,void *cmap)
     V_copytoscr(x,w,y,h);
 }
 
-void V_remap_rect(int x,int y,int w,int h,byte *cmap)
-{
+void V_remap_rect (int x, int y, int w, int h, byte *cmap) {
     int cx,cy;
     for (cx=x; cx<x+w; cx++)
         for (cy=y; cy<y+h; cy++)
             mappixel(cx,cy,cmap);
 }
 
-void V_toggle()
-{
+void V_toggle (void) {
     if (!SDL_WM_ToggleFullScreen(screen)) {
         int ncolors = screen->format->palette->ncolors;
         SDL_Color colors[256];