mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- removed the playernum parameter from CheckLocalView
This was always used with 'consoleplayer' which really is the only thing making sense here. But this is a part of the global state which should be avoided in play code. In particular, this makes no real sense in case of secondary maps where it should always return false.
This commit is contained in:
parent
7149d1d312
commit
ddab2c3e78
18 changed files with 50 additions and 61 deletions
|
@ -752,7 +752,7 @@ public:
|
|||
void ClearInventory();
|
||||
|
||||
// Returns true if this view is considered "local" for the player.
|
||||
bool CheckLocalView (int playernum) const;
|
||||
bool CheckLocalView() const;
|
||||
|
||||
// Finds the first item of a particular type.
|
||||
AActor *FindInventory (PClassActor *type, bool subclass=false);
|
||||
|
|
|
@ -224,7 +224,7 @@ bool AnnounceKill (AActor *killer, AActor *killee)
|
|||
|
||||
if (cl_bbannounce && deathmatch)
|
||||
{
|
||||
bool playSound = killee->CheckLocalView (consoleplayer);
|
||||
bool playSound = killee->CheckLocalView();
|
||||
|
||||
if (killer == NULL)
|
||||
{ // The world killed the player
|
||||
|
@ -258,7 +258,7 @@ bool AnnounceKill (AActor *killer, AActor *killee)
|
|||
// Blood only plays the announcement sound on the killer's
|
||||
// computer. I think it sounds neater to also hear it on
|
||||
// the killee's machine.
|
||||
playSound |= killer->CheckLocalView (consoleplayer);
|
||||
playSound |= killer->CheckLocalView();
|
||||
}
|
||||
|
||||
message = GStrings(choice->Message);
|
||||
|
@ -302,8 +302,8 @@ bool AnnounceTelefrag (AActor *killer, AActor *killee)
|
|||
killee->player->userinfo.GetName(), killer->player->userinfo.GetName());
|
||||
Printf (PRINT_MEDIUM, "%s\n", assembled);
|
||||
}
|
||||
if (killee->CheckLocalView (consoleplayer) ||
|
||||
killer->CheckLocalView (consoleplayer))
|
||||
if (killee->CheckLocalView() ||
|
||||
killer->CheckLocalView())
|
||||
{
|
||||
DoVoiceAnnounce (TelefragSounds[rannum % 7]);
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ bool AnnounceSpreeLoss (AActor *who)
|
|||
{
|
||||
if (cl_bbannounce)
|
||||
{
|
||||
if (who->CheckLocalView (consoleplayer))
|
||||
if (who->CheckLocalView())
|
||||
{
|
||||
DoVoiceAnnounce (TooBadSounds[M_Random() % 3]);
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ bool AnnounceMultikill (AActor *who)
|
|||
{
|
||||
if (cl_bbannounce)
|
||||
{
|
||||
if (who->CheckLocalView (consoleplayer))
|
||||
if (who->CheckLocalView())
|
||||
{
|
||||
DoVoiceAnnounce (GoodJobSounds[M_Random() % 3]);
|
||||
}
|
||||
|
|
|
@ -621,7 +621,7 @@ void FParser::SF_ExitLevel(void)
|
|||
void FParser::SF_Tip(void)
|
||||
{
|
||||
if (t_argc>0 && Script->trigger &&
|
||||
Script->trigger->CheckLocalView(consoleplayer))
|
||||
Script->trigger->CheckLocalView())
|
||||
{
|
||||
C_MidPrint(SmallFont, GetFormatString(0).GetChars());
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ void FParser::SF_PlayerTip(void)
|
|||
if (CheckArgs(1))
|
||||
{
|
||||
int plnum = T_GetPlayerNum(t_argv[0]);
|
||||
if (plnum!=-1 && Level->Players[plnum]->mo->CheckLocalView(consoleplayer))
|
||||
if (plnum!=-1 && Level->Players[plnum]->mo->CheckLocalView())
|
||||
{
|
||||
C_MidPrint(SmallFont, GetFormatString(1).GetChars());
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ void FParser::SF_PlayerTip(void)
|
|||
void FParser::SF_Message(void)
|
||||
{
|
||||
if (t_argc>0 && Script->trigger &&
|
||||
Script->trigger->CheckLocalView(consoleplayer))
|
||||
Script->trigger->CheckLocalView())
|
||||
{
|
||||
Printf(PRINT_HIGH, "%s\n", GetFormatString(0).GetChars());
|
||||
}
|
||||
|
@ -693,7 +693,7 @@ void FParser::SF_PlayerMsg(void)
|
|||
if (CheckArgs(1))
|
||||
{
|
||||
int plnum = T_GetPlayerNum(t_argv[0]);
|
||||
if (plnum!=-1 && Level->Players[plnum]->mo->CheckLocalView(consoleplayer))
|
||||
if (plnum!=-1 && Level->Players[plnum]->mo->CheckLocalView())
|
||||
{
|
||||
Printf(PRINT_HIGH, "%s\n", GetFormatString(1).GetChars());
|
||||
}
|
||||
|
|
|
@ -494,7 +494,7 @@ int P_CheckKeys (AActor *owner, int keynum, bool remote, bool quiet)
|
|||
|
||||
// If we get here, that means the actor isn't holding an appropriate key.
|
||||
|
||||
if (owner->CheckLocalView(consoleplayer))
|
||||
if (owner->CheckLocalView())
|
||||
{
|
||||
PrintMessage(failtext);
|
||||
|
||||
|
|
|
@ -8588,7 +8588,7 @@ scriptwait:
|
|||
screen = screen->target;
|
||||
}
|
||||
if (pcd == PCD_ENDPRINTBOLD || screen == NULL ||
|
||||
screen->CheckLocalView (consoleplayer))
|
||||
screen->CheckLocalView())
|
||||
{
|
||||
if (pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (Level->flags2 & LEVEL2_HEXENHACK)))
|
||||
C_MidPrintBold(activefont, work);
|
||||
|
@ -8837,7 +8837,7 @@ scriptwait:
|
|||
|
||||
case PCD_LOCALAMBIENTSOUND:
|
||||
lookup = Level->Behaviors.LookupString (STACK(2));
|
||||
if (lookup != NULL && activator->CheckLocalView (consoleplayer))
|
||||
if (lookup != NULL && activator->CheckLocalView())
|
||||
{
|
||||
S_Sound (CHAN_AUTO,
|
||||
lookup,
|
||||
|
@ -9966,7 +9966,7 @@ scriptwait:
|
|||
}
|
||||
|
||||
case PCD_SETMUGSHOTSTATE:
|
||||
if (!multiplayer || (activator != nullptr && activator->CheckLocalView(consoleplayer)))
|
||||
if (!multiplayer || (activator != nullptr && activator->CheckLocalView()))
|
||||
{
|
||||
StatusBar->SetMugShotState(Level->Behaviors.LookupString(STACK(1)));
|
||||
}
|
||||
|
|
|
@ -1294,8 +1294,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Print)
|
|||
PARAM_NAME (fontname);
|
||||
|
||||
if (text[0] == '$') text = GStrings(&text[1]);
|
||||
if (self->CheckLocalView (consoleplayer) ||
|
||||
(self->target != NULL && self->target->CheckLocalView (consoleplayer)))
|
||||
if (self->CheckLocalView() ||
|
||||
(self->target != NULL && self->target->CheckLocalView()))
|
||||
{
|
||||
float saved = con_midtime;
|
||||
FFont *font = NULL;
|
||||
|
@ -1358,7 +1358,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Log)
|
|||
PARAM_STRING_VAL(text);
|
||||
PARAM_BOOL(local);
|
||||
|
||||
if (local && !self->CheckLocalView(consoleplayer)) return 0;
|
||||
if (local && !self->CheckLocalView()) return 0;
|
||||
|
||||
if (text[0] == '$') text = GStrings(&text[1]);
|
||||
FString formatted = strbin1(text);
|
||||
|
@ -1378,7 +1378,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LogInt)
|
|||
PARAM_INT(num);
|
||||
PARAM_BOOL(local);
|
||||
|
||||
if (local && !self->CheckLocalView(consoleplayer)) return 0;
|
||||
if (local && !self->CheckLocalView()) return 0;
|
||||
Printf("%d\n", num);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1395,7 +1395,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LogFloat)
|
|||
PARAM_FLOAT(num);
|
||||
PARAM_BOOL(local);
|
||||
|
||||
if (local && !self->CheckLocalView(consoleplayer)) return 0;
|
||||
if (local && !self->CheckLocalView()) return 0;
|
||||
IGNORE_FORMAT_PRE
|
||||
Printf("%H\n", num);
|
||||
IGNORE_FORMAT_POST
|
||||
|
@ -4925,7 +4925,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetMugshotState)
|
|||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_STRING(name);
|
||||
if (self->CheckLocalView(consoleplayer))
|
||||
if (self->CheckLocalView())
|
||||
StatusBar->SetMugShotState(name);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -498,7 +498,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
|
|||
}
|
||||
|
||||
if (deathmatch &&
|
||||
source->CheckLocalView (consoleplayer) &&
|
||||
source->CheckLocalView() &&
|
||||
cl_showmultikills)
|
||||
{
|
||||
const char *multimsg;
|
||||
|
|
|
@ -3200,7 +3200,7 @@ FUNC(LS_SendToCommunicator)
|
|||
it->player->SetLogNumber (arg0);
|
||||
}
|
||||
|
||||
if (it->CheckLocalView (consoleplayer))
|
||||
if (it->CheckLocalView())
|
||||
{
|
||||
S_StopSound (CHAN_VOICE);
|
||||
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM);
|
||||
|
|
|
@ -6274,7 +6274,7 @@ int P_PushUp(AActor *thing, FChangePosition *cpos)
|
|||
if (cpos->instant)
|
||||
{
|
||||
intersect->Prev.Z += intersect->Z() - oldz;
|
||||
if (intersect->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
|
||||
if (intersect->CheckLocalView()) R_ResetViewInterpolation();
|
||||
}
|
||||
|
||||
intersect->UpdateRenderSectorList();
|
||||
|
@ -6371,7 +6371,7 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
|
|||
if (cpos->instant)
|
||||
{
|
||||
thing->Prev.Z += thing->floorz - oldz;
|
||||
if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
|
||||
if (thing->CheckLocalView()) R_ResetViewInterpolation();
|
||||
}
|
||||
thing->SetZ(thing->floorz);
|
||||
P_CheckFakeFloorTriggers(thing, oldz);
|
||||
|
@ -6385,7 +6385,7 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
|
|||
if (cpos->instant)
|
||||
{
|
||||
thing->Prev.Z += -oldfloorz + thing->floorz;
|
||||
if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
|
||||
if (thing->CheckLocalView()) R_ResetViewInterpolation();
|
||||
}
|
||||
thing->AddZ(-oldfloorz + thing->floorz);
|
||||
P_CheckFakeFloorTriggers(thing, oldz);
|
||||
|
@ -6425,7 +6425,7 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
|
|||
if (cpos->instant)
|
||||
{
|
||||
thing->Prev.Z += thing->floorz - thing->Z();
|
||||
if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
|
||||
if (thing->CheckLocalView()) R_ResetViewInterpolation();
|
||||
}
|
||||
|
||||
thing->SetZ(thing->floorz);
|
||||
|
@ -6439,7 +6439,7 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
|
|||
if (cpos->instant)
|
||||
{
|
||||
thing->Prev.Z += -oldfloorz + thing->floorz;
|
||||
if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
|
||||
if (thing->CheckLocalView()) R_ResetViewInterpolation();
|
||||
}
|
||||
}
|
||||
else return;
|
||||
|
|
|
@ -943,9 +943,9 @@ DEFINE_ACTION_FUNCTION(AActor, GiveBody)
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
bool AActor::CheckLocalView (int playernum) const
|
||||
bool AActor::CheckLocalView() const
|
||||
{
|
||||
auto p = &players[playernum];
|
||||
auto p = &players[consoleplayer];
|
||||
if (p->camera == this)
|
||||
{
|
||||
return true;
|
||||
|
@ -966,7 +966,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckLocalView)
|
|||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_INT(cp);
|
||||
ACTION_RETURN_BOOL(self->CheckLocalView(cp));
|
||||
ACTION_RETURN_BOOL(self->CheckLocalView());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -594,7 +594,7 @@ void P_GiveSecret(FLevelLocals *Level, AActor *actor, bool printmessage, bool pl
|
|||
ret.IntAt(&retval);
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
}
|
||||
if (retval && cl_showsecretmessage && actor->CheckLocalView(consoleplayer))
|
||||
if (retval && cl_showsecretmessage && actor->CheckLocalView())
|
||||
{
|
||||
if (printmessage)
|
||||
{
|
||||
|
|
|
@ -438,7 +438,7 @@ void player_t::SetLogText (const char *text)
|
|||
{
|
||||
LogText = text;
|
||||
|
||||
if (mo->CheckLocalView(consoleplayer))
|
||||
if (mo->CheckLocalView())
|
||||
{
|
||||
// Print log text to console
|
||||
AddToConsole(-1, TEXTCOLOR_GOLD);
|
||||
|
|
|
@ -334,19 +334,6 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FInterpolator &rs, FIn
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
DInterpolation::DInterpolation()
|
||||
{
|
||||
Next = nullptr;
|
||||
Prev = nullptr;
|
||||
refcount = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int DInterpolation::AddRef()
|
||||
{
|
||||
return ++refcount;
|
||||
|
@ -404,7 +391,7 @@ void DInterpolation::Serialize(FSerializer &arc)
|
|||
//==========================================================================
|
||||
|
||||
DSectorPlaneInterpolation::DSectorPlaneInterpolation(sector_t *_sector, bool _plane, bool attach)
|
||||
: DInterpolation(sector->Level)
|
||||
: DInterpolation(_sector->Level)
|
||||
{
|
||||
sector = _sector;
|
||||
ceiling = _plane;
|
||||
|
@ -570,7 +557,7 @@ size_t DSectorPlaneInterpolation::PropagateMark()
|
|||
//==========================================================================
|
||||
|
||||
DSectorScrollInterpolation::DSectorScrollInterpolation(sector_t *_sector, bool _plane)
|
||||
: DInterpolation(sector->Level)
|
||||
: DInterpolation(_sector->Level)
|
||||
{
|
||||
sector = _sector;
|
||||
ceiling = _plane;
|
||||
|
@ -676,7 +663,7 @@ void DSectorScrollInterpolation::Serialize(FSerializer &arc)
|
|||
//==========================================================================
|
||||
|
||||
DWallScrollInterpolation::DWallScrollInterpolation(side_t *_side, int _part)
|
||||
: DInterpolation(side->GetLevel())
|
||||
: DInterpolation(_side->GetLevel())
|
||||
{
|
||||
side = _side;
|
||||
part = _part;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#define R_INTERPOLATE_H
|
||||
|
||||
#include "dobject.h"
|
||||
|
||||
struct FLevelLocals;
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -15,14 +17,14 @@ class DInterpolation : public DObject
|
|||
DECLARE_ABSTRACT_CLASS(DInterpolation, DObject)
|
||||
HAS_OBJECT_POINTERS
|
||||
|
||||
TObjPtr<DInterpolation*> Next;
|
||||
TObjPtr<DInterpolation*> Prev;
|
||||
TObjPtr<DInterpolation*> Next = nullptr;
|
||||
TObjPtr<DInterpolation*> Prev = nullptr;
|
||||
|
||||
protected:
|
||||
FLevelLocals *Level;
|
||||
int refcount;
|
||||
int refcount = 0;
|
||||
|
||||
DInterpolation(FLevelLocals *l) : Level(l) {}
|
||||
DInterpolation(FLevelLocals *l = nullptr) : Level(l) {}
|
||||
|
||||
public:
|
||||
int AddRef();
|
||||
|
|
|
@ -1420,7 +1420,7 @@ void S_PlaySound(AActor *a, int chan, FSoundID sid, float vol, float atten, bool
|
|||
}
|
||||
else
|
||||
{
|
||||
if (a->CheckLocalView(consoleplayer))
|
||||
if (a->CheckLocalView())
|
||||
{
|
||||
S_Sound(chan, sid, vol, ATTN_NONE);
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ class PuzzleItem : Inventory
|
|||
}
|
||||
// [RH] Always play the sound if the use fails.
|
||||
Owner.A_PlaySound ("*puzzfail", CHAN_VOICE);
|
||||
if (Owner.CheckLocalView (consoleplayer))
|
||||
if (Owner.CheckLocalView())
|
||||
{
|
||||
Console.MidPrint ("SmallFont", PuzzFailMessage, true);
|
||||
}
|
||||
|
|
|
@ -765,7 +765,7 @@ class Inventory : Actor
|
|||
toucher = player.mo;
|
||||
}
|
||||
|
||||
bool localview = toucher.CheckLocalView(consoleplayer);
|
||||
bool localview = toucher.CheckLocalView();
|
||||
|
||||
bool res;
|
||||
[res, toucher] = CallTryPickup(toucher);
|
||||
|
@ -1049,7 +1049,7 @@ class Inventory : Actor
|
|||
}
|
||||
/*
|
||||
else if ((ItemFlags & IF_FANCYPICKUPSOUND) &&
|
||||
(toucher == NULL || toucher->CheckLocalView(consoleplayer)))
|
||||
(toucher == NULL || toucher->CheckLocalView()))
|
||||
{
|
||||
atten = ATTN_NONE;
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ class Inventory : Actor
|
|||
atten = ATTN_NORM;
|
||||
}
|
||||
|
||||
if (toucher != NULL && toucher.CheckLocalView(consoleplayer))
|
||||
if (toucher != NULL && toucher.CheckLocalView())
|
||||
{
|
||||
chan = CHAN_PICKUP|CHAN_NOPAUSE;
|
||||
}
|
||||
|
|
|
@ -529,7 +529,7 @@ class Scanner : PowerupGiver
|
|||
{
|
||||
if (!level.AllMap)
|
||||
{
|
||||
if (Owner.CheckLocalView (consoleplayer))
|
||||
if (Owner.CheckLocalView())
|
||||
{
|
||||
Console.MidPrint("SmallFont", "$TXT_NEEDMAP");
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ class RaiseAlarm : DummyStrifeItem
|
|||
if (dropper.target != null)
|
||||
{
|
||||
dropper.target.SoundAlert(dropper.target);
|
||||
if (dropper.target.CheckLocalView(consoleplayer))
|
||||
if (dropper.target.CheckLocalView())
|
||||
{
|
||||
Console.MidPrint(SmallFont, "$TXT_YOUFOOL");
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ class CloseDoor222 : DummyStrifeItem
|
|||
Door_Close(222, 16);
|
||||
if (dropper.target != null)
|
||||
{
|
||||
if (dropper.target.CheckLocalView(consoleplayer))
|
||||
if (dropper.target.CheckLocalView())
|
||||
{
|
||||
Console.MidPrint(SmallFont, "$TXT_YOUREDEAD");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue