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

# Conflicts:
#	src/fragglescript/t_func.cpp
#	src/g_inventory/a_keys.cpp
#	src/p_acs.cpp
#	src/p_mobj.cpp
#	src/p_user.cpp
#	src/r_data/r_interpolate.cpp
#	src/r_data/r_interpolate.h
This commit is contained in:
Christoph Oelckers 2019-01-31 03:29:25 +01:00 committed by drfrag
parent 79eadafa6b
commit 358718de05
16 changed files with 44 additions and 44 deletions

View file

@ -755,7 +755,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);

View file

@ -228,7 +228,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
@ -262,7 +262,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);
@ -306,8 +306,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]);
}
@ -341,7 +341,7 @@ bool AnnounceSpreeLoss (AActor *who)
{
if (cl_bbannounce)
{
if (who->CheckLocalView (consoleplayer))
if (who->CheckLocalView())
{
DoVoiceAnnounce (TooBadSounds[M_Random() % 3]);
}
@ -361,7 +361,7 @@ bool AnnounceMultikill (AActor *who)
{
if (cl_bbannounce)
{
if (who->CheckLocalView (consoleplayer))
if (who->CheckLocalView())
{
DoVoiceAnnounce (GoodJobSounds[M_Random() % 3]);
}

View file

@ -658,7 +658,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());
}
@ -697,7 +697,7 @@ void FParser::SF_PlayerTip(void)
if (CheckArgs(1))
{
int plnum = T_GetPlayerNum(t_argv[0]);
if (plnum!=-1 && players[plnum].mo->CheckLocalView(consoleplayer))
if (plnum!=-1 && players[plnum].mo->CheckLocalView())
{
C_MidPrint(SmallFont, GetFormatString(1).GetChars());
}
@ -713,7 +713,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());
}
@ -730,7 +730,7 @@ void FParser::SF_PlayerMsg(void)
if (CheckArgs(1))
{
int plnum = T_GetPlayerNum(t_argv[0]);
if (plnum!=-1 && players[plnum].mo->CheckLocalView(consoleplayer))
if (plnum!=-1 && players[plnum].mo->CheckLocalView())
{
Printf(PRINT_HIGH, "%s\n", GetFormatString(1).GetChars());
}

View file

@ -8731,7 +8731,7 @@ scriptwait:
screen = screen->target;
}
if (pcd == PCD_ENDPRINTBOLD || screen == NULL ||
screen->CheckLocalView (consoleplayer))
screen->CheckLocalView())
{
C_MidPrint(activefont, work, pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (level.flags2 & LEVEL2_HEXENHACK)));
}
@ -8976,7 +8976,7 @@ scriptwait:
case PCD_LOCALAMBIENTSOUND:
lookup = FBehavior::StaticLookupString (STACK(2));
if (lookup != NULL && activator && activator->CheckLocalView (consoleplayer))
if (lookup != NULL && activator && activator->CheckLocalView())
{
S_Sound (CHAN_AUTO,
lookup,
@ -10103,7 +10103,7 @@ scriptwait:
}
case PCD_SETMUGSHOTSTATE:
if (!multiplayer || (activator != nullptr && activator->CheckLocalView(consoleplayer)))
if (!multiplayer || (activator != nullptr && activator->CheckLocalView()))
{
StatusBar->SetMugShotState(FBehavior::StaticLookupString(STACK(1)));
}

View file

@ -1312,8 +1312,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;
@ -1376,7 +1376,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);
@ -1396,7 +1396,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;
}
@ -1413,7 +1413,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
@ -4935,7 +4935,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;
}

View file

@ -503,7 +503,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
}
if (deathmatch &&
source->CheckLocalView (consoleplayer) &&
source->CheckLocalView() &&
cl_showmultikills)
{
const char *multimsg;

View file

@ -3198,7 +3198,7 @@ FUNC(LS_SendToCommunicator)
it->player->SetLogNumber (arg0);
}
if (it->CheckLocalView (consoleplayer))
if (it->CheckLocalView())
{
S_StopSound (CHAN_VOICE);
it->player->SetSubtitle(arg0, name);

View file

@ -6298,7 +6298,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();
@ -6395,7 +6395,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);
@ -6409,7 +6409,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);
@ -6449,7 +6449,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);
@ -6463,7 +6463,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;

View file

@ -965,18 +965,18 @@ DEFINE_ACTION_FUNCTION(AActor, GiveBody)
//
//============================================================================
bool AActor::CheckLocalView (int playernum) const
bool AActor::CheckLocalView() const
{
if (players[playernum].camera == this)
if (players[consoleplayer].camera == this)
{
return true;
}
if (players[playernum].mo != this || players[playernum].camera == NULL)
if (players[consoleplayer].mo != this || players[consoleplayer].camera == NULL)
{
return false;
}
if (players[playernum].camera->player == NULL &&
!(players[playernum].camera->flags3 & MF3_ISMONSTER))
if (players[consoleplayer].camera->player == NULL &&
!(players[consoleplayer].camera->flags3 & MF3_ISMONSTER))
{
return true;
}
@ -987,7 +987,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckLocalView)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(cp);
ACTION_RETURN_BOOL(self->CheckLocalView(cp));
ACTION_RETURN_BOOL(self->CheckLocalView());
}
//============================================================================

View file

@ -614,7 +614,7 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu
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)
{

View file

@ -471,7 +471,7 @@ void player_t::SetLogText (const char *text)
{
LogText = text;
if (mo && mo->CheckLocalView(consoleplayer))
if (mo && mo->CheckLocalView())
{
// Print log text to console
AddToConsole(-1, TEXTCOLOR_GOLD);

View file

@ -1446,7 +1446,7 @@ void S_PlaySoundPitch(AActor *a, int chan, FSoundID sid, float vol, float atten,
}
else
{
if (a->CheckLocalView(consoleplayer))
if (a->CheckLocalView())
{
S_SoundPitch(chan, sid, vol, ATTN_NONE, pitch);
}

View file

@ -611,7 +611,7 @@ class Actor : Thinker native
native void SoundAlert(Actor target, bool splash = false, double maxdist = 0);
native void ClearBounce();
native TerrainDef GetFloorTerrain();
native bool CheckLocalView(int consoleplayer);
native bool CheckLocalView(int consoleplayer = -1); // parameter is not used anymore but needed for backward compatibility.
native bool CheckNoDelay();
native bool UpdateWaterLevel (bool splash = true);
native bool IsZeroDamage();

View file

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

View file

@ -766,7 +766,7 @@ class Inventory : Actor
toucher = player.mo;
}
bool localview = toucher.CheckLocalView(consoleplayer);
bool localview = toucher.CheckLocalView();
if (!toucher.CanTouchItem(self))
return;
@ -1053,7 +1053,7 @@ class Inventory : Actor
}
/*
else if ((ItemFlags & IF_FANCYPICKUPSOUND) &&
(toucher == NULL || toucher->CheckLocalView(consoleplayer)))
(toucher == NULL || toucher->CheckLocalView()))
{
atten = ATTN_NONE;
}
@ -1063,7 +1063,7 @@ class Inventory : Actor
atten = ATTN_NORM;
}
if (toucher != NULL && toucher.CheckLocalView(consoleplayer))
if (toucher != NULL && toucher.CheckLocalView())
{
chan = CHAN_PICKUP|CHAN_NOPAUSE;
}

View file

@ -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");
}