mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-22 11:41:08 +00:00
- flag stuff.
This commit is contained in:
parent
3e91ac6417
commit
e9fc342c93
1 changed files with 27 additions and 45 deletions
|
@ -2003,15 +2003,9 @@ int InitBloodSpray(DSWActor* actor, bool dogib, short velocity)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int BloodSprayFall(DSWActor* actor)
|
||||||
BloodSprayFall(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
actor->s().z += 1500;
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
|
|
||||||
sp->z += 1500;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2025,16 +2019,14 @@ BloodSprayFall(DSWActor* actor)
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Update the scoreboard for team color that just scored.
|
// Update the scoreboard for team color that just scored.
|
||||||
void
|
void DoFlagScore(int16_t pal)
|
||||||
DoFlagScore(int16_t pal)
|
|
||||||
{
|
{
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
int SpriteNum;
|
|
||||||
|
|
||||||
StatIterator it(STAT_DEFAULT);
|
SWStatIterator it(STAT_DEFAULT);
|
||||||
while ((SpriteNum = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[SpriteNum];
|
sp = &actor->s();
|
||||||
|
|
||||||
if (sp->picnum < 1900 || sp->picnum > 1999)
|
if (sp->picnum < 1900 || sp->picnum > 1999)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2048,30 +2040,28 @@ DoFlagScore(int16_t pal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
DSWActor* DoFlagRangeTest(DSWActor* actor, int range)
|
||||||
DoFlagRangeTest(short Weapon, short range)
|
|
||||||
{
|
{
|
||||||
SPRITEp wp = &sprite[Weapon];
|
SPRITEp wp = &actor->s();
|
||||||
|
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
int i;
|
|
||||||
unsigned int stat;
|
unsigned int stat;
|
||||||
int dist, tx, ty;
|
int dist, tx, ty;
|
||||||
int tmin;
|
int tmin;
|
||||||
|
|
||||||
for (stat = 0; stat < SIZ(StatDamageList); stat++)
|
for (stat = 0; stat < SIZ(StatDamageList); stat++)
|
||||||
{
|
{
|
||||||
StatIterator it(StatDamageList[stat]);
|
SWStatIterator it(StatDamageList[stat]);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[i];
|
sp = &itActor->s();
|
||||||
|
|
||||||
|
|
||||||
DISTANCE(sp->x, sp->y, wp->x, wp->y, dist, tx, ty, tmin);
|
DISTANCE(sp->x, sp->y, wp->x, wp->y, dist, tx, ty, tmin);
|
||||||
if (dist > range)
|
if (dist > range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sp == wp)
|
if (actor == itActor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!TEST(sp->cstat, CSTAT_SPRITE_BLOCK))
|
if (!TEST(sp->cstat, CSTAT_SPRITE_BLOCK))
|
||||||
|
@ -2087,16 +2077,14 @@ DoFlagRangeTest(short Weapon, short range)
|
||||||
if (dist > range)
|
if (dist > range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return i; // Return the spritenum
|
return itActor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1; // -1 for no sprite index. Not
|
return nullptr;
|
||||||
// found.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoCarryFlag(DSWActor* actor)
|
||||||
DoCarryFlag(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
SPRITEp sp = &actor->s();
|
SPRITEp sp = &actor->s();
|
||||||
|
@ -2321,11 +2309,10 @@ DoCarryFlagNoDet(DSWActor* actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int SetCarryFlag(DSWActor* actor)
|
||||||
SetCarryFlag(int16_t Weapon)
|
|
||||||
{
|
{
|
||||||
SPRITEp sp = &sprite[Weapon];
|
SPRITEp sp = &actor->s();
|
||||||
USERp u = User[Weapon].Data();
|
USERp u = actor->u();
|
||||||
|
|
||||||
// stuck
|
// stuck
|
||||||
SET(u->Flags, SPR_BOUNCE);
|
SET(u->Flags, SPR_BOUNCE);
|
||||||
|
@ -2334,31 +2321,27 @@ SetCarryFlag(int16_t Weapon)
|
||||||
// u->WaitTics = SEC(3);
|
// u->WaitTics = SEC(3);
|
||||||
SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
SET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
u->Counter = 0;
|
u->Counter = 0;
|
||||||
change_sprite_stat(Weapon, STAT_ITEM);
|
change_actor_stat(actor, STAT_ITEM);
|
||||||
if (sp->hitag == 1)
|
if (sp->hitag == 1)
|
||||||
ChangeSpriteState(Weapon, s_CarryFlagNoDet);
|
ChangeState(actor, s_CarryFlagNoDet);
|
||||||
else
|
else
|
||||||
ChangeSpriteState(Weapon, s_CarryFlag);
|
ChangeState(actor, s_CarryFlag);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoFlag(DSWActor* actor)
|
||||||
DoFlag(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int Weapon = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[Weapon];
|
|
||||||
int16_t hit_sprite = -1;
|
|
||||||
|
|
||||||
hit_sprite = DoFlagRangeTest(Weapon, 1000);
|
auto hitActor = DoFlagRangeTest(actor, 1000);
|
||||||
|
|
||||||
if (hit_sprite != -1)
|
if (hitActor)
|
||||||
{
|
{
|
||||||
auto hitActor = &swActors[hit_sprite];
|
SPRITEp hsp = &hitActor->s();
|
||||||
SPRITEp hsp = &sprite[hit_sprite];
|
|
||||||
|
|
||||||
SetCarryFlag(Weapon);
|
SetCarryFlag(actor);
|
||||||
|
|
||||||
// check to see if sprite is player or enemy
|
// check to see if sprite is player or enemy
|
||||||
if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY))
|
if (TEST(hsp->extra, SPRX_PLAYER_OR_ENEMY))
|
||||||
|
@ -2367,7 +2350,6 @@ DoFlag(DSWActor* actor)
|
||||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
SetAttach(hitActor, actor);
|
SetAttach(hitActor, actor);
|
||||||
u->sz = hsp->z - DIV2(SPRITEp_SIZE_Z(hsp));
|
u->sz = hsp->z - DIV2(SPRITEp_SIZE_Z(hsp));
|
||||||
//u->sz = hsp->z - SPRITEp_MID(hsp); // Set mid way up who it hit
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue