mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 16:07:55 +00:00
This commit is contained in:
commit
0b4fd6c766
2 changed files with 34 additions and 26 deletions
|
@ -1366,42 +1366,49 @@ void APlayerPawn::GiveDefaultInventory ()
|
||||||
PClassActor *ti = PClass::FindActor (di->Name);
|
PClassActor *ti = PClass::FindActor (di->Name);
|
||||||
if (ti)
|
if (ti)
|
||||||
{
|
{
|
||||||
AInventory *item = FindInventory (ti);
|
if (!ti->IsDescendantOf(RUNTIME_CLASS(AInventory)))
|
||||||
if (item != NULL)
|
|
||||||
{
|
{
|
||||||
item->Amount = clamp<int>(
|
Printf(TEXTCOLOR_ORANGE "%s is not an inventory item and cannot be given to a player as start item.\n", ti->TypeName.GetChars());
|
||||||
item->Amount + (di->Amount ? di->Amount : ((AInventory *)item->GetDefault ())->Amount),
|
|
||||||
0, item->MaxAmount);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item = static_cast<AInventory *>(Spawn (ti));
|
AInventory *item = FindInventory(ti);
|
||||||
item->ItemFlags |= IF_IGNORESKILL; // no skill multiplicators here
|
if (item != NULL)
|
||||||
item->Amount = di->Amount;
|
|
||||||
if (item->IsKindOf (RUNTIME_CLASS (AWeapon)))
|
|
||||||
{
|
{
|
||||||
// To allow better control any weapon is emptied of
|
item->Amount = clamp<int>(
|
||||||
// ammo before being given to the player.
|
item->Amount + (di->Amount ? di->Amount : ((AInventory *)item->GetDefault())->Amount),
|
||||||
static_cast<AWeapon*>(item)->AmmoGive1 =
|
0, item->MaxAmount);
|
||||||
static_cast<AWeapon*>(item)->AmmoGive2 = 0;
|
|
||||||
}
|
}
|
||||||
AActor *check;
|
else
|
||||||
if (!item->CallTryPickup(this, &check))
|
|
||||||
{
|
{
|
||||||
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.
|
// To allow better control any weapon is emptied of
|
||||||
// This problem is only detectable when it's too late to do something about it...
|
// ammo before being given to the player.
|
||||||
I_Error("Cannot give morph items when starting a game");
|
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)) &&
|
||||||
if (item != NULL && item->IsKindOf (RUNTIME_CLASS (AWeapon)) &&
|
static_cast<AWeapon*>(item)->CheckAmmo(AWeapon::EitherFire, false))
|
||||||
static_cast<AWeapon*>(item)->CheckAmmo(AWeapon::EitherFire, false))
|
{
|
||||||
{
|
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> (item);
|
||||||
player->ReadyWeapon = player->PendingWeapon = static_cast<AWeapon *> (item);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
di = di->Next;
|
di = di->Next;
|
||||||
|
|
|
@ -183,6 +183,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
identitymap[i] = i;
|
identitymap[i] = i;
|
||||||
}
|
}
|
||||||
|
identitycolormap.Maps = identitymap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_InitFuzzTable(int fuzzoff)
|
void R_InitFuzzTable(int fuzzoff)
|
||||||
|
|
Loading…
Reference in a new issue