This commit is contained in:
Christoph Oelckers 2016-01-24 11:50:54 +01:00
commit be3b84e751
12 changed files with 112 additions and 66 deletions

View file

@ -8,7 +8,7 @@ include( CheckCXXCompilerFlag )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUGMODE=1" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DDEBUGMODE=1" )
if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) if( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-pointer-sign -Wno-uninitialized" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-pointer-sign -Wno-uninitialized -Wno-unused-but-set-variable" )
endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) endif( ZD_CMAKE_COMPILER_IS_GNUC_COMPATIBLE )
CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS ) CHECK_FUNCTION_EXISTS( itoa ITOA_EXISTS )

View file

@ -286,16 +286,19 @@ if( NO_FMOD )
endif( NO_FMOD ) endif( NO_FMOD )
if( NO_OPENAL ) if( NO_OPENAL )
add_definitions( -DNO_OPENAL=1 ) add_definitions( -DNO_OPENAL=1 )
set(MPG123_FOUND NO)
set(SNDFILE_FOUND NO)
else( NO_OPENAL )
# Search for libSndFile
find_package( SndFile )
# Search for libmpg123
find_package( MPG123 )
endif( NO_OPENAL ) endif( NO_OPENAL )
# Search for libSndFile
find_package( SndFile )
# Search for libmpg123
find_package( MPG123 )
# Search for FluidSynth # Search for FluidSynth
find_package( FluidSynth ) find_package( FluidSynth )
@ -456,7 +459,8 @@ if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
set( CMAKE_CXX_FLAGS_MINSIZEREL "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_MINSIZEREL}" ) set( CMAKE_CXX_FLAGS_MINSIZEREL "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_MINSIZEREL}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" ) set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${REL_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}" ) set( CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result ${CMAKE_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result ${CMAKE_CXX_FLAGS}" )
# Remove extra warnings when using the official DirectX headers. # Remove extra warnings when using the official DirectX headers.
# Also, TDM-GCC 4.4.0 no longer accepts glibc-style printf formats as valid, # Also, TDM-GCC 4.4.0 no longer accepts glibc-style printf formats as valid,

View file

