From 25bb94cd948e5b68c314d4097f1cd8788cdcc330 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Dec 2019 18:29:10 +0100 Subject: [PATCH] - reducing the completionist cruft. The 3 CD related files don't really contain enough code to justify this, merged all non-empty parts into one. --- source/exhumed/CMakeLists.txt | 2 -- source/exhumed/src/cd.cpp | 30 ++++++++++++++-------- source/exhumed/src/cdaudio.cpp | 47 ---------------------------------- source/exhumed/src/cdaudio.h | 29 --------------------- source/exhumed/src/cdrom.cpp | 32 ----------------------- source/exhumed/src/cdrom.h | 29 --------------------- source/exhumed/src/exhumed.cpp | 19 -------------- source/exhumed/src/menu.cpp | 1 - source/exhumed/src/movie.cpp | 1 - source/exhumed/src/player.cpp | 1 - source/exhumed/src/sound.h | 1 + source/exhumed/src/view.cpp | 1 - 12 files changed, 21 insertions(+), 172 deletions(-) delete mode 100644 source/exhumed/src/cdaudio.cpp delete mode 100644 source/exhumed/src/cdaudio.h delete mode 100644 source/exhumed/src/cdrom.cpp delete mode 100644 source/exhumed/src/cdrom.h diff --git a/source/exhumed/CMakeLists.txt b/source/exhumed/CMakeLists.txt index 650d0189d..33b8a7db3 100644 --- a/source/exhumed/CMakeLists.txt +++ b/source/exhumed/CMakeLists.txt @@ -41,8 +41,6 @@ set( PCH_SOURCES src/bubbles.cpp src/bullet.cpp src/cd.cpp - src/cdaudio.cpp - src/cdrom.cpp src/config.cpp src/enginesubs.cpp src/exhumed.cpp diff --git a/source/exhumed/src/cd.cpp b/source/exhumed/src/cd.cpp index 8339ed8b9..44375b96b 100644 --- a/source/exhumed/src/cd.cpp +++ b/source/exhumed/src/cd.cpp @@ -30,8 +30,6 @@ BEGIN_PS_NS extern short word_9AC30; -static char *pTrack = NULL; -static int trackhandle = -1; int nLastVolumeSet = 0; /* TODO @@ -52,7 +50,7 @@ bool playCDtrack(int nTrack, bool bLoop) // try ogg vorbis now sprintf(filename, "exhumed%02d.ogg", nTrack); - trackhandle = Mus_Play(nullptr, filename, true); + Mus_Play(nullptr, filename, true); return true; } @@ -66,18 +64,12 @@ int StepFadeCDaudio() return 0; } Mus_Stop(); - trackhandle = 0; return 1; } bool CDplaying() { - if (trackhandle <= 0) { - return false; - } - else { - return true; - } + return Mus_IsPlaying(); } void StopCD() @@ -89,4 +81,22 @@ void FadeSong() { } +int fadecdaudio() +{ + StartfadeCDaudio(); + + while (1) + { + if (!StepFadeCDaudio()) { + return 1; + } + else { + WaitTicks(1); + } + } + + return 1; +} + + END_PS_NS diff --git a/source/exhumed/src/cdaudio.cpp b/source/exhumed/src/cdaudio.cpp deleted file mode 100644 index 088a2a7c3..000000000 --- a/source/exhumed/src/cdaudio.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 sirlemonhead, Nuke.YKT -This file is part of PCExhumed. -PCExhumed 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" -#include "cdaudio.h" -#include "cd.h" -#include "exhumed.h" - - -BEGIN_PS_NS - -int fadecdaudio() -{ - StartfadeCDaudio(); - - while (1) - { - if (!StepFadeCDaudio()) { - return 1; - } - else { - WaitTicks(1); - } - } - - return 1; -} - -void CheckCD() -{ - -} -END_PS_NS diff --git a/source/exhumed/src/cdaudio.h b/source/exhumed/src/cdaudio.h deleted file mode 100644 index 6a012429a..000000000 --- a/source/exhumed/src/cdaudio.h +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 sirlemonhead, Nuke.YKT -This file is part of PCExhumed. -PCExhumed 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 __cdaudio_h__ -#define __cdaudio_h__ - -BEGIN_PS_NS - -void CheckCD(); -int fadecdaudio(); - -END_PS_NS - -#endif diff --git a/source/exhumed/src/cdrom.cpp b/source/exhumed/src/cdrom.cpp deleted file mode 100644 index e80ba83c8..000000000 --- a/source/exhumed/src/cdrom.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 sirlemonhead, Nuke.YKT -This file is part of PCExhumed. -PCExhumed 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" -#include "cdrom.h" - -BEGIN_PS_NS - -int checkcdrom() -{ - return 1; -} - -char GetCDDriveLetter() -{ - return 'D'; -} -END_PS_NS diff --git a/source/exhumed/src/cdrom.h b/source/exhumed/src/cdrom.h deleted file mode 100644 index b5d329499..000000000 --- a/source/exhumed/src/cdrom.h +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010-2019 EDuke32 developers and contributors -Copyright (C) 2019 sirlemonhead, Nuke.YKT -This file is part of PCExhumed. -PCExhumed 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 __cdrom_h__ -#define __cdrom_h__ - -BEGIN_PS_NS - -int checkcdrom(); -char GetCDDriveLetter(); - -END_PS_NS - -#endif diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 08846e7b2..244a360bd 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -57,8 +57,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "wasp.h" #include "scorp.h" #include "rat.h" -#include "cdrom.h" -#include "cdaudio.h" #include "serial.h" #include "network.h" #include "random.h" @@ -2182,23 +2180,6 @@ LOOP3: fadecdaudio(); } - CheckCD(); - -#if 0 - if (!bNoCDCheck) - { - while (!checkcdrom()) - { - EraseScreen(overscanindex); - Query(2, 0, "Insert CD into drive", "(ESC to abort)"); - inputState.ClearAllKeyStatus(); - if (inputState.keyGetChar() == asc_Escape) { - I_Error("Aborted\n"); - } - } - } -#endif - if (levelnew == kMap20) { lCountDown = 81000; diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index 480c53565..df618cd85 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "object.h" #include "light.h" #include "cd.h" -#include "cdaudio.h" #include "menu/menu.h" #include diff --git a/source/exhumed/src/movie.cpp b/source/exhumed/src/movie.cpp index d11ac5b7c..75e60a5e2 100644 --- a/source/exhumed/src/movie.cpp +++ b/source/exhumed/src/movie.cpp @@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "exhumed.h" #include "names.h" #include "movie.h" -#include "cdrom.h" #include "light.h" #include #include diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index c0f2865ff..286842762 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -43,7 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "grenade.h" #include "menu.h" #include "cd.h" -#include "cdaudio.h" #include "map.h" #include "sound.h" #include "textures.h" diff --git a/source/exhumed/src/sound.h b/source/exhumed/src/sound.h index 0eea988e8..efcf2331f 100644 --- a/source/exhumed/src/sound.h +++ b/source/exhumed/src/sound.h @@ -121,6 +121,7 @@ void UpdateCreepySounds(); void InitFX(); void UnInitFX(); void FadeSong(); +int fadecdaudio(); int LocalSoundPlaying(); void LoadFX(); void StopAllSounds(); diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index 6fcbb4e98..48c4fac40 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "init.h" #include "menu.h" #include "cd.h" -#include "cdaudio.h" #include "typedefs.h" #include "map.h" #include "move.h"