Merge remote-tracking branch 'gz/master' into thereisnospoon

This commit is contained in:
ZZYZX 2017-01-24 11:05:14 +02:00
commit 8c36a2a3df
8 changed files with 25 additions and 14 deletions

View file

@ -150,6 +150,7 @@ public:
int MugShotMaxHealth; int MugShotMaxHealth;
int RunHealth; int RunHealth;
int PlayerFlags; int PlayerFlags;
double FullHeight;
TObjPtr<AInventory> InvFirst; // first inventory item displayed on inventory bar TObjPtr<AInventory> InvFirst; // first inventory item displayed on inventory bar
TObjPtr<AInventory> InvSel; // selected inventory item TObjPtr<AInventory> InvSel; // selected inventory item

View file

@ -6906,6 +6906,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetSize)
self->LinkToWorld(&ctx); self->LinkToWorld(&ctx);
ACTION_RETURN_BOOL(false); ACTION_RETURN_BOOL(false);
} }
if (self->player && self->player->mo == self)
{
self->player->mo->FullHeight = newheight;
}
ACTION_RETURN_BOOL(true); ACTION_RETURN_BOOL(true);
} }

View file

@ -689,7 +689,8 @@ void APlayerPawn::Serialize(FSerializer &arc)
("userange", UseRange, def->UseRange) ("userange", UseRange, def->UseRange)
("aircapacity", AirCapacity, def->AirCapacity) ("aircapacity", AirCapacity, def->AirCapacity)
("viewheight", ViewHeight, def->ViewHeight) ("viewheight", ViewHeight, def->ViewHeight)
("viewbob", ViewBob, def->ViewBob); ("viewbob", ViewBob, def->ViewBob)
("fullheight", FullHeight, def->FullHeight);
} }
//=========================================================================== //===========================================================================
@ -714,7 +715,7 @@ void APlayerPawn::BeginPlay ()
{ {
Super::BeginPlay (); Super::BeginPlay ();
ChangeStatNum (STAT_PLAYER); ChangeStatNum (STAT_PLAYER);
FullHeight = Height;
// Check whether a PWADs normal sprite is to be combined with the base WADs // Check whether a PWADs normal sprite is to be combined with the base WADs
// crouch sprite. In such a case the sprites normally don't match and it is // crouch sprite. In such a case the sprites normally don't match and it is
// best to disable the crouch sprite. // best to disable the crouch sprite.
@ -766,11 +767,11 @@ void APlayerPawn::Tick()
{ {
if (player != NULL && player->mo == this && player->CanCrouch() && player->playerstate != PST_DEAD) if (player != NULL && player->mo == this && player->CanCrouch() && player->playerstate != PST_DEAD)
{ {
Height = GetDefault()->Height * player->crouchfactor; Height = FullHeight * player->crouchfactor;
} }
else else
{ {
if (health > 0) Height = GetDefault()->Height; if (health > 0) Height = FullHeight;
} }
Super::Tick(); Super::Tick();
} }
@ -2309,7 +2310,7 @@ void P_DeathThink (player_t *player)
void P_CrouchMove(player_t * player, int direction) void P_CrouchMove(player_t * player, int direction)
{ {
double defaultheight = player->mo->GetDefault()->Height; double defaultheight = player->mo->FullHeight;
double savedheight = player->mo->Height; double savedheight = player->mo->Height;
double crouchspeed = direction * CROUCHSPEED; double crouchspeed = direction * CROUCHSPEED;
double oldheight = player->viewheight; double oldheight = player->viewheight;
@ -3245,6 +3246,7 @@ DEFINE_FIELD(APlayerPawn, AirCapacity)
DEFINE_FIELD(APlayerPawn, FlechetteType) DEFINE_FIELD(APlayerPawn, FlechetteType)
DEFINE_FIELD(APlayerPawn, DamageFade) DEFINE_FIELD(APlayerPawn, DamageFade)
DEFINE_FIELD(APlayerPawn, ViewBob) DEFINE_FIELD(APlayerPawn, ViewBob)
DEFINE_FIELD(APlayerPawn, FullHeight)
DEFINE_FIELD(PClassPlayerPawn, HealingRadiusType) DEFINE_FIELD(PClassPlayerPawn, HealingRadiusType)
DEFINE_FIELD(PClassPlayerPawn, DisplayName) DEFINE_FIELD(PClassPlayerPawn, DisplayName)

View file

@ -1613,7 +1613,7 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx)
} }
else if (ValueType->IsKindOf(RUNTIME_CLASS(PClassPointer))) else if (ValueType->IsKindOf(RUNTIME_CLASS(PClassPointer)))
{ {
FxExpression *x = new FxClassTypeCast(static_cast<PClassPointer*>(ValueType), basex); FxExpression *x = new FxClassTypeCast(static_cast<PClassPointer*>(ValueType), basex, Explicit);
x = x->Resolve(ctx); x = x->Resolve(ctx);
basex = nullptr; basex = nullptr;
delete this; delete this;
@ -4412,7 +4412,7 @@ FxExpression *FxTypeCheck::Resolve(FCompileContext& ctx)
if (left->ValueType->IsKindOf(RUNTIME_CLASS(PClassPointer))) if (left->ValueType->IsKindOf(RUNTIME_CLASS(PClassPointer)))
{ {
left = new FxClassTypeCast(NewClassPointer(RUNTIME_CLASS(DObject)), left); left = new FxClassTypeCast(NewClassPointer(RUNTIME_CLASS(DObject)), left, false);
ClassCheck = true; ClassCheck = true;
} }
else else
@ -4420,7 +4420,7 @@ FxExpression *FxTypeCheck::Resolve(FCompileContext& ctx)
left = new FxTypeCast(left, NewPointer(RUNTIME_CLASS(DObject)), false); left = new FxTypeCast(left, NewPointer(RUNTIME_CLASS(DObject)), false);
ClassCheck = false; ClassCheck = false;
} }
right = new FxClassTypeCast(NewClassPointer(RUNTIME_CLASS(DObject)), right); right = new FxClassTypeCast(NewClassPointer(RUNTIME_CLASS(DObject)), right, false);
RESOLVE(left, ctx); RESOLVE(left, ctx);
RESOLVE(right, ctx); RESOLVE(right, ctx);
@ -9922,12 +9922,13 @@ VMFunction *FxReturnStatement::GetDirectFunction()
// //
//========================================================================== //==========================================================================
FxClassTypeCast::FxClassTypeCast(PClassPointer *dtype, FxExpression *x) FxClassTypeCast::FxClassTypeCast(PClassPointer *dtype, FxExpression *x, bool explicitily)
: FxExpression(EFX_ClassTypeCast, x->ScriptPosition) : FxExpression(EFX_ClassTypeCast, x->ScriptPosition)
{ {
ValueType = dtype; ValueType = dtype;
desttype = dtype->ClassRestriction; desttype = dtype->ClassRestriction;
basex=x; basex=x;
Explicit = explicitily;
} }
//========================================================================== //==========================================================================
@ -9991,7 +9992,9 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
if (clsname != NAME_None) if (clsname != NAME_None)
{ {
cls = FindClassType(clsname, ctx); if (Explicit) cls = FindClassType(clsname, ctx);
else cls = PClass::FindClass(clsname);
if (cls == nullptr) if (cls == nullptr)
{ {
/* lax */ /* lax */
@ -10141,7 +10144,7 @@ FxExpression *FxClassPtrCast::Resolve(FCompileContext &ctx)
} }
else if (basex->ValueType == TypeString || basex->ValueType == TypeName) else if (basex->ValueType == TypeString || basex->ValueType == TypeName)
{ {
FxExpression *x = new FxClassTypeCast(to, basex); FxExpression *x = new FxClassTypeCast(to, basex, true);
basex = nullptr; basex = nullptr;
delete this; delete this;
return x->Resolve(ctx); return x->Resolve(ctx);

View file

@ -1913,10 +1913,11 @@ class FxClassTypeCast : public FxExpression
{ {
PClass *desttype; PClass *desttype;
FxExpression *basex; FxExpression *basex;
bool Explicit;
public: public:
FxClassTypeCast(PClassPointer *dtype, FxExpression *x); FxClassTypeCast(PClassPointer *dtype, FxExpression *x, bool explicitly);
~FxClassTypeCast(); ~FxClassTypeCast();
FxExpression *Resolve(FCompileContext&); FxExpression *Resolve(FCompileContext&);
ExpEmit Emit(VMFunctionBuilder *build); ExpEmit Emit(VMFunctionBuilder *build);

View file

@ -197,7 +197,7 @@ FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type)
sc.SetEscape(true); sc.SetEscape(true);
sc.MustGetString(); sc.MustGetString();
sc.SetEscape(false); sc.SetEscape(false);
x = new FxClassTypeCast(static_cast<PClassPointer *>(type), new FxConstant(FName(sc.String), sc)); x = new FxClassTypeCast(static_cast<PClassPointer *>(type), new FxConstant(FName(sc.String), sc), false);
} }
else else
{ {

View file

@ -1036,7 +1036,6 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
{ {
auto field = Fields[0]; auto field = Fields[0];
FieldDesc *fd = nullptr; FieldDesc *fd = nullptr;
FString str = FName(field->Names[0].Name);
PType *fieldtype = DetermineType(type, field, field->Names->Name, field->Type, true, true); PType *fieldtype = DetermineType(type, field, field->Names->Name, field->Type, true, true);

View file

@ -37,6 +37,7 @@ class PlayerPawn : Actor native
native Class<Actor> FlechetteType; native Class<Actor> FlechetteType;
native color DamageFade; // [CW] Fades for when you are being damaged. native color DamageFade; // [CW] Fades for when you are being damaged.
native double ViewBob; // [SP] ViewBob Multiplier native double ViewBob; // [SP] ViewBob Multiplier
native double FullHeight;
Default Default
{ {