@ -1083,8 +1083,15 @@ CCMD(nextsecret)
CCMD(currentpos) CCMD(currentpos)
{ {
AActor *mo = players[consoleplayer].mo; AActor *mo = players[consoleplayer].mo;
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n", if(mo)
FIXED2FLOAT(mo->X()), FIXED2FLOAT(mo->Y()), FIXED2FLOAT(mo->Z()), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel); {
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
FIXED2FLOAT(mo->X()), FIXED2FLOAT(mo->Y()), FIXED2FLOAT(mo->Z()), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
}
else
{
Printf("You are not in game!");
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -412,6 +412,21 @@ class CommandDrawSwitchableImage : public CommandDrawImage
return compare != value; return compare != value;
} }
} }
// Key species are used to allow altnerates for existing key slots.
static FName LookupKeySpecies(int keynum)
{
for(unsigned int i = 0;i < PClass::m_Types.Size();++i)
{
const PClass *cls = PClass::m_Types[i];
if(cls->IsDescendantOf(RUNTIME_CLASS(AKey)))
{
AKey *key = (AKey *)GetDefaultByType(cls);
if(key->KeyNumber == keynum)
return cls->TypeName;
}
}
return FName();
}
public: public:
CommandDrawSwitchableImage(SBarInfo *script) : CommandDrawImage(script), CommandDrawSwitchableImage(SBarInfo *script) : CommandDrawImage(script),
@ -442,6 +457,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
condition = KEYSLOT; condition = KEYSLOT;
sc.MustGetToken(TK_IntConst); sc.MustGetToken(TK_IntConst);
conditionalValue[0] = sc.Number; conditionalValue[0] = sc.Number;
keySpecies[0] = LookupKeySpecies(conditionalValue[0]);
} }
else if(sc.Compare("armortype")) else if(sc.Compare("armortype"))
{ {
@ -468,6 +484,8 @@ class CommandDrawSwitchableImage : public CommandDrawImage
{ {
sc.MustGetToken(TK_IntConst); sc.MustGetToken(TK_IntConst);
conditionalValue[1] = sc.Number; conditionalValue[1] = sc.Number;
if(condition == KEYSLOT)
keySpecies[1] = LookupKeySpecies(conditionalValue[1]);
} }
else if(condition == ARMORTYPE) else if(condition == ARMORTYPE)
{ {
@ -541,11 +559,21 @@ class CommandDrawSwitchableImage : public CommandDrawImage
if(item->IsKindOf(RUNTIME_CLASS(AKey))) if(item->IsKindOf(RUNTIME_CLASS(AKey)))
{ {
int keynum = static_cast<AKey *>(item)->KeyNumber; int keynum = static_cast<AKey *>(item)->KeyNumber;
if(keynum)
if(keynum == conditionalValue[0]) {
found1 = true; if(keynum == conditionalValue[0])
if(conditionAnd && keynum == conditionalValue[1]) // two keys found1 = true;
found2 = true; if(conditionAnd && keynum == conditionalValue[1]) // two keys
found2 = true;
}
else
{
FName species = item->GetSpecies();
if(species == keySpecies[0])
found1 = true;
if(conditionAnd && species == keySpecies[1])
found2 = true;
}
} }
} }
@ -639,6 +667,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
Operator conditionalOperator[2]; Operator conditionalOperator[2];
FString inventoryItem[2]; FString inventoryItem[2];
int armorType[2]; int armorType[2];
FName keySpecies[2];
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1595,7 +1624,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
public: public:
CommandDrawSelectedInventory(SBarInfo *script) : CommandDrawImage(script), CommandDrawSelectedInventory(SBarInfo *script) : CommandDrawImage(script),
CommandDrawNumber(script), alternateOnEmpty(false), CommandDrawNumber(script), alternateOnEmpty(false),
artiflash(false), alwaysShowCounter(false) artiflash(false), alwaysShowCounter(false), itemflash(false)
{ {
length = INT_MAX; // Counter size length = INT_MAX; // Counter size
} }

View file

@ -722,7 +722,10 @@ DIntermissionController::DIntermissionController(FIntermissionDescriptor *Desc,
mScreen = NULL; mScreen = NULL;
mFirst = true; mFirst = true;
mGameState = state; mGameState = state;
NextPage();
// If the intermission finishes straight away then cancel the wipe.
if(!NextPage())
wipegamestate = GS_FINALE;
} }
bool DIntermissionController::NextPage () bool DIntermissionController::NextPage ()

View file

@ -5939,7 +5939,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
const PClass *type, angle_t angle, AActor **pLineTarget, AActor **pMissileActor, const PClass *type, angle_t angle, AActor **pLineTarget, AActor **pMissileActor,
bool nofreeaim, bool noautoaim) bool nofreeaim, bool noautoaim)
{ {
static const int angdiff[3] = { -1<<26, 1<<26, 0 }; static const int angdiff[3] = { -(1<<26), 1<<26, 0 };
angle_t an = angle; angle_t an = angle;
angle_t pitch; angle_t pitch;
AActor *linetarget; AActor *linetarget;

View file

@ -891,7 +891,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash)
angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget) angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget)
{ {
static const int angdiff[3] = { -1<<26, 1<<26, 0 }; static const int angdiff[3] = { -(1<<26), 1<<26, 0 };
int i; int i;
angle_t an; angle_t an;
angle_t pitch; angle_t pitch;

View file

@ -1223,7 +1223,7 @@ void P_InitSectorSpecial(sector_t *sector, int special, bool nothinkers)
if (!nothinkers) if (!nothinkers)
{ {
new DStrobe(sector, STROBEBRIGHT, FASTDARK, false); new DStrobe(sector, STROBEBRIGHT, FASTDARK, false);
new DScroller(DScroller::sc_floor, (-FRACUNIT / 2) << 3, new DScroller(DScroller::sc_floor, -((FRACUNIT / 2) << 3),
0, -1, int(sector - sectors), 0); 0, -1, int(sector - sectors), 0);
} }
keepspecial = true; keepspecial = true;

View file

@ -108,7 +108,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
sector_t *destsect; sector_t *destsect;
bool resetpitch = false; bool resetpitch = false;
fixed_t floorheight, ceilingheight; fixed_t floorheight, ceilingheight;
fixed_t missilespeed; fixed_t missilespeed = 0;
old = thing->Pos(); old = thing->Pos();
aboveFloor = thing->Z() - thing->floorz; aboveFloor = thing->Z() - thing->floorz;

View file

@ -447,8 +447,6 @@ void DSectorPlaneInterpolation::UpdateInterpolation()
oldheight = sector->ceilingplane.d; oldheight = sector->ceilingplane.d;
oldtexz = sector->GetPlaneTexZ(sector_t::ceiling); oldtexz = sector->GetPlaneTexZ(sector_t::ceiling);
} }
if (oldtexz <-128*FRACUNIT)
__asm nop
} }
//========================================================================== //==========================================================================

