Fixed: MUSINFO was not multiplayer-aware
- Move MUSINFO change request out of FLevelLocals and into player_t. This allows the MusicChanger actors to change music for each player independantly. This is similar to PrBoom+, which switches depending on the displayplayer. The difference being, we don't actually track the music other players are listening to. (Which might not be a bad idea to implement at some point.) - Moved a few fields in player_t for better packing.
This commit is contained in:
parent
9cd6aae902
commit
3463b87876
7 changed files with 58 additions and 42 deletions
|
|
@ -309,7 +309,9 @@ player_t::player_t()
|
|||
ConversationNPC(0),
|
||||
ConversationPC(0),
|
||||
ConversationNPCAngle(0),
|
||||
ConversationFaceTalker(0)
|
||||
ConversationFaceTalker(0),
|
||||
MUSINFOactor(0),
|
||||
MUSINFOtics(-1)
|
||||
{
|
||||
memset (&cmd, 0, sizeof(cmd));
|
||||
memset (frags, 0, sizeof(frags));
|
||||
|
|
@ -400,6 +402,8 @@ player_t &player_t::operator=(const player_t &p)
|
|||
ConversationPC = p.ConversationPC;
|
||||
ConversationNPCAngle = p.ConversationNPCAngle;
|
||||
ConversationFaceTalker = p.ConversationFaceTalker;
|
||||
MUSINFOactor = p.MUSINFOactor;
|
||||
MUSINFOtics = p.MUSINFOtics;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -430,6 +434,7 @@ size_t player_t::FixPointers (const DObject *old, DObject *rep)
|
|||
if (*&PremorphWeapon == old) PremorphWeapon = static_cast<AWeapon *>(rep), changed++;
|
||||
if (*&ConversationNPC == old) ConversationNPC = replacement, changed++;
|
||||
if (*&ConversationPC == old) ConversationPC = replacement, changed++;
|
||||
if (*&MUSINFOactor == old) MUSINFOactor = replacement, changed++;
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
|
@ -443,6 +448,7 @@ size_t player_t::PropagateMark()
|
|||
GC::Mark(ReadyWeapon);
|
||||
GC::Mark(ConversationNPC);
|
||||
GC::Mark(ConversationPC);
|
||||
GC::Mark(MUSINFOactor);
|
||||
GC::Mark(PremorphWeapon);
|
||||
if (PendingWeapon != WP_NOCHANGE)
|
||||
{
|
||||
|
|
@ -2331,6 +2337,30 @@ void P_PlayerThink (player_t *player)
|
|||
|
||||
player->crouchoffset = -FixedMul(player->mo->ViewHeight, (FRACUNIT - player->crouchfactor));
|
||||
|
||||
// MUSINFO stuff
|
||||
if (player->MUSINFOtics >= 0 && player->MUSINFOactor != NULL)
|
||||
{
|
||||
if (--player->MUSINFOtics < 0)
|
||||
{
|
||||
if (player - players == consoleplayer)
|
||||
{
|
||||
if (player->MUSINFOactor->args[0] != 0)
|
||||
{
|
||||
FName *music = level.info->MusicMap.CheckKey(player->MUSINFOactor->args[0]);
|
||||
|
||||
if (music != NULL)
|
||||
{
|
||||
S_ChangeMusic(music->GetChars(), player->MUSINFOactor->args[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S_ChangeMusic("*");
|
||||
}
|
||||
}
|
||||
DPrintf("MUSINFO change for player %d to %d\n", (int)(player - players), player->MUSINFOactor->args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
|
|
@ -3105,6 +3135,10 @@ void player_t::Serialize (FArchive &arc)
|
|||
{
|
||||
userinfo.SkinChanged(skinname, CurrentPlayerClass);
|
||||
}
|
||||
if (SaveVersion >= 4522)
|
||||
{
|
||||
arc << MUSINFOactor << MUSINFOtics;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue