diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index a138695f8..57ac5e5fe 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -659,130 +659,6 @@ const VECTORDATA gVectorData[] = { }; -const WEAPONITEMDATA gWeaponItemData[] = { - { - 0, - -1, - 0, - 0, - 0, - 0, - 0, - -1, - 0 - }, - { - 0, - 559, - -8, - 0, - 48, - 48, - 3, - 2, - 8 - }, - { - 0, - 558, - -8, - 0, - 48, - 48, - 4, - 3, - 50 - }, - { - 0, - 524, - -8, - 0, - 48, - 48, - 2, - 1, - 9 - }, - { - 0, - 525, - -8, - 0, - 48, - 48, - 10, - 9, - 100 - }, - { - 0, - 539, - -8, - 0, - 48, - 48, - 8, - 7, - 64 - }, - { - 0, - 526, - -8, - 0, - 48, - 48, - 5, - 4, - 6 - }, - { - 0, - -1, - 0, - 0, - 0, - 0, - 1, - -1, - 0 - }, - { - 0, - 618, - -8, - 0, - 48, - 48, - 7, - 6, - 480 - }, - { - 0, - 589, - -8, - 0, - 48, - 48, - 6, - 5, - 1 - }, - { - 0, - 800, - -8, - 0, - 48, - 48, - 9, - 8, - 35 - } -}; - const MissileType missileInfo[] = { // Cleaver { diff --git a/source/games/blood/src/actor.h b/source/games/blood/src/actor.h index 7d0149a7b..35209e8ed 100644 --- a/source/games/blood/src/actor.h +++ b/source/games/blood/src/actor.h @@ -84,20 +84,6 @@ struct THINGINFO double fClipdist() const { return clipdist * 0.25; } }; -struct WEAPONITEMDATA -{ - int16_t cstat; - int16_t picno; - int8_t shade; - uint8_t pal; - uint8_t xrepeat; - uint8_t yrepeat; - int16_t type; - int16_t ammoType; - int16_t count; - FTextureID textureID() const { return tileGetTextureID(picno); } -}; - struct MissileType { int16_t picno; @@ -153,7 +139,6 @@ struct VECTORDATA { double fMaxDist() const { return maxDist * maptoworld; } }; -extern const WEAPONITEMDATA gWeaponItemData[]; extern const MissileType missileInfo[]; extern const EXPLOSION explodeInfo[]; extern const THINGINFO thingInfo[]; diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 242a33b69..8c86aa7c3 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -2283,15 +2283,17 @@ void trPlayerCtrlGiveStuff(int data2, int weapon, int data4, DBloodPlayer* pPlay default: for (int i = 0; i < 11; i++) { - if (gWeaponItemData[i].type != weapon) continue; - - const WEAPONITEMDATA* pWeaponData = &gWeaponItemData[i]; - int nAmmoType = pWeaponData->ammoType; + auto cls = GetSpawnType(kItemWeaponBase + i); + if (!cls) continue; + auto defaults = GetDefaultByType(cls); + if (defaults->IntVar("type") != weapon) continue; + int count = defaults->IntVar("count"); + int nAmmoType = defaults->IntVar("ammotype"); switch (data2) { case 1: pPlayer->hasWeapon[weapon] = true; - if (pPlayer->ammoCount[nAmmoType] >= pWeaponData->count) break; - pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + pWeaponData->count, gAmmoInfo[nAmmoType].max); + if (pPlayer->ammoCount[nAmmoType] >= count) break; + pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + count, gAmmoInfo[nAmmoType].max); break; case 2: pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + data4, gAmmoInfo[nAmmoType].max); diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index affeebee9..7b0593acf 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1277,39 +1277,32 @@ bool PickupAmmo(DBloodPlayer* pPlayer, DBloodActor* ammoactor) bool PickupWeapon(DBloodPlayer* pPlayer, DBloodActor* weaponactor) { - const WEAPONITEMDATA* pWeaponItemData = &gWeaponItemData[weaponactor->GetType() - kItemWeaponBase]; - int nWeaponType = pWeaponItemData->type; - int nAmmoType = pWeaponItemData->ammoType; - if (!pPlayer->hasWeapon[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) { + int nWeaponType = weaponactor->IntVar("type"); + int nAmmoType = weaponactor->IntVar("ammotype"); + int nCount = (currentLevel->featureflags & kFeatureCustomAmmoCount) && weaponactor->xspr.data1 ? + weaponactor->xspr.data1 : weaponactor->IntVar("count"); + + if (!pPlayer->hasWeapon[nWeaponType] || gGameOptions.nWeaponSettings == 2 || gGameOptions.nWeaponSettings == 3) + { if (weaponactor->GetType() == kItemWeaponLifeLeech && gGameOptions.nGameType > 1 && findDroppedLeech(pPlayer, NULL)) return 0; pPlayer->hasWeapon[nWeaponType] = 1; if (nAmmoType == -1) return 0; // allow to set custom ammo count for weapon pickups -#ifdef NOONE_EXTENSIONS - else if (gModernMap && weaponactor->hasX() && weaponactor->xspr.data1 > 0) - pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + weaponactor->xspr.data1, gAmmoInfo[nAmmoType].max); -#endif - else - pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + pWeaponItemData->count, gAmmoInfo[nAmmoType].max); + + pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + nCount, gAmmoInfo[nAmmoType].max); int nNewWeapon = WeaponUpgrade(pPlayer, nWeaponType); if (nNewWeapon != pPlayer->curWeapon) { pPlayer->weaponState = 0; pPlayer->nextWeapon = nNewWeapon; } - sfxPlay3DSound(pPlayer->GetActor(), 777, -1, 0); - return 1; } - - if (!actGetRespawnTime(weaponactor) || nAmmoType == -1 || pPlayer->ammoCount[nAmmoType] >= gAmmoInfo[nAmmoType].max) return 0; -#ifdef NOONE_EXTENSIONS - else if (gModernMap && weaponactor->hasX() && weaponactor->xspr.data1 > 0) - pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + weaponactor->xspr.data1, gAmmoInfo[nAmmoType].max); -#endif else - pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + pWeaponItemData->count, gAmmoInfo[nAmmoType].max); - + { + if (!actGetRespawnTime(weaponactor) || nAmmoType == -1 || pPlayer->ammoCount[nAmmoType] >= gAmmoInfo[nAmmoType].max) return 0; + pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + nCount, gAmmoInfo[nAmmoType].max); + } sfxPlay3DSound(pPlayer->GetActor(), 777, -1, 0); return 1; }