mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
d8d4679471
24 changed files with 172 additions and 107 deletions
|
@ -9,6 +9,9 @@ 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" )
|
||||||
|
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
|
||||||
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable" )
|
||||||
|
endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
|
||||||
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 )
|
||||||
|
|
|
@ -299,16 +299,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 )
|
||||||
|
@ -485,6 +488,11 @@ 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}" )
|
||||||
|
|
||||||
|
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
|
||||||
|
set( CMAKE_C_FLAGS "-Wno-unused-result ${CMAKE_C_FLAGS}" )
|
||||||
|
set( CMAKE_CXX_FLAGS "-Wno-unused-result ${CMAKE_CXX_FLAGS}" )
|
||||||
|
endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.5")
|
||||||
|
set( CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers ${CMAKE_C_FLAGS}" )
|
||||||
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}" )
|
set( CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS}" )
|
||||||
|
|
||||||
# Remove extra warnings when using the official DirectX headers.
|
# Remove extra warnings when using the official DirectX headers.
|
||||||
|
|
|
@ -193,7 +193,7 @@ DEFINE_SPECIAL(Transfer_FloorLight, 210, -1, -1, 1)
|
||||||
DEFINE_SPECIAL(Transfer_CeilingLight, 211, -1, -1, 1)
|
DEFINE_SPECIAL(Transfer_CeilingLight, 211, -1, -1, 1)
|
||||||
DEFINE_SPECIAL(Sector_SetColor, 212, 4, 5, 5)
|
DEFINE_SPECIAL(Sector_SetColor, 212, 4, 5, 5)
|
||||||
DEFINE_SPECIAL(Sector_SetFade, 213, 4, 4, 4)
|
DEFINE_SPECIAL(Sector_SetFade, 213, 4, 4, 4)
|
||||||
DEFINE_SPECIAL(Sector_SetDamage, 214, 3, 3, 3)
|
DEFINE_SPECIAL(Sector_SetDamage, 214, 3, 5, 5)
|
||||||
DEFINE_SPECIAL(Teleport_Line, 215, 2, 3, 3)
|
DEFINE_SPECIAL(Teleport_Line, 215, 2, 3, 3)
|
||||||
DEFINE_SPECIAL(Sector_SetGravity, 216, 3, 3, 3)
|
DEFINE_SPECIAL(Sector_SetGravity, 216, 3, 3, 3)
|
||||||
DEFINE_SPECIAL(Stairs_BuildUpDoom, 217, 5, 5, 5)
|
DEFINE_SPECIAL(Stairs_BuildUpDoom, 217, 5, 5, 5)
|
||||||
|
|
20
src/actor.h
20
src/actor.h
|
@ -591,31 +591,11 @@ enum
|
||||||
struct fixedvec3
|
struct fixedvec3
|
||||||
{
|
{
|
||||||
fixed_t x, y, z;
|
fixed_t x, y, z;
|
||||||
|
|
||||||
operator FVector3()
|
|
||||||
{
|
|
||||||
return FVector3(FIXED2FLOAT(x), FIXED2FLOAT(y), FIXED2FLOAT(z));
|
|
||||||
}
|
|
||||||
|
|
||||||
operator TVector3<double>()
|
|
||||||
{
|
|
||||||
return TVector3<double>(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct fixedvec2
|
struct fixedvec2
|
||||||
{
|
{
|
||||||
fixed_t x, y;
|
fixed_t x, y;
|
||||||
|
|
||||||
operator FVector2()
|
|
||||||
{
|
|
||||||
return FVector2(FIXED2FLOAT(x), FIXED2FLOAT(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
operator TVector2<double>()
|
|
||||||
{
|
|
||||||
return TVector2<double>(FIXED2DBL(x), FIXED2DBL(y));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FDropItem
|
struct FDropItem
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
AActor *COPY_AAPTR(AActor *origin, int selector)
|
AActor *COPY_AAPTR(AActor *origin, int selector)
|
||||||
{
|
{
|
||||||
|
if (selector == AAPTR_DEFAULT) return origin;
|
||||||
|
|
||||||
if (origin)
|
if (origin)
|
||||||
{
|
{
|
||||||
if (origin->player)
|
if (origin->player)
|
||||||
|
|
|
@ -465,7 +465,8 @@ fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
|
||||||
|
|
||||||
float speed = (float)th->Speed;
|
float speed = (float)th->Speed;
|
||||||
|
|
||||||
TVector3<double> velocity = source->Vec3To(dest);
|
fixedvec3 fixvel = source->Vec3To(dest);
|
||||||
|
TVector3<double> velocity(fixvel.x, fixvel.y, fixvel.z);
|
||||||
velocity.MakeUnit();
|
velocity.MakeUnit();
|
||||||
th->velx = FLOAT2FIXED(velocity[0] * speed);
|
th->velx = FLOAT2FIXED(velocity[0] * speed);
|
||||||
th->vely = FLOAT2FIXED(velocity[1] * speed);
|
th->vely = FLOAT2FIXED(velocity[1] * speed);
|
||||||
|
|
|
@ -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!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -176,8 +176,9 @@ void AAimingCamera::Tick ()
|
||||||
}
|
}
|
||||||
if (MaxPitchChange)
|
if (MaxPitchChange)
|
||||||
{ // Aim camera's pitch; use floats for precision
|
{ // Aim camera's pitch; use floats for precision
|
||||||
TVector2<double> vect = tracer->Vec2To(this);
|
fixedvec2 fv3 = tracer->Vec2To(this);
|
||||||
double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2);
|
TVector2<double> vect(fv3.x, fv3.y);
|
||||||
|
double dz = Z() - tracer->Z() - tracer->height/2;
|
||||||
double dist = vect.Length();
|
double dist = vect.Length();
|
||||||
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
|
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
|
||||||
int desiredpitch = (angle_t)(ang * 2147483648.f / PI);
|
int desiredpitch = (angle_t)(ang * 2147483648.f / PI);
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 ()
|
||||||
|
|
|
@ -274,7 +274,14 @@ bool DOptionMenu::MenuEvent (int mkey, bool fromcontroller)
|
||||||
mDesc->mSelectedItem = mDesc->mScrollTop + mDesc->mScrollPos + 1;
|
mDesc->mSelectedItem = mDesc->mScrollTop + mDesc->mScrollPos + 1;
|
||||||
while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable())
|
while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable())
|
||||||
{
|
{
|
||||||
++mDesc->mSelectedItem;
|
if (++mDesc->mSelectedItem >= (int)mDesc->mItems.Size())
|
||||||
|
{
|
||||||
|
mDesc->mSelectedItem = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mDesc->mScrollPos > mDesc->mSelectedItem)
|
||||||
|
{
|
||||||
|
mDesc->mScrollPos = mDesc->mSelectedItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,7 +301,14 @@ bool DOptionMenu::MenuEvent (int mkey, bool fromcontroller)
|
||||||
mDesc->mSelectedItem = mDesc->mScrollTop + mDesc->mScrollPos;
|
mDesc->mSelectedItem = mDesc->mScrollTop + mDesc->mScrollPos;
|
||||||
while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable())
|
while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable())
|
||||||
{
|
{
|
||||||
++mDesc->mSelectedItem;
|
if (++mDesc->mSelectedItem >= (int)mDesc->mItems.Size())
|
||||||
|
{
|
||||||
|
mDesc->mSelectedItem = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mDesc->mScrollPos > mDesc->mSelectedItem)
|
||||||
|
{
|
||||||
|
mDesc->mScrollPos = mDesc->mSelectedItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6012,7 +6012,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
||||||
startalpha = clamp<int>(startalpha, 0, 0xFF); // Clamp to byte
|
startalpha = clamp<int>(startalpha, 0, 0xFF); // Clamp to byte
|
||||||
lifetime = clamp<int>(lifetime, 0, 0xFF); // Clamp to byte
|
lifetime = clamp<int>(lifetime, 0, 0xFF); // Clamp to byte
|
||||||
fadestep = clamp<int>(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic)
|
fadestep = clamp<int>(fadestep, -1, 0xFF); // Clamp to byte inc. -1 (indicating automatic)
|
||||||
size = clamp<int>(size, 0, 0xFF); // Clamp to byte
|
size = clamp<int>(size, 0, 127); // Clamp to byte
|
||||||
|
|
||||||
if (lifetime != 0)
|
if (lifetime != 0)
|
||||||
P_SpawnParticle(x, y, z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz);
|
P_SpawnParticle(x, y, z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz);
|
||||||
|
|
|
@ -2777,7 +2777,8 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
|
||||||
// disabled and is so by default.
|
// disabled and is so by default.
|
||||||
if (max_pitch <= ANGLE_180)
|
if (max_pitch <= ANGLE_180)
|
||||||
{
|
{
|
||||||
TVector2<double> dist = self->Vec2To(other);
|
fixedvec2 pos = self->Vec2To(other);
|
||||||
|
TVector2<double> dist(pos.x, pos.y);
|
||||||
|
|
||||||
// Positioning ala missile spawning, 32 units above foot level
|
// Positioning ala missile spawning, 32 units above foot level
|
||||||
fixed_t source_z = self->Z() + 32*FRACUNIT + self->GetBobOffset();
|
fixed_t source_z = self->Z() + 32*FRACUNIT + self->GetBobOffset();
|
||||||
|
@ -2801,7 +2802,7 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
|
||||||
if (!(flags & FAF_NODISTFACTOR))
|
if (!(flags & FAF_NODISTFACTOR))
|
||||||
target_z += pitch_offset;
|
target_z += pitch_offset;
|
||||||
|
|
||||||
double dist_z = FIXED2DBL(target_z - source_z);
|
double dist_z = target_z - source_z;
|
||||||
double ddist = sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
|
double ddist = sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
|
||||||
int other_pitch = (int)rad2bam(asin(dist_z / ddist));
|
int other_pitch = (int)rad2bam(asin(dist_z / ddist));
|
||||||
|
|
||||||
|
@ -2915,8 +2916,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
|
||||||
if (linetarget == NULL)
|
if (linetarget == NULL)
|
||||||
{
|
{
|
||||||
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
|
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
|
||||||
TVector2<double> xydiff = self->Vec2To(self->target);
|
fixedvec2 pos = self->Vec2To(self->target);
|
||||||
double zdiff = FIXED2DBL((self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip));
|
TVector2<double> xydiff(pos.x, pos.y);
|
||||||
|
double zdiff = (self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip);
|
||||||
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
|
self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2037,7 +2037,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
//dest->x - source->x
|
//dest->x - source->x
|
||||||
fixedvec3 vect = mo->Vec3To(origin);
|
fixedvec3 vect = mo->Vec3To(origin);
|
||||||
vect.z += origin->height / 2;
|
vect.z += origin->height / 2;
|
||||||
FVector3 velocity(vect);
|
TVector3<double> velocity(vect.x, vect.y, vect.z);
|
||||||
velocity.Resize(speed);
|
velocity.Resize(speed);
|
||||||
mo->velx = (fixed_t)(velocity.X);
|
mo->velx = (fixed_t)(velocity.X);
|
||||||
mo->vely = (fixed_t)(velocity.Y);
|
mo->vely = (fixed_t)(velocity.Y);
|
||||||
|
@ -5733,7 +5733,8 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
|
||||||
// missile?
|
// missile?
|
||||||
// Answer: No, because this way, you can set up sets of parallel missiles.
|
// Answer: No, because this way, you can set up sets of parallel missiles.
|
||||||
|
|
||||||
FVector3 velocity = source->Vec3To(dest);
|
fixedvec3 fixvel = source->Vec3To(dest);
|
||||||
|
FVector3 velocity(fixvel.x, fixvel.y, fixvel.z);
|
||||||
// Floor and ceiling huggers should never have a vertical component to their velocity
|
// Floor and ceiling huggers should never have a vertical component to their velocity
|
||||||
if (th->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
|
if (th->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
|
||||||
{
|
{
|
||||||
|
@ -5742,7 +5743,7 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
|
||||||
// [RH] Adjust the trajectory if the missile will go over the target's head.
|
// [RH] Adjust the trajectory if the missile will go over the target's head.
|
||||||
else if (z - source->Z() >= dest->height)
|
else if (z - source->Z() >= dest->height)
|
||||||
{
|
{
|
||||||
velocity.Z += dest->height - z + source->Z();
|
velocity.Z += (dest->height - z + source->Z());
|
||||||
}
|
}
|
||||||
velocity.Resize (speed);
|
velocity.Resize (speed);
|
||||||
th->velx = (fixed_t)(velocity.X);
|
th->velx = (fixed_t)(velocity.X);
|
||||||
|
@ -5938,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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1243,7 +1243,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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -256,7 +256,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
||||||
{
|
{
|
||||||
fixedvec3 vect = mobj->Vec3To(targ);
|
fixedvec3 vect = mobj->Vec3To(targ);
|
||||||
vect.z += targ->height / 2;
|
vect.z += targ->height / 2;
|
||||||
FVector3 aim = vect;
|
TVector3<double> aim(vect.x, vect.y, vect.z);
|
||||||
|
|
||||||
if (leadTarget && speed > 0 && (targ->velx | targ->vely | targ->velz))
|
if (leadTarget && speed > 0 && (targ->velx | targ->vely | targ->velz))
|
||||||
{
|
{
|
||||||
|
@ -267,7 +267,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
||||||
// with the math. I don't think I would have thought of using
|
// with the math. I don't think I would have thought of using
|
||||||
// trig alone had I been left to solve it by myself.
|
// trig alone had I been left to solve it by myself.
|
||||||
|
|
||||||
FVector3 tvel(targ->velx, targ->vely, targ->velz);
|
TVector3<double> tvel(targ->velx, targ->vely, targ->velz);
|
||||||
if (!(targ->flags & MF_NOGRAVITY) && targ->waterlevel < 3)
|
if (!(targ->flags & MF_NOGRAVITY) && targ->waterlevel < 3)
|
||||||
{ // If the target is subject to gravity and not underwater,
|
{ // If the target is subject to gravity and not underwater,
|
||||||
// assume that it isn't moving vertically. Thanks to gravity,
|
// assume that it isn't moving vertically. Thanks to gravity,
|
||||||
|
@ -288,14 +288,14 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
|
||||||
|
|
||||||
// Use the cross product of two of the triangle's sides to get a
|
// Use the cross product of two of the triangle's sides to get a
|
||||||
// rotation vector.
|
// rotation vector.
|
||||||
FVector3 rv(tvel ^ aim);
|
TVector3<double> rv(tvel ^ aim);
|
||||||
// The vector must be normalized.
|
// The vector must be normalized.
|
||||||
rv.MakeUnit();
|
rv.MakeUnit();
|
||||||
// Now combine the rotation vector with angle b to get a rotation matrix.
|
// Now combine the rotation vector with angle b to get a rotation matrix.
|
||||||
FMatrix3x3 rm(rv, cos(asin(sinb)), sinb);
|
TMatrix3x3<double> rm(rv, cos(asin(sinb)), sinb);
|
||||||
// And multiply the original aim vector with the matrix to get a
|
// And multiply the original aim vector with the matrix to get a
|
||||||
// new aim vector that leads the target.
|
// new aim vector that leads the target.
|
||||||
FVector3 aimvec = rm * aim;
|
TVector3<double> aimvec = rm * aim;
|
||||||
// And make the projectile follow that vector at the desired speed.
|
// And make the projectile follow that vector at the desired speed.
|
||||||
double aimscale = fspeed / dist;
|
double aimscale = fspeed / dist;
|
||||||
mobj->velx = fixed_t (aimvec[0] * aimscale);
|
mobj->velx = fixed_t (aimvec[0] * aimscale);
|
||||||
|
|
|
@ -157,8 +157,9 @@ private:
|
||||||
IOHIDElementCookie cookie;
|
IOHIDElementCookie cookie;
|
||||||
int32_t value;
|
int32_t value;
|
||||||
|
|
||||||
DigitalButton(const IOHIDElementCookie cookie)
|
explicit DigitalButton(const IOHIDElementCookie cookie)
|
||||||
: cookie(cookie)
|
: cookie(cookie)
|
||||||
|
, value(0)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -261,9 +261,12 @@ void FInterpolator::DoInterpolations(fixed_t smoothratio)
|
||||||
|
|
||||||
didInterp = true;
|
didInterp = true;
|
||||||
|
|
||||||
for (DInterpolation *probe = Head; probe != NULL; probe = probe->Next)
|
DInterpolation *probe = Head;
|
||||||
|
while (probe != NULL)
|
||||||
{
|
{
|
||||||
|
DInterpolation *next = probe->Next;
|
||||||
probe->Interpolate(smoothratio);
|
probe->Interpolate(smoothratio);
|
||||||
|
probe = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -4060,7 +4060,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle)
|
||||||
ACTION_PARAM_INT(ptr, 2);
|
ACTION_PARAM_INT(ptr, 2);
|
||||||
|
|
||||||
AActor *ref = COPY_AAPTR(self, ptr);
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
if (ref != NULL)
|
if (ref == NULL)
|
||||||
{
|
{
|
||||||
ACTION_SET_RESULT(false);
|
ACTION_SET_RESULT(false);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -1096,6 +1096,11 @@ void WI_End ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WI_autoSkip()
|
||||||
|
{
|
||||||
|
return wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE);
|
||||||
|
}
|
||||||
|
|
||||||
void WI_initNoState ()
|
void WI_initNoState ()
|
||||||
{
|
{
|
||||||
state = NoState;
|
state = NoState;
|
||||||
|
@ -1114,7 +1119,7 @@ void WI_updateNoState ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool noauto = noautostartmap;
|
bool noauto = noautostartmap;
|
||||||
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
bool autoskip = WI_autoSkip();
|
||||||
|
|
||||||
for (int i = 0; !noauto && i < MAXPLAYERS; ++i)
|
for (int i = 0; !noauto && i < MAXPLAYERS; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1254,7 +1259,7 @@ void WI_updateDeathmatchStats ()
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
bool stillticking;
|
bool stillticking;
|
||||||
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
bool autoskip = WI_autoSkip();
|
||||||
|
|
||||||
WI_updateAnimatedBack();
|
WI_updateAnimatedBack();
|
||||||
|
|
||||||
|
@ -1506,7 +1511,7 @@ void WI_updateNetgameStats ()
|
||||||
int i;
|
int i;
|
||||||
int fsum;
|
int fsum;
|
||||||
bool stillticking;
|
bool stillticking;
|
||||||
bool autoskip = (wi_autoadvance > 0 && bcnt > (wi_autoadvance * TICRATE));
|
bool autoskip = WI_autoSkip();
|
||||||
|
|
||||||
WI_updateAnimatedBack ();
|
WI_updateAnimatedBack ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue