DEADSOFTWARE

portability: use only english strings for debug
[flatwaifu.git] / src / memory.c
index 5be719f55d45d1741146a21e3341a5a1d97be3b1..f1187462d2a047ffe760ae283ee3d33bc634ad36 100644 (file)
@@ -1,23 +1,19 @@
-/*
-   Copyright (C) Prikol Software 1996-1997
-   Copyright (C) Aleksey Volynskov 1996-1997
-
-   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 <stdio.h>
@@ -33,10 +29,10 @@ static short resl[MAX_WAD];
 
 void M_startup (void) {
   if(m_active) return;
-  logo("M_startup: настройка памяти\n");
+  logo("M_startup: setup memory\n");
   memset(resp,0,sizeof(resp));
   memset(resl,0,sizeof(resl));
-  //  logo("  свободно DPMI-памяти: %uK\n",dpmi_memavl()>>10);
+  //  logo("  free DPMI-memory: %uK\n",dpmi_memavl()>>10);
   m_active=TRUE;
 }
 
@@ -50,7 +46,7 @@ static void allocres (int h) {
 
   if(h>d_start && h<d_end) s=1; else s=0;
   if(!(p=malloc(wad[h].l+4+s*8)))
-    ERR_fatal("M_lock: не хватает памяти");
+    ERR_fatal("M_lock: out of memory");
   *p=h;
   ++p;
   resp[h]=p;
@@ -66,8 +62,7 @@ static void allocres (int h) {
 
 void *M_lock (int h) {
   if(h==-1 || h==0xFFFF) return NULL;
-  h&=-1-0x8000;
-  if(h>=MAX_WAD) ERR_fatal("M_lock: странный номер ресурса");
+  if(h>=MAX_WAD) ERR_fatal("M_lock: invalid resource id");
   if(!resl[h]) if(!resp[h]) allocres(h);
   ++resl[h];
   return resp[h];
@@ -78,15 +73,15 @@ void M_unlock (void *p) {
 
   if(!p) return;
   h=((int*)p)[-1];
-  if(h>=MAX_WAD) ERR_fatal("M_unlock: странный номер ресурса");
+  if(h>=MAX_WAD) ERR_fatal("M_unlock: invalid resource id");
   if(!resl[h]) return;
   --resl[h];
 }
 
 int M_locked (int h) {
-  return (h != -1) && (h != 0xFFFF) && (resl[h & (-1 - 0x8000)] != 0);
+  return (h != -1) && (h != 0xFFFF) && (resl[h] != 0);
 }
 
 int M_was_locked (int h) {
-  return (h != -1) && (h != 0xFFFF) && (resp[h & (-1 - 0x8000)] != NULL);
+  return (h != -1) && (h != 0xFFFF) && (resp[h] != NULL);
 }