Fixed incorrect fullscreen hud scaling (default scale/scale to fullscreen were swapped by mistake).

Fixed inventory bar having a blank space to the right if no next item is present (tends to happen when you only have two items).
Added "no pistol at spawn" option.
Added a hint of another prototype feature.
This commit is contained in:
Marisa the Magician 2019-09-05 14:32:14 +02:00
commit ee8e612f48
6 changed files with 136 additions and 10 deletions

View file

@ -8,6 +8,70 @@ Class UPlayer : UTPlayer
Player.StartItem "DefaultAmmo", 50;
}
override void GiveDefaultInventory()
{
if ( !player ) return;
// HexenArmor must always be the first item in the inventory because
// it provides player class based protection that should not affect
// any other protection item.
let myclass = GetClass();
GiveInventoryType('HexenArmor');
let harmor = HexenArmor(FindInventory('HexenArmor'));
harmor.Slots[4] = self.HexenArmor[0];
for ( int i=0; i<4; ++i ) harmor.SlotsIncrement[i] = self.HexenArmor[i+1];
// BasicArmor must come right after that. It should not affect any
// other protection item as well but needs to process the damage
// before the HexenArmor does.
GiveInventoryType('BasicArmor');
// Now add the items from the DECORATE definition
let di = GetDropItems();
for ( DropItem di=GetDropItems(); di; di=di.Next )
{
Class<Actor> ti = di.Name;
if ( !ti ) continue;
// no pistol start
if ( sting_nopstart && ((ti is 'Automag') || (ti is 'UMiniAmmo')) ) continue;
let tinv = (class<Inventory>)(ti);
if ( !tinv )
{
Console.Printf(TEXTCOLOR_ORANGE.."%s is not an inventory item and cannot be given to a player as start item.\n",di.Name);
continue;
}
let item = FindInventory(tinv);
if ( item ) item.Amount = clamp(item.Amount+(di.Amount?di.Amount:item.default.Amount),0,item.MaxAmount);
else
{
item = Inventory(Spawn(ti));
item.bIgnoreSkill = true; // no skill multipliers here
item.Amount = di.Amount;
let weap = Weapon(item);
if ( weap )
{
// To allow better control any weapon is emptied of
// ammo before being given to the player.
weap.AmmoGive1 = weap.AmmoGive2 = 0;
}
bool res;
Actor check;
[res,check] = item.CallTryPickup(self);
if ( !res )
{
item.Destroy();
item = null;
}
else if ( check != self )
{
// Player was morphed. This is illegal at game start.
// This problem is only detectable when it's too late to do something about it...
ThrowAbortException("Cannot give morph item '%s' when starting a game!",di.Name);
}
}
let weap = Weapon(item);
if ( weap && weap.CheckAmmo(Weapon.EitherFire,false) )
player.ReadyWeapon = player.PendingWeapon = weap;
}
}
// Have to modify the give cheat to handle UT armor
override void CheatGive( String name, int amount )
{