enabled nnext's grow and shrink shrooms by feature flag.

This is a contained feature with no wide reaching impact so it's fine to support.
This commit is contained in:
Christoph Oelckers 2023-10-10 23:58:41 +02:00
parent 4deb01bc42
commit 49e5919229
11 changed files with 135 additions and 135 deletions

View file

@ -2199,10 +2199,9 @@ static void checkCeilHit(DBloodActor* actor)
else
{
actor2->spr.flags |= 5;
#ifdef NOONE_EXTENSIONS
// add size shroom abilities
if ((actor->IsPlayerActor() && isShrunk(actor)) || (actor2->IsPlayerActor() && isGrown(actor2))) {
if ((actor->IsPlayerActor() && isShrunk(actor)) || (actor2->IsPlayerActor() && isGrown(actor2)))
{
int mass1 = actor2->mass();
int mass2 = actor->mass();
if (mass1 > mass2)
@ -2215,7 +2214,6 @@ static void checkCeilHit(DBloodActor* actor)
}
}
}
#endif
if (!actor->IsPlayerActor() || getPlayer(actor)->godMode == 0)
{
switch (actor2->GetType())
@ -2266,6 +2264,18 @@ static void checkCeilHit(DBloodActor* actor)
//
//---------------------------------------------------------------------------
bool IsBurningDude(DBloodActor* actor)
{
if (actor == nullptr || !actor->IsDudeActor()) return false;
return actor->classflags() & 1;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static void checkHit(DBloodActor* actor)
{
const auto& coll = actor->hit.hit;
@ -2278,7 +2288,6 @@ static void checkHit(DBloodActor* actor)
{
auto actor2 = coll.actor();
#ifdef NOONE_EXTENSIONS
// add size shroom abilities
if ((actor2->IsPlayerActor() && isShrunk(actor2)) || (actor->IsPlayerActor() && isGrown(actor)))
{
@ -2295,7 +2304,6 @@ static void checkHit(DBloodActor* actor)
}
}
}
#endif
switch (actor2->GetType())
{
@ -2309,13 +2317,13 @@ static void checkHit(DBloodActor* actor)
actDamageSprite(nullptr, actor2, kDamageFall, 80);
break;
case kDudeBurningInnocent:
case kDudeBurningCultist:
case kDudeBurningZombieAxe:
case kDudeBurningZombieButcher:
// This does not make sense
actor->xspr.burnTime = ClipLow(actor->xspr.burnTime - 4, 0);
actDamageSprite(actor->GetBurnSource(), actor, kDamageBurn, 8);
default:
if (IsBurningDude(actor))
{
// This does not make sense
//actor->xspr.burnTime = ClipLow(actor->xspr.burnTime - 4, 0);
actDamageSprite(actor->GetBurnSource(), actor, kDamageBurn, 8);
}
break;
}
}
@ -2344,7 +2352,6 @@ static void checkFloorHit(DBloodActor* actor)
{
auto actor2 = coll.actor();
#ifdef NOONE_EXTENSIONS
// add size shroom abilities
if ((actor2->IsPlayerActor() && isShrunk(actor2)) || (actor->IsPlayerActor() && isGrown(actor)))
{
@ -2361,7 +2368,6 @@ static void checkFloorHit(DBloodActor* actor)
if (dmg > 0) actDamageSprite(actor, actor2, (Chance(0x2000)) ? kDamageFall : kDamageBullet, dmg);
}
}
#endif
DBloodPlayer* pPlayer = nullptr;
if (actor->IsPlayerActor()) pPlayer = getPlayer(actor);
@ -2399,11 +2405,7 @@ static void checkFloorHit(DBloodActor* actor)
break;
default:
if (actor2->IsDudeActor() && (actor2->classflags() & 2))
#ifdef NOONE_EXTENSIONS
if (pPlayer && !isShrunk(actor))
#else
if (pPlayer)
#endif
actDamageSprite(actor, actor2, kDamageBullet, 8);
break;
}
@ -3866,18 +3868,6 @@ static void actCheckTraps()
//
//---------------------------------------------------------------------------
bool IsBurningDude(DBloodActor* actor)
{
if (actor == NULL) return false;
return actor->classflags() & 1;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static void actCheckDudes()
{
BloodStatIterator it(kStatDude);
@ -4643,6 +4633,47 @@ void actBurnSprite(DBloodActor* pSource, DBloodActor* pTarget, int nTime)
pTarget->SetBurnSource(pSource);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool ceilIsTooLow(DBloodActor* actor)
{
if (actor != nullptr)
{
sectortype* pSector = actor->sector();
double a = pSector->ceilingz - pSector->floorz;
double top, bottom;
GetActorExtents(actor, &top, &bottom);
if (a > top - bottom) return true;
}
return false;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool isGrown(DBloodActor* actor)
{
if (!(currentLevel->featureflags & kFeaturePlayerSize)) return false;
if (powerupCheck(getPlayer(actor), kPwUpGrowShroom) > 0) return true;
else if (actor->hasX() && actor->xspr.scale >= 512) return true;
else return false;
}
bool isShrunk(DBloodActor* actor)
{
if (!(currentLevel->featureflags & kFeaturePlayerSize)) return false;
if (powerupCheck(getPlayer(actor), kPwUpShrinkShroom) > 0) return true;
else if (actor->hasX() && actor->xspr.scale > 0 && actor->xspr.scale <= 128) return true;
else return false;
}
//---------------------------------------------------------------------------
//
//

View file

@ -133,6 +133,9 @@ DBloodActor* actFireThing(DBloodActor* actor, double xyoff, double zoff, double
DBloodActor* actFireMissile(DBloodActor* actor, double xyoff, double zoff, DVector3 dc, int nType);
void actBurnSprite(DBloodActor* pSource, DBloodActor* pTarget, int nTime);
bool isGrown(DBloodActor* pSprite);
bool isShrunk(DBloodActor* pSprite);
bool ceilIsTooLow(DBloodActor* actor);
int actGetRespawnTime(DBloodActor *pSprite);
bool actCheckRespawn(DBloodActor *pSprite);

View file

@ -435,7 +435,7 @@ static void unicultThinkGoto(DBloodActor* actor)
static void unicultThinkChase(DBloodActor* actor)
{
if (actor->GetType() < kDudeBase || actor->GetType() >= kDudeMax) return;
if (!actor->IsDudeActor()) return;
auto const target = actor->GetTarget();
if (target == nullptr)

View file

@ -282,6 +282,7 @@ enum EFeatureFlags
kFeatureCustomClipdist = 4,
kFeatureCustomTrapExploder = 8,
kFeatureCustomEnemyHealth = 16,
kFeaturePlayerSize = 32,
};
constexpr int BMAX_PATH = 260;

View file

@ -122,17 +122,17 @@ public:
bool IsPlayerActor()
{
return GetType() >= kDudePlayer1 && GetType() <= kDudePlayer8;
return IsKindOf(BloodPlayerBaseClass);
}
bool IsDudeActor()
{
return GetType() >= kDudeBase && GetType() < kDudeMax;
return IsKindOf(BloodDudeBaseClass);
}
bool IsThingActor()
{
return GetType() >= kThingBase && GetType() < kThingMax;
return IsKindOf(BloodThingBaseClass);
}
bool IsItemActor()

View file

@ -1,5 +1,6 @@
xx(BloodMissileBase)
xx(BloodDudeBase)
xx(BloodPlayerBase)
xx(BloodThingBase)
xx(BloodDudeZombieButcher)

View file

@ -234,6 +234,8 @@ enum {
kItemReflectShots = 124,
kItemBeastVision = 125,
kItemShroomDelirium = 128,
kItemShroomGrow = 129,
kItemShroomShrink = 130,
kItemArmorAsbest = 139,
kItemArmorBasic = 140,

View file

@ -1860,25 +1860,6 @@ void debrisMove(int listIndex)
//
//---------------------------------------------------------------------------
bool ceilIsTooLow(DBloodActor* actor)
{
if (actor != nullptr)
{
sectortype* pSector = actor->sector();
double a = pSector->ceilingz - pSector->floorz;
double top, bottom;
GetActorExtents(actor, &top, &bottom);
if (a > top - bottom) return true;
}
return false;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void aiSetGenIdleState(DBloodActor* actor)
{
switch (actor->GetType())
@ -7376,36 +7357,6 @@ void playerQavSceneReset(DBloodPlayer* pPlayer)
pQavScene->qavResrc = NULL;
}
bool playerSizeShrink(DBloodPlayer* pPlayer, int divider)
{
pPlayer->GetActor()->xspr.scale = 256 / divider;
playerSetRace(pPlayer, kModeHumanShrink);
return true;
}
bool playerSizeGrow(DBloodPlayer* pPlayer, int multiplier)
{
pPlayer->GetActor()->xspr.scale = 256 * multiplier;
playerSetRace(pPlayer, kModeHumanGrown);
return true;
}
bool playerSizeReset(DBloodPlayer* pPlayer)
{
playerSetRace(pPlayer, kModeHuman);
pPlayer->GetActor()->xspr.scale = 0;
return true;
}
void playerDeactivateShrooms(DBloodPlayer* pPlayer)
{
powerupDeactivate(pPlayer, kPwUpGrowShroom);
pPlayer->pwUpTime[kPwUpGrowShroom] = 0;
powerupDeactivate(pPlayer, kPwUpShrinkShroom);
pPlayer->pwUpTime[kPwUpShrinkShroom] = 0;
}
//---------------------------------------------------------------------------
//
//
@ -7452,20 +7403,6 @@ bool IsKillableDude(DBloodActor* actor)
}
}
bool isGrown(DBloodActor* actor)
{
if (powerupCheck(getPlayer(actor), kPwUpGrowShroom) > 0) return true;
else if (actor->hasX() && actor->xspr.scale >= 512) return true;
else return false;
}
bool isShrunk(DBloodActor* actor)
{
if (powerupCheck(getPlayer(actor), kPwUpShrinkShroom) > 0) return true;
else if (actor->hasX() && actor->xspr.scale > 0 && actor->xspr.scale <= 128) return true;
else return false;
}
bool isActive(DBloodActor* actor)
{
if (!actor->hasX())

View file

@ -340,11 +340,6 @@ bool modernTypeOperateSprite(DBloodActor*, EVENT& event);
bool modernTypeOperateWall(walltype* pWall, const EVENT& event);
void modernTypeSendCommand(DBloodActor* nSprite, int channel, COMMAND_ID command, DBloodActor* initiator);
// ------------------------------------------------------------------------- //
bool playerSizeShrink(DBloodPlayer* pPlayer, int divider);
bool playerSizeGrow(DBloodPlayer* pPlayer, int multiplier);
bool playerSizeReset(DBloodPlayer* pPlayer);
void playerDeactivateShrooms(DBloodPlayer* pPlayer);
// ------------------------------------------------------------------------- //
QAV* playerQavSceneLoad(int qavId);
void playerQavSceneProcess(DBloodPlayer* pPlayer, QAVSCENE* pQavScene);
void playerQavScenePlay(DBloodPlayer* pPlayer);
@ -356,8 +351,6 @@ void callbackMakeMissileBlocking(DBloodActor* actor);
void callbackGenDudeUpdate(DBloodActor* actor);
// ------------------------------------------------------------------------- //
DBloodPlayer* getPlayerById(int id);
bool isGrown(DBloodActor* pSprite);
bool isShrunk(DBloodActor* pSprite);
bool IsBurningDude(DBloodActor* pSprite);
bool IsKillableDude(DBloodActor* pSprite);
bool isActive(DBloodActor* nSprite);

View file

@ -266,6 +266,41 @@ int powerupCheck(DBloodPlayer* pPlayer, int nPowerUp)
return pPlayer->pwUpTime[nPowerUp];
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool playerSizeShrink(DBloodPlayer* pPlayer, int divider)
{
pPlayer->GetActor()->xspr.scale = 256 / divider;
playerSetRace(pPlayer, kModeHumanShrink);
return true;
}
bool playerSizeGrow(DBloodPlayer* pPlayer, int multiplier)
{
pPlayer->GetActor()->xspr.scale = 256 * multiplier;
playerSetRace(pPlayer, kModeHumanGrown);
return true;
}
bool playerSizeReset(DBloodPlayer* pPlayer)
{
playerSetRace(pPlayer, kModeHuman);
pPlayer->GetActor()->xspr.scale = 0;
return true;
}
void playerDeactivateShrooms(DBloodPlayer* pPlayer)
{
powerupDeactivate(pPlayer, kPwUpGrowShroom);
pPlayer->pwUpTime[kPwUpGrowShroom] = 0;
powerupDeactivate(pPlayer, kPwUpShrinkShroom);
pPlayer->pwUpTime[kPwUpShrinkShroom] = 0;
}
//---------------------------------------------------------------------------
//
@ -288,17 +323,21 @@ bool powerupActivate(DBloodPlayer* pPlayer, int nPowerUp)
case kItemModernMapLevel:
if (gModernMap) gFullMap = true;
break;
#endif
case kItemShroomShrink:
if (!gModernMap) break;
if (!(currentLevel->featureflags & kFeaturePlayerSize)) break;
else if (isGrown(pPlayer->GetActor())) playerDeactivateShrooms(pPlayer);
else playerSizeShrink(pPlayer, 2);
break;
case kItemShroomGrow:
if (!gModernMap) break;
if (!(currentLevel->featureflags & kFeaturePlayerSize)) break;
else if (isShrunk(pPlayer->GetActor())) playerDeactivateShrooms(pPlayer);
else {
else
{
playerSizeGrow(pPlayer, 2);
if (powerupCheck(getPlayer(pPlayer->GetActor()), kPwUpShadowCloak) > 0) {
if (powerupCheck(getPlayer(pPlayer->GetActor()), kPwUpShadowCloak) > 0)
{
powerupDeactivate(pPlayer, kPwUpShadowCloak);
pPlayer->pwUpTime[kPwUpShadowCloak] = 0;
}
@ -307,7 +346,6 @@ bool powerupActivate(DBloodPlayer* pPlayer, int nPowerUp)
actDamageSprite(pPlayer->GetActor(), pPlayer->GetActor(), kDamageExplode, 65535);
}
break;
#endif
case kItemFeatherFall:
case kItemJumpBoots:
pPlayer->damageControl[0]++;
@ -352,19 +390,21 @@ void powerupDeactivate(DBloodPlayer* pPlayer, int nPowerUp)
if (nPack >= 0)
pPlayer->packSlots[nPack].isActive = 0;
switch (nPowerUp + kItemBase) {
#ifdef NOONE_EXTENSIONS
switch (nPowerUp + kItemBase)
{
case kItemShroomShrink:
if (gModernMap) {
if (currentLevel->featureflags & kFeaturePlayerSize)
{
playerSizeReset(pPlayer);
if (ceilIsTooLow(pPlayer->GetActor()))
actDamageSprite(pPlayer->GetActor(), pPlayer->GetActor(), kDamageExplode, 65535);
}
break;
case kItemShroomGrow:
if (gModernMap) playerSizeReset(pPlayer);
if (currentLevel->featureflags & kFeaturePlayerSize)
playerSizeReset(pPlayer);
break;
#endif
case kItemFeatherFall:
case kItemJumpBoots:
pPlayer->damageControl[0]--;
@ -1029,31 +1069,24 @@ bool PickupItem(DBloodPlayer* pPlayer, DBloodActor* itemactor)
switch (itemactor->GetType()) {
case kItemShadowCloak:
#ifdef NOONE_EXTENSIONS
if (isGrown(pPlayer->GetActor()) || !powerupActivate(pPlayer, nType)) return false;
#else
if (!powerupActivate(pPlayer, nType)) return false;
#endif
break;
#ifdef NOONE_EXTENSIONS
case kItemShroomShrink:
case kItemShroomGrow:
if (gModernMap) {
switch (itemactor->GetType()) {
case kItemShroomShrink:
if (isShrunk(pPlayer->GetActor())) return false;
break;
case kItemShroomGrow:
if (isGrown(pPlayer->GetActor())) return false;
break;
}
if (currentLevel->featureflags & kFeaturePlayerSize)
{
if (isShrunk(pPlayer->GetActor())) return false;
powerupActivate(pPlayer, nType);
}
break;
#endif
case kItemShroomGrow:
if (currentLevel->featureflags & kFeaturePlayerSize)
{
if (isGrown(pPlayer->GetActor())) return false;
powerupActivate(pPlayer, nType);
}
break;
case kItemFlagABase:
case kItemFlagBBase: {
if (gGameOptions.nGameType != 3 || !itemactor->hasX()) return 0;

View file

@ -356,7 +356,6 @@ static void fakeMoveDude(DBloodActor* actor)
int bottom, top;
if (IsPlayerSprite(pSprite))
pPlayer = &gPlayer[pSprite->type - kDudePlayer1];
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
GetSpriteExtents(pSprite, &top, &bottom);
top += predict.z - pSprite->z;
bottom += predict.z - pSprite->z;