DEADSOFTWARE

portability: avoid errors on some compilers
[flatwaifu.git] / src / monster.c
index e895a3827709675ab06c0b93361e1d26f4a89222..77a161df669ab9f8dd217f37b42d6d7f0e255e97 100644 (file)
@@ -1,24 +1,19 @@
-/*
-   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>
@@ -35,7 +30,6 @@
 #include "misc.h"
 #include "fx.h"
 #include "smoke.h"
-#include "my.h"
 #include "player.h"
 #include "error.h"
 #include "game.h"
@@ -90,38 +84,38 @@ static char *sleepanim[MN_TN]={
 
 int hit_xv, hit_yv;
 mn_t mn[MAXMN];
+int mnum, gsndt;
 
 static void *fsnd,*pauksnd,*trupsnd;
 static void *snd[MN_TN][5],*impsitsnd[2],*impdthsnd[2],*firsnd,*slopsnd,*gsnd[4];
 static void *swgsnd,*pchsnd,*telesnd;
 static void *positsnd[3],*podthsnd[3];
-static int mnum,gsndt;
 static mnsz_t mnsz[MN_TN+1]={
-//rad  ht  life  pain rv jv  slop min_pn
-    0,  0,    0,    0, 0, 0,    0,    0,       // none
-   15, 28,   60,   20, 7,10,   0,   10,        // demon
-   10, 28,   25,   15, 3,10,   30,    0,       // imp
-   10, 28,   15,   10, 3,10,   30,    0,       // zomby
-   10, 28,   20,   10, 3,10,   30,    0,       // sergeant
-   20, 55,  500,   70, 5,10,   0,   50,        // cyberdemon
-   12, 28,   60,   20, 3,10,   30,   10,       // chaingunner
-   12, 32,  150,   40, 3,10,    0,   30,       // baron of hell
-   12, 32,   75,   40, 3,10,    0,   30,       // hell knight
-   15, 28,  100,   10, 4, 4,    0,    0,       // cacodemon
-    8, 18,   60,   10, 4, 4,    0,    0,       // lost soul
-   15, 28,  100,   10, 4, 4,    0,    0,       // pain elemental
-   64, 50,  500,   70, 4,10,    0,   50,       // spider mastermind
-   25, 27,  150,   20, 4,10,    0,    0,       // arachnotron
-   18, 30,  200,   40, 3, 7,    0,   20,       // mancubus
-   17, 36,  200,   40, 6,11,    0,   20,       // revenant
-   17, 36,  150,   30, 7,12,    0,   10,       // archvile
-    5,  5,   35,   20,14, 6,    0,   10,       // fish
-    5, 17,   20,    0, 7, 6,    0,    0,       // barrel
-   17, 38,   20,   40, 3, 6,    0,   20,       // robot
-    8, 26,  400,   70, 8,10,   30,   50                // man
+  /* rad  ht life  pain  rv  jv slop min_pn */
+  {    0,  0,   0,    0,  0,  0,   0,     0 }, // none
+  {   15, 28,  60,   20,  7, 10,   0,    10 }, // demon
+  {   10, 28,  25,   15,  3, 10,  30,     0 }, // imp
+  {   10, 28,  15,   10,  3, 10,  30,     0 }, // zomby
+  {   10, 28,  20,   10,  3, 10,  30,     0 }, // sergeant
+  {   20, 55, 500,   70,  5, 10,   0,    50 }, // cyberdemon
+  {   12, 28,  60,   20,  3, 10,  30,    10 }, // chaingunner
+  {   12, 32, 150,   40,  3, 10,   0,    30 }, // baron of hell
+  {   12, 32,  75,   40,  3, 10,   0,    30 }, // hell knight
+  {   15, 28, 100,   10,  4,  4,   0,     0 }, // cacodemon
+  {    8, 18,  60,   10,  4,  4,   0,     0 }, // lost soul
+  {   15, 28, 100,   10,  4,  4,   0,     0 }, // pain elemental
+  {   64, 50, 500,   70,  4, 10,   0,    50 }, // spider mastermind
+  {   25, 27, 150,   20,  4, 10,   0,     0 }, // arachnotron
+  {   18, 30, 200,   40,  3,  7,   0,    20 }, // mancubus
+  {   17, 36, 200,   40,  6, 11,   0,    20 }, // revenant
+  {   17, 36, 150,   30,  7, 12,   0,    10 }, // archvile
+  {    5,  5,  35,   20, 14,  6,   0,    10 }, // fish
+  {    5, 17,  20,    0,  7,  6,   0,     0 }, // barrel
+  {   17, 38,  20,   40,  3,  6,   0,    20 }, // robot
+  {    8, 26, 400,   70,  8, 10,  30,    50 }  // man
 };
 
