diff --git a/src/items.c b/src/items.c
index 65f39e2bb5f5437a02ff017ead6f102bc9003776..64b766f1ef0d8f2b02ebba0aa764d537a60a512f 100644 (file)
--- a/src/items.c
+++ b/src/items.c
-/*
- 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 "things.h"
#include "misc.h"
#include "map.h"
-#include "my.h"
#include "files.h"
#include "game.h"
+
item_t it[MAXITEM];
static void *snd[4];
rsndtm = 0;
}
-int IT_load (FILE *h) {
- int m, i, j;
- old_thing_t t;
- switch (blk.t) {
- case MB_THING:
- for (i = 0; blk.sz > 0; ++i, blk.sz -= 8) {
- t.x = myfread16(h);
- t.y = myfread16(h);
- t.t = myfread16(h);
- t.f = myfread16(h);
- it[i].o.x = t.x;
- it[i].o.y = t.y;
- it[i].t = t.t;
- it[i].s = t.f;
- if (it[i].t && (it[i].s & THF_DM) && !g_dm) {
- it[i].t=0;
- }
- }
- m = i;
- for (i = 0, j = -1; i < m; ++i) {
- if (it[i].t == TH_PLR1) {
- j = i;
- it[i].t = 0;
- }
- }
- if (!g_dm) {
- if (j == -1) {
- ERR_fatal("Предмет игрок_1 не найден");
- }
- dm_pos[0].x = it[j].o.x;
- dm_pos[0].y = it[j].o.y;
- dm_pos[0].d = it[j].s & THF_DIR;
- }
- for (i = 0, j = -1; i < m; ++i) {
- if (it[i].t == TH_PLR2) {
- j = i;
- it[i].t = 0;
- }
- }
- if (!g_dm && _2pl) {
- if (j == -1) {
- ERR_fatal("Предмет игрок_2 не найден");
- }
- dm_pos[1].x = it[j].o.x;
- dm_pos[1].y = it[j].o.y;
- dm_pos[1].d = it[j].s & THF_DIR;
- }
- for (i = 0, j = 0; i < m; ++i) {
- if (it[i].t == TH_DMSTART) {
- if (g_dm) {
- dm_pos[j].x = it[i].o.x;
- dm_pos[j].y = it[i].o.y;
- dm_pos[j].d = it[i].s & THF_DIR;
- }
- it[i].t = 0;
- ++j;
- }
- }
- if (g_dm && j < 2) {
- ERR_fatal("Меньше 2-ух точек DM");
- }
- if (g_dm) {
- dm_pnum = j;
- dm_pl1p = myrand(dm_pnum);
- do {
- dm_pl2p = myrand(dm_pnum);
- } while (dm_pl2p == dm_pl1p);
- } else {
- dm_pl1p = 0;
- dm_pl2p = 1;
- dm_pnum = 2;
- }
- PL_spawn(&pl1, dm_pos[dm_pl1p].x, dm_pos[dm_pl1p].y, dm_pos[dm_pl1p].d);
- if (_2pl) {
- PL_spawn(&pl2, dm_pos[dm_pl2p].x, dm_pos[dm_pl2p].y, dm_pos[dm_pl2p].d);
- }
- for (i = 0; i < m; ++i) {
- if (it[i].t >= TH_CLIP && it[i].t < TH_DEMON) {
- it[i].s = 0;
- it[i].t = it[i].t - TH_CLIP + I_CLIP;
- if (it[i].t >= I_KEYR && it[i].t <= I_KEYB) {
- it[i].t |= 0x8000;
- }
- } else if (it[i].t >= TH_DEMON) {
- MN_spawn(it[i].o.x, it[i].o.y, it[i].s & THF_DIR, it[i].t - TH_DEMON + MN_DEMON);
- it[i].t = 0;
- }
- }
- return 1;
- }
- return 0;
-}
-
static void takesnd (int t) {
if(tsndtm) return;
t&=0x7FFF;