mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-21 19:11:06 +00:00
- useObjResizer
This commit is contained in:
parent
63ae861765
commit
cd98e940aa
2 changed files with 55 additions and 42 deletions
|
@ -77,13 +77,12 @@ void CKillMgr::AddKill(spritetype* pSprite)
|
||||||
void CKillMgr::CountTotalKills(void)
|
void CKillMgr::CountTotalKills(void)
|
||||||
{
|
{
|
||||||
TotalKills = 0;
|
TotalKills = 0;
|
||||||
int nSprite;
|
BloodStatIterator it(kStatDude);
|
||||||
StatIterator it(kStatDude);
|
while (auto actor = it.Next())
|
||||||
while ((nSprite = it.NextIndex()) >= 0)
|
|
||||||
{
|
{
|
||||||
spritetype* pSprite = &sprite[nSprite];
|
spritetype* pSprite = &actor->s();
|
||||||
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
|
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
|
||||||
I_Error("Non-enemy sprite (%d) in the enemy sprite list.", nSprite);
|
I_Error("Non-enemy sprite (%d) in the enemy sprite list.", actor->GetIndex());
|
||||||
if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent)
|
if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent)
|
||||||
TotalKills++;
|
TotalKills++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2526,85 +2526,98 @@ void trPlayerCtrlUsePowerup(DBloodActor* sourceactor, PLAYER* pPlayer, int evCmd
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void useObjResizer(XSPRITE* pXSource, short objType, int objIndex) {
|
//---------------------------------------------------------------------------
|
||||||
switch (objType) {
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void useObjResizer(DBloodActor* sourceactor, int targType, int targIndex, DBloodActor* targetactor)
|
||||||
|
{
|
||||||
|
auto pXSource = &sourceactor->x();
|
||||||
|
switch (targType)
|
||||||
|
{
|
||||||
// for sectors
|
// for sectors
|
||||||
case 6:
|
case OBJ_SECTOR:
|
||||||
if (valueIsBetween(pXSource->data1, -1, 32767))
|
if (valueIsBetween(pXSource->data1, -1, 32767))
|
||||||
sector[objIndex].floorxpan_ = (float)ClipRange(pXSource->data1, 0, 255);
|
sector[targIndex].floorxpan_ = (float)ClipRange(pXSource->data1, 0, 255);
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data2, -1, 32767))
|
if (valueIsBetween(pXSource->data2, -1, 32767))
|
||||||
sector[objIndex].floorypan_ = (float)ClipRange(pXSource->data2, 0, 255);
|
sector[targIndex].floorypan_ = (float)ClipRange(pXSource->data2, 0, 255);
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data3, -1, 32767))
|
if (valueIsBetween(pXSource->data3, -1, 32767))
|
||||||
sector[objIndex].ceilingxpan_ = (float)ClipRange(pXSource->data3, 0, 255);
|
sector[targIndex].ceilingxpan_ = (float)ClipRange(pXSource->data3, 0, 255);
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data4, -1, 65535))
|
if (valueIsBetween(pXSource->data4, -1, 65535))
|
||||||
sector[objIndex].ceilingypan_ = (float)ClipRange(pXSource->data4, 0, 255);
|
sector[targIndex].ceilingypan_ = (float)ClipRange(pXSource->data4, 0, 255);
|
||||||
break;
|
break;
|
||||||
// for sprites
|
// for sprites
|
||||||
case OBJ_SPRITE: {
|
case OBJ_SPRITE:
|
||||||
|
{
|
||||||
bool fit = false;
|
bool fit = false;
|
||||||
|
auto pTarget = &targetactor->s();
|
||||||
// resize by seq scaling
|
// resize by seq scaling
|
||||||
if (sprite[pXSource->reference].flags & kModernTypeFlag1) {
|
if (sourceactor->s().flags & kModernTypeFlag1)
|
||||||
|
{
|
||||||
if (valueIsBetween(pXSource->data1, -255, 32767)) {
|
if (valueIsBetween(pXSource->data1, -255, 32767))
|
||||||
|
{
|
||||||
int mulDiv = (valueIsBetween(pXSource->data2, 0, 257)) ? pXSource->data2 : 256;
|
int mulDiv = (valueIsBetween(pXSource->data2, 0, 257)) ? pXSource->data2 : 256;
|
||||||
if (pXSource->data1 > 0) xsprite[sprite[objIndex].extra].scale = mulDiv * ClipHigh(pXSource->data1, 25);
|
if (pXSource->data1 > 0) targetactor->x().scale = mulDiv * ClipHigh(pXSource->data1, 25);
|
||||||
else if (pXSource->data1 < 0) xsprite[sprite[objIndex].extra].scale = mulDiv / ClipHigh(abs(pXSource->data1), 25);
|
else if (pXSource->data1 < 0) targetactor->x().scale = mulDiv / ClipHigh(abs(pXSource->data1), 25);
|
||||||
else xsprite[sprite[objIndex].extra].scale = 0;
|
else targetactor->x().scale = 0;
|
||||||
fit = true;
|
fit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// resize by repeats
|
// resize by repeats
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
if (valueIsBetween(pXSource->data1, -1, 32767)) {
|
{
|
||||||
sprite[objIndex].xrepeat = ClipRange(pXSource->data1, 0, 255);
|
if (valueIsBetween(pXSource->data1, -1, 32767))
|
||||||
|
{
|
||||||
|
pTarget->xrepeat = ClipRange(pXSource->data1, 0, 255);
|
||||||
fit = true;
|
fit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data2, -1, 32767)) {
|
if (valueIsBetween(pXSource->data2, -1, 32767))
|
||||||
sprite[objIndex].yrepeat = ClipRange(pXSource->data2, 0, 255);
|
{
|
||||||
|
pTarget->yrepeat = ClipRange(pXSource->data2, 0, 255);
|
||||||
fit = true;
|
fit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fit && (sprite[objIndex].type == kDudeModernCustom || sprite[objIndex].type == kDudeModernCustomBurning)) {
|
if (fit && (pTarget->type == kDudeModernCustom || pTarget->type == kDudeModernCustomBurning))
|
||||||
|
{
|
||||||
// request properties update for custom dude
|
// request properties update for custom dude
|
||||||
gGenDudeExtra[objIndex].updReq[kGenDudePropertySpriteSize] = true;
|
|
||||||
gGenDudeExtra[objIndex].updReq[kGenDudePropertyAttack] = true;
|
targetactor->genDudeExtra().updReq[kGenDudePropertySpriteSize] = true;
|
||||||
gGenDudeExtra[objIndex].updReq[kGenDudePropertyMass] = true;
|
targetactor->genDudeExtra().updReq[kGenDudePropertyAttack] = true;
|
||||||
gGenDudeExtra[objIndex].updReq[kGenDudePropertyDmgScale] = true;
|
targetactor->genDudeExtra().updReq[kGenDudePropertyMass] = true;
|
||||||
evPostActor(&bloodActors[objIndex], kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
|
targetactor->genDudeExtra().updReq[kGenDudePropertyDmgScale] = true;
|
||||||
|
evPostActor(targetactor, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data3, -1, 32767))
|
if (valueIsBetween(pXSource->data3, -1, 32767))
|
||||||
sprite[objIndex].xoffset = ClipRange(pXSource->data3, 0, 255);
|
pTarget->xoffset = ClipRange(pXSource->data3, 0, 255);
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data4, -1, 65535))
|
if (valueIsBetween(pXSource->data4, -1, 65535))
|
||||||
sprite[objIndex].yoffset = ClipRange(pXSource->data4, 0, 255);
|
pTarget->yoffset = ClipRange(pXSource->data4, 0, 255);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OBJ_WALL:
|
case OBJ_WALL:
|
||||||
if (valueIsBetween(pXSource->data1, -1, 32767))
|
if (valueIsBetween(pXSource->data1, -1, 32767))
|
||||||
wall[objIndex].xrepeat = ClipRange(pXSource->data1, 0, 255);
|
wall[targIndex].xrepeat = ClipRange(pXSource->data1, 0, 255);
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data2, -1, 32767))
|
if (valueIsBetween(pXSource->data2, -1, 32767))
|
||||||
wall[objIndex].yrepeat = ClipRange(pXSource->data2, 0, 255);
|
wall[targIndex].yrepeat = ClipRange(pXSource->data2, 0, 255);
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data3, -1, 32767))
|
if (valueIsBetween(pXSource->data3, -1, 32767))
|
||||||
wall[objIndex].xpan_ = (float)ClipRange(pXSource->data3, 0, 255);
|
wall[targIndex].xpan_ = (float)ClipRange(pXSource->data3, 0, 255);
|
||||||
|
|
||||||
if (valueIsBetween(pXSource->data4, -1, 65535))
|
if (valueIsBetween(pXSource->data4, -1, 65535))
|
||||||
wall[objIndex].ypan_ = (float)ClipRange(pXSource->data4, 0, 255);
|
wall[targIndex].ypan_ = (float)ClipRange(pXSource->data4, 0, 255);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -4617,6 +4630,7 @@ void modernTypeSendCommand(int nSprite, int destChannel, COMMAND_ID command) {
|
||||||
void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
||||||
|
|
||||||
if (event.type != OBJ_SPRITE || !event.actor || !event.actor->hasX()) return;
|
if (event.type != OBJ_SPRITE || !event.actor || !event.actor->hasX()) return;
|
||||||
|
auto destactor = destObjType == OBJ_SPRITE? &bloodActors[destObjIndex] : nullptr;
|
||||||
spritetype* pSource = &event.actor->s();
|
spritetype* pSource = &event.actor->s();
|
||||||
XSPRITE* pXSource = &event.actor->x();
|
XSPRITE* pXSource = &event.actor->x();
|
||||||
|
|
||||||
|
@ -4700,7 +4714,7 @@ void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
||||||
break;
|
break;
|
||||||
// size and pan changer of sprite/wall/sector via TX ID
|
// size and pan changer of sprite/wall/sector via TX ID
|
||||||
case kModernObjSizeChanger:
|
case kModernObjSizeChanger:
|
||||||
useObjResizer(pXSource, destObjType, destObjIndex);
|
useObjResizer(event.actor, destObjType, destObjIndex, destactor);
|
||||||
break;
|
break;
|
||||||
// iterate data filed value of destination object
|
// iterate data filed value of destination object
|
||||||
case kModernObjDataAccumulator:
|
case kModernObjDataAccumulator:
|
||||||
|
|
Loading…
Reference in a new issue