Merge branch 'master' of https://github.com/raa-eruanna/qzdoom into qzdoom

This commit is contained in:
Magnus Norddahl 2017-02-17 05:35:15 +01:00
commit cd2179e62a
15 changed files with 121 additions and 81 deletions

View file

@ -103,12 +103,16 @@ if( WIN32 )
set( FMOD_SEARCH_PATHS set( FMOD_SEARCH_PATHS
"C:/Program Files/FMOD SoundSystem/FMOD Programmers API ${WIN_TYPE}/api" "C:/Program Files/FMOD SoundSystem/FMOD Programmers API ${WIN_TYPE}/api"
"C:/Program Files (x86)/FMOD SoundSystem/FMOD Programmers API ${WIN_TYPE}/api" "C:/Program Files (x86)/FMOD SoundSystem/FMOD Programmers API ${WIN_TYPE}/api"
# This next one is for Randy.
"E:/Software/Dev/FMOD/${WIN_TYPE}/api"
) )
set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES inc ) set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES inc )
set( FMOD_LIB_PATH_SUFFIXES PATH_SUFFIXES lib ) set( FMOD_LIB_PATH_SUFFIXES PATH_SUFFIXES lib )
if( ( MSVC14 AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" ) OR # For VS 2015.
( MSVC15 AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v150_xp" ) ) # For VS 2017.
# for modern Windows SDKs the DirectX headers should be available by default.
set( DX_dinput8_LIBRARY dinput8 )
else()
find_path( D3D_INCLUDE_DIR d3d9.h find_path( D3D_INCLUDE_DIR d3d9.h
PATHS ENV DXSDK_DIR PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include ) PATH_SUFFIXES Include )
@ -159,6 +163,7 @@ if( WIN32 )
if( NOT DX_dxguid_LIBRARY ) if( NOT DX_dxguid_LIBRARY )
message( STATUS "Could not find dxguid.lib. Build may fail on old Windows SDKs.") message( STATUS "Could not find dxguid.lib. Build may fail on old Windows SDKs.")
endif() endif()
endif()
set( ZDOOM_LIBS set( ZDOOM_LIBS
opengl32 opengl32

View file

@ -259,5 +259,6 @@ DEFINE_SPECIAL(Stairs_BuildDownDoom, 270, 5, 5, 5)
DEFINE_SPECIAL(Stairs_BuildUpDoomSync, 271, 4, 4, 4) DEFINE_SPECIAL(Stairs_BuildUpDoomSync, 271, 4, 4, 4)
DEFINE_SPECIAL(Stairs_BuildDownDoomSync, 272, 4, 4, 4) DEFINE_SPECIAL(Stairs_BuildDownDoomSync, 272, 4, 4, 4)
DEFINE_SPECIAL(Stairs_BuildUpDoomCrush, 273, 5, 5, 5) DEFINE_SPECIAL(Stairs_BuildUpDoomCrush, 273, 5, 5, 5)
DEFINE_SPECIAL(Door_AnimatedClose, 274, 4, 4, 4)
#undef DEFINE_SPECIAL #undef DEFINE_SPECIAL

View file

@ -476,7 +476,7 @@ DEFINE_ACTION_FUNCTION(FKeyBindings, GetKeysForCommand)
{ {
PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings); PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings);
PARAM_STRING(cmd); PARAM_STRING(cmd);
int k1, k2, c; int k1, k2;
self->GetKeysForCommand(cmd.GetChars(), &k1, &k2); self->GetKeysForCommand(cmd.GetChars(), &k1, &k2);
if (numret > 0) ret[0].SetInt(k1); if (numret > 0) ret[0].SetInt(k1);
if (numret > 1) ret[1].SetInt(k2); if (numret > 1) ret[1].SetInt(k2);

View file

@ -1942,13 +1942,13 @@ static int PatchMisc (int dummy)
if (armor!=NULL) if (armor!=NULL)
{ {
armor->IntVar(NAME_SaveAmount) = 100 * deh.GreenAC; armor->IntVar(NAME_SaveAmount) = 100 * deh.GreenAC;
armor->FloatVar(NAME_SavePercent) = deh.GreenAC == 1 ? 0.33335 : 0.5; armor->FloatVar(NAME_SavePercent) = deh.GreenAC == 1 ? 33.335 : 50;
} }
armor = GetDefaultByName ("BlueArmor"); armor = GetDefaultByName ("BlueArmor");
if (armor!=NULL) if (armor!=NULL)
{ {
armor->IntVar(NAME_SaveAmount) = 100 * deh.BlueAC; armor->IntVar(NAME_SaveAmount) = 100 * deh.BlueAC;
armor->FloatVar(NAME_SavePercent) = deh.BlueAC == 1 ? 0.33335 : 0.5; armor->FloatVar(NAME_SavePercent) = deh.BlueAC == 1 ? 33.335 : 50;
} }
auto barmor = GetDefaultByName ("ArmorBonus"); auto barmor = GetDefaultByName ("ArmorBonus");

View file

@ -544,7 +544,7 @@ void FullGC()
void Barrier(DObject *pointing, DObject *pointed) void Barrier(DObject *pointing, DObject *pointed)
{ {
assert(pointed->GetClass() < (void*)0x1000000000000000); assert(pointed->GetClass() != nullptr);
assert(pointing == NULL || (pointing->IsBlack() && !pointing->IsDead())); assert(pointing == NULL || (pointing->IsBlack() && !pointing->IsDead()));
assert(pointed->IsWhite() && !pointed->IsDead()); assert(pointed->IsWhite() && !pointed->IsDead());
assert(State != GCS_Finalize && State != GCS_Pause); assert(State != GCS_Finalize && State != GCS_Pause);

View file

@ -138,9 +138,13 @@ DEFINE_ACTION_FUNCTION(IJoystickConfig, GetNumAxes)
void UpdateJoystickMenu(IJoystickConfig *selected) void UpdateJoystickMenu(IJoystickConfig *selected)
{ {
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_JoystickOptions); DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_JoystickOptions);
DMenuDescriptor **ddesc = MenuDescriptors.CheckKey("JoystickOptionsDefaults");
if (ddesc == nullptr) return; // without any data the menu cannot be set up and must remain empty.
if (desc != NULL && (*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor))) if (desc != NULL && (*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor)))
{ {
DOptionMenuDescriptor *opt = (DOptionMenuDescriptor *)*desc; DOptionMenuDescriptor *opt = (DOptionMenuDescriptor *)*desc;
DOptionMenuDescriptor *dopt = (DOptionMenuDescriptor *)*ddesc;
if (dopt == nullptr) return;
DMenuItemBase *it; DMenuItemBase *it;
int i; int i;
@ -162,11 +166,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
} }
} }
} }
#ifdef _WIN32 opt->mItems = dopt->mItems;
opt->mItems.Resize(8);
#else
opt->mItems.Resize(5);
#endif
it = opt->GetItem("ConfigureMessage"); it = opt->GetItem("ConfigureMessage");
if (it != nullptr) it->SetValue(0, !!Joysticks.Size()); if (it != nullptr) it->SetValue(0, !!Joysticks.Size());

View file

@ -94,6 +94,8 @@ float BackbuttonAlpha;
static bool MenuEnabled = true; static bool MenuEnabled = true;
void M_InitVideoModes(); void M_InitVideoModes();
extern PClass *DefaultListMenuClass;
extern PClass *DefaultOptionMenuClass;
#define KEY_REPEAT_DELAY (TICRATE*5/12) #define KEY_REPEAT_DELAY (TICRATE*5/12)
@ -623,7 +625,9 @@ void M_SetMenu(FName menu, int param)
} }
else else
{ {
const PClass *cls = ld->mClass == nullptr? RUNTIME_CLASS(DListMenu) : ld->mClass; PClass *cls = ld->mClass;
if (cls == nullptr) cls = DefaultListMenuClass;
if (cls == nullptr) cls = PClass::FindClass("ListMenu");
DListMenu *newmenu = (DListMenu *)cls->CreateNew(); DListMenu *newmenu = (DListMenu *)cls->CreateNew();
newmenu->Init(DMenu::CurrentMenu, ld); newmenu->Init(DMenu::CurrentMenu, ld);
@ -633,7 +637,9 @@ void M_SetMenu(FName menu, int param)
else if ((*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor))) else if ((*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor)))
{ {
DOptionMenuDescriptor *ld = static_cast<DOptionMenuDescriptor*>(*desc); DOptionMenuDescriptor *ld = static_cast<DOptionMenuDescriptor*>(*desc);
const PClass *cls = ld->mClass == nullptr? PClass::FindClass("OptionMenu") : ld->mClass; PClass *cls = ld->mClass;
if (cls == nullptr) cls = DefaultOptionMenuClass;
if (cls == nullptr) cls = PClass::FindClass("OptionMenu");
DMenu *newmenu = (DMenu*)cls->CreateNew(); DMenu *newmenu = (DMenu*)cls->CreateNew();
IFVIRTUALPTRNAME(newmenu, "OptionMenu", Init) IFVIRTUALPTRNAME(newmenu, "OptionMenu", Init)

View file

@ -112,7 +112,7 @@ class DMenuDescriptor : public DObject
public: public:
FName mMenuName; FName mMenuName;
FString mNetgameMessage; FString mNetgameMessage;
const PClass *mClass; PClass *mClass = nullptr;
virtual size_t PropagateMark() { return 0; } virtual size_t PropagateMark() { return 0; }
}; };

