mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 01:21:17 +00:00
- did some more lightening on the PlayerPawn class. 4 more properties and one native member function have been handled.
This commit is contained in:
parent
c762757aca
commit
8e376754fc
11 changed files with 61 additions and 61 deletions
|
@ -101,7 +101,6 @@ public:
|
||||||
// These are virtual on the script side only.
|
// These are virtual on the script side only.
|
||||||
void PlayIdle();
|
void PlayIdle();
|
||||||
|
|
||||||
const char *GetSoundClass () const;
|
|
||||||
int hasBuddha(); // returns 0 for no buddha, 1 for regular buddha and 2 for strong buddha
|
int hasBuddha(); // returns 0 for no buddha, 1 for regular buddha and 2 for strong buddha
|
||||||
|
|
||||||
enum EInvulState
|
enum EInvulState
|
||||||
|
@ -141,18 +140,17 @@ public:
|
||||||
double ViewBob;
|
double ViewBob;
|
||||||
double curBob;
|
double curBob;
|
||||||
|
|
||||||
// Former class properties that were moved into the object to get rid of the meta class.
|
// Everything below this point is only used by scripted code or through the scripted variable interface.
|
||||||
FName SoundClass; // Sound class
|
|
||||||
FName Face; // Doom status bar face (when used)
|
|
||||||
FName Portrait;
|
|
||||||
FName Slot[10];
|
|
||||||
|
|
||||||
// Everything below this point is only used by scripted code.
|
|
||||||
int RunHealth;
|
int RunHealth;
|
||||||
TObjPtr<AActor*> InvFirst; // first inventory item displayed on inventory bar
|
TObjPtr<AActor*> InvFirst; // first inventory item displayed on inventory bar
|
||||||
double ForwardMove1, ForwardMove2;
|
double ForwardMove1, ForwardMove2;
|
||||||
double SideMove1, SideMove2;
|
double SideMove1, SideMove2;
|
||||||
double HexenArmor[5];
|
double HexenArmor[5];
|
||||||
|
|
||||||
|
// Former class properties that were moved into the object to get rid of the meta class.
|
||||||
|
FName SoundClass; // Sound class
|
||||||
|
FName Portrait;
|
||||||
|
FName Slot[10];
|
||||||
PClassActor *FlechetteType;
|
PClassActor *FlechetteType;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -498,7 +498,7 @@ void FWeaponSlots::SendDifferences(int playernum, const FWeaponSlots &other)
|
||||||
void FWeaponSlots::SetFromPlayer(PClassActor *type)
|
void FWeaponSlots::SetFromPlayer(PClassActor *type)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
auto Slot = ((APlayerPawn*)GetDefaultByType(type))->Slot;
|
auto Slot = &GetDefaultByType(type)->NameVar(NAME_Slot);
|
||||||
for (int i = 0; i < NUM_WEAPON_SLOTS; ++i)
|
for (int i = 0; i < NUM_WEAPON_SLOTS; ++i)
|
||||||
{
|
{
|
||||||
if (Slot[i] != NAME_None)
|
if (Slot[i] != NAME_None)
|
||||||
|
|
|
@ -490,7 +490,7 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu
|
||||||
if (CurrentState != NULL)
|
if (CurrentState != NULL)
|
||||||
{
|
{
|
||||||
int skin = player->userinfo.GetSkin();
|
int skin = player->userinfo.GetSkin();
|
||||||
const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? ((APlayerPawn*)GetDefaultByType(player->MorphedPlayerClass))->Face.GetChars() : Skins[skin].Face.GetChars());
|
const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? ((APlayerPawn*)GetDefaultByType(player->MorphedPlayerClass))->NameVar(NAME_Face).GetChars() : Skins[skin].Face.GetChars());
|
||||||
return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle);
|
return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1027,6 +1027,9 @@ xx(ForwardMove1)
|
||||||
xx(ForwardMove2)
|
xx(ForwardMove2)
|
||||||
xx(SideMove1)
|
xx(SideMove1)
|
||||||
xx(SideMove2)
|
xx(SideMove2)
|
||||||
|
xx(Face)
|
||||||
|
xx(Slot)
|
||||||
|
xx(SoundClass)
|
||||||
|
|
||||||
xx(BlueCard)
|
xx(BlueCard)
|
||||||
xx(YellowCard)
|
xx(YellowCard)
|
||||||
|
|
|
@ -806,18 +806,6 @@ void APlayerPawn::Serialize(FSerializer &arc)
|
||||||
("fullheight", FullHeight, def->FullHeight);
|
("fullheight", FullHeight, def->FullHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// APlayerPawn :: MarkPlayerSounds
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(APlayerPawn, MarkPlayerSounds)
|
|
||||||
{
|
|
||||||
PARAM_SELF_PROLOGUE(APlayerPawn);
|
|
||||||
S_MarkPlayerSounds(self->GetSoundClass());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// APlayerPawn :: BeginPlay
|
// APlayerPawn :: BeginPlay
|
||||||
|
@ -941,30 +929,10 @@ void APlayerPawn::GiveDeathmatchInventory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// APlayerPawn :: GetSoundClass
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
const char *APlayerPawn::GetSoundClass() const
|
|
||||||
{
|
|
||||||
if (player != NULL &&
|
|
||||||
(player->mo == NULL || !(player->mo->flags4 &MF4_NOSKIN)) &&
|
|
||||||
(unsigned int)player->userinfo.GetSkin() >= PlayerClasses.Size () &&
|
|
||||||
(unsigned)player->userinfo.GetSkin() < Skins.Size())
|
|
||||||
{
|
|
||||||
return Skins[player->userinfo.GetSkin()].Name.GetChars();
|
|
||||||
}
|
|
||||||
|
|
||||||
return SoundClass != NAME_None? SoundClass.GetChars() : "player";
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// APlayerPawn :: hasBuddha
|
// APlayerPawn :: hasBuddha
|
||||||
//
|
//
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int APlayerPawn::hasBuddha()
|
int APlayerPawn::hasBuddha()
|
||||||
|
@ -2075,7 +2043,6 @@ DEFINE_FIELD(APlayerPawn, ViewBob)
|
||||||
DEFINE_FIELD(APlayerPawn, curBob)
|
DEFINE_FIELD(APlayerPawn, curBob)
|
||||||
DEFINE_FIELD(APlayerPawn, FullHeight)
|
DEFINE_FIELD(APlayerPawn, FullHeight)
|
||||||
DEFINE_FIELD(APlayerPawn, SoundClass)
|
DEFINE_FIELD(APlayerPawn, SoundClass)
|
||||||
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)
|
||||||
|
|
|
@ -1017,14 +1017,8 @@ void R_InitSprites ()
|
||||||
auto basetype = ((APlayerPawn*)GetDefaultByType(PlayerClasses[i].Type));
|
auto basetype = ((APlayerPawn*)GetDefaultByType(PlayerClasses[i].Type));
|
||||||
|
|
||||||
Skins[i].Name = "Base";
|
Skins[i].Name = "Base";
|
||||||
if (basetype->Face == NAME_None)
|
auto face = basetype->NameVar(NAME_Face);
|
||||||
{
|
Skins[i].Face = face == NAME_None? FName("STF") : face;
|
||||||
Skins[i].Face = "STF";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Skins[i].Face = basetype->Face;
|
|
||||||
}
|
|
||||||
Skins[i].range0start = basetype->IntVar(NAME_ColorRangeStart);
|
Skins[i].range0start = basetype->IntVar(NAME_ColorRangeStart);
|
||||||
Skins[i].range0end = basetype->IntVar(NAME_ColorRangeEnd);
|
Skins[i].range0end = basetype->IntVar(NAME_ColorRangeEnd);
|
||||||
Skins[i].Scale = basetype->Scale;
|
Skins[i].Scale = basetype->Scale;
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include "serializer.h"
|
#include "serializer.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
#include "r_data/sprites.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
@ -1897,6 +1898,27 @@ bool S_AreSoundsEquivalent (AActor *actor, int id1, int id2)
|
||||||
return id1 == id2;
|
return id1 == id2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// APlayerPawn :: GetSoundClass
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
static const char *GetSoundClass(AActor *pp)
|
||||||
|
{
|
||||||
|
auto player = pp->player;
|
||||||
|
if (player != nullptr &&
|
||||||
|
(player->mo == nullptr || !(player->mo->flags4 &MF4_NOSKIN)) &&
|
||||||
|
(unsigned int)player->userinfo.GetSkin() >= PlayerClasses.Size() &&
|
||||||
|
(unsigned)player->userinfo.GetSkin() < Skins.Size())
|
||||||
|
{
|
||||||
|
return Skins[player->userinfo.GetSkin()].Name.GetChars();
|
||||||
|
}
|
||||||
|
auto sclass = pp->NameVar(NAME_SoundClass);
|
||||||
|
|
||||||
|
return sclass != NAME_None ? sclass.GetChars() : "player";
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// S_FindSkinnedSound
|
// S_FindSkinnedSound
|
||||||
|
@ -1909,10 +1931,10 @@ int S_FindSkinnedSound (AActor *actor, FSoundID refid)
|
||||||
const char *pclass;
|
const char *pclass;
|
||||||
int gender = 0;
|
int gender = 0;
|
||||||
|
|
||||||
if (actor != NULL && actor->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
if (actor != nullptr)
|
||||||
{
|
{
|
||||||
pclass = static_cast<APlayerPawn*>(actor)->GetSoundClass ();
|
pclass = GetSoundClass (actor);
|
||||||
if (actor->player != NULL) gender = actor->player->userinfo.GetGender();
|
if (actor->player != nullptr) gender = actor->player->userinfo.GetGender();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2062,8 +2084,9 @@ void sfxinfo_t::MarkUsed()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void S_MarkPlayerSounds (const char *playerclass)
|
void S_MarkPlayerSounds (AActor *player)
|
||||||
{
|
{
|
||||||
|
const char *playerclass = GetSoundClass(player);
|
||||||
int classidx = S_FindPlayerClass(playerclass);
|
int classidx = S_FindPlayerClass(playerclass);
|
||||||
if (classidx < 0)
|
if (classidx < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -364,7 +364,7 @@ int S_AddSoundLump (const char *logicalname, int lump); // Add sound by lump ind
|
||||||
int S_AddPlayerSound (const char *playerclass, const int gender, int refid, const char *lumpname);
|
int S_AddPlayerSound (const char *playerclass, const int gender, int refid, const char *lumpname);
|
||||||
int S_AddPlayerSound (const char *playerclass, const int gender, int refid, int lumpnum, bool fromskin=false);
|
int S_AddPlayerSound (const char *playerclass, const int gender, int refid, int lumpnum, bool fromskin=false);
|
||||||
int S_AddPlayerSoundExisting (const char *playerclass, const int gender, int refid, int aliasto, bool fromskin=false);
|
int S_AddPlayerSoundExisting (const char *playerclass, const int gender, int refid, int aliasto, bool fromskin=false);
|
||||||
void S_MarkPlayerSounds (const char *playerclass);
|
void S_MarkPlayerSounds (AActor *player);
|
||||||
void S_ShrinkPlayerSoundLists ();
|
void S_ShrinkPlayerSoundLists ();
|
||||||
void S_UnloadSound (sfxinfo_t *sfx);
|
void S_UnloadSound (sfxinfo_t *sfx);
|
||||||
sfxinfo_t *S_LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer = nullptr);
|
sfxinfo_t *S_LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer = nullptr);
|
||||||
|
|
|
@ -1375,7 +1375,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, soundclass, S, PlayerPawn)
|
||||||
|
|
||||||
FString tmp = str;
|
FString tmp = str;
|
||||||
tmp.ReplaceChars (' ', '_');
|
tmp.ReplaceChars (' ', '_');
|
||||||
defaults->SoundClass = tmp.IsNotEmpty()? FName(tmp) : NAME_None;
|
defaults->NameVar(NAME_SoundClass) = tmp.IsNotEmpty()? FName(tmp) : NAME_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1386,7 +1386,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, face, S, PlayerPawn)
|
||||||
PROP_STRING_PARM(str, 0);
|
PROP_STRING_PARM(str, 0);
|
||||||
FString tmp = str;
|
FString tmp = str;
|
||||||
|
|
||||||
if (tmp.Len() == 0) defaults->Face = NAME_None;
|
if (tmp.Len() == 0) defaults->NameVar(NAME_Face) = NAME_None;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp.ToUpper();
|
tmp.ToUpper();
|
||||||
|
@ -1401,7 +1401,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, face, S, PlayerPawn)
|
||||||
"Invalid face '%s' for '%s';\nSTF replacement codes must be 3 alphanumeric characters.\n",
|
"Invalid face '%s' for '%s';\nSTF replacement codes must be 3 alphanumeric characters.\n",
|
||||||
tmp.GetChars(), info->TypeName.GetChars());
|
tmp.GetChars(), info->TypeName.GetChars());
|
||||||
}
|
}
|
||||||
defaults->Face = tmp;
|
defaults->NameVar(NAME_Face) = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1708,7 +1708,8 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, weaponslot, ISsssssssssssssssssssssssssssss
|
||||||
PROP_STRING_PARM(str, i);
|
PROP_STRING_PARM(str, i);
|
||||||
weapons << ' ' << str;
|
weapons << ' ' << str;
|
||||||
}
|
}
|
||||||
defaults->Slot[slot] = weapons.IsEmpty()? NAME_None : FName(weapons);
|
FName *slots = &defaults->NameVar(NAME_Slot);
|
||||||
|
slots[slot] = weapons.IsEmpty()? NAME_None : FName(weapons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1649,6 +1649,20 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckFor3DCeilingHit, CheckFor3DCeilingHit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// APlayerPawn :: MarkPlayerSounds
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(APlayerPawn, MarkPlayerSounds, S_MarkPlayerSounds)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(APlayerPawn);
|
||||||
|
S_MarkPlayerSounds(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFINE_FIELD(AActor, snext)
|
DEFINE_FIELD(AActor, snext)
|
||||||
DEFINE_FIELD(AActor, player)
|
DEFINE_FIELD(AActor, player)
|
||||||
DEFINE_FIELD_NAMED(AActor, __Pos, pos)
|
DEFINE_FIELD_NAMED(AActor, __Pos, pos)
|
||||||
|
|
|
@ -25,7 +25,6 @@ class PlayerPawn : Actor native
|
||||||
native clearscope Inventory InvFirst; // first inventory item displayed on inventory bar
|
native clearscope Inventory InvFirst; // first inventory item displayed on inventory bar
|
||||||
native clearscope Inventory InvSel; // selected inventory item
|
native clearscope Inventory InvSel; // selected inventory item
|
||||||
native Name SoundClass; // Sound class
|
native Name SoundClass; // Sound class
|
||||||
native Name Face; // Doom status bar face (when used)
|
|
||||||
native Name Portrait;
|
native Name Portrait;
|
||||||
native Name Slot[10];
|
native Name Slot[10];
|
||||||
native double HexenArmor[5];
|
native double HexenArmor[5];
|
||||||
|
@ -51,6 +50,7 @@ class PlayerPawn : Actor native
|
||||||
|
|
||||||
meta Name HealingRadiusType;
|
meta Name HealingRadiusType;
|
||||||
meta Name InvulMode;
|
meta Name InvulMode;
|
||||||
|
meta Name Face;
|
||||||
meta int TeleportFreezeTime;
|
meta int TeleportFreezeTime;
|
||||||
meta int ColorRangeStart; // Skin color range
|
meta int ColorRangeStart; // Skin color range
|
||||||
meta int ColorRangeEnd;
|
meta int ColorRangeEnd;
|
||||||
|
|
Loading…
Reference in a new issue