DEADSOFTWARE

save: move save code to separated file
[flatwaifu.git] / src / fx.c
index 2b81fd652610230a8331ca015dc1e86be90ccc92..252eb8ae61b14e46cf454b50a98fbc03471f182b 100644 (file)
--- a/src/fx.c
+++ b/src/fx.c
@@ -23,7 +23,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "vga.h"
 #include "view.h"
 #include "fx.h"
 #include "misc.h"
 
 enum{NONE,TFOG,IFOG,BUBL};
 
-#pragma pack(1)
-typedef struct{
-  int x,y,xv,yv;
-  char t,s;
-}fx_t;
-#pragma pack()
+fx_t fx[MAXFX];
 
-static void *spr[15],*bsnd[2];
-static char sprd[15];
-static fx_t fx[MAXFX];
+static void *bsnd[2];
 static char bubsn;
 static int last;
 
-unsigned char fx_scr1[64000],fx_scr2[64000];
+//unsigned char fx_scr1[64000],fx_scr2[64000];
 
 #define SINP 256
 #define SINPM (SINP-1)
@@ -67,8 +59,8 @@ static void setamp(int a) {
   for(i=0;i<SINP;++i) sintab[i]=stdsin[i]*a;
 }
 
-void FX_trans1(int t) {
-
+/*
+void FX_trans1 (int t) {
   int x,y,u,v;
   static unsigned char k;
   unsigned p;
@@ -85,8 +77,8 @@ void FX_trans1(int t) {
         else scra[p]=fx_scr1[v*320+u];
       }else scra[p]=fx_scr2[p];
     }
-
 }
+*/
 
 static void init_fx1sin(void) {
   int j,r,l,rr;
@@ -105,50 +97,13 @@ static void init_fx1sin(void) {
   }
 }
 
-void FX_savegame (FILE *h) {
-  int i, n;
-  for (i = n = 0; i < MAXFX; ++i) {
-    if (fx[i].t) {
-      ++n;
-    }
-  }
-  myfwrite32(n, h);
-  for (i = 0; i < MAXFX; ++i) {
-    if (fx[i].t) {
-      myfwrite32(fx[i].x, h);
-      myfwrite32(fx[i].y, h);
-      myfwrite32(fx[i].xv, h);
-      myfwrite32(fx[i].yv, h);
-      myfwrite8(fx[i].t, h);
-      myfwrite8(fx[i].s, h);
-    }
-  }
-}
-
-void FX_loadgame (FILE *h) {
-  int i, n;
-  n = myfread32(h);
-  for (i = 0; i < n; i++) {
-    fx[i].x = myfread32(h);
-    fx[i].y = myfread32(h);
-    fx[i].xv = myfread32(h);
-    fx[i].yv = myfread32(h);
-    fx[i].t = myfread8(h);
-    fx[i].s = myfread8(h);
-  }
-}
-
-void FX_alloc(void) {
-  int i;
-
-  for(i=0;i<10;++i) spr[i]=Z_getspr("TFOG",i,0,sprd+i);
-  for(;i<15;++i) spr[i]=Z_getspr("IFOG",i-10,0,sprd+i);
+void FX_alloc (void) {
   bsnd[0]=Z_getsnd("BUBL1");
   bsnd[1]=Z_getsnd("BUBL2");
   init_fx1sin();
 }
 
-void FX_init(void) {
+void FX_init (void) {
   int i;
 
   for(i=0;i<MAXFX;++i) fx[i].t=0;
@@ -156,7 +111,7 @@ void FX_init(void) {
   last=0;
 }
 
-void FX_act(void) {
+void FX_act (void) {
   int i;
   byte b;
 
@@ -178,23 +133,7 @@ void FX_act(void) {
   }
 }
 
-void FX_draw(void) {
-  int i,s;
-
-  for(i=0;i<MAXFX;++i) {
-    s=-1;
-    switch(fx[i].t) {
-      case TFOG: s=fx[i].s/2;break;
-         case IFOG: s=fx[i].s/2+10;break;
-         case BUBL:
-               V_dot((fx[i].x>>8)-w_x+WD/2,(fx[i].y>>8)-w_y+HT/2+1+w_o,0xC0+fx[i].s);//V_dot((fx[i].x>>8)-w_x+100,(fx[i].y>>8)-w_y+50+w_o,0xC0+fx[i].s);
-               continue;
-    }
-    if(s>=0) Z_drawspr(fx[i].x,fx[i].y,spr[s],sprd[s]);
-  }
-}
-
-static int findfree(void) {
+static int findfree (void) {
   int i;
 
   for(i=0;i<MAXFX;++i) if(!fx[i].t) return i;
@@ -203,7 +142,7 @@ static int findfree(void) {
   return last;
 }
 
-void FX_tfog(int x,int y) {
+void FX_tfog (int x, int y) {
   int i;
 
   i=findfree();
@@ -211,7 +150,7 @@ void FX_tfog(int x,int y) {
        fx[i].x=x;fx[i].y=y;
 }
 
-void FX_ifog(int x,int y) {
+void FX_ifog (int x, int y) {
   int i;
 
   i=findfree();
@@ -219,7 +158,7 @@ void FX_ifog(int x,int y) {
     fx[i].x=x;fx[i].y=y;
 }
 
-void FX_bubble(int x,int y,int xv,int yv,int n) {
+void FX_bubble (int x, int y, int xv, int yv, int n) {
   int i;
 
   if(!bubsn) {Z_sound(bsnd[rand()&1],128);bubsn=1;}
@@ -230,4 +169,3 @@ void FX_bubble(int x,int y,int xv,int yv,int n) {
        fx[i].xv=xv;fx[i].yv=yv-myrand(256)-768;
   }
 }
-