mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-21 11:11:16 +00:00
- Initial SetOwner WIP.
This commit is contained in:
parent
ae874275ec
commit
119d4393db
6 changed files with 29 additions and 34 deletions
|
@ -494,7 +494,6 @@ int DoGenerateSewerDebris(DSWActor* actor)
|
|||
{
|
||||
SPRITEp sp = &actor->s();
|
||||
USERp u = actor->u();
|
||||
short n;
|
||||
|
||||
static STATEp Debris[] =
|
||||
{
|
||||
|
@ -510,9 +509,9 @@ int DoGenerateSewerDebris(DSWActor* actor)
|
|||
{
|
||||
u->Tics = u->WaitTics;
|
||||
|
||||
n = SpawnSprite(STAT_DEAD_ACTOR, 0, Debris[RANDOM_P2(4<<8)>>8], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 200);
|
||||
auto spawned = SpawnActor(STAT_DEAD_ACTOR, 0, Debris[RANDOM_P2(4<<8)>>8], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 200);
|
||||
|
||||
SetOwner(u->SpriteNum, n);
|
||||
SetOwner(actor, spawned);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1938,7 +1938,9 @@ int move_missile(int spritenum, int xchange, int ychange, int zchange, int ceild
|
|||
int DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets);
|
||||
|
||||
void change_sprite_stat(short, short);
|
||||
void SetOwner(short, short);
|
||||
void SetOwner(DSWActor*, DSWActor*);
|
||||
void SetOwner(int a, int b); // we still need this...
|
||||
void ClearOwner(DSWActor* ownr);
|
||||
void SetAttach(short, short);
|
||||
void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, int camang);
|
||||
void ChangeState(short SpriteNum, STATEp statep);
|
||||
|
|
|
@ -312,7 +312,6 @@ SpawnMidSplash(short SpriteNum)
|
|||
np = &sprite[New];
|
||||
nu = User[New].Data();
|
||||
|
||||
//SetOwner(Weapon, New);
|
||||
np->shade = -12;
|
||||
np->xrepeat = 70-RandomRange(20);
|
||||
np->yrepeat = 70-RandomRange(20);
|
||||
|
@ -346,7 +345,6 @@ SpawnFloorSplash(short SpriteNum)
|
|||
np = &sprite[New];
|
||||
nu = User[New].Data();
|
||||
|
||||
//SetOwner(Weapon, New);
|
||||
np->shade = -12;
|
||||
np->xrepeat = 70-RandomRange(20);
|
||||
np->yrepeat = 70-RandomRange(20);
|
||||
|
|
|
@ -583,29 +583,28 @@ STATE s_IconFlag[] =
|
|||
{ICON_FLAG + 2, 32, DoGet, &s_IconFlag[0]}
|
||||
};
|
||||
|
||||
void
|
||||
SetOwner(short owner, short child)
|
||||
void SetOwner(DSWActor* ownr, DSWActor* child)
|
||||
{
|
||||
SPRITEp cp = &sprite[child];
|
||||
SPRITEp cp = &child->s();
|
||||
|
||||
if (owner == 0)
|
||||
if (ownr != nullptr && ownr->hasU())
|
||||
{
|
||||
////DSPRINTF(ds, "Set Owner possible problem - owner is 0, child %d", child);
|
||||
//MONO_PRINT(ds);
|
||||
SET(ownr->u()->Flags2, SPR2_CHILDREN);
|
||||
}
|
||||
|
||||
if (owner >= 0)
|
||||
{
|
||||
ASSERT(User[owner].Data());
|
||||
SET(User[owner]->Flags2, SPR2_CHILDREN);
|
||||
}
|
||||
else
|
||||
{
|
||||
////DSPRINTF(ds,"Owner is -1 !!!!!!!!!!!!!!!!!!!!!");
|
||||
//MONO_PRINT(ds);
|
||||
}
|
||||
cp->owner = ownr? ownr->GetSpriteIndex() : -1;
|
||||
}
|
||||
|
||||
cp->owner = owner;
|
||||
|
||||
void ClearOwner(DSWActor* child)
|
||||
{
|
||||
if (child) child->s().owner = -1;
|
||||
}
|
||||
|
||||
void SetOwner(int a, int b)
|
||||
{
|
||||
if (a >= 0 && b >= 0) SetOwner(&swActors[a], &swActors[b]);
|
||||
else if (b >= 0) ClearOwner(&swActors[b]);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1001,6 +1000,13 @@ SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int
|
|||
return SpriteNum;
|
||||
}
|
||||
|
||||
DSWActor* SpawnActor(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel)
|
||||
{
|
||||
int s = SpawnSprite(stat, id, state, sectnum, x, y, z, ang, vel);
|
||||
return s >= 0 ? &swActors[s] : nullptr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PicAnimOff(short picnum)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@ BEGIN_SW_NS
|
|||
|
||||
void KillSprite(int16_t SpriteNum);
|
||||
int16_t SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel);
|
||||
DSWActor* SpawnActor(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel);
|
||||
void SpriteSetup(void);
|
||||
int move_actor(short SpriteNum, int xchange, int ychange, int zchange);
|
||||
short GetSpriteDir(short sn);
|
||||
|
|
|
@ -30,17 +30,6 @@ public:
|
|||
spritetype& s() { return sprite[index]; }
|
||||
USER* u() { return User[index].Data(); }
|
||||
|
||||
void SetOwner(DSWActor* own)
|
||||
{
|
||||
s().owner = own ? own->s().index : -1;
|
||||
}
|
||||
|
||||
DSWActor* GetOwner()
|
||||
{
|
||||
if (s().owner == -1 || s().owner == MAXSPRITES - 1) return nullptr;
|
||||
return base() + s().owner;
|
||||
}
|
||||
|
||||
int GetSpriteIndex() const
|
||||
{
|
||||
return index;
|
||||
|
|
Loading…
Reference in a new issue