From d3ca1fddcca11914e451b41fe4c6e6c2400eeef9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 2 Oct 2010 16:26:10 +0000 Subject: [PATCH] - added new action special Ceiling_LowerAndCrushDist. It's similar to Ceiling_LowerAndCrush but allows to explicitly set the distance from the floor where the ceiling stops moving. This is used to remove the special behavior for Strife from the code that unlike the other games moved the ceiling to the floor, not to 8 units above it. SVN r2881 (trunk) --- src/actionspecials.h | 1 + src/p_ceiling.cpp | 8 +- src/p_lnspec.cpp | 8 +- src/p_spec.h | 1 + src/sound/music_psuedo_mididevice.cpp | 260 -------------------------- wadsrc/static/xlat/strife.txt | 4 +- 6 files changed, 18 insertions(+), 264 deletions(-) delete mode 100644 src/sound/music_psuedo_mididevice.cpp diff --git a/src/actionspecials.h b/src/actionspecials.h index 0f31243e0a..8fcb3cf8d3 100644 --- a/src/actionspecials.h +++ b/src/actionspecials.h @@ -95,6 +95,7 @@ DEFINE_SPECIAL(Polyobj_OR_MoveTimes8, 93, 4, 4, 4) DEFINE_SPECIAL(Pillar_BuildAndCrush, 94, 4, 5, 5) DEFINE_SPECIAL(FloorAndCeiling_LowerByValue, 95, 3, 3, 3) DEFINE_SPECIAL(FloorAndCeiling_RaiseByValue, 96, 3, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerAndCrushDist, 97, 3, 5, 5) DEFINE_SPECIAL(Scroll_Texture_Left, 100, -1, -1, 2) DEFINE_SPECIAL(Scroll_Texture_Right, 101, -1, -1, 2) diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index c9aec4f37d..ec569735c7 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -162,6 +162,7 @@ void DCeiling::Tick () { case ceilCrushAndRaise: case ceilLowerAndCrush: + case ceilLowerAndCrushDist: if (m_Speed1 == FRACUNIT && m_Speed2 == FRACUNIT) m_Speed = FRACUNIT / 8; break; @@ -255,11 +256,16 @@ manual_ceiling: case DCeiling::ceilCrushRaiseAndStay: ceiling->m_TopHeight = sec->ceilingplane.d; case DCeiling::ceilLowerAndCrush: + case DCeiling::ceilLowerAndCrushDist: targheight = sec->FindHighestFloorPoint (&spot); - if (type != DCeiling::ceilLowerAndCrush || gameinfo.gametype != GAME_Strife) + if (type == DCeiling::ceilLowerAndCrush) { targheight += 8*FRACUNIT; } + else if (type == DCeiling::ceilLowerAndCrushDist) + { + targheight += height; + } ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight); ceiling->m_Direction = -1; break; diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index b0697904a3..b5a973cbdd 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -547,6 +547,12 @@ FUNC(LS_Ceiling_LowerAndCrush) return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), 0, arg2, 0, 0, CRUSHTYPE(arg3)); } +FUNC(LS_Ceiling_LowerAndCrushDist) +// Ceiling_LowerAndCrush (tag, speed, crush, dist, crushtype) +{ + return EV_DoCeiling (DCeiling::ceilLowerAndCrushDist, ln, arg0, SPEED(arg1), SPEED(arg1), arg3*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg4)); +} + FUNC(LS_Ceiling_CrushStop) // Ceiling_CrushStop (tag) { @@ -3150,7 +3156,7 @@ lnSpecFunc LineSpecials[256] = /* 94 */ LS_Pillar_BuildAndCrush, /* 95 */ LS_FloorAndCeiling_LowerByValue, /* 96 */ LS_FloorAndCeiling_RaiseByValue, - /* 97 */ LS_NOP, + /* 97 */ LS_Ceiling_LowerAndCrushDist, /* 98 */ LS_NOP, /* 99 */ LS_NOP, /* 100 */ LS_NOP, // Scroll_Texture_Left diff --git a/src/p_spec.h b/src/p_spec.h index 0171cf7962..70b79ec09f 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -664,6 +664,7 @@ public: ceilRaiseInstant, ceilCrushAndRaise, ceilLowerAndCrush, + ceilLowerAndCrushDist, ceilCrushRaiseAndStay, ceilRaiseToNearest, ceilLowerToLowest, diff --git a/src/sound/music_psuedo_mididevice.cpp b/src/sound/music_psuedo_mididevice.cpp deleted file mode 100644 index ec72794e3d..0000000000 --- a/src/sound/music_psuedo_mididevice.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/* -** music_psuedo_mididevice.cpp -** Common base class for psuedo MIDI devices. -** -**--------------------------------------------------------------------------- -** Copyright 2008-2010 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -// HEADER FILES ------------------------------------------------------------ - -#include "i_musicinterns.h" -#include "templates.h" -#include "doomdef.h" -#include "m_swap.h" - -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - -// CODE -------------------------------------------------------------------- - -//========================================================================== -// -// PsuedoMIDIDevice Constructor -// -//========================================================================== - -PsuedoMIDIDevice::PsuedoMIDIDevice() -{ - Stream = NULL; - Started = false; - bLooping = true; -} - -//========================================================================== -// -// PsuedoMIDIDevice Destructor -// -//========================================================================== - -PsuedoMIDIDevice::~PsuedoMIDIDevice() -{ - Close(); -} - -//========================================================================== -// -// PsuedoMIDIDevice :: Close -// -//========================================================================== - -void PsuedoMIDIDevice::Close() -{ - if (Stream != NULL) - { - delete Stream; - Stream = NULL; - } - Started = false; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: IsOpen -// -//========================================================================== - -bool PsuedoMIDIDevice::IsOpen() const -{ - return Stream != NULL; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: GetTechnology -// -//========================================================================== - -int PsuedoMIDIDevice::GetTechnology() const -{ - return MOD_MIDIPORT; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: Resume -// -//========================================================================== - -int PsuedoMIDIDevice::Resume() -{ - if (!Started) - { - if (Stream->Play(bLooping, 1)) - { - Started = true; - return 0; - } - return 1; - } - return 0; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: Stop -// -//========================================================================== - -void PsuedoMIDIDevice::Stop() -{ - if (Started) - { - Stream->Stop(); - Started = false; - } -} - -//========================================================================== -// -// PsuedoMIDIDevice :: Pause -// -//========================================================================== - -bool PsuedoMIDIDevice::Pause(bool paused) -{ - if (Stream != NULL) - { - return Stream->SetPaused(paused); - } - return true; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: StreamOutSync -// -//========================================================================== - -int PsuedoMIDIDevice::StreamOutSync(MIDIHDR *header) -{ - assert(0); - return 0; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: StreamOut -// -//========================================================================== - -int PsuedoMIDIDevice::StreamOut(MIDIHDR *header) -{ - assert(0); - return 0; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: SetTempo -// -//========================================================================== - -int PsuedoMIDIDevice::SetTempo(int tempo) -{ - return 0; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: SetTimeDiv -// -//========================================================================== - -int PsuedoMIDIDevice::SetTimeDiv(int timediv) -{ - return 0; -} - -//========================================================================== -// -// PsuedoMIDIDevice :: GetStats -// -//========================================================================== - -FString PsuedoMIDIDevice::GetStats() -{ - if (Stream != NULL) - { - return Stream->GetStats(); - } - return "Psuedo MIDI device not open"; -} - - -//========================================================================== -// -// FMODMIDIDevice :: Open -// -//========================================================================== - -int FMODMIDIDevice::Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata) -{ - return 0; -} - -//========================================================================== -// -// FMODMIDIDevice :: Preprocess -// -// Create a standard MIDI file and stream it. -// -//========================================================================== - -bool FMODMIDIDevice::Preprocess(MIDIStreamer *song, bool looping) -{ - TArray midi; - - song->CreateSMF(midi); - Stream = GSnd->OpenStream((char *)&midi[0], looping ? SoundStream::Loop : 0, -1, midi.Size()); - return false; -} diff --git a/wadsrc/static/xlat/strife.txt b/wadsrc/static/xlat/strife.txt index 0c141c855b..b1e1700371 100644 --- a/wadsrc/static/xlat/strife.txt +++ b/wadsrc/static/xlat/strife.txt @@ -109,7 +109,7 @@ RetailOnly = 121 193 = WALK|REP, ACS_ExecuteAlways (0, 0, 193, tag) 38 = WALK, Floor_LowerToLowest (tag, F_SLOW) 39 = WALK|MONST, Teleport (0, tag) - 44 = WALK, Ceiling_LowerAndCrush (tag, C_SLOW, 10) + 44 = WALK, Ceiling_LowerAndCrushDist (tag, C_SLOW, 10) 52 = WALK|REP, ACS_ExecuteAlways (0, 0, 52, tag) 53 = WALK, Plat_PerpetualRaiseLip (tag, P_SLOW, PLATWAIT, 0) 54 = WALK, Plat_Stop (tag) @@ -145,7 +145,7 @@ RetailOnly = 121 216 = WALK|REP, ACS_ExecuteAlways (0, 0, 216, tag) 90 = WALK|REP, Door_Raise (tag, D_SLOW, VDOORWAIT) - 72 = WALK|REP, Ceiling_LowerAndCrush (tag, C_SLOW, 10) + 72 = WALK|REP, Ceiling_LowerAndCrushDist (tag, C_SLOW, 10) 73 = WALK|REP, Ceiling_CrushAndRaiseA (tag, C_SLOW, C_SLOW, 10) 74 = WALK|REP, Ceiling_CrushStop (tag) 75 = WALK|REP, Door_Close (tag, D_SLOW)