From dcd773ed9d347edba8362b24de5c4762a2cd8685 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Jul 2020 00:16:42 +0200 Subject: [PATCH] - removed some unused pieces of code. --- source/blood/CMakeLists.txt | 1 - source/blood/src/blood.cpp | 99 --------------------------- source/blood/src/getopt.cpp | 99 --------------------------- source/blood/src/getopt.h | 40 ----------- source/blood/src/macros.h | 131 ------------------------------------ source/blood/src/misc.cpp | 18 ----- 6 files changed, 388 deletions(-) delete mode 100644 source/blood/src/getopt.cpp delete mode 100644 source/blood/src/getopt.h delete mode 100644 source/blood/src/macros.h diff --git a/source/blood/CMakeLists.txt b/source/blood/CMakeLists.txt index 62ec5ea44..449e9ff4f 100644 --- a/source/blood/CMakeLists.txt +++ b/source/blood/CMakeLists.txt @@ -41,7 +41,6 @@ set( PCH_SOURCES src/fx.cpp src/gamemenu.cpp src/gameutil.cpp - src/getopt.cpp src/gib.cpp src/globals.cpp src/inifile.cpp diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 73ca31a33..9369792ab 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -42,7 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "eventq.h" #include "fx.h" #include "gib.h" -#include "getopt.h" #include "globals.h" #include "levels.h" #include "loadsave.h" @@ -869,107 +868,9 @@ void ProcessFrame(void) } -#if 0 -SWITCH switches[] = { - { "broadcast", 1, 0 }, - { "masterslave", 3, 0 }, - { "record", 7, 1 }, - { "robust", 8, 0 }, - { "skill", 10, 1 }, - { "ini", 13, 1 }, - { "noaim", 14, 0 }, - //{ "f", 15, 1 }, - { "control", 16, 1 }, - { "vector", 17, 1 }, - { "noresend", 22, 0 }, - { "silentaim", 23, 0 }, - { "art", 26, 1 }, - { "client", 31, 1 }, - { "noautoload", 32, 0 }, - { NULL, 0, 0 } -}; -#endif void ParseOptions(void) { - // Stuff for later. -#if 0 - int option; - while ((option = GetOptions(switches)) != -1) - { - switch (option) - { - case 18: - bQuickStart = 1; - break; - //case 12: - // EightyTwoFifty = 1; - // break; - case 1: - gPacketMode = PACKETMODE_2; - break; - case 21: - break; - case 2: - if (OptArgc < 1) - ThrowError("Missing argument"); - strcpy(gUserMapFilename, OptArgv[0]); - bAddUserMap = 1; - bNoDemo = 1; - break; - case 3: - gPacketMode = PACKETMODE_2; - break; - case 30: - if (OptArgc < 1) - ThrowError("Missing argument"); - gNetPlayers = ClipRange(atoi(OptArgv[0]), 1, kMaxPlayers); - gNetMode = NETWORK_SERVER; - break; - case 31: - if (OptArgc < 1) - ThrowError("Missing argument"); - gNetMode = NETWORK_CLIENT; - strncpy(gNetAddress, OptArgv[0], sizeof(gNetAddress)-1); - break; - case 22: - bNoResend = 0; - break; - case 23: - bSilentAim = 1; - break; - case 5: - gGameOptions.nMonsterSettings = 0; - break; - case 6: - if (OptArgc < 1) - gDemo.SetupPlayback(NULL); - else - gDemo.SetupPlayback(OptArgv[0]); - break; - case 7: - if (OptArgc < 1) - gDemo.Create(NULL); - else - gDemo.Create(OptArgv[0]); - break; - case 8: - gRobust = 1; - break; - case 10: - if (OptArgc < 1) - ThrowError("Missing argument"); - gSkill = strtoul(OptArgv[0], NULL, 0); - if (gSkill < 0) - gSkill = 0; - else if (gSkill > 4) - gSkill = 4; - break; - case 15: - break; - } - } -#endif #if 0 if (bAddUserMap) { diff --git a/source/blood/src/getopt.cpp b/source/blood/src/getopt.cpp deleted file mode 100644 index d422a1fea..000000000 --- a/source/blood/src/getopt.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 Nuke.YKT - -This file is part of NBlood. - -NBlood 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. - -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, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#include "ns.h" // Must come before everything else! - -#include -#include -#include "compat.h" -#include "getopt.h" - -BEGIN_BLD_NS - -int margc; -char const * const *margv; - -const char *OptArgv[16]; -int OptArgc; -const char *OptFull; -const char *SwitchChars = "-/"; - -int GetOptions(SWITCH *switches) -{ - static const char *pChar = NULL; - static int OptIndex = 1; - if (!pChar) - { - if (OptIndex >= margc) - return -1; - pChar = margv[OptIndex++]; - if (!pChar) - return -1; - } - OptFull = pChar; - if (!strchr(SwitchChars, *pChar)) - { - pChar = NULL; - return -2; - } - pChar++; - int i; - int vd; - for (i = 0; true; i++) - { - if (!switches[i].name) - return -3; - int nLength = strlen(switches[i].name); - if (!Bstrncasecmp(pChar, switches[i].name, nLength) && (pChar[nLength]=='=' || pChar[nLength]==0)) - { - pChar += nLength; - if (*pChar=='=') - { - pChar++; - } - else - { - pChar = NULL; - } - break; - } - } - vd = switches[i].at4; - OptArgc = 0; - while (OptArgc < switches[i].at8) - { - if (!pChar) - { - if (OptIndex >= margc) - break; - pChar = margv[OptIndex++]; - if (strchr(SwitchChars, *pChar) != 0) - break; - } - OptArgv[OptArgc++] = pChar; - pChar = NULL; - } - return vd; -} - -END_BLD_NS diff --git a/source/blood/src/getopt.h b/source/blood/src/getopt.h deleted file mode 100644 index fa8032f93..000000000 --- a/source/blood/src/getopt.h +++ /dev/null @@ -1,40 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 Nuke.YKT - -This file is part of NBlood. - -NBlood 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. - -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, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- -#pragma once - -BEGIN_BLD_NS - -extern int margc; -extern char const * const *margv; - -extern const char *OptArgv[16]; -extern int OptArgc; -extern const char *OptFull; - -struct SWITCH { - const char *name; - int at4, at8; -}; -int GetOptions(SWITCH *switches); - -END_BLD_NS diff --git a/source/blood/src/macros.h b/source/blood/src/macros.h deleted file mode 100644 index 2d2ed2fd3..000000000 --- a/source/blood/src/macros.h +++ /dev/null @@ -1,131 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 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. - -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, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef EDUKE32_MACROS_H_ -#define EDUKE32_MACROS_H_ - -#include "mmulti.h" - -// Macros, some from SW source - -#define BGSTRETCH (hud_bgstretch ? 1024 : 0) - -#define TRAVERSE_SPRITE_SECT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n) -#define TRAVERSE_SPRITE_STAT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n) -#define TRAVERSE_CONNECT(i) i = 0; i != -1; i = connectpoint2[i] - -#define TEST(flags,mask) ((flags) & (mask)) -#define SET(flags,mask) ((flags) |= (mask)) -#define RESET(flags,mask) ((flags) &= ~(mask)) -#define FLIP(flags,mask) ((flags) ^= (mask)) - -// mask definitions - -#define BIT(shift) (1u<<(shift)) - -// rotatesprite flags -#define ROTATE_SPRITE_TRANSLUCENT (BIT(0)) -#define ROTATE_SPRITE_VIEW_CLIP (BIT(1)) // clip to view -#define ROTATE_SPRITE_YFLIP (BIT(2)) -#define ROTATE_SPRITE_IGNORE_START_MOST (BIT(3)) // don't clip to startumost -#define ROTATE_SPRITE_SCREEN_CLIP (BIT(1)|BIT(3)) // use window -#define ROTATE_SPRITE_CORNER (BIT(4)) // place sprite from upper left corner -#define ROTATE_SPRITE_TRANS_FLIP (BIT(5)) -#define ROTATE_SPRITE_NON_MASK (BIT(6)) // non masked sprites -#define ROTATE_SPRITE_ALL_PAGES (BIT(7)) // copies to all pages - -#define RS_SCALE BIT(16) - -// system defines for status bits -#define CEILING_STAT_PLAX BIT(0) -#define CEILING_STAT_SLOPE BIT(1) -#define CEILING_STAT_SWAPXY BIT(2) -#define CEILING_STAT_SMOOSH BIT(3) -#define CEILING_STAT_XFLIP BIT(4) -#define CEILING_STAT_YFLIP BIT(5) -#define CEILING_STAT_RELATIVE BIT(6) -#define CEILING_STAT_TYPE_MASK (BIT(7)|BIT(8)) -#define CEILING_STAT_MASKED BIT(7) -#define CEILING_STAT_TRANS BIT(8) -#define CEILING_STAT_TRANS_FLIP (BIT(7)|BIT(8)) -#define CEILING_STAT_FAF_BLOCK_HITSCAN BIT(15) - -#define FLOOR_STAT_PLAX BIT(0) -#define FLOOR_STAT_SLOPE BIT(1) -#define FLOOR_STAT_SWAPXY BIT(2) -#define FLOOR_STAT_SMOOSH BIT(3) -#define FLOOR_STAT_XFLIP BIT(4) -#define FLOOR_STAT_YFLIP BIT(5) -#define FLOOR_STAT_RELATIVE BIT(6) -#define FLOOR_STAT_TYPE_MASK (BIT(7)|BIT(8)) -#define FLOOR_STAT_MASKED BIT(7) -#define FLOOR_STAT_TRANS BIT(8) -#define FLOOR_STAT_TRANS_FLIP (BIT(7)|BIT(8)) -#define FLOOR_STAT_FAF_BLOCK_HITSCAN BIT(15) - - -//cstat, bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B" -// bit 1: 1 = 50/50 transluscence, 0 = normal "T" -// bit 2: 1 = x-flipped, 0 = normal "F" -// bit 3: 1 = y-flipped, 0 = normal "F" -// bits 5-4: 00 = FACE sprite (default) "R" -// 01 = WALL sprite (like masked walls) -// 10 = FLOOR sprite (parallel to ceilings&floors) -// 11 = SPIN sprite (face sprite that can spin 2draw style - not done yet) -// bit 6: 1 = 1-sided sprite, 0 = normal "1" -// bit 7: 1 = Real centered centering, 0 = foot center "C" -// bit 8: 1 = Blocking sprite (use with hitscan) "H" -// bit 9: reserved -// bit 10: reserved -// bit 11: 1 = determine shade based only on its own shade member (see CON's spritenoshade command), i.e. -// don't take over shade from parallaxed ceiling/nonparallaxed floor -// (NOTE: implemented on the game side) -// bit 12: reserved -// bit 13: reserved -// bit 14: reserved -// bit 15: 1 = Invisible sprite, 0 = not invisible -#define CSTAT_SPRITE_NOSHADE BIT(11) -#define CSTAT_SPRITE_BREAKABLE (CSTAT_SPRITE_BLOCK_HITSCAN) - -#define SP(i) sprite[i].yvel -#define SX(i) sprite[i].x -#define SY(i) sprite[i].y -#define SZ(i) sprite[i].z -#define SS(i) sprite[i].shade -#define PN(i) sprite[i].picnum -#define SA(i) sprite[i].ang -//#define SV sprite[i].xvel -//#define ZV sprite[i].zvel -//#define RX sprite[i].xrepeat -//#define RY sprite[i].yrepeat -#define OW(i) sprite[i].owner -#define CS(i) sprite[i].cstat -#define SH(i) sprite[i].extra -//#define CX sprite[i].xoffset -//#define CY sprite[i].yoffset -//#define CD sprite[i].clipdist -//#define PL sprite[i].pal -#define SLT(i) sprite[i].lotag -#define SHT(i) sprite[i].hitag -#define SECT(i) sprite[i].sectnum - -#endif diff --git a/source/blood/src/misc.cpp b/source/blood/src/misc.cpp index 835f8328b..b56b30941 100644 --- a/source/blood/src/misc.cpp +++ b/source/blood/src/misc.cpp @@ -162,23 +162,5 @@ void SplitPath(const char *pzPath, char *pzDirectory, char *pzFile, char *pzType } } -void ConcatPath(const char *pzPath1, const char *pzPath2, char *pzConcatPath) -{ - int n1 = Bstrlen(pzPath1), n2 = Bstrlen(pzPath2); - int i = n1, j = 0; - while (i > 0 && (pzPath1[i-1] == '/' || pzPath1[i-1] == '\\')) - { - i--; - } - while (j < n2 && (pzPath2[j] == '/' || pzPath1[j] == '\\')) - { - j++; - } - Bstrncpy(pzConcatPath, pzPath1, i); - pzConcatPath[i] = 0; - Bstrcat(pzConcatPath, "/"); - Bstrcat(pzConcatPath, pzPath2+j); -} - END_BLD_NS