View file

@ -62,6 +62,8 @@ static DOptionMenuDescriptor *DefaultOptionMenuSettings; // contains common sett
FOptionMenuSettings OptionSettings; FOptionMenuSettings OptionSettings;
FOptionMap OptionValues; FOptionMap OptionValues;
bool mustPrintErrors; bool mustPrintErrors;
PClass *DefaultListMenuClass;
PClass *DefaultOptionMenuClass;
void I_BuildALDeviceList(FOptionValues *opt); void I_BuildALDeviceList(FOptionValues *opt);
@ -291,7 +293,7 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
else if (sc.Compare("Class")) else if (sc.Compare("Class"))
{ {
sc.MustGetString(); sc.MustGetString();
const PClass *cls = PClass::FindClass(sc.String); PClass *cls = PClass::FindClass(sc.String);
if (cls == nullptr || !cls->IsDescendantOf(RUNTIME_CLASS(DListMenu))) if (cls == nullptr || !cls->IsDescendantOf(RUNTIME_CLASS(DListMenu)))
{ {
sc.ScriptError("Unknown menu class '%s'", sc.String); sc.ScriptError("Unknown menu class '%s'", sc.String);
@ -699,7 +701,7 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc)
else if (sc.Compare("Class")) else if (sc.Compare("Class"))
{ {
sc.MustGetString(); sc.MustGetString();
const PClass *cls = PClass::FindClass(sc.String); PClass *cls = PClass::FindClass(sc.String);
if (cls == nullptr || !cls->IsDescendantOf("OptionMenu")) if (cls == nullptr || !cls->IsDescendantOf("OptionMenu"))
{ {
sc.ScriptError("Unknown menu class '%s'", sc.String); sc.ScriptError("Unknown menu class '%s'", sc.String);
@ -948,7 +950,9 @@ void M_ParseMenuDefs()
} }
} }
} }
DefaultListMenuClass = DefaultListMenuSettings->mClass;
DefaultListMenuSettings = nullptr; DefaultListMenuSettings = nullptr;
DefaultOptionMenuClass = DefaultOptionMenuSettings->mClass;
DefaultOptionMenuSettings = nullptr; DefaultOptionMenuSettings = nullptr;
} }

