- Added DECORATE conversions for Hexen's Cleric Mace, Firedemon and fog by

Karate Chris.
- Added several type checks to the weapon slot code.
- Changed: Players no longer respawn in instant death sectors with 
  the 'Respawn where died' flag on.


SVN r1101 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-02 08:38:07 +00:00
commit fddf69e950
14 changed files with 1053 additions and 1152 deletions

View file

@ -335,7 +335,7 @@ AWeapon *AWeapon::AddWeapon (const PClass *weapontype)
{
AWeapon *weap;
if (weapontype == NULL)
if (weapontype == NULL || !weapontype->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
return NULL;
}
@ -604,6 +604,17 @@ bool FWeaponSlot::AddWeapon (const char *type)
bool FWeaponSlot::AddWeapon (const PClass *type)
{
int i;
if (type == NULL)
{
return false;
}
if (!type->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
Printf("Can't add non-weapon %s to weapon slots\n", type->TypeName.GetChars());
return false;
}
for (i = 0; i < MAX_WEAPONS_PER_SLOT; i++)
{
@ -639,7 +650,7 @@ AWeapon *FWeaponSlot::PickWeapon (player_t *player)
{
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory (Weapons[j]));
if (weap != NULL && weap->CheckAmmo (AWeapon::EitherFire, false))
if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)) && weap->CheckAmmo (AWeapon::EitherFire, false))
{
return weap;
}
@ -651,7 +662,7 @@ AWeapon *FWeaponSlot::PickWeapon (player_t *player)
{
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory (Weapons[i]));
if (weap != NULL && weap->CheckAmmo (AWeapon::EitherFire, false))
if (weap != NULL && weap->IsKindOf(RUNTIME_CLASS(AWeapon)) && weap->CheckAmmo (AWeapon::EitherFire, false))
{
return weap;
}

View file

@ -1168,18 +1168,18 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
y -= (texture->GetHeight()/2)-texture->TopOffset;
}
// I'll handle the conversion from fixed to int myself for more control
fixed_t fx = (x + ST_X + xOffset) << FRACBITS;
fixed_t fy = (y + ST_Y + yOffset) << FRACBITS;
fixed_t fw = texture->GetScaledWidth() << FRACBITS;
fixed_t fh = texture->GetScaledHeight() << FRACBITS;
// I'll handle the conversion from fixed to int myself for more control
fixed_t fx = (x + ST_X + xOffset) << FRACBITS;
fixed_t fy = (y + ST_Y + yOffset) << FRACBITS;
fixed_t fw = texture->GetScaledWidth() << FRACBITS;
fixed_t fh = texture->GetScaledHeight() << FRACBITS;
if(Scaled)
screen->VirtualToRealCoords(fx, fy, fw, fh, 320, 200, true);
x = fx >> FRACBITS;
y = fy >> FRACBITS;
// Round to nearest
int w = (fw + (FRACUNIT>>1)) >> FRACBITS;
int h = (fh + (FRACUNIT>>1)) >> FRACBITS;
screen->VirtualToRealCoords(fx, fy, fw, fh, 320, 200, true);
x = fx >> FRACBITS;
y = fy >> FRACBITS;
// Round to nearest
int w = (fw + (FRACUNIT>>1)) >> FRACBITS;
int h = (fh + (FRACUNIT>>1)) >> FRACBITS;
screen->DrawTexture(texture, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,