Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
98e549246d
22 changed files with 146 additions and 63 deletions
|
|
@ -906,6 +906,16 @@ CCMD(info)
|
|||
"the NOBLOCKMAP flag or have height/radius of 0.\n");
|
||||
}
|
||||
|
||||
CCMD(myinfo)
|
||||
{
|
||||
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return;
|
||||
Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
|
||||
players[consoleplayer].mo->GetClass()->TypeName.GetChars(),
|
||||
players[consoleplayer].mo->health,
|
||||
players[consoleplayer].mo->SpawnHealth());
|
||||
PrintMiscActorInfo(players[consoleplayer].mo);
|
||||
}
|
||||
|
||||
typedef bool (*ActorTypeChecker) (AActor *);
|
||||
|
||||
static bool IsActorAMonster(AActor *mo)
|
||||
|
|
|
|||
|
|
@ -1598,6 +1598,30 @@ CCMD (printinv)
|
|||
}
|
||||
}
|
||||
|
||||
CCMD (targetinv)
|
||||
{
|
||||
AInventory *item;
|
||||
FTranslatedLineTarget t;
|
||||
|
||||
if (CheckCheatmode () || players[consoleplayer].mo == NULL)
|
||||
return;
|
||||
|
||||
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE,
|
||||
&t, 0., ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART);
|
||||
|
||||
if (t.linetarget)
|
||||
{
|
||||
for (item = t.linetarget->Inventory; item != NULL; item = item->Inventory)
|
||||
{
|
||||
Printf ("%s #%u (%d/%d)\n", item->GetClass()->TypeName.GetChars(),
|
||||
item->InventoryID,
|
||||
item->Amount, item->MaxAmount);
|
||||
}
|
||||
}
|
||||
else Printf("No target found. Targetinv cannot find actors that have "
|
||||
"the NOBLOCKMAP flag or have height/radius of 0.\n");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AInventory :: AttachToOwner
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ DPSprite::DPSprite(player_t *owner, AActor *caller, int id)
|
|||
: x(.0), y(.0),
|
||||
oldx(.0), oldy(.0),
|
||||
firstTic(true),
|
||||
Sprite(0),
|
||||
Flags(0),
|
||||
Caller(caller),
|
||||
Owner(owner),
|
||||
|
|
|
|||
|
|
@ -1366,42 +1366,49 @@ void APlayerPawn::GiveDefaultInventory ()
|
|||
PClassActor *ti = PClass::FindActor (di->Name);
|
||||
if (ti)
|
||||
{
|
||||
AInventory *item = FindInventory (ti);
|
||||
if (item != NULL)
|
||||
if (!ti->IsDescendantOf(RUNTIME_CLASS(AInventory)))
|
||||
{
|
||||
item->Amount = clamp<int>(
|
||||
item->Amount + (di->Amount ? di->Amount : ((AInventory *)item->GetDefault ())->Amount),
|
||||
0, item->MaxAmount);
|
||||
Printf(TEXTCOLOR_ORANGE "%s is not an inventory item and cannot be given to a player as start item.\n", ti->TypeName.GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
item = static_cast<AInventory *>(Spawn (ti));
|
||||
item->ItemFlags |= IF_IGNORESKILL; // no skill multiplicators here
|
||||
item->Amount = di->Amount;
|
||||
if (item->IsKindOf (RUNTIME_CLASS (AWeapon)))
|
||||
AInventory *item = FindInventory(ti);
|
||||
if (item != NULL)
|
||||
{
|
||||
// To allow better control any weapon is emptied of
|
||||
// ammo before being given to the player.
|
||||
static_cast<AWeapon*>(item)->AmmoGive1 =
|
||||
static_cast<AWeapon*>(item)->AmmoGive2 = 0;
|
||||
item->Amount = clamp<int>(
|
||||
item->Amount + (di->Amount ? di->Amount : ((AInventory *)item->GetDefault())->Amount),
|
||||
0, item->MaxAmount);
|
||||
}
|
||||
AActor *check;
|
||||
if (!item->CallTryPickup(this, &check))
|
||||
else
|
||||
{
|
||||
if (check != this)
|
||||
item = static_cast<AInventory *>(Spawn(ti));
|
||||
item->ItemFlags |= IF_IGNORESKILL; // no skill multiplicators here
|
||||
item->Amount = di->Amount;
|
||||
if (item->IsKindOf(RUNTIME_CLASS(AWeapon)))
|
||||
{
|
||||
// Player was morphed. This is illegal at game start.
|
||||
// This problem is only detectable when it's too late to do something about it...
|
||||
I_Error("Cannot give morph items when starting a game");
|
||||
// To allow better control any weapon is emptied of
|
||||
// ammo before being given to the player.
|
||||
static_cast<AWeapon*>(item)->AmmoGive1 =
|
||||
static_cast<AWeapon*>(item)->AmmoGive2 = 0;
|
||||
}
|
||||
AActor *check;
|
||||
if (!item->CallTryPickup(this, &check))
|
||||
{
|
||||
if (check != this)
|
||||
{
|
||||
// Player was morphed. This is illegal at game start.
|
||||
// This problem is only detectable when it's too late to do something about it...
|
||||
I_Error("Cannot give morph items when starting a game");
|
||||
}
|
||||
item->Destroy();
|
||||
item = NULL;
|
||||
}
|
||||
item->Destroy ();
|
||||
item = NULL;
|
||||
}
|
||||
}
|
||||
if (item != NULL && item->IsKindOf (RUNTIME_CLASS (AWeapon)) &&
|
||||
static_cast<AWeapon*>(item)->CheckAmmo(AWeapon::EitherFire, false))
|
||||
{
|
||||
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> (item);
|
||||
if (item != NULL && item->IsKindOf(RUNTIME_CLASS(AWeapon)) &&
|
||||
static_cast<AWeapon*>(item)->CheckAmmo(AWeapon::EitherFire, false))
|
||||
{
|
||||
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> (item);
|
||||
}
|
||||
}
|
||||
}
|
||||
di = di->Next;
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ namespace swrenderer
|
|||
{
|
||||
identitymap[i] = i;
|
||||
}
|
||||
identitycolormap.Maps = identitymap;
|
||||
}
|
||||
|
||||
void R_InitFuzzTable(int fuzzoff)
|
||||
|
|
|
|||
|
|
@ -524,8 +524,13 @@ template<>
|
|||
inline bool Writer<StringBuffer>::WriteDouble(double d) {
|
||||
if (internal::Double(d).IsNanOrInf()) {
|
||||
// Note: This code path can only be reached if (RAPIDJSON_WRITE_DEFAULT_FLAGS & kWriteNanAndInfFlag).
|
||||
if (!(kWriteDefaultFlags & kWriteNanAndInfFlag))
|
||||
return false;
|
||||
if (!(kWriteDefaultFlags & kWriteNanAndInfFlag))
|
||||
{
|
||||
// At least ensure that the output does not get broken.
|
||||
PutReserve(*os_, 1);
|
||||
PutUnsafe(*os_, '0');
|
||||
return false;
|
||||
}
|
||||
if (internal::Double(d).IsNan()) {
|
||||
PutReserve(*os_, 3);
|
||||
PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
|
||||
|
|
|
|||
|
|
@ -7083,7 +7083,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
FxExpression *self = (ctx.Function && ctx.Function->Variants[0].Flags & VARF_Method) ? new FxSelf(ScriptPosition) : nullptr;
|
||||
FxExpression *self = (ctx.Function && (ctx.Function->Variants[0].Flags & VARF_Method) && ctx.Class->IsKindOf(RUNTIME_CLASS(PClassActor))) ? new FxSelf(ScriptPosition) : (FxExpression*)new FxConstant(ScriptPosition);
|
||||
FxExpression *x = new FxActionSpecialCall(self, special, ArgList, ScriptPosition);
|
||||
delete this;
|
||||
return x->Resolve(ctx);
|
||||
|
|
@ -7655,9 +7655,9 @@ ExpEmit FxActionSpecialCall::Emit(VMFunctionBuilder *build)
|
|||
unsigned i = 0;
|
||||
|
||||
build->Emit(OP_PARAMI, abs(Special)); // pass special number
|
||||
// fixme: This really should use the Self pointer that got passed to this class instead of just using the first argument from the function.
|
||||
// Once static functions are possible, or specials can be called through a member access operator this won't work anymore.
|
||||
build->Emit(OP_PARAM, 0, REGT_POINTER, 0); // pass self
|
||||
|
||||
ExpEmit selfemit(Self->Emit(build));
|
||||
build->Emit(OP_PARAM, 0, selfemit.Konst ? REGT_POINTER | REGT_KONST : REGT_POINTER, selfemit.RegNum); // pass special number
|
||||
for (; i < ArgList.Size(); ++i)
|
||||
{
|
||||
FxExpression *argex = ArgList[i];
|
||||
|
|
|
|||
|
|
@ -1428,6 +1428,7 @@ static HCURSOR CreateAlphaCursor(FTexture *cursorpic)
|
|||
{
|
||||
TArray<uint32_t> unscaled;
|
||||
unscaled.Resize(32 * 32);
|
||||
for (int i = 0; i < 32 * 32; i++) unscaled[i] = 0;
|
||||
FBitmap bmp((BYTE *)&unscaled[0] + 31 * 32 * 4, -32 * 4, 32, 32);
|
||||
cursorpic->CopyTrueColorPixels(&bmp, 0, 0);
|
||||
uint32_t *scaled = (uint32_t*)bits;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue