mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 06:41:59 +00:00
- actGetRespawnTime + actCheckRespawn.
This commit is contained in:
parent
6db18e61d9
commit
d7078dda48
4 changed files with 59 additions and 42 deletions
|
@ -3341,7 +3341,7 @@ static void modernCustomDudeDeath(DBloodActor* actor, int nSeq, int damageType)
|
|||
auto pXSprite = &actor->x();
|
||||
|
||||
playGenDudeSound(pSprite, kGenDudeSndDeathNormal);
|
||||
int dudeToGib = (actCheckRespawn(pSprite)) ? -1 : ((nSeq == 3) ? nDudeToGibClient2 : nDudeToGibClient1);
|
||||
int dudeToGib = (actCheckRespawn(actor)) ? -1 : ((nSeq == 3) ? nDudeToGibClient2 : nDudeToGibClient1);
|
||||
if (nSeq == 3)
|
||||
{
|
||||
GENDUDEEXTRA* pExtra = genDudeExtra(pSprite);
|
||||
|
@ -3369,7 +3369,7 @@ static void modernCustomDudeBurningDeath(DBloodActor* actor, int nSeq)
|
|||
auto pSprite = &actor->s();
|
||||
|
||||
playGenDudeSound(pSprite, kGenDudeSndDeathExplode);
|
||||
int dudeToGib = (actCheckRespawn(pSprite)) ? -1 : nDudeToGibClient1;
|
||||
int dudeToGib = (actCheckRespawn(actor)) ? -1 : nDudeToGibClient1;
|
||||
|
||||
if (Chance(0x4000)) spawnGibs(actor, GIBTYPE_27, -0xccccc);
|
||||
|
||||
|
@ -3659,7 +3659,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
|
|||
fxSpawnBlood(pSprite, damage);
|
||||
}
|
||||
gKillMgr.AddKill(pSprite);
|
||||
actCheckRespawn(pSprite);
|
||||
actCheckRespawn(actor);
|
||||
pSprite->type = kThingBloodChunks;
|
||||
actPostSprite(actor, kStatThing);
|
||||
}
|
||||
|
@ -5566,7 +5566,7 @@ void actExplodeSprite(DBloodActor* actor)
|
|||
{
|
||||
auto spawned = actSpawnSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0, 1);
|
||||
spawned->SetOwner(actor->GetOwner());
|
||||
if (actCheckRespawn(pSprite))
|
||||
if (actCheckRespawn(actor))
|
||||
{
|
||||
pXSprite->state = 1;
|
||||
pXSprite->health = thingInfo[0].startHealth << 4;
|
||||
|
@ -6796,38 +6796,48 @@ void actBuildMissile(spritetype* pMissile, int nXSprite, int nSprite) {
|
|||
}
|
||||
}
|
||||
|
||||
int actGetRespawnTime(spritetype *pSprite) {
|
||||
if (pSprite->extra <= 0) return -1;
|
||||
XSPRITE *pXSprite = &xsprite[pSprite->extra];
|
||||
if (IsDudeSprite(pSprite) && !IsPlayerSprite(pSprite)) {
|
||||
if (pXSprite->respawn == 2 || (pXSprite->respawn != 1 && gGameOptions.nMonsterSettings == 2))
|
||||
int actGetRespawnTime(DBloodActor* actor)
|
||||
{
|
||||
spritetype* pSprite = &actor->s();
|
||||
if (!actor->hasX()) return -1;
|
||||
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
|
||||
if (actor->IsDudeActor() && !actor->IsPlayerActor())
|
||||
{
|
||||
if (pXSprite->respawn == 2 || (pXSprite->respawn != 1 && gGameOptions.nMonsterSettings == 2))
|
||||
return gGameOptions.nMonsterRespawnTime;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsWeaponSprite(pSprite)) {
|
||||
if (actor->IsWeaponActor())
|
||||
{
|
||||
if (pXSprite->respawn == 3 || gGameOptions.nWeaponSettings == 1) return 0;
|
||||
else if (pXSprite->respawn != 1 && gGameOptions.nWeaponSettings != 0)
|
||||
else if (pXSprite->respawn != 1 && gGameOptions.nWeaponSettings != 0)
|
||||
return gGameOptions.nWeaponRespawnTime;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsAmmoSprite(pSprite)) {
|
||||
if (pXSprite->respawn == 2 || (pXSprite->respawn != 1 && gGameOptions.nWeaponSettings != 0))
|
||||
if (actor->IsAmmoActor())
|
||||
{
|
||||
if (pXSprite->respawn == 2 || (pXSprite->respawn != 1 && gGameOptions.nWeaponSettings != 0))
|
||||
return gGameOptions.nWeaponRespawnTime;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsItemSprite(pSprite)) {
|
||||
if (actor->IsItemActor())
|
||||
{
|
||||
if (pXSprite->respawn == 3 && gGameOptions.nGameType == 1) return 0;
|
||||
else if (pXSprite->respawn == 2 || (pXSprite->respawn != 1 && gGameOptions.nItemSettings != 0)) {
|
||||
switch (pSprite->type) {
|
||||
else if (pXSprite->respawn == 2 || (pXSprite->respawn != 1 && gGameOptions.nItemSettings != 0))
|
||||
{
|
||||
switch (pSprite->type)
|
||||
{
|
||||
case kItemShadowCloak:
|
||||
case kItemTwoGuns:
|
||||
case kItemReflectShots:
|
||||
return gGameOptions.nSpecialRespawnTime;
|
||||
case kItemDeathMask:
|
||||
return gGameOptions.nSpecialRespawnTime<<1;
|
||||
return gGameOptions.nSpecialRespawnTime << 1;
|
||||
default:
|
||||
return gGameOptions.nItemRespawnTime;
|
||||
}
|
||||
|
@ -6837,38 +6847,42 @@ int actGetRespawnTime(spritetype *pSprite) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool actCheckRespawn(spritetype *pSprite)
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool actCheckRespawn(DBloodActor* actor)
|
||||
{
|
||||
int nSprite = pSprite->index;
|
||||
int nXSprite = pSprite->extra;
|
||||
if (nXSprite > 0)
|
||||
spritetype* pSprite = &actor->s();
|
||||
if (actor->hasX())
|
||||
{
|
||||
XSPRITE *pXSprite = &xsprite[nXSprite];
|
||||
int nRespawnTime = actGetRespawnTime(pSprite);
|
||||
if (nRespawnTime < 0)
|
||||
return 0;
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
int nRespawnTime = actGetRespawnTime(actor);
|
||||
if (nRespawnTime < 0) return 0;
|
||||
|
||||
pXSprite->respawnPending = 1;
|
||||
if (pSprite->type >= kThingBase && pSprite->type < kThingMax)
|
||||
{
|
||||
pXSprite->respawnPending = 3;
|
||||
if (pSprite->type == kThingTNTBarrel)
|
||||
pSprite->cstat |= 32768;
|
||||
if (pSprite->type == kThingTNTBarrel) pSprite->cstat |= 32768;
|
||||
}
|
||||
if (nRespawnTime > 0)
|
||||
{
|
||||
if (pXSprite->respawnPending == 1)
|
||||
nRespawnTime = MulScale(nRespawnTime, 0xa000, 16);
|
||||
if (pXSprite->respawnPending == 1) nRespawnTime = MulScale(nRespawnTime, 0xa000, 16);
|
||||
pSprite->owner = pSprite->statnum;
|
||||
actPostSprite(pSprite->index, kStatRespawn);
|
||||
actPostSprite(actor, kStatRespawn);
|
||||
pSprite->flags |= kHitagRespawn;
|
||||
|
||||
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax))
|
||||
{
|
||||
pSprite->cstat &= ~257;
|
||||
pSprite->x = baseSprite[nSprite].x;
|
||||
pSprite->y = baseSprite[nSprite].y;
|
||||
pSprite->z = baseSprite[nSprite].z;
|
||||
pSprite->x = actor->basePoint().x;
|
||||
pSprite->y = actor->basePoint().y;
|
||||
pSprite->z = actor->basePoint().z;
|
||||
}
|
||||
evPost(nSprite, 3, nRespawnTime, kCallbackRespawn);
|
||||
evPost(actor, nRespawnTime, kCallbackRespawn);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -239,9 +239,8 @@ DBloodActor * actSpawnThing(int nSector, int x, int y, int z, int nThingType);
|
|||
spritetype * actFireThing_(spritetype *pSprite, int a2, int a3, int a4, int thingType, int a6);
|
||||
DBloodActor* actFireThing(DBloodActor* pSprite, int a2, int a3, int a4, int thingType, int a6);
|
||||
|
||||
spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5, int a6, int nType);
|
||||
int actGetRespawnTime(spritetype *pSprite);
|
||||
bool actCheckRespawn(spritetype *pSprite);
|
||||
int actGetRespawnTime(DBloodActor *pSprite);
|
||||
bool actCheckRespawn(DBloodActor *pSprite);
|
||||
bool actCanSplatWall(int nWall);
|
||||
void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, VECTOR_TYPE vectorType);
|
||||
void actPostSprite(int nSprite, int nStatus);
|
||||
|
|
|
@ -208,6 +208,7 @@ void fxDynPuff(int nSprite) // 8
|
|||
|
||||
void Respawn(int nSprite) // 9
|
||||
{
|
||||
auto actor = &bloodActors[nSprite];
|
||||
spritetype *pSprite = &sprite[nSprite];
|
||||
assert(pSprite->extra > 0 && pSprite->extra < kMaxXSprites);
|
||||
XSPRITE *pXSprite = &xsprite[pSprite->extra];
|
||||
|
@ -222,13 +223,13 @@ void Respawn(int nSprite) // 9
|
|||
|
||||
switch (pXSprite->respawnPending) {
|
||||
case 1: {
|
||||
int nTime = MulScale(actGetRespawnTime(pSprite), 0x4000, 16);
|
||||
int nTime = MulScale(actGetRespawnTime(actor), 0x4000, 16);
|
||||
pXSprite->respawnPending = 2;
|
||||
evPost(nSprite, 3, nTime, kCallbackRespawn);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
int nTime = MulScale(actGetRespawnTime(pSprite), 0x2000, 16);
|
||||
int nTime = MulScale(actGetRespawnTime(actor), 0x2000, 16);
|
||||
pXSprite->respawnPending = 3;
|
||||
evPost(nSprite, 3, nTime, kCallbackRespawn);
|
||||
break;
|
||||
|
|
|
@ -1113,7 +1113,9 @@ char PickupAmmo(PLAYER* pPlayer, spritetype* pAmmo) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon) {
|
||||
char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon)
|
||||
{
|
||||
auto actor = &bloodActors[pWeapon->index];
|
||||
const WEAPONITEMDATA *pWeaponItemData = &gWeaponItemData[pWeapon->type - kItemWeaponBase];
|
||||
int nWeaponType = pWeaponItemData->type;
|
||||
int nAmmoType = pWeaponItemData->ammoType;
|
||||
|
@ -1139,7 +1141,7 @@ char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (!actGetRespawnTime(pWeapon) || nAmmoType == -1 || pPlayer->ammoCount[nAmmoType] >= gAmmoInfo[nAmmoType].max) return 0;
|
||||
if (!actGetRespawnTime(actor) || nAmmoType == -1 || pPlayer->ammoCount[nAmmoType] >= gAmmoInfo[nAmmoType].max) return 0;
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
else if (gModernMap && pWeapon->extra >= 0 && xsprite[pWeapon->extra].data1 > 0)
|
||||
pPlayer->ammoCount[nAmmoType] = ClipHigh(pPlayer->ammoCount[nAmmoType] + xsprite[pWeapon->extra].data1, gAmmoInfo[nAmmoType].max);
|
||||
|
@ -1153,6 +1155,7 @@ char PickupWeapon(PLAYER *pPlayer, spritetype *pWeapon) {
|
|||
|
||||
void PickUp(PLAYER *pPlayer, spritetype *pSprite)
|
||||
{
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
const char *msg = nullptr;
|
||||
int nType = pSprite->type;
|
||||
char pickedUp = 0;
|
||||
|
@ -1185,7 +1188,7 @@ void PickUp(PLAYER *pPlayer, spritetype *pSprite)
|
|||
trTriggerSprite(pSprite->index, pXSprite, kCmdSpritePickup);
|
||||
}
|
||||
|
||||
if (!actCheckRespawn(pSprite))
|
||||
if (!actCheckRespawn(actor))
|
||||
actPostSprite(pSprite->index, kStatFree);
|
||||
|
||||
pPlayer->pickupEffect = 30;
|
||||
|
|
Loading…
Reference in a new issue