mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 08:00:56 +00:00
- FlagOwner refactoring.
Only those parts which use it as a sprite index, seveal actors recycle it as a general purpose variable.
This commit is contained in:
parent
e9fc342c93
commit
aef68363b4
4 changed files with 18 additions and 16 deletions
|
@ -1131,6 +1131,7 @@ struct USER
|
||||||
DSWActor* targetActor; // target player for the enemy - can only handle one player at at time
|
DSWActor* targetActor; // target player for the enemy - can only handle one player at at time
|
||||||
DSWActor* flameActor;
|
DSWActor* flameActor;
|
||||||
DSWActor* attachActor; // attach to sprite if needed - electro snake
|
DSWActor* attachActor; // attach to sprite if needed - electro snake
|
||||||
|
DSWActor* flagOwnerActor;
|
||||||
|
|
||||||
int Flags;
|
int Flags;
|
||||||
int Flags2;
|
int Flags2;
|
||||||
|
@ -1249,7 +1250,7 @@ struct USER
|
||||||
// !JIM! my extensions
|
// !JIM! my extensions
|
||||||
int ShellNum; // This is shell no. 0 to whatever
|
int ShellNum; // This is shell no. 0 to whatever
|
||||||
// Shell gets deleted when ShellNum < (ShellCount - MAXSHELLS)
|
// Shell gets deleted when ShellNum < (ShellCount - MAXSHELLS)
|
||||||
short FlagOwner; // The spritenum of the original flag
|
short FlagOwner; // The spritenum of the original flag (abused to hell by other things)
|
||||||
short Vis; // Shading upgrade, for shooting, etc...
|
short Vis; // Shading upgrade, for shooting, etc...
|
||||||
bool DidAlert; // Has actor done his alert noise before?
|
bool DidAlert; // Has actor done his alert noise before?
|
||||||
|
|
||||||
|
|
|
@ -2090,8 +2090,10 @@ int DoCarryFlag(DSWActor* actor)
|
||||||
SPRITEp sp = &actor->s();
|
SPRITEp sp = &actor->s();
|
||||||
|
|
||||||
const int FLAG_DETONATE_STATE = 99;
|
const int FLAG_DETONATE_STATE = 99;
|
||||||
SPRITEp fp = &sprite[u->FlagOwner];
|
auto fown = u->flagOwnerActor;
|
||||||
USERp fu = User[u->FlagOwner].Data();
|
if (!fown) return 0;
|
||||||
|
SPRITEp fp = &fown->s();
|
||||||
|
USERp fu = fown->u();
|
||||||
|
|
||||||
|
|
||||||
// if no owner then die
|
// if no owner then die
|
||||||
|
@ -2139,10 +2141,9 @@ int DoCarryFlag(DSWActor* actor)
|
||||||
if (sector[ap->sectnum].hitag == 9000 && sector[ap->sectnum].lotag == ap->pal
|
if (sector[ap->sectnum].hitag == 9000 && sector[ap->sectnum].lotag == ap->pal
|
||||||
&& ap->pal != sp->pal)
|
&& ap->pal != sp->pal)
|
||||||
{
|
{
|
||||||
if (u->FlagOwner >= 0)
|
if (fown != nullptr)
|
||||||
{
|
{
|
||||||
if (fp->lotag) // Trigger everything if there is a
|
if (fp->lotag) // Trigger everything if there is a lotag
|
||||||
// lotag
|
|
||||||
DoMatchEverything(nullptr, fp->lotag, ON);
|
DoMatchEverything(nullptr, fp->lotag, ON);
|
||||||
}
|
}
|
||||||
if (!TEST_BOOL1(fp))
|
if (!TEST_BOOL1(fp))
|
||||||
|
@ -2248,11 +2249,13 @@ DoCarryFlagNoDet(DSWActor* actor)
|
||||||
|
|
||||||
SPRITEp ap = &u->attachActor->s();
|
SPRITEp ap = &u->attachActor->s();
|
||||||
USERp au = u->attachActor->u();
|
USERp au = u->attachActor->u();
|
||||||
SPRITEp fp = &sprite[u->FlagOwner];
|
auto fown = u->flagOwnerActor;
|
||||||
USERp fu = User[u->FlagOwner].Data();
|
if (!fown) return 0;
|
||||||
|
SPRITEp fp = &fown->s();
|
||||||
|
USERp fu = fown->u();
|
||||||
|
|
||||||
|
|
||||||
if (u->FlagOwner >= 0)
|
if (u->flagOwnerActor != nullptr)
|
||||||
fu->WaitTics = 30 * 120; // Keep setting respawn tics so it
|
fu->WaitTics = 30 * 120; // Keep setting respawn tics so it
|
||||||
// won't respawn
|
// won't respawn
|
||||||
|
|
||||||
|
@ -2269,7 +2272,7 @@ DoCarryFlagNoDet(DSWActor* actor)
|
||||||
|
|
||||||
if (!au || au->Health <= 0)
|
if (!au || au->Health <= 0)
|
||||||
{
|
{
|
||||||
if (u->FlagOwner >= 0)
|
if (u->flagOwnerActor != nullptr)
|
||||||
fu->WaitTics = 0; // Tell it to respawn
|
fu->WaitTics = 0; // Tell it to respawn
|
||||||
SetSuicide(actor);
|
SetSuicide(actor);
|
||||||
return false;
|
return false;
|
||||||
|
@ -2279,12 +2282,9 @@ DoCarryFlagNoDet(DSWActor* actor)
|
||||||
if (sector[ap->sectnum].hitag == 9000 && sector[ap->sectnum].lotag == ap->pal
|
if (sector[ap->sectnum].hitag == 9000 && sector[ap->sectnum].lotag == ap->pal
|
||||||
&& ap->pal != sp->pal)
|
&& ap->pal != sp->pal)
|
||||||
{
|
{
|
||||||
if (u->FlagOwner >= 0)
|
if (u->flagOwnerActor != nullptr)
|
||||||
{
|
{
|
||||||
//DSPRINTF(ds, "Flag has owner %d, fp->lotag = %d", u->FlagOwner, fp->lotag);
|
if (fp->lotag) // Trigger everything if there is a lotag
|
||||||
//MONO_PRINT(ds);
|
|
||||||
if (fp->lotag) // Trigger everything if there is a
|
|
||||||
// lotag
|
|
||||||
DoMatchEverything(nullptr, fp->lotag, ON);
|
DoMatchEverything(nullptr, fp->lotag, ON);
|
||||||
fu->WaitTics = 0; // Tell it to respawn
|
fu->WaitTics = 0; // Tell it to respawn
|
||||||
}
|
}
|
||||||
|
|
|
@ -921,6 +921,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, USER& w, USER* def
|
||||||
("bounce", w.bounce, def->bounce)
|
("bounce", w.bounce, def->bounce)
|
||||||
("ShellNum", w.ShellNum, def->ShellNum)
|
("ShellNum", w.ShellNum, def->ShellNum)
|
||||||
("FlagOwner", w.FlagOwner, def->FlagOwner)
|
("FlagOwner", w.FlagOwner, def->FlagOwner)
|
||||||
|
("FlagOwnerActor", w.flagOwnerActor, def->flagOwnerActor)
|
||||||
("Vis", w.Vis, def->Vis)
|
("Vis", w.Vis, def->Vis)
|
||||||
("DidAlert", w.DidAlert, def->DidAlert)
|
("DidAlert", w.DidAlert, def->DidAlert)
|
||||||
("filler", w.filler, def->filler)
|
("filler", w.filler, def->filler)
|
||||||
|
|
|
@ -6461,7 +6461,7 @@ KeyMain:
|
||||||
nu->spal = np->pal = sp->pal; // Set the palette of the flag
|
nu->spal = np->pal = sp->pal; // Set the palette of the flag
|
||||||
|
|
||||||
SetOwner(pp->PlayerSprite,New); // Player now owns the flag
|
SetOwner(pp->PlayerSprite,New); // Player now owns the flag
|
||||||
nu->FlagOwner = SpriteNum; // Tell carried flag who owns it
|
nu->flagOwnerActor = actor; // Tell carried flag who owns it
|
||||||
KillGet(SpriteNum); // Set up for flag respawning
|
KillGet(SpriteNum); // Set up for flag respawning
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue