mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- added a Door_AnimatedClose special.
This commit is contained in:
parent
4d99b58f96
commit
cfeb1724fe
6 changed files with 38 additions and 18 deletions
|
@ -259,5 +259,6 @@ DEFINE_SPECIAL(Stairs_BuildDownDoom, 270, 5, 5, 5)
|
|||
DEFINE_SPECIAL(Stairs_BuildUpDoomSync, 271, 4, 4, 4)
|
||||
DEFINE_SPECIAL(Stairs_BuildDownDoomSync, 272, 4, 4, 4)
|
||||
DEFINE_SPECIAL(Stairs_BuildUpDoomCrush, 273, 5, 5, 5)
|
||||
DEFINE_SPECIAL(Door_AnimatedClose, 274, 4, 4, 4)
|
||||
|
||||
#undef DEFINE_SPECIAL
|
||||
|
|
|
@ -112,7 +112,7 @@ class DMenuDescriptor : public DObject
|
|||
public:
|
||||
FName mMenuName;
|
||||
FString mNetgameMessage;
|
||||
const PClass *mClass;
|
||||
PClass *mClass;
|
||||
|
||||
virtual size_t PropagateMark() { return 0; }
|
||||
};
|
||||
|
|
|
@ -293,7 +293,7 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
|
|||
else if (sc.Compare("Class"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
const PClass *cls = PClass::FindClass(sc.String);
|
||||
PClass *cls = PClass::FindClass(sc.String);
|
||||
if (cls == nullptr || !cls->IsDescendantOf(RUNTIME_CLASS(DListMenu)))
|
||||
{
|
||||
sc.ScriptError("Unknown menu class '%s'", sc.String);
|
||||
|
@ -701,7 +701,7 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc)
|
|||
else if (sc.Compare("Class"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
const PClass *cls = PClass::FindClass(sc.String);
|
||||
PClass *cls = PClass::FindClass(sc.String);
|
||||
if (cls == nullptr || !cls->IsDescendantOf("OptionMenu"))
|
||||
{
|
||||
sc.ScriptError("Unknown menu class '%s'", sc.String);
|
||||
|
|
|
@ -538,7 +538,8 @@ void DAnimatedDoor::Serialize(FSerializer &arc)
|
|||
("delay", m_Delay)
|
||||
("dooranim", m_DoorAnim)
|
||||
("setblock1", m_SetBlocking1)
|
||||
("setblock2", m_SetBlocking2);
|
||||
("setblock2", m_SetBlocking2)
|
||||
("tyoe", m_Type);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -614,7 +615,6 @@ void DAnimatedDoor::Tick ()
|
|||
}
|
||||
|
||||
m_Timer = m_Delay;
|
||||
m_Status = Waiting;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -631,7 +631,7 @@ void DAnimatedDoor::Tick ()
|
|||
|
||||
case Waiting:
|
||||
// IF DOOR IS DONE WAITING...
|
||||
if (!m_Timer--)
|
||||
if (m_Type == adClose || !m_Timer--)
|
||||
{
|
||||
if (!StartClosing())
|
||||
{
|
||||
|
@ -683,7 +683,7 @@ void DAnimatedDoor::Tick ()
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim)
|
||||
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim, DAnimatedDoor::EADType type)
|
||||
: DMovingCeiling (sec, false)
|
||||
{
|
||||
double topdist;
|
||||
|
@ -717,7 +717,8 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
|
|||
|
||||
topdist = m_Sector->ceilingplane.fD() - topdist * m_Sector->ceilingplane.fC();
|
||||
|
||||
m_Status = Opening;
|
||||
m_Type = type;
|
||||
m_Status = type == adClose? Waiting : Opening;
|
||||
m_Speed = speed;
|
||||
m_Delay = delay;
|
||||
m_Timer = m_Speed;
|
||||
|
@ -728,9 +729,12 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
|
|||
m_Line2->flags |= ML_BLOCKING;
|
||||
m_BotDist = m_Sector->ceilingplane.fD();
|
||||
m_Sector->MoveCeiling (2048., topdist, 1);
|
||||
if (m_DoorAnim->OpenSound != NAME_None)
|
||||
if (type == adOpenClose)
|
||||
{
|
||||
SN_StartSequence (m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1);
|
||||
if (m_DoorAnim->OpenSound != NAME_None)
|
||||
{
|
||||
SN_StartSequence(m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,7 +745,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay)
|
||||
bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay, DAnimatedDoor::EADType type)
|
||||
{
|
||||
sector_t *sec;
|
||||
int secnum;
|
||||
|
@ -756,7 +760,7 @@ bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay)
|
|||
sec = line->backsector;
|
||||
|
||||
// Make sure door isn't already being animated
|
||||
if (sec->ceilingdata != NULL)
|
||||
if (sec->ceilingdata != NULL )
|
||||
{
|
||||
if (actor->player == NULL)
|
||||
return false;
|
||||
|
@ -774,7 +778,7 @@ bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay)
|
|||
FDoorAnimation *anim = TexMan.FindAnimatedDoor (line->sidedef[0]->GetTexture(side_t::top));
|
||||
if (anim != NULL)
|
||||
{
|
||||
new DAnimatedDoor (sec, line, speed, delay, anim);
|
||||
new DAnimatedDoor (sec, line, speed, delay, anim, type);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -799,7 +803,7 @@ bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay)
|
|||
if (anim != NULL)
|
||||
{
|
||||
rtn = true;
|
||||
new DAnimatedDoor (sec, line, speed, delay, anim);
|
||||
new DAnimatedDoor (sec, line, speed, delay, anim, type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,7 +297,13 @@ FUNC(LS_Door_Animated)
|
|||
if (arg3 != 0 && !P_CheckKeys (it, arg3, arg0 != 0))
|
||||
return false;
|
||||
|
||||
return EV_SlidingDoor (ln, it, arg0, arg1, arg2);
|
||||
return EV_SlidingDoor (ln, it, arg0, arg1, arg2, DAnimatedDoor::adOpenClose);
|
||||
}
|
||||
|
||||
FUNC(LS_Door_AnimatedClose)
|
||||
// Door_AnimatedClose (tag, speed)
|
||||
{
|
||||
return EV_SlidingDoor(ln, it, arg0, arg1, -1, DAnimatedDoor::adClose);
|
||||
}
|
||||
|
||||
FUNC(LS_Generic_Door)
|
||||
|
@ -3594,6 +3600,7 @@ static lnSpecFunc LineSpecials[] =
|
|||
/* 271 */ LS_Stairs_BuildUpDoomSync,
|
||||
/* 272 */ LS_Stairs_BuildDownDoomSync,
|
||||
/* 273 */ LS_Stairs_BuildUpDoomCrush,
|
||||
/* 274 */ LS_Door_AnimatedClose,
|
||||
|
||||
};
|
||||
|
||||
|
|
14
src/p_spec.h
14
src/p_spec.h
|
@ -322,8 +322,15 @@ class DAnimatedDoor : public DMovingCeiling
|
|||
{
|
||||
DECLARE_CLASS (DAnimatedDoor, DMovingCeiling)
|
||||
public:
|
||||
|
||||
enum EADType
|
||||
{
|
||||
adOpenClose,
|
||||
adClose
|
||||
};
|
||||
|
||||
DAnimatedDoor (sector_t *sector);
|
||||
DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim);
|
||||
DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim, EADType type);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
@ -336,6 +343,7 @@ protected:
|
|||
int m_Timer;
|
||||
double m_BotDist;
|
||||
int m_Status;
|
||||
int m_Type;
|
||||
enum
|
||||
{
|
||||
Opening,
|
||||
|
@ -347,12 +355,12 @@ protected:
|
|||
int m_Delay;
|
||||
bool m_SetBlocking1, m_SetBlocking2;
|
||||
|
||||
friend bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay);
|
||||
friend bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay, EADType type);
|
||||
private:
|
||||
DAnimatedDoor ();
|
||||
};
|
||||
|
||||
bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay);
|
||||
bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay, DAnimatedDoor::EADType type);
|
||||
|
||||
//
|
||||
// P_CEILNG
|
||||
|
|
Loading…
Reference in a new issue