Replaced expresser cases involving CBaseMultiplayerPlayer with CBasePlayer to allow singleplayer expressers to be obtained

This commit is contained in:
Blixibon 2021-04-07 13:53:06 -05:00
parent bec712f3f9
commit 1a6f1f0cab
2 changed files with 11 additions and 0 deletions

View File

@ -174,7 +174,11 @@ void CResponseQueue::RemoveExpresserHost(CBaseEntity *host)
/// TODO: Kind of an ugly hack until I get the class hierarchy straightened out.
static CAI_Expresser *InferExpresserFromBaseEntity(CBaseEntity * RESTRICT pEnt)
{
#ifdef MAPBASE
if ( CBasePlayer *pPlayer = ToBasePlayer(pEnt) )
#else
if ( CBaseMultiplayerPlayer *pPlayer = dynamic_cast<CBaseMultiplayerPlayer *>(pEnt) )
#endif
{
return pPlayer->GetExpresser();
}

View File

@ -4835,10 +4835,17 @@ void CSceneEntity::OnSceneFinished( bool canceled, bool fireoutput )
CBaseFlex *pFlex = FindNamedActor( 0 ) ;
if ( pFlex )
{
#ifdef MAPBASE
CBasePlayer *pAsPlayer = ToBasePlayer(pFlex);
#else
CBaseMultiplayerPlayer *pAsPlayer = dynamic_cast<CBaseMultiplayerPlayer *>(pFlex);
#endif
if (pAsPlayer)
{
CAI_Expresser *pExpresser = pAsPlayer->GetExpresser();
#ifdef MAPBASE
if (pExpresser)
#endif
pExpresser->OnSpeechFinished();
}
else if ( CAI_BaseActor *pActor = dynamic_cast<CAI_BaseActor*>( pFlex ) )