mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- separated the blood translation index from the BloodColor variable to allow more than 255 blood translations and as a prerequisite for allowing to change the blood color.
This commit is contained in:
parent
59bd4d608c
commit
00dc59ebdc
8 changed files with 30 additions and 44 deletions
|
@ -807,11 +807,6 @@ public:
|
|||
return (flags & MF_COUNTKILL) && !(flags & MF_FRIENDLY);
|
||||
}
|
||||
|
||||
PalEntry GetBloodColor() const
|
||||
{
|
||||
return GetClass()->BloodColor;
|
||||
}
|
||||
|
||||
// These also set CF_INTERPVIEW for players.
|
||||
void SetPitch(DAngle p, bool interpolate, bool forceclamp = false);
|
||||
void SetAngle(DAngle ang, bool interpolate);
|
||||
|
@ -1144,6 +1139,8 @@ public:
|
|||
BYTE FloatBobPhase;
|
||||
BYTE FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc)
|
||||
DWORD Translation;
|
||||
PalEntry BloodColor;
|
||||
DWORD BloodTranslation;
|
||||
|
||||
// [RH] Stuff that used to be part of an Actor Info
|
||||
FSoundIDNoInit SeeSound;
|
||||
|
|
|
@ -295,7 +295,6 @@ void PClassActor::DeriveData(PClass *newclass)
|
|||
PClassActor *newa = static_cast<PClassActor *>(newclass);
|
||||
|
||||
newa->DefaultStateUsage = DefaultStateUsage;
|
||||
newa->BloodColor = BloodColor;
|
||||
newa->distancecheck = distancecheck;
|
||||
|
||||
newa->DropItems = DropItems;
|
||||
|
|
|
@ -290,8 +290,6 @@ public:
|
|||
|
||||
TArray<PClassActor *> VisibleToPlayerClass;
|
||||
|
||||
PalEntry BloodColor; // Colorized blood
|
||||
|
||||
FDropItem *DropItems;
|
||||
FString SourceLumpName;
|
||||
FIntCVar *distancecheck;
|
||||
|
|
|
@ -2580,8 +2580,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
|||
else if (flags & SIXF_USEBLOODCOLOR)
|
||||
{
|
||||
// [XA] Use the spawning actor's BloodColor to translate the newly-spawned object.
|
||||
PalEntry bloodcolor = self->GetBloodColor();
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
mo->Translation = self->BloodTranslation;
|
||||
}
|
||||
}
|
||||
if (flags & SIXF_TRANSFERPOINTERS)
|
||||
|
|
|
@ -4803,7 +4803,7 @@ void P_TraceBleed(int damage, const DVector3 &pos, AActor *actor, DAngle angle,
|
|||
{
|
||||
if (bleedtrace.HitType == TRACE_HitWall)
|
||||
{
|
||||
PalEntry bloodcolor = actor->GetBloodColor();
|
||||
PalEntry bloodcolor = actor->BloodColor;
|
||||
if (bloodcolor != 0)
|
||||
{
|
||||
bloodcolor.r >>= 1; // the full color is too bright for blood decals
|
||||
|
@ -5994,7 +5994,6 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
|
|||
{
|
||||
if (!(thing->flags&MF_NOBLOOD))
|
||||
{
|
||||
PalEntry bloodcolor = thing->GetBloodColor();
|
||||
PClassActor *bloodcls = thing->GetBloodType();
|
||||
|
||||
P_TraceBleed (newdam > 0 ? newdam : cpos->crushchange, thing);
|
||||
|
@ -6006,9 +6005,9 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
|
|||
|
||||
mo->Vel.X = pr_crunch.Random2() / 16.;
|
||||
mo->Vel.Y = pr_crunch.Random2() / 16.;
|
||||
if (bloodcolor != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
if (thing->BloodTranslation != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
mo->Translation = thing->BloodTranslation;
|
||||
}
|
||||
|
||||
if (!(cl_bloodtype <= 1)) mo->renderflags |= RF_INVISIBLE;
|
||||
|
@ -6017,7 +6016,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
|
|||
DAngle an = (M_Random() - 128) * (360./256);
|
||||
if (cl_bloodtype >= 1)
|
||||
{
|
||||
P_DrawSplash2(32, thing->PosPlusZ(thing->Height/2), an, 2, bloodcolor);
|
||||
P_DrawSplash2(32, thing->PosPlusZ(thing->Height/2), an, 2, thing->BloodColor);
|
||||
}
|
||||
}
|
||||
if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound))
|
||||
|
|
|
@ -316,8 +316,8 @@ DEFINE_FIELD(AActor, RadiusDamageFactor)
|
|||
DEFINE_FIELD(AActor, SelfDamageFactor)
|
||||
DEFINE_FIELD(AActor, StealthAlpha)
|
||||
DEFINE_FIELD(AActor, WoundHealth)
|
||||
|
||||
//DEFINE_FIELD(PClassActor, BloodColor)
|
||||
DEFINE_FIELD(AActor, BloodColor)
|
||||
DEFINE_FIELD(AActor, BloodTranslation)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -409,6 +409,8 @@ void AActor::Serialize(FSerializer &arc)
|
|||
A("inventoryid", InventoryID)
|
||||
A("floatbobphase", FloatBobPhase)
|
||||
A("translation", Translation)
|
||||
A("bloodcolor", BloodColor)
|
||||
A("bloodtranslation", BloodTranslation)
|
||||
A("seesound", SeeSound)
|
||||
A("attacksound", AttackSound)
|
||||
A("paimsound", PainSound)
|
||||
|
@ -1665,8 +1667,7 @@ bool AActor::Grind(bool items)
|
|||
if (isgeneric) // Not a custom crush state, so colorize it appropriately.
|
||||
{
|
||||
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
|
||||
PalEntry bloodcolor = GetBloodColor();
|
||||
if (bloodcolor!=0) Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
Translation = BloodTranslation;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1707,10 +1708,7 @@ bool AActor::Grind(bool items)
|
|||
gib->Alpha = Alpha;
|
||||
gib->Height = 0;
|
||||
gib->radius = 0;
|
||||
|
||||
PalEntry bloodcolor = GetBloodColor();
|
||||
if (bloodcolor != 0)
|
||||
gib->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
gib->Translation = BloodTranslation;
|
||||
}
|
||||
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
|
||||
}
|
||||
|
@ -6051,7 +6049,6 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnPuff)
|
|||
void P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *originator)
|
||||
{
|
||||
AActor *th;
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
PClassActor *bloodcls = originator->GetBloodType();
|
||||
DVector3 pos = pos1;
|
||||
pos.Z += pr_spawnblood.Random2() / 64.;
|
||||
|
@ -6076,9 +6073,9 @@ void P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *origina
|
|||
th->tics = 1;
|
||||
}
|
||||
// colorize the blood
|
||||
if (bloodcolor != 0 && !(th->flags2 & MF2_DONTTRANSLATE))
|
||||
if (!(th->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
th->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
th->Translation = originator->BloodTranslation;
|
||||
}
|
||||
|
||||
// Moved out of the blood actor so that replacing blood is easier
|
||||
|
@ -6135,7 +6132,7 @@ void P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *origina
|
|||
}
|
||||
|
||||
if (bloodtype >= 1)
|
||||
P_DrawSplash2 (40, pos, dir, 2, bloodcolor);
|
||||
P_DrawSplash2 (40, pos, dir, 2, originator->BloodColor);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, SpawnBlood)
|
||||
|
@ -6159,7 +6156,6 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnBlood)
|
|||
|
||||
void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
||||
{
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
PClassActor *bloodcls = originator->GetBloodType(1);
|
||||
|
||||
int bloodtype = cl_bloodtype;
|
||||
|
@ -6178,16 +6174,16 @@ void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
|||
mo->Vel.Z = 3;
|
||||
|
||||
// colorize the blood!
|
||||
if (bloodcolor!=0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
if (!(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
mo->Translation = originator->BloodTranslation;
|
||||
}
|
||||
|
||||
if (!(bloodtype <= 1)) mo->renderflags |= RF_INVISIBLE;
|
||||
}
|
||||
if (bloodtype >= 1)
|
||||
{
|
||||
P_DrawSplash2 (40, pos, hitangle-180., 2, bloodcolor);
|
||||
P_DrawSplash2 (40, pos, hitangle-180., 2, originator->BloodColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6199,7 +6195,6 @@ void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
|||
|
||||
void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
||||
{
|
||||
PalEntry bloodcolor = originator->GetBloodColor();
|
||||
PClassActor *bloodcls = originator->GetBloodType(2);
|
||||
|
||||
int bloodtype = cl_bloodtype;
|
||||
|
@ -6220,16 +6215,16 @@ void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
|||
mo->target = originator;
|
||||
|
||||
// colorize the blood!
|
||||
if (bloodcolor != 0 && !(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
if (!(mo->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
mo->Translation = originator->BloodTranslation;
|
||||
}
|
||||
|
||||
if (!(bloodtype <= 1)) mo->renderflags |= RF_INVISIBLE;
|
||||
}
|
||||
if (bloodtype >= 1)
|
||||
{
|
||||
P_DrawSplash2(40, pos + add, hitangle - 180., 2, bloodcolor);
|
||||
P_DrawSplash2(40, pos + add, hitangle - 180., 2, originator->BloodColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6255,7 +6250,6 @@ DEFINE_ACTION_FUNCTION(AActor, BloodSplatter)
|
|||
|
||||
void P_RipperBlood (AActor *mo, AActor *bleeder)
|
||||
{
|
||||
PalEntry bloodcolor = bleeder->GetBloodColor();
|
||||
PClassActor *bloodcls = bleeder->GetBloodType();
|
||||
|
||||
double xo = pr_ripperblood.Random2() / 16.;
|
||||
|
@ -6281,16 +6275,16 @@ void P_RipperBlood (AActor *mo, AActor *bleeder)
|
|||
th->tics += pr_ripperblood () & 3;
|
||||
|
||||
// colorize the blood!
|
||||
if (bloodcolor!=0 && !(th->flags2 & MF2_DONTTRANSLATE))
|
||||
if (!(th->flags2 & MF2_DONTTRANSLATE))
|
||||
{
|
||||
th->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
||||
th->Translation = bleeder->BloodTranslation;
|
||||
}
|
||||
|
||||
if (!(bloodtype <= 1)) th->renderflags |= RF_INVISIBLE;
|
||||
}
|
||||
if (bloodtype >= 1)
|
||||
{
|
||||
P_DrawSplash2(28, pos, bleeder->AngleTo(mo) + 180., 0, bloodcolor);
|
||||
P_DrawSplash2(28, pos, bleeder->AngleTo(mo) + 180., 0, bleeder->BloodColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1053,10 +1053,9 @@ DEFINE_PROPERTY(bloodcolor, C, Actor)
|
|||
{
|
||||
PROP_COLOR_PARM(color, 0);
|
||||
|
||||
PalEntry pe = color;
|
||||
pe.a = CreateBloodTranslation(pe);
|
||||
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
|
||||
static_cast<PClassActor *>(info)->BloodColor = pe;
|
||||
defaults->BloodColor = color;
|
||||
defaults->BloodColor.a = 255; // a should not be 0.
|
||||
defaults->BloodTranslation = TRANSLATION(TRANSLATION_Blood, CreateBloodTranslation(color));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -194,7 +194,8 @@ class Actor : Thinker native
|
|||
native double SelfDamageFactor;
|
||||
native double StealthAlpha;
|
||||
native int WoundHealth; // Health needed to enter wound state
|
||||
//native color BloodColor; // won't be accessible for now because it needs refactoring to remove the 255-translations limit.
|
||||
native readonly color BloodColor;
|
||||
native readonly int BloodTranslation;
|
||||
|
||||
meta String Obituary; // Player was killed by this actor
|
||||
meta String HitObituary; // Player was killed by this actor in melee
|
||||
|
|
Loading…
Reference in a new issue