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,61 +103,66 @@ if( WIN32 )
set( FMOD_SEARCH_PATHS
"C:/Program Files/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_LIB_PATH_SUFFIXES PATH_SUFFIXES lib )
find_path( D3D_INCLUDE_DIR d3d9.h
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include )
if( NOT D3D_INCLUDE_DIR )
# Modern versions of the Windows SDK include d3d9.h. Unfortunately,
# CMake cannot find this file via find_path, so we check for it using
# CHECK_INCLUDE_FILE.
CHECK_INCLUDE_FILE( d3d9.h D3D9_H_FOUND )
if ( NOT D3D9_H_FOUND )
message( SEND_ERROR "Could not find DirectX 9 header files" )
endif()
else()
include_directories( ${D3D_INCLUDE_DIR} )
endif()
find_path( XINPUT_INCLUDE_DIR xinput.h
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include )
if( NOT XINPUT_INCLUDE_DIR )
# Modern versions of the Windows SDK include xinput.h. Unfortunately,
# CMake cannot find this file via find_path, so we check for it using
# CHECK_INCLUDE_FILES. windows.h must be included before xinput.h.
CHECK_INCLUDE_FILES( "windows.h;xinput.h" XINPUT_H_FOUND )
if( NOT XINPUT_H_FOUND )
message( WARNING "Could not find xinput.h. XInput will be disabled." )
add_definitions( -DNO_XINPUT )
endif()
else()
include_directories( ${XINPUT_INCLUDE_DIR} )
endif()
find_library( DX_dinput8_LIBRARY dinput8
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
find_library( DX_dxguid_LIBRARY dxguid
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
# Modern versions of the Windows SDK include dinput8.lib. Unfortunately,
# CMake cannot find these libraries via find_library.
if( NOT DX_dinput8_LIBRARY )
# If we got this far, assume dinput8.lib is in the system library path.
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 )
endif()
else()
find_path( D3D_INCLUDE_DIR d3d9.h
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include )
if( NOT D3D_INCLUDE_DIR )
# Modern versions of the Windows SDK include d3d9.h. Unfortunately,
# CMake cannot find this file via find_path, so we check for it using
# CHECK_INCLUDE_FILE.
CHECK_INCLUDE_FILE( d3d9.h D3D9_H_FOUND )
if ( NOT D3D9_H_FOUND )
message( SEND_ERROR "Could not find DirectX 9 header files" )
endif()
else()
include_directories( ${D3D_INCLUDE_DIR} )
endif()
find_path( XINPUT_INCLUDE_DIR xinput.h
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Include )
if( NOT XINPUT_INCLUDE_DIR )
# Modern versions of the Windows SDK include xinput.h. Unfortunately,
# CMake cannot find this file via find_path, so we check for it using
# CHECK_INCLUDE_FILES. windows.h must be included before xinput.h.
CHECK_INCLUDE_FILES( "windows.h;xinput.h" XINPUT_H_FOUND )
if( NOT XINPUT_H_FOUND )
message( WARNING "Could not find xinput.h. XInput will be disabled." )
add_definitions( -DNO_XINPUT )
endif()
else()
include_directories( ${XINPUT_INCLUDE_DIR} )
endif()
# Modern versions of the Windows SDK do NOT include dxguid.lib. Its contents
# were moved to dinput8.lib.
if( NOT DX_dxguid_LIBRARY )
message( STATUS "Could not find dxguid.lib. Build may fail on old Windows SDKs.")
find_library( DX_dinput8_LIBRARY dinput8
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
find_library( DX_dxguid_LIBRARY dxguid
PATHS ENV DXSDK_DIR
PATH_SUFFIXES Lib Lib/${XBITS} )
# Modern versions of the Windows SDK include dinput8.lib. Unfortunately,
# CMake cannot find these libraries via find_library.
if( NOT DX_dinput8_LIBRARY )
# If we got this far, assume dinput8.lib is in the system library path.
set( DX_dinput8_LIBRARY dinput8 )
endif()
# Modern versions of the Windows SDK do NOT include dxguid.lib. Its contents
# were moved to dinput8.lib.
if( NOT DX_dxguid_LIBRARY )
message( STATUS "Could not find dxguid.lib. Build may fail on old Windows SDKs.")
endif()
endif()
set( ZDOOM_LIBS

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_BuildDownDoomSync, 272, 4, 4, 4)
DEFINE_SPECIAL(Stairs_BuildUpDoomCrush, 273, 5, 5, 5)
DEFINE_SPECIAL(Door_AnimatedClose, 274, 4, 4, 4)
#undef DEFINE_SPECIAL

View File

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

View File

@ -1942,13 +1942,13 @@ static int PatchMisc (int dummy)
if (armor!=NULL)
{
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");
if (armor!=NULL)
{
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");

View File

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

View File

@ -138,9 +138,13 @@ DEFINE_ACTION_FUNCTION(IJoystickConfig, GetNumAxes)
void UpdateJoystickMenu(IJoystickConfig *selected)
{
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)))
{
DOptionMenuDescriptor *opt = (DOptionMenuDescriptor *)*desc;
DOptionMenuDescriptor *dopt = (DOptionMenuDescriptor *)*ddesc;
if (dopt == nullptr) return;
DMenuItemBase *it;
int i;
@ -162,11 +166,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
}
}
}
#ifdef _WIN32
opt->mItems.Resize(8);
#else
opt->mItems.Resize(5);
#endif
opt->mItems = dopt->mItems;
it = opt->GetItem("ConfigureMessage");
if (it != nullptr) it->SetValue(0, !!Joysticks.Size());

View File

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

View File

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

View File

@ -62,6 +62,8 @@ static DOptionMenuDescriptor *DefaultOptionMenuSettings; // contains common sett
FOptionMenuSettings OptionSettings;
FOptionMap OptionValues;
bool mustPrintErrors;
PClass *DefaultListMenuClass;
PClass *DefaultOptionMenuClass;
void I_BuildALDeviceList(FOptionValues *opt);
@ -291,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);
@ -699,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);
@ -948,7 +950,9 @@ void M_ParseMenuDefs()
}
}
}
DefaultListMenuClass = DefaultListMenuSettings->mClass;
DefaultListMenuSettings = nullptr;
DefaultOptionMenuClass = DefaultOptionMenuSettings->mClass;
DefaultOptionMenuSettings = nullptr;
}

View File

@ -538,7 +538,8 @@ void DAnimatedDoor::Serialize(FSerializer &arc)
("delay", m_Delay)
("dooranim", m_DoorAnim)
("setblock1", m_SetBlocking1)
("setblock2", m_SetBlocking2);
("setblock2", m_SetBlocking2)
("type", 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;
}
}

View File

@ -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,
};

View File

@ -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

View File

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

View File

@ -1530,7 +1530,7 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx)
SAFE_RESOLVE(basex, ctx);
// 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.");
delete this;

View File

@ -559,7 +559,7 @@ OptionMenu "MouseOptions"
//
//-------------------------------------------------------------------------------------------
OptionMenu "JoystickOptions"
OptionMenu "JoystickOptionsDefaults"
{
Title "$JOYMNU_OPTIONS"
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
}
OptionMenu "JoystickOptions"
{
Title "$JOYMNU_OPTIONS"
}
OptionValue "JoyAxisMapNames"
{
-1, "$OPTVAL_NONE"