mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +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;
|
mName = static_cast<FIntermissionActionCast*>(desc)->mName;
|
||||||
mClass = PClass::FindClass(static_cast<FIntermissionActionCast*>(desc)->mCastClass);
|
mClass = PClass::FindClass(static_cast<FIntermissionActionCast*>(desc)->mCastClass);
|
||||||
if (mClass != NULL) mDefaults = GetDefaultByType(mClass);
|
if (mClass != NULL) mDefaults = GetDefaultByType(mClass);
|
||||||
else mDefaults = NULL;
|
else
|
||||||
|
{
|
||||||
|
mDefaults = NULL;
|
||||||
|
caststate = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mCastSounds.Resize(static_cast<FIntermissionActionCast*>(desc)->mCastSounds.Size());
|
mCastSounds.Resize(static_cast<FIntermissionActionCast*>(desc)->mCastSounds.Size());
|
||||||
for (unsigned i=0; i < mCastSounds.Size(); i++)
|
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)))
|
if (mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)))
|
||||||
{
|
{
|
||||||
advplayerstate = mDefaults->MissileState;
|
advplayerstate = mDefaults->MissileState;
|
||||||
castsprite = skins[players[consoleplayer].userinfo.skin].sprite;
|
|
||||||
casttranslation = translationtables[TRANSLATION_Players][consoleplayer];
|
casttranslation = translationtables[TRANSLATION_Players][consoleplayer];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
advplayerstate = NULL;
|
advplayerstate = NULL;
|
||||||
if (caststate != NULL) castsprite = caststate->sprite;
|
|
||||||
else castsprite = -1;
|
|
||||||
casttranslation = NULL;
|
casttranslation = NULL;
|
||||||
|
if (mDefaults->Translation != 0)
|
||||||
|
{
|
||||||
|
casttranslation = translationtables[GetTranslationType(mDefaults->Translation)]
|
||||||
|
[GetTranslationIndex(mDefaults->Translation)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
castdeath = false;
|
castdeath = false;
|
||||||
castframes = 0;
|
castframes = 0;
|
||||||
|
@ -434,22 +441,25 @@ int DIntermissionScreenCast::Responder (event_t *ev)
|
||||||
|
|
||||||
castdeath = true;
|
castdeath = true;
|
||||||
|
|
||||||
FName label[] = {NAME_Death, NAME_Cast};
|
if (mClass != NULL)
|
||||||
caststate = mClass->ActorInfo->FindState(2, label);
|
|
||||||
if (caststate == NULL) return -1;
|
|
||||||
|
|
||||||
casttics = caststate->GetTics();
|
|
||||||
castframes = 0;
|
|
||||||
castattacking = false;
|
|
||||||
|
|
||||||
if (mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)))
|
|
||||||
{
|
{
|
||||||
int snd = S_FindSkinnedSound(players[consoleplayer].mo, "*death");
|
FName label[] = {NAME_Death, NAME_Cast};
|
||||||
if (snd != 0) S_Sound (CHAN_VOICE | CHAN_UI, snd, 1, ATTN_NONE);
|
caststate = mClass->ActorInfo->FindState(2, label);
|
||||||
}
|
if (caststate == NULL) return -1;
|
||||||
else if (mDefaults->DeathSound)
|
|
||||||
{
|
casttics = caststate->GetTics();
|
||||||
S_Sound (CHAN_VOICE | CHAN_UI, mDefaults->DeathSound, 1, ATTN_NONE);
|
castframes = 0;
|
||||||
|
castattacking = false;
|
||||||
|
|
||||||
|
if (mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)))
|
||||||
|
{
|
||||||
|
int snd = S_FindSkinnedSound(players[consoleplayer].mo, "*death");
|
||||||
|
if (snd != 0) S_Sound (CHAN_VOICE | CHAN_UI, snd, 1, ATTN_NONE);
|
||||||
|
}
|
||||||
|
else if (mDefaults->DeathSound)
|
||||||
|
{
|
||||||
|
S_Sound (CHAN_VOICE | CHAN_UI, mDefaults->DeathSound, 1, ATTN_NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -562,6 +572,20 @@ void DIntermissionScreenCast::Drawer ()
|
||||||
// draw the current frame in the middle of the screen
|
// draw the current frame in the middle of the screen
|
||||||
if (caststate != NULL)
|
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()];
|
sprframe = &SpriteFrames[sprites[castsprite].spriteframes + caststate->GetFrame()];
|
||||||
pic = TexMan(sprframe->Texture[0]);
|
pic = TexMan(sprframe->Texture[0]);
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,6 @@ class DIntermissionScreenCast : public DIntermissionScreen
|
||||||
TArray<FICastSound> mCastSounds;
|
TArray<FICastSound> mCastSounds;
|
||||||
|
|
||||||
int casttics;
|
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
|
const FRemapTable *casttranslation; // [RH] Draw "our hero" with their chosen suit color
|
||||||
FState* caststate;
|
FState* caststate;
|
||||||
FState* basestate;
|
FState* basestate;
|
||||||
|
|
Loading…
Reference in a new issue