View file

@ -538,7 +538,8 @@ void DAnimatedDoor::Serialize(FSerializer &arc)
("delay", m_Delay) ("delay", m_Delay)
("dooranim", m_DoorAnim) ("dooranim", m_DoorAnim)
("setblock1", m_SetBlocking1) ("setblock1", m_SetBlocking1)
("setblock2", m_SetBlocking2); ("setblock2", m_SetBlocking2)
("type", m_Type);
} }
//============================================================================ //============================================================================
@ -614,7 +615,6 @@ void DAnimatedDoor::Tick ()
} }
m_Timer = m_Delay; m_Timer = m_Delay;
m_Status = Waiting;
} }
else else
{ {
@ -631,7 +631,7 @@ void DAnimatedDoor::Tick ()
case Waiting: case Waiting:
// IF DOOR IS DONE WAITING... // IF DOOR IS DONE WAITING...
if (!m_Timer--) if (m_Type == adClose || !m_Timer--)
{ {
if (!StartClosing()) 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) : DMovingCeiling (sec, false)
{ {
double topdist; 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(); 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_Speed = speed;
m_Delay = delay; m_Delay = delay;
m_Timer = m_Speed; m_Timer = m_Speed;
@ -728,11 +729,14 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
m_Line2->flags |= ML_BLOCKING; m_Line2->flags |= ML_BLOCKING;
m_BotDist = m_Sector->ceilingplane.fD(); m_BotDist = m_Sector->ceilingplane.fD();
m_Sector->MoveCeiling (2048., topdist, 1); m_Sector->MoveCeiling (2048., topdist, 1);
if (type == adOpenClose)
{
if (m_DoorAnim->OpenSound != NAME_None) if (m_DoorAnim->OpenSound != NAME_None)
{ {
SN_StartSequence(m_Sector, CHAN_INTERIOR, m_DoorAnim->OpenSound, 1); 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; sector_t *sec;
int secnum; int secnum;
@ -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)); FDoorAnimation *anim = TexMan.FindAnimatedDoor (line->sidedef[0]->GetTexture(side_t::top));
if (anim != NULL) if (anim != NULL)
{ {
new DAnimatedDoor (sec, line, speed, delay, anim); new DAnimatedDoor (sec, line, speed, delay, anim, type);
return true; return true;
} }
return false; return false;
@ -799,7 +803,7 @@ bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay)
if (anim != NULL) if (anim != NULL)
{ {
rtn = true; rtn = true;
new DAnimatedDoor (sec, line, speed, delay, anim); new DAnimatedDoor (sec, line, speed, delay, anim, type);
break; break;
} }
} }

View file

@ -297,7 +297,13 @@ FUNC(LS_Door_Animated)
if (arg3 != 0 && !P_CheckKeys (it, arg3, arg0 != 0)) if (arg3 != 0 && !P_CheckKeys (it, arg3, arg0 != 0))
return false; 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) FUNC(LS_Generic_Door)
@ -3594,6 +3600,7 @@ static lnSpecFunc LineSpecials[] =
/* 271 */ LS_Stairs_BuildUpDoomSync, /* 271 */ LS_Stairs_BuildUpDoomSync,
/* 272 */ LS_Stairs_BuildDownDoomSync, /* 272 */ LS_Stairs_BuildDownDoomSync,
/* 273 */ LS_Stairs_BuildUpDoomCrush, /* 273 */ LS_Stairs_BuildUpDoomCrush,
/* 274 */ LS_Door_AnimatedClose,
}; };

