- made ColorRangeStart and ColorRangeEnd meta properties of APlayerPawn.

These are only used during initialization and they should have been readonly from the start.
This commit is contained in:
Christoph Oelckers 2019-01-02 22:13:25 +01:00
parent 8bbbd95dfd
commit 6eb8ded471
6 changed files with 21 additions and 20 deletions

View file

@ -151,8 +151,6 @@ public:
FName Portrait; FName Portrait;
FName Slot[10]; FName Slot[10];
double HexenArmor[5]; double HexenArmor[5];
uint8_t ColorRangeStart; // Skin color range
uint8_t ColorRangeEnd;
// Everything below this point is only used by scripted code. // Everything below this point is only used by scripted code.
PClassActor *FlechetteType; PClassActor *FlechetteType;

View file

@ -1028,6 +1028,11 @@ xx(WeaponFlags)
xx(DropTime) xx(DropTime)
xx(PickupSound) xx(PickupSound)
// PlayerPawn member fields
xx(ColorRangeStart)
xx(ColorRangeEnd)
xx(BlueCard) xx(BlueCard)
xx(YellowCard) xx(YellowCard)
xx(RedCard) xx(RedCard)

View file

@ -2142,8 +2142,6 @@ DEFINE_FIELD(APlayerPawn, Face)
DEFINE_FIELD(APlayerPawn, Portrait) DEFINE_FIELD(APlayerPawn, Portrait)
DEFINE_FIELD(APlayerPawn, Slot) DEFINE_FIELD(APlayerPawn, Slot)
DEFINE_FIELD(APlayerPawn, HexenArmor) DEFINE_FIELD(APlayerPawn, HexenArmor)
DEFINE_FIELD(APlayerPawn, ColorRangeStart)
DEFINE_FIELD(APlayerPawn, ColorRangeEnd)
DEFINE_FIELD_X(PlayerInfo, player_t, mo) DEFINE_FIELD_X(PlayerInfo, player_t, mo)
DEFINE_FIELD_X(PlayerInfo, player_t, playerstate) DEFINE_FIELD_X(PlayerInfo, player_t, playerstate)

View file

@ -778,22 +778,22 @@ void R_InitSkins (void)
if (!remove) if (!remove)
{ {
auto transdef = ((APlayerPawn*)GetDefaultByType(transtype)); auto transdef = GetDefaultByType(transtype);
auto basedef = ((APlayerPawn*)GetDefaultByType(basetype)); auto basedef = GetDefaultByType(basetype);
Skins[i].range0start = transdef->ColorRangeStart; Skins[i].range0start = transdef->IntVar(NAME_ColorRangeStart);
Skins[i].range0end = transdef->ColorRangeEnd; Skins[i].range0end = transdef->IntVar(NAME_ColorRangeEnd);
remove = true; remove = true;
for (j = 0; j < (int)PlayerClasses.Size (); j++) for (j = 0; j < (int)PlayerClasses.Size (); j++)
{ {
auto type = PlayerClasses[j].Type; auto type = PlayerClasses[j].Type;
auto type_def = ((APlayerPawn*)GetDefaultByType(type)); auto type_def = GetDefaultByType(type);
if (type->IsDescendantOf (basetype) && if (type->IsDescendantOf (basetype) &&
GetDefaultByType(type)->SpawnState->sprite == GetDefaultByType(basetype)->SpawnState->sprite && GetDefaultByType(type)->SpawnState->sprite == GetDefaultByType(basetype)->SpawnState->sprite &&
type_def->ColorRangeStart == basedef->ColorRangeStart && type_def->IntVar(NAME_ColorRangeStart) == basedef->IntVar(NAME_ColorRangeStart) &&
type_def->ColorRangeEnd == basedef->ColorRangeEnd) type_def->IntVar(NAME_ColorRangeEnd) == basedef->IntVar(NAME_ColorRangeEnd))
{ {
PlayerClasses[j].Skins.Push ((int)i); PlayerClasses[j].Skins.Push ((int)i);
remove = false; remove = false;
@ -995,9 +995,9 @@ void R_InitSprites ()
for (i = 0; i < numskins; i++) for (i = 0; i < numskins; i++)
{ // Assume Doom skin by default { // Assume Doom skin by default
auto type = ((APlayerPawn*)GetDefaultByType(PlayerClasses[0].Type)); auto type = GetDefaultByType(PlayerClasses[0].Type);
Skins[i].range0start = type->ColorRangeStart; Skins[i].range0start = type->IntVar(NAME_ColorRangeStart);
Skins[i].range0end = type->ColorRangeEnd; Skins[i].range0end = type->IntVar(NAME_ColorRangeEnd);
Skins[i].Scale = type->Scale; Skins[i].Scale = type->Scale;
} }
@ -1021,8 +1021,8 @@ void R_InitSprites ()
{ {
Skins[i].Face = basetype->Face; Skins[i].Face = basetype->Face;
} }
Skins[i].range0start = basetype->ColorRangeStart; Skins[i].range0start = basetype->IntVar(NAME_ColorRangeStart);
Skins[i].range0end = basetype->ColorRangeEnd; Skins[i].range0end = basetype->IntVar(NAME_ColorRangeEnd);
Skins[i].Scale = basetype->Scale; Skins[i].Scale = basetype->Scale;
Skins[i].sprite = basetype->SpawnState->sprite; Skins[i].sprite = basetype->SpawnState->sprite;
Skins[i].namespc = ns_global; Skins[i].namespc = ns_global;

View file

@ -1399,8 +1399,8 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, colorrange, I_I, PlayerPawn)
if (start > end) if (start > end)
swapvalues (start, end); swapvalues (start, end);
defaults->ColorRangeStart = start; defaults->IntVar(NAME_ColorRangeStart) = start;
defaults->ColorRangeEnd = end; defaults->IntVar(NAME_ColorRangeEnd) = end;
} }
//========================================================================== //==========================================================================

View file

@ -29,8 +29,6 @@ class PlayerPawn : Actor native
native Name Portrait; native Name Portrait;
native Name Slot[10]; native Name Slot[10];
native double HexenArmor[5]; native double HexenArmor[5];
native uint8 ColorRangeStart; // Skin color range
native uint8 ColorRangeEnd;
// [GRB] Player class properties // [GRB] Player class properties
native double JumpZ; native double JumpZ;
@ -54,6 +52,8 @@ class PlayerPawn : Actor native
meta Name HealingRadiusType; meta Name HealingRadiusType;
meta Name InvulMode; meta Name InvulMode;
meta int TeleportFreezeTime; meta int TeleportFreezeTime;
meta int ColorRangeStart; // Skin color range
meta int ColorRangeEnd;
property prefix: Player; property prefix: Player;
property HealRadiusType: HealingradiusType; property HealRadiusType: HealingradiusType;