Merge branch 'scripting'
Conflicts: src/actor.h src/g_doom/a_doomweaps.cpp src/g_hexen/a_blastradius.cpp src/p_enemy.cpp src/p_enemy.h src/thingdef/thingdef.h src/thingdef/thingdef_codeptr.cpp wadsrc/static/actors/constants.txt
This commit is contained in:
commit
b3b0886b64
230 changed files with 24061 additions and 8641 deletions
|
|
@ -117,16 +117,14 @@ static int statspace;
|
|||
void AM_GetPosition(fixed_t & x, fixed_t & y);
|
||||
|
||||
|
||||
FTextureID GetHUDIcon(const PClass *cls)
|
||||
FTextureID GetHUDIcon(PClassInventory *cls)
|
||||
{
|
||||
FTextureID tex;
|
||||
tex.texnum = cls->Meta.GetMetaInt(HUMETA_AltIcon, 0);
|
||||
return tex;
|
||||
return cls->AltHUDIcon;
|
||||
}
|
||||
|
||||
void SetHUDIcon(PClass *cls, FTextureID tex)
|
||||
void SetHUDIcon(PClassInventory *cls, FTextureID tex)
|
||||
{
|
||||
cls->Meta.SetMetaInt(HUMETA_AltIcon, tex.GetIndex());
|
||||
cls->AltHUDIcon = tex;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -378,32 +376,33 @@ static void DrawArmor(ABasicArmor * barmor, AHexenArmor * harmor, int x, int y)
|
|||
// this doesn't have to be done each frame
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
static TArray<const PClass*> KeyTypes, UnassignedKeyTypes;
|
||||
static TArray<PClassActor *> KeyTypes, UnassignedKeyTypes;
|
||||
|
||||
static int STACK_ARGS ktcmp(const void * a, const void * b)
|
||||
{
|
||||
AKey * key1 = (AKey*)GetDefaultByType ( *(const PClass**)a );
|
||||
AKey * key2 = (AKey*)GetDefaultByType ( *(const PClass**)b );
|
||||
AKey *key1 = (AKey*)GetDefaultByType ( *(PClassActor **)a );
|
||||
AKey *key2 = (AKey*)GetDefaultByType ( *(PClassActor **)b );
|
||||
return key1->KeyNumber - key2->KeyNumber;
|
||||
}
|
||||
|
||||
static void SetKeyTypes()
|
||||
{
|
||||
for(unsigned int i=0;i<PClass::m_Types.Size();i++)
|
||||
for(unsigned int i = 0; i < PClassActor::AllActorClasses.Size(); i++)
|
||||
{
|
||||
const PClass * ti = PClass::m_Types[i];
|
||||
PClass *ti = PClassActor::AllActorClasses[i];
|
||||
|
||||
if (ti->IsDescendantOf(RUNTIME_CLASS(AKey)))
|
||||
{
|
||||
AKey * key = (AKey*)GetDefaultByType(ti);
|
||||
PClassActor *tia = static_cast<PClassActor *>(ti);
|
||||
AKey *key = (AKey*)GetDefaultByType(tia);
|
||||
|
||||
if (key->Icon.isValid() && key->KeyNumber>0)
|
||||
{
|
||||
KeyTypes.Push(ti);
|
||||
KeyTypes.Push(tia);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnassignedKeyTypes.Push(ti);
|
||||
UnassignedKeyTypes.Push(tia);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -414,7 +413,7 @@ static void SetKeyTypes()
|
|||
else
|
||||
{
|
||||
// Don't leave the list empty
|
||||
const PClass * ti = RUNTIME_CLASS(AKey);
|
||||
PClassActor *ti = RUNTIME_CLASS(AKey);
|
||||
KeyTypes.Push(ti);
|
||||
}
|
||||
}
|
||||
|
|
@ -479,30 +478,30 @@ static int DrawKeys(player_t * CPlayer, int x, int y)
|
|||
int xo=x;
|
||||
int i;
|
||||
int c=0;
|
||||
AInventory * inv;
|
||||
AInventory *inv;
|
||||
|
||||
if (!deathmatch)
|
||||
{
|
||||
if (KeyTypes.Size()==0) SetKeyTypes();
|
||||
if (KeyTypes.Size() == 0) SetKeyTypes();
|
||||
|
||||
// First all keys that are assigned to locks (in reverse order of definition)
|
||||
for(i=KeyTypes.Size()-1;i>=0;i--)
|
||||
for (i = KeyTypes.Size()-1; i >= 0; i--)
|
||||
{
|
||||
if ((inv=CPlayer->mo->FindInventory(KeyTypes[i])))
|
||||
if ((inv = CPlayer->mo->FindInventory(KeyTypes[i])))
|
||||
{
|
||||
DrawOneKey(xo, x, y, c, inv);
|
||||
}
|
||||
}
|
||||
// And now the rest
|
||||
for(i=UnassignedKeyTypes.Size()-1;i>=0;i--)
|
||||
for (i = UnassignedKeyTypes.Size()-1; i >= 0; i--)
|
||||
{
|
||||
if ((inv=CPlayer->mo->FindInventory(UnassignedKeyTypes[i])))
|
||||
if ((inv = CPlayer->mo->FindInventory(UnassignedKeyTypes[i])))
|
||||
{
|
||||
DrawOneKey(xo, x, y, c, inv);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x==xo && y!=yo) y+=11;
|
||||
if (x == xo && y != yo) y+=11;
|
||||
return y-11;
|
||||
}
|
||||
|
||||
|
|
@ -512,14 +511,14 @@ static int DrawKeys(player_t * CPlayer, int x, int y)
|
|||
// Drawing Ammo
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
static TArray<const PClass *> orderedammos;
|
||||
static TArray<PClassAmmo *> orderedammos;
|
||||
|
||||
static void AddAmmoToList(AWeapon * weapdef)
|
||||
{
|
||||
|
||||
for(int i=0; i<2;i++)
|
||||
{
|
||||
const PClass * ti = i==0? weapdef->AmmoType1 : weapdef->AmmoType2;
|
||||
PClassAmmo * ti = i==0? weapdef->AmmoType1 : weapdef->AmmoType2;
|
||||
if (ti)
|
||||
{
|
||||
AAmmo * ammodef=(AAmmo*)GetDefaultByType(ti);
|
||||
|
|
@ -559,7 +558,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
|
|||
// Order ammo by use of weapons in the weapon slots
|
||||
for (k = 0; k < NUM_WEAPON_SLOTS; k++) for(j = 0; j < CPlayer->weapons.Slots[k].Size(); j++)
|
||||
{
|
||||
const PClass *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
|
||||
PClassActor *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
|
||||
|
||||
if (weap)
|
||||
{
|
||||
|
|
@ -592,7 +591,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
|
|||
for(i=orderedammos.Size()-1;i>=0;i--)
|
||||
{
|
||||
|
||||
const PClass * type = orderedammos[i];
|
||||
PClassAmmo * type = orderedammos[i];
|
||||
AAmmo * ammoitem = (AAmmo*)CPlayer->mo->FindInventory(type);
|
||||
|
||||
AAmmo * inv = ammoitem? ammoitem : (AAmmo*)GetDefaultByType(orderedammos[i]);
|
||||
|
|
@ -681,7 +680,7 @@ static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
|
|||
|
||||
// Powered up weapons and inherited sister weapons are not displayed.
|
||||
if (weapon->WeaponFlags & WIF_POWERED_UP) return;
|
||||
if (weapon->SisterWeapon && weapon->IsKindOf(RUNTIME_TYPE(weapon->SisterWeapon))) return;
|
||||
if (weapon->SisterWeapon && weapon->IsKindOf(weapon->SisterWeapon->GetClass())) return;
|
||||
|
||||
trans=0x6666;
|
||||
if (CPlayer->ReadyWeapon)
|
||||
|
|
@ -705,16 +704,16 @@ static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
|
|||
}
|
||||
|
||||
|
||||
static void DrawWeapons(player_t * CPlayer, int x, int y)
|
||||
static void DrawWeapons(player_t *CPlayer, int x, int y)
|
||||
{
|
||||
int k,j;
|
||||
AInventory * inv;
|
||||
AInventory *inv;
|
||||
|
||||
// First draw all weapons in the inventory that are not assigned to a weapon slot
|
||||
for(inv=CPlayer->mo->Inventory;inv;inv=inv->Inventory)
|
||||
for(inv = CPlayer->mo->Inventory; inv; inv = inv->Inventory)
|
||||
{
|
||||
if (inv->IsKindOf(RUNTIME_CLASS(AWeapon)) &&
|
||||
!CPlayer->weapons.LocateWeapon(RUNTIME_TYPE(inv), NULL, NULL))
|
||||
!CPlayer->weapons.LocateWeapon(static_cast<AWeapon*>(inv)->GetClass(), NULL, NULL))
|
||||
{
|
||||
DrawOneWeapon(CPlayer, x, y, static_cast<AWeapon*>(inv));
|
||||
}
|
||||
|
|
@ -723,7 +722,7 @@ static void DrawWeapons(player_t * CPlayer, int x, int y)
|
|||
// And now everything in the weapon slots back to front
|
||||
for (k = NUM_WEAPON_SLOTS - 1; k >= 0; k--) for(j = CPlayer->weapons.Slots[k].Size() - 1; j >= 0; j--)
|
||||
{
|
||||
const PClass *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
|
||||
PClassActor *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
|
||||
if (weap)
|
||||
{
|
||||
inv=CPlayer->mo->FindInventory(weap);
|
||||
|
|
@ -1180,7 +1179,7 @@ void HUD_InitHud()
|
|||
}
|
||||
else
|
||||
{
|
||||
const PClass * ti = PClass::FindClass(sc.String);
|
||||
PClass *ti = PClass::FindClass(sc.String);
|
||||
if (!ti)
|
||||
{
|
||||
Printf("Unknown item class '%s' in ALTHUDCF\n", sc.String);
|
||||
|
|
@ -1199,9 +1198,8 @@ void HUD_InitHud()
|
|||
}
|
||||
else tex.SetInvalid();
|
||||
|
||||
if (ti) SetHUDIcon(const_cast<PClass*>(ti), tex);
|
||||
if (ti) SetHUDIcon(static_cast<PClassInventory*>(ti), tex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue