mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- fixed: The cast call could not handle actors with changing sprites
- fixed: The cast call was missing some NULL pointer checks for invalid actor classes. - fixed: The cast call did not use a translation defined for an actor class. SVN r2968 (trunk)
This commit is contained in:
parent
1287c9419a
commit
48e17ccf1c
2 changed files with 43 additions and 20 deletions
|
@ -392,7 +392,12 @@ void DIntermissionScreenCast::Init(FIntermissionAction *desc, bool first)
|
|||
mName = static_cast<FIntermissionActionCast*>(desc)->mName;
|
||||
mClass = PClass::FindClass(static_cast<FIntermissionActionCast*>(desc)->mCastClass);
|
||||
if (mClass != NULL) mDefaults = GetDefaultByType(mClass);
|
||||
else mDefaults = NULL;
|
||||
else
|
||||
{
|
||||
mDefaults = NULL;
|
||||
caststate = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
mCastSounds.Resize(static_cast<FIntermissionActionCast*>(desc)->mCastSounds.Size());
|
||||
for (unsigned i=0; i < mCastSounds.Size(); i++)
|
||||
|
@ -405,15 +410,17 @@ void DIntermissionScreenCast::Init(FIntermissionAction *desc, bool first)
|
|||
if (mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)))
|
||||
{
|
||||
advplayerstate = mDefaults->MissileState;
|
||||
castsprite = skins[players[consoleplayer].userinfo.skin].sprite;
|
||||
casttranslation = translationtables[TRANSLATION_Players][consoleplayer];
|
||||
}
|
||||
else
|
||||
{
|
||||
advplayerstate = NULL;
|
||||
if (caststate != NULL) castsprite = caststate->sprite;
|
||||
else castsprite = -1;
|
||||
casttranslation = NULL;
|
||||
if (mDefaults->Translation != 0)
|
||||
{
|
||||
casttranslation = translationtables[GetTranslationType(mDefaults->Translation)]
|
||||
[GetTranslationIndex(mDefaults->Translation)];
|
||||
}
|
||||
}
|
||||
castdeath = false;
|
||||
castframes = 0;
|
||||
|
@ -434,6 +441,8 @@ int DIntermissionScreenCast::Responder (event_t *ev)
|
|||
|
||||
castdeath = true;
|
||||
|
||||
if (mClass != NULL)
|
||||
{
|
||||
FName label[] = {NAME_Death, NAME_Cast};
|
||||
caststate = mClass->ActorInfo->FindState(2, label);
|
||||
if (caststate == NULL) return -1;
|
||||
|
@ -451,6 +460,7 @@ int DIntermissionScreenCast::Responder (event_t *ev)
|
|||
{
|
||||
S_Sound (CHAN_VOICE | CHAN_UI, mDefaults->DeathSound, 1, ATTN_NONE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -562,6 +572,20 @@ void DIntermissionScreenCast::Drawer ()
|
|||
// draw the current frame in the middle of the screen
|
||||
if (caststate != NULL)
|
||||
{
|
||||
int castsprite;
|
||||
|
||||
if (!(mDefaults->flags4 & MF4_NOSKIN) &&
|
||||
mDefaults->SpawnState != NULL && caststate->sprite == mDefaults->SpawnState->sprite &&
|
||||
mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)) &&
|
||||
skins != NULL)
|
||||
{
|
||||
castsprite = skins[players[consoleplayer].userinfo.skin].sprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
castsprite = caststate->sprite;
|
||||
}
|
||||
|
||||
sprframe = &SpriteFrames[sprites[castsprite].spriteframes + caststate->GetFrame()];
|
||||
pic = TexMan(sprframe->Texture[0]);
|
||||
|
||||
|
|
|
@ -234,7 +234,6 @@ class DIntermissionScreenCast : public DIntermissionScreen
|
|||
TArray<FICastSound> mCastSounds;
|
||||
|
||||
int casttics;
|
||||
int castsprite; // [RH] For overriding the player sprite with a skin
|
||||
const FRemapTable *casttranslation; // [RH] Draw "our hero" with their chosen suit color
|
||||
FState* caststate;
|
||||
FState* basestate;
|
||||
|
|
Loading…
Reference in a new issue