View file

@ -676,52 +676,55 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
z = y = x = 0; z = y = x = 0;
} }
switch (type) // [BL] Moved this case out of the switch statement to make code easier
// on static analysis.
if(type == SOURCE_Unattached)
{ {
case SOURCE_None:
default:
break;
case SOURCE_Actor:
// assert(actor != NULL);
if (actor != NULL)
{
x = actor->SoundX();
y = actor->SoundZ();
z = actor->SoundY();
}
break;
case SOURCE_Sector:
assert(sector != NULL);
if (sector != NULL)
{
if (chanflags & CHAN_AREA)
{
CalcSectorSoundOrg(sector, channum, &x, &z, &y);
}
else
{
x = sector->soundorg[0];
z = sector->soundorg[1];
chanflags |= CHAN_LISTENERZ;
}
}
break;
case SOURCE_Polyobj:
assert(poly != NULL);
CalcPolyobjSoundOrg(poly, &x, &z, &y);
break;
case SOURCE_Unattached:
pos->X = pt[0]; pos->X = pt[0];
pos->Y = !(chanflags & CHAN_LISTENERZ) ? pt[1] : FIXED2FLOAT(y); pos->Y = !(chanflags & CHAN_LISTENERZ) ? pt[1] : FIXED2FLOAT(y);
pos->Z = pt[2]; pos->Z = pt[2];
break;
} }
if (type != SOURCE_Unattached) else
{ {
switch (type)
{
case SOURCE_None:
default:
break;
case SOURCE_Actor:
//assert(actor != NULL);
if (actor != NULL)
{
x = actor->SoundX();
y = actor->SoundZ();
z = actor->SoundY();
}
break;
case SOURCE_Sector:
assert(sector != NULL);
if (sector != NULL)
{
if (chanflags & CHAN_AREA)
{
CalcSectorSoundOrg(sector, channum, &x, &z, &y);
}
else
{
x = sector->soundorg[0];
z = sector->soundorg[1];
chanflags |= CHAN_LISTENERZ;
}
}
break;
case SOURCE_Polyobj:
assert(poly != NULL);
CalcPolyobjSoundOrg(poly, &x, &z, &y);
break;
}
if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != NULL) if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != NULL)
{ {
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->SoundZ() : 0; y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->SoundZ() : 0;

View file

@ -1059,7 +1059,9 @@ void FSingleLumpFont::LoadTranslations()
break; break;
default: default:
break; // Should be unreachable.
I_Error("Unknown font type in FSingleLumpFont::LoadTranslation.");
return;
} }
for(unsigned int i = 0;i < count;++i) for(unsigned int i = 0;i < count;++i)