mirror of https://github.com/ZDoom/gzdoom-gles.git
- 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
|
@ -807,11 +807,6 @@ public:
|
||||||
return (flags & MF_COUNTKILL) && !(flags & MF_FRIENDLY);
|
return (flags & MF_COUNTKILL) && !(flags & MF_FRIENDLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
PalEntry GetBloodColor() const
|
|
||||||
{
|
|
||||||
return GetClass()->BloodColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// These also set CF_INTERPVIEW for players.
|
// These also set CF_INTERPVIEW for players.
|
||||||
void SetPitch(DAngle p, bool interpolate, bool forceclamp = false);
|
void SetPitch(DAngle p, bool interpolate, bool forceclamp = false);
|
||||||
void SetAngle(DAngle ang, bool interpolate);
|
void SetAngle(DAngle ang, bool interpolate);
|
||||||
|
@ -1144,6 +1139,8 @@ public:
|
||||||
BYTE FloatBobPhase;
|
BYTE FloatBobPhase;
|
||||||
BYTE FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc)
|
BYTE FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc)
|
||||||
DWORD Translation;
|
DWORD Translation;
|
||||||
|
PalEntry BloodColor;
|
||||||
|
DWORD BloodTranslation;
|
||||||
|
|
||||||
// [RH] Stuff that used to be part of an Actor Info
|
// [RH] Stuff that used to be part of an Actor Info
|
||||||
FSoundIDNoInit SeeSound;
|
FSoundIDNoInit SeeSound;
|
||||||
|
|
|
@ -295,7 +295,6 @@ void PClassActor::DeriveData(PClass *newclass)
|
||||||
PClassActor *newa = static_cast<PClassActor *>(newclass);
|
PClassActor *newa = static_cast<PClassActor *>(newclass);
|
||||||
|
|
||||||
newa->DefaultStateUsage = DefaultStateUsage;
|
newa->DefaultStateUsage = DefaultStateUsage;
|
||||||
newa->BloodColor = BloodColor;
|
|
||||||
newa->distancecheck = distancecheck;
|
newa->distancecheck = distancecheck;
|
||||||
|
|
||||||
newa->DropItems = DropItems;
|
newa->DropItems = DropItems;
|
||||||
|
|
|
@ -290,8 +290,6 @@ public:
|
||||||
|
|
||||||
TArray<PClassActor *> VisibleToPlayerClass;
|
TArray<PClassActor *> VisibleToPlayerClass;
|
||||||
|
|
||||||
PalEntry BloodColor; // Colorized blood
|
|
||||||
|
|
||||||
FDropItem *DropItems;
|
FDropItem *DropItems;
|
||||||
FString SourceLumpName;
|
FString SourceLumpName;
|
||||||
FIntCVar *distancecheck;
|
FIntCVar *distancecheck;
|
||||||
|
|
|
@ -2580,8 +2580,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
|
||||||
else if (flags & SIXF_USEBLOODCOLOR)
|
else if (flags & SIXF_USEBLOODCOLOR)
|
||||||
{
|
{
|
||||||
// [XA] Use the spawning actor's BloodColor to translate the newly-spawned object.
|
// [XA] Use the spawning actor's BloodColor to translate the newly-spawned object.
|
||||||
PalEntry bloodcolor = self->GetBloodColor();
|
mo->Translation = self->BloodTranslation;
|
||||||
mo->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags & SIXF_TRANSFERPOINTERS)
|
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)
|
if (bleedtrace.HitType == TRACE_HitWall)
|
||||||
{
|
{
|
||||||
PalEntry bloodcolor = actor->GetBloodColor();
|
PalEntry bloodcolor = actor->BloodColor;
|
||||||
if (bloodcolor != 0)
|
if (bloodcolor != 0)
|
||||||
{
|
{
|
||||||
bloodcolor.r >>= 1; // the full color is too bright for blood decals
|
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))
|
if (!(thing->flags&MF_NOBLOOD))
|
||||||
{
|
{
|
||||||
PalEntry bloodcolor = thing->GetBloodColor();
|
|
||||||
PClassActor *bloodcls = thing->GetBloodType();
|
PClassActor *bloodcls = thing->GetBloodType();
|
||||||
|
|
||||||
P_TraceBleed (newdam > 0 ? newdam : cpos->crushchange, thing);
|
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.X = pr_crunch.Random2() / 16.;
|
||||||
mo->Vel.Y = 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;
|
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);
|
DAngle an = (M_Random() - 128) * (360./256);
|
||||||
if (cl_bloodtype >= 1)
|
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))
|
if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound))
|
||||||
|
|
|
@ -316,8 +316,8 @@ DEFINE_FIELD(AActor, RadiusDamageFactor)
|
||||||
DEFINE_FIELD(AActor, SelfDamageFactor)
|
DEFINE_FIELD(AActor, SelfDamageFactor)
|
||||||
DEFINE_FIELD(AActor, StealthAlpha)
|
DEFINE_FIELD(AActor, StealthAlpha)
|
||||||
DEFINE_FIELD(AActor, WoundHealth)
|
DEFINE_FIELD(AActor, WoundHealth)
|
||||||
|
DEFINE_FIELD(AActor, BloodColor)
|
||||||
//DEFINE_FIELD(PClassActor, BloodColor)
|
DEFINE_FIELD(AActor, BloodTranslation)
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -409,6 +409,8 @@ void AActor::Serialize(FSerializer &arc)
|
||||||
A("inventoryid", InventoryID)
|
A("inventoryid", InventoryID)
|
||||||
A("floatbobphase", FloatBobPhase)
|
A("floatbobphase", FloatBobPhase)
|
||||||
A("translation", Translation)
|
A("translation", Translation)
|
||||||
|
A("bloodcolor", BloodColor)
|
||||||
|
A("bloodtranslation", BloodTranslation)
|
||||||
A("seesound", SeeSound)
|
A("seesound", SeeSound)
|
||||||
A("attacksound", AttackSound)
|
A("attacksound", AttackSound)
|
||||||
A("paimsound", PainSound)
|
A("paimsound", PainSound)
|
||||||
|
@ -1665,8 +1667,7 @@ bool AActor::Grind(bool items)
|
||||||
if (isgeneric) // Not a custom crush state, so colorize it appropriately.
|
if (isgeneric) // Not a custom crush state, so colorize it appropriately.
|
||||||
{
|
{
|
||||||
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
|
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
|
||||||
PalEntry bloodcolor = GetBloodColor();
|
Translation = BloodTranslation;
|
||||||
if (bloodcolor!=0) Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1707,10 +1708,7 @@ bool AActor::Grind(bool items)
|
||||||
gib->Alpha = Alpha;
|
gib->Alpha = Alpha;
|
||||||
gib->Height = 0;
|
gib->Height = 0;
|
||||||
gib->radius = 0;
|
gib->radius = 0;
|
||||||
|
gib->Translation = BloodTranslation;
|
||||||
PalEntry bloodcolor = GetBloodColor();
|
|
||||||
if (bloodcolor != 0)
|
|
||||||
gib->Translation = TRANSLATION(TRANSLATION_Blood, bloodcolor.a);
|
|
||||||
}
|
}
|
||||||
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE);
|
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)
|
void P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *originator)
|
||||||
{
|
{
|
||||||
AActor *th;
|
AActor *th;
|
||||||
PalEntry bloodcolor = originator->GetBloodColor();
|
|
||||||
PClassActor *bloodcls = originator->GetBloodType();
|
PClassActor *bloodcls = originator->GetBloodType();
|
||||||
DVector3 pos = pos1;
|
DVector3 pos = pos1;
|
||||||
pos.Z += pr_spawnblood.Random2() / 64.;
|
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;
|
th->tics = 1;
|
||||||
}
|
}
|
||||||
// colorize the blood
|
// 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
|
// 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)
|
if (bloodtype >= 1)
|
||||||
P_DrawSplash2 (40, pos, dir, 2, bloodcolor);
|
P_DrawSplash2 (40, pos, dir, 2, originator->BloodColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AActor, SpawnBlood)
|
DEFINE_ACTION_FUNCTION(AActor, SpawnBlood)
|
||||||
|
@ -6159,7 +6156,6 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnBlood)
|
||||||
|
|
||||||
void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
||||||
{
|
{
|
||||||
PalEntry bloodcolor = originator->GetBloodColor();
|
|
||||||
PClassActor *bloodcls = originator->GetBloodType(1);
|
PClassActor *bloodcls = originator->GetBloodType(1);
|
||||||
|
|
||||||
int bloodtype = cl_bloodtype;
|
int bloodtype = cl_bloodtype;
|
||||||
|
@ -6178,16 +6174,16 @@ void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
||||||
mo->Vel.Z = 3;
|
mo->Vel.Z = 3;
|
||||||
|
|
||||||
// colorize the blood!
|
// 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)) mo->renderflags |= RF_INVISIBLE;
|
||||||
}
|
}
|
||||||
if (bloodtype >= 1)
|
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)
|
void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
||||||
{
|
{
|
||||||
PalEntry bloodcolor = originator->GetBloodColor();
|
|
||||||
PClassActor *bloodcls = originator->GetBloodType(2);
|
PClassActor *bloodcls = originator->GetBloodType(2);
|
||||||
|
|
||||||
int bloodtype = cl_bloodtype;
|
int bloodtype = cl_bloodtype;
|
||||||
|
@ -6220,16 +6215,16 @@ void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle)
|
||||||
mo->target = originator;
|
mo->target = originator;
|
||||||
|
|
||||||
// colorize the blood!
|
// 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)) mo->renderflags |= RF_INVISIBLE;
|
||||||
}
|
}
|
||||||
if (bloodtype >= 1)
|
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)
|
void P_RipperBlood (AActor *mo, AActor *bleeder)
|
||||||
{
|
{
|
||||||
PalEntry bloodcolor = bleeder->GetBloodColor();
|
|
||||||
PClassActor *bloodcls = bleeder->GetBloodType();
|
PClassActor *bloodcls = bleeder->GetBloodType();
|
||||||
|
|
||||||
double xo = pr_ripperblood.Random2() / 16.;
|
double xo = pr_ripperblood.Random2() / 16.;
|
||||||
|
@ -6281,16 +6275,16 @@ void P_RipperBlood (AActor *mo, AActor *bleeder)
|
||||||
th->tics += pr_ripperblood () & 3;
|
th->tics += pr_ripperblood () & 3;
|
||||||
|
|
||||||
// colorize the blood!
|
// 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)) th->renderflags |= RF_INVISIBLE;
|
||||||
}
|
}
|
||||||
if (bloodtype >= 1)
|
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);
|
PROP_COLOR_PARM(color, 0);
|
||||||
|
|
||||||
PalEntry pe = color;
|
defaults->BloodColor = color;
|
||||||
pe.a = CreateBloodTranslation(pe);
|
defaults->BloodColor.a = 255; // a should not be 0.
|
||||||
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
|
defaults->BloodTranslation = TRANSLATION(TRANSLATION_Blood, CreateBloodTranslation(color));
|
||||||
static_cast<PClassActor *>(info)->BloodColor = pe;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -194,7 +194,8 @@ class Actor : Thinker native
|
||||||
native double SelfDamageFactor;
|
native double SelfDamageFactor;
|
||||||
native double StealthAlpha;
|
native double StealthAlpha;
|
||||||
native int WoundHealth; // Health needed to enter wound state
|
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 Obituary; // Player was killed by this actor
|
||||||
meta String HitObituary; // Player was killed by this actor in melee
|
meta String HitObituary; // Player was killed by this actor in melee
|
||||||
|
|
Loading…
Reference in New Issue