View file

@ -322,8 +322,15 @@ class DAnimatedDoor : public DMovingCeiling
{ {
DECLARE_CLASS (DAnimatedDoor, DMovingCeiling) DECLARE_CLASS (DAnimatedDoor, DMovingCeiling)
public: public:
enum EADType
{
adOpenClose,
adClose
};
DAnimatedDoor (sector_t *sector); 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 Serialize(FSerializer &arc);
void Tick (); void Tick ();
@ -336,6 +343,7 @@ protected:
int m_Timer; int m_Timer;
double m_BotDist; double m_BotDist;
int m_Status; int m_Status;
int m_Type;
enum enum
{ {
Opening, Opening,
@ -347,12 +355,12 @@ protected:
int m_Delay; int m_Delay;
bool m_SetBlocking1, m_SetBlocking2; 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: private:
DAnimatedDoor (); 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 // P_CEILNG

View file

@ -1256,7 +1256,7 @@ DEFINE_ACTION_FUNCTION(DObject, S_Sound)
PARAM_INT(channel); PARAM_INT(channel);
PARAM_FLOAT_DEF(volume); PARAM_FLOAT_DEF(volume);
PARAM_FLOAT_DEF(attn); PARAM_FLOAT_DEF(attn);
S_Sound(channel, id, volume, attn); S_Sound(channel, id, static_cast<float>(volume), static_cast<float>(attn));
return 0; return 0;
} }

View file

@ -1530,7 +1530,7 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx)
SAFE_RESOLVE(basex, ctx); SAFE_RESOLVE(basex, ctx);
// first deal with the simple types // first deal with the simple types
if (ValueType == TypeError || basex->ValueType == TypeError) if (ValueType == TypeError || basex->ValueType == TypeError || basex->ValueType == nullptr)
{ {
ScriptPosition.Message(MSG_ERROR, "Trying to cast to invalid type."); ScriptPosition.Message(MSG_ERROR, "Trying to cast to invalid type.");
delete this; delete this;

View file

@ -559,7 +559,7 @@ OptionMenu "MouseOptions"
// //
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
OptionMenu "JoystickOptions" OptionMenu "JoystickOptionsDefaults"
{ {
Title "$JOYMNU_OPTIONS" Title "$JOYMNU_OPTIONS"
Option "$JOYMNU_ENABLE", "use_joystick", "YesNo" Option "$JOYMNU_ENABLE", "use_joystick", "YesNo"
@ -577,6 +577,11 @@ OptionMenu "JoystickOptions"
// The rest will be filled in by joystick code if devices get connected or disconnected // The rest will be filled in by joystick code if devices get connected or disconnected
} }
OptionMenu "JoystickOptions"
{
Title "$JOYMNU_OPTIONS"
}
OptionValue "JoyAxisMapNames" OptionValue "JoyAxisMapNames"
{ {
-1, "$OPTVAL_NONE" -1, "$OPTVAL_NONE"