-static void setst(int i,int st) {
+void setst (int i, int st) {
   char *a;
   int t;
 
@@ -163,81 +157,6 @@ static void setst(int i,int st) {
   mn[i].ap=a;
 }
 
-void MN_savegame (FILE *h) {
-  int i, n;
-  for (n = MAXMN - 1; n >= 0 && mn[n].t == 0; n--) {
-    // empty
-  }
-  n += 1;
-  myfwrite32(n, h);
-  for (i = 0; i < n; i++) {
-    myfwrite32(mn[i].o.x, h);
-    myfwrite32(mn[i].o.y, h);
-    myfwrite32(mn[i].o.xv, h);
-    myfwrite32(mn[i].o.yv, h);
-    myfwrite32(mn[i].o.vx, h);
-    myfwrite32(mn[i].o.vy, h);
-    myfwrite32(mn[i].o.r, h);
-    myfwrite32(mn[i].o.h, h);
-    myfwrite8(mn[i].t, h);
-    myfwrite8(mn[i].d, h);
-    myfwrite8(mn[i].st, h);
-    myfwrite8(mn[i].ftime, h);
-    myfwrite32(mn[i].fobj, h);
-    myfwrite32(mn[i].s, h);
-    myfwrite32(0, h); // mn[i].ap useless, changed after load
-    myfwrite32(mn[i].aim, h);
-    myfwrite32(mn[i].life, h);
-    myfwrite32(mn[i].pain, h);
-    myfwrite32(mn[i].ac, h);
-    myfwrite32(mn[i].tx, h);
-    myfwrite32(mn[i].ty, h);
-    myfwrite32(mn[i].ammo, h);
-    myfwrite16(mn[i].atm, h);
-  }
-  myfwrite32(mnum, h);
-  myfwrite32(gsndt, h);
-}
-
-void MN_loadgame (FILE *h) {
-  int i, n, c;
-  n = myfread32(h);
-  for (i = 0; i < n; i++) {
-    mn[i].o.x = myfread32(h);
-    mn[i].o.y = myfread32(h);
-    mn[i].o.xv = myfread32(h);
-    mn[i].o.yv = myfread32(h);
-    mn[i].o.vx = myfread32(h);
-    mn[i].o.vy = myfread32(h);
-    mn[i].o.r = myfread32(h);
-    mn[i].o.h = myfread32(h);
-    mn[i].t = myfread8(h);
-    mn[i].d = myfread8(h);
-    mn[i].st = myfread8(h);
-    mn[i].ftime = myfread8(h);
-    mn[i].fobj = myfread32(h);
-    mn[i].s = myfread32(h);
-    mn[i].ap = NULL; myfread32(h); // useless, changed after loading
-    mn[i].aim = myfread32(h);
-    mn[i].life = myfread32(h);
-    mn[i].pain = myfread32(h);
-    mn[i].ac = myfread32(h);
-    mn[i].tx = myfread32(h);
-    mn[i].ty = myfread32(h);
-    mn[i].ammo = myfread32(h);
-    mn[i].atm = myfread16(h);
-  }
-  mnum = myfread32(h);
-  gsndt = myfread32(h);
-  for (n = 0; n < MAXMN; ++n) {
-    if (mn[n].t) {
-      c = mn[n].ac;
-      setst(n, mn[n].st);
-      mn[n].ac = c;
-    }
-  }
-}
-
 #define GGAS_TOTAL (MN__LAST-MN_DEMON+16+10)
 
 void MN_alloc (void) {