DEADSOFTWARE

update copyrights
[flatwaifu.git] / src / smoke.c
index 4ec8117a26a12bff82048fc138da3f7eed9b5d43..db8afc7e828d6609b5c00580befdfbf07cc7b1f6 100644 (file)
@@ -1,74 +1,41 @@
-/*
-   Copyright (C) Prikol Software 1996-1997
-   Copyright (C) Aleksey Volynskov 1996-1997
-   Copyright (C) <ARembo@gmail.com> 2011
-
-   This file is part of the Doom2D:Rembo project.
-
-   Doom2D:Rembo is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2 as
-   published by the Free Software Foundation.
-
-   Doom2D:Rembo is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/> or
-   write to the Free Software Foundation, Inc.,
-   51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-*/
+/* Copyright (C) 1996-1997 Aleksey Volynskov
+ * Copyright (C) 2011 Rambo
+ * Copyright (C) 2020 SovietPony
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
 
 #include "glob.h"
 #include <stdlib.h>
-#include "vga.h"
 #include "view.h"
 #include "smoke.h"
+#include "game.h"
 #include "fx.h"
 #include "misc.h"
+#include "my.h"
+#include "monster.h"
 
 #define MAXSR 20
 
-#define SMSN 10
-#define FLSN 8
+smoke_t sm[MAXSMOK];
 
-#pragma pack(1)
-typedef struct{
-  int x,y,xv,yv;
-  byte t,s;
-  short o;
-}smoke_t;
-#pragma pack()
-
-static smoke_t sm[MAXSMOK];
 static int sr_r,sxr[MAXSR],syr[MAXSR];
 static int lsm;
 
-static void *spr[SMSN],*fspr[FLSN];
 static void *burnsnd;
 static int burntm=0;
 
-byte flametab[16]={
-0xBC,0xBA,0xB8,0xB6,0xB4,0xB2,0xB0,0xD5,0xD6,0xD7,0xA1,0xA0,0xE3,0xE2,0xE1,0xE0
-};
-
-void SMK_savegame(FILE* h) {
-  int i,n;
-
-  for(i=n=0;i<MAXSMOK;++i) if(sm[i].t) ++n;
-  myfwrite(&n,1,4,h);
-  for(i=0;i<MAXSMOK;++i) if(sm[i].t) myfwrite(&sm[i],1,sizeof(sm[0]),h);
-}
-
-void SMK_loadgame(FILE* h) {
-  int n;
-
-  myfread(&n,1,4,h);
-  myfread(sm,1,n*sizeof(sm[0]),h);
-}
-
-void SMK_init(void) {
+void SMK_init (void) {
   int i;
 
   for(i=0;i<MAXSMOK;++i) {sm[i].t=0;}
@@ -76,12 +43,9 @@ void SMK_init(void) {
   burntm=0;
 }
 
-void SMK_alloc(void) {
+void SMK_alloc (void) {
   int i;
-
   burnsnd=Z_getsnd("BURN");
-  for(i=0;i<SMSN;++i) spr[i]=Z_getspr("SMOK",i,0,NULL);
-  for(i=0;i<FLSN;++i) fspr[i]=Z_getspr("FLAM",i,0,NULL);
   for(i=0;i<MAXSR;++i) {
     sxr[i]=myrand(256*2+1)-256;
     syr[i]=myrand(256*2+1)-256;
@@ -93,7 +57,7 @@ static void inclast(void) {
   if(++lsm>=MAXSMOK) lsm=0;
 }
 
-void SMK_act(void) {
+void SMK_act (void) {
   int i,ox,oy;
   static obj_t o;
 
@@ -137,22 +101,7 @@ void SMK_act(void) {
   }
 }
 
-void SMK_draw(void) {
-  int i,s;
-
-  for(i=0;i<MAXSMOK;++i) if(sm[i].t) switch(sm[i].s) {
-    case 0:
-      if((s=sm[i].t)>=(SMSN-1)*3) s=0; else s=SMSN-1-s/3;
-      V_sprf((sm[i].x>>8)-w_x+WD/2,(sm[i].y>>8)-w_y+HT/2+1+w_o,spr[s],&smoke_sprf);//V_sprf((sm[i].x>>8)-w_x+100,(sm[i].y>>8)-w_y+50+w_o,spr[s],&smoke_sprf);
-      break;
-    case 1:
-      if((s=sm[i].t)>=(FLSN-1)) s=0; else s=FLSN-1-s;
-      V_sprf((sm[i].x>>8)-w_x+WD/2,(sm[i].y>>8)-w_y+HT/2+1+w_o,fspr[s],&flame_sprf);//V_sprf((sm[i].x>>8)-w_x+100,(sm[i].y>>8)-w_y+50+w_o,fspr[s],&flame_sprf);
-      break;
-  }
-}
-
-void SMK_add(int x,int y,int xv,int yv,byte t,byte s,short o) {
+static void SMK_add (int x, int y, int xv, int yv, byte t, byte s, short o) {
   int i;
 
   if(!Z_canfit(x>>8,(y>>8)+3,3,7)) return;
@@ -165,7 +114,7 @@ void SMK_add(int x,int y,int xv,int yv,byte t,byte s,short o) {
   inclast();
 }
 
-void SMK_gas(int x0,int y0,int xr,int yr,int xv,int yv,int k) {
+void SMK_gas (int x0, int y0, int xr, int yr, int xv, int yv, int k) {
   int i,x,y;
   static int sxv,syv;
 
@@ -181,7 +130,7 @@ void SMK_gas(int x0,int y0,int xr,int yr,int xv,int yv,int k) {
   }
 }
 
-void SMK_flame(int x0,int y0,int ox,int oy,int xr,int yr,int xv,int yv,int k,int o) {
+void SMK_flame (int x0, int y0, int ox, int oy, int xr, int yr, int xv, int yv, int k, int o) {
   int i,x,y;
   static int sxv,syv;