mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- a few minor fixes.
This commit is contained in:
parent
de24fc2c88
commit
2903025268
5 changed files with 29 additions and 17 deletions
|
@ -8623,8 +8623,8 @@ scriptwait:
|
|||
{
|
||||
screen = screen->target;
|
||||
}
|
||||
if (pcd == PCD_ENDHUDMESSAGEBOLD || screen == NULL ||
|
||||
players[consoleplayer].mo == screen)
|
||||
if (Level->isPrimaryLevel() && (pcd == PCD_ENDHUDMESSAGEBOLD || screen == NULL ||
|
||||
players[consoleplayer].mo == screen))
|
||||
{
|
||||
int type = Stack[optstart-6];
|
||||
int id = Stack[optstart-5];
|
||||
|
|
|
@ -739,7 +739,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
|
|||
int i;
|
||||
|
||||
// Make sure this is actually a player.
|
||||
if (pc == nullptr || pc->player == nullptr || npc == nullptr || pc->Level != currentUILevel) return;
|
||||
if (pc == nullptr || pc->player == nullptr || npc == nullptr || !pc->Level->isPrimaryLevel()) return;
|
||||
auto Level = pc->Level;
|
||||
|
||||
// [CW] If an NPC is talking to a PC already, then don't let
|
||||
|
|
|
@ -631,14 +631,23 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
|
|||
seg.extend = (tempvec - (seg.dir | tempvec) * seg.dir) * 3;
|
||||
length += seg.length;
|
||||
|
||||
// Only consider sound in 2D (for now, anyway)
|
||||
// [BB] You have to divide by lengthsquared here, not multiply with it.
|
||||
AActor *mo = players[consoleplayer].camera;
|
||||
|
||||
double r = ((seg.start.Y - mo->Y()) * (-seg.dir.Y) - (seg.start.X - mo->X()) * (seg.dir.X)) / (seg.length * seg.length);
|
||||
r = clamp<double>(r, 0., 1.);
|
||||
seg.soundpos = seg.start + r * seg.dir;
|
||||
seg.sounddist = (seg.soundpos - mo->Pos()).LengthSquared();
|
||||
if (source->Level->isPrimaryLevel())
|
||||
{
|
||||
// Only consider sound in 2D (for now, anyway)
|
||||
// [BB] You have to divide by lengthsquared here, not multiply with it.
|
||||
AActor *mo = players[consoleplayer].camera;
|
||||
|
||||
double r = ((seg.start.Y - mo->Y()) * (-seg.dir.Y) - (seg.start.X - mo->X()) * (seg.dir.X)) / (seg.length * seg.length);
|
||||
r = clamp<double>(r, 0., 1.);
|
||||
seg.soundpos = seg.start + r * seg.dir;
|
||||
seg.sounddist = (seg.soundpos - mo->Pos()).LengthSquared();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set to invalid for secondary levels.
|
||||
seg.soundpos = {0,0};
|
||||
seg.sounddist = -1;
|
||||
}
|
||||
trail.Push(seg);
|
||||
}
|
||||
|
||||
|
@ -647,7 +656,7 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
|
|||
|
||||
if (steps)
|
||||
{
|
||||
if (!(flags & RAF_SILENT))
|
||||
if (!(flags & RAF_SILENT) && source->Level->isPrimaryLevel())
|
||||
{
|
||||
FSoundID sound;
|
||||
|
||||
|
|
|
@ -997,7 +997,7 @@ void P_RandomChaseDir (AActor *actor)
|
|||
|
||||
if (actor->FriendPlayer != 0)
|
||||
{
|
||||
player = players[i = actor->FriendPlayer - 1].mo;
|
||||
player = actor->Level->Players[i = actor->FriendPlayer - 1]->mo;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1600,7 +1600,7 @@ int P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params)
|
|||
actor->IsFriend(p->mo) &&
|
||||
(anyone || P_IsVisible(actor, p->mo, allaround)))
|
||||
{
|
||||
actor->target = players[c].mo;
|
||||
actor->target = Level->Players[c]->mo;
|
||||
|
||||
// killough 12/98:
|
||||
// get out of refiring loop, to avoid hitting player accidentally
|
||||
|
|
|
@ -1040,22 +1040,25 @@ bool AActor::IsInsideVisibleAngles() const
|
|||
//
|
||||
// Returns true if this actor should be seen by the console player.
|
||||
//
|
||||
// Not that even for secondary maps this must check the real player!
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
bool AActor::IsVisibleToPlayer() const
|
||||
{
|
||||
auto &p = players[consoleplayer];
|
||||
// [BB] Safety check. This should never be NULL. Nevertheless, we return true to leave the default ZDoom behavior unaltered.
|
||||
if ( players[consoleplayer].camera == NULL )
|
||||
if ( p.camera == nullptr )
|
||||
return true;
|
||||
|
||||
if (VisibleToTeam != 0 && teamplay &&
|
||||
(signed)(VisibleToTeam-1) != players[consoleplayer].userinfo.GetTeam() )
|
||||
(signed)(VisibleToTeam-1) != p.userinfo.GetTeam() )
|
||||
return false;
|
||||
|
||||
auto &vis = GetInfo()->VisibleToPlayerClass;
|
||||
if (vis.Size() == 0) return true; // early out for the most common case.
|
||||
|
||||
const player_t* pPlayer = players[consoleplayer].camera->player;
|
||||
const player_t* pPlayer = p.camera->player;
|
||||
|
||||
if (pPlayer)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue