- scriptified the remains of AAmmo.

This commit is contained in:
Christoph Oelckers 2017-01-18 14:18:17 +01:00
commit d9fd2d509f
22 changed files with 122 additions and 245 deletions

View file

@ -75,7 +75,6 @@
#include "v_text.h"
#include "vmbuilder.h"
#include "a_armor.h"
#include "a_ammo.h"
// [SO] Just the way Randy said to do it :)
// [RH] Made this CVAR_SERVERINFO
@ -1536,7 +1535,7 @@ static int PatchSprite (int sprNum)
static int PatchAmmo (int ammoNum)
{
PClassActor *ammoType = NULL;
AAmmo *defaultAmmo = NULL;
AInventory *defaultAmmo = NULL;
int result;
int oldclip;
int dummy;
@ -1549,7 +1548,7 @@ static int PatchAmmo (int ammoNum)
ammoType = AmmoNames[ammoNum];
if (ammoType != NULL)
{
defaultAmmo = (AAmmo *)GetDefaultByType (ammoType);
defaultAmmo = (AInventory*)GetDefaultByType (ammoType);
if (defaultAmmo != NULL)
{
max = &defaultAmmo->MaxAmount;
@ -1575,8 +1574,8 @@ static int PatchAmmo (int ammoNum)
// Calculate the new backpack-given amounts for this ammo.
if (ammoType != NULL)
{
defaultAmmo->BackpackMaxAmount = defaultAmmo->MaxAmount * 2;
defaultAmmo->BackpackAmount = defaultAmmo->Amount;
defaultAmmo->IntVar("BackpackMaxAmount") = defaultAmmo->MaxAmount * 2;
defaultAmmo->IntVar("BackpackAmount") = defaultAmmo->Amount;
}
// Fix per-ammo/max-ammo amounts for descendants of the base ammo class
@ -1591,7 +1590,7 @@ static int PatchAmmo (int ammoNum)
if (type->IsDescendantOf (ammoType))
{
defaultAmmo = (AAmmo *)GetDefaultByType (type);
defaultAmmo = (AInventory *)GetDefaultByType (type);
defaultAmmo->MaxAmount = *max;
defaultAmmo->Amount = Scale (defaultAmmo->Amount, *per, oldclip);
}
@ -1673,7 +1672,7 @@ static int PatchWeapon (int weapNum)
info->AmmoType1 = (PClassInventory*)AmmoNames[val];
if (info->AmmoType1 != NULL)
{
info->AmmoGive1 = ((AAmmo*)GetDefaultByType (info->AmmoType1))->Amount * 2;
info->AmmoGive1 = ((AInventory*)GetDefaultByType (info->AmmoType1))->Amount * 2;
if (info->AmmoUse1 == 0)
{
info->AmmoUse1 = 1;
@ -2930,7 +2929,7 @@ static bool LoadDehSupp ()
else
{
auto cls = PClass::FindActor(sc.String);
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(AAmmo)))
if (cls == NULL || !cls->IsDescendantOf(PClass::FindActor(NAME_Ammo)))
{
sc.ScriptError("Unknown ammo type '%s'", sc.String);
}