Small improvements to Dialogue internals

- Guarantee not-visible dialogue on map transition/invalidation
- Don't grab a portrait for skins that don't have portraits
This commit is contained in:
toaster 2023-11-30 15:03:48 +00:00
parent 4c284680ff
commit 42f37e7ded

View file

@ -70,15 +70,20 @@ void Dialogue::SetSpeaker(std::string skinName, int portraitID)
if (sprdef->numframes > 0) if (sprdef->numframes > 0)
{ {
portraitID %= sprdef->numframes; portraitID %= sprdef->numframes;
const spriteframe_t *sprframe = &sprdef->spriteframes[portraitID];
portrait = static_cast<patch_t *>( W_CachePatchNum(sprframe->lumppat[0], PU_CACHE) );
portraitColormap = R_GetTranslationColormap(skinID, static_cast<skincolornum_t>(skin->prefcolor), GTC_CACHE);
}
else
{
portrait = nullptr;
portraitColormap = nullptr;
} }
const spriteframe_t *sprframe = &sprdef->spriteframes[portraitID];
speaker = skin->realname; speaker = skin->realname;
portrait = static_cast<patch_t *>( W_CachePatchNum(sprframe->lumppat[0], PU_CACHE) );
portraitColormap = R_GetTranslationColormap(skinID, static_cast<skincolornum_t>(skin->prefcolor), GTC_CACHE);
voiceSfx = skin->soundsid[ S_sfx[sfx_ktalk].skinsound ]; voiceSfx = skin->soundsid[ S_sfx[sfx_ktalk].skinsound ];
} }
else else
@ -333,6 +338,7 @@ void Dialogue::Unset(void)
{ {
Dismiss(); Dismiss();
SetSpeaker(); SetSpeaker();
slide = 0;
} }
/* /*