- sop::sp_child.

This commit is contained in:
Christoph Oelckers 2021-11-01 20:07:53 +01:00
parent b6c741892e
commit 0e37e0904e
4 changed files with 18 additions and 18 deletions

View file

@ -1693,7 +1693,7 @@ struct SECTOR_OBJECTstruct
soANIMATORp Animator;
SPRITEp controller;
SPRITEp sp_child; // child sprite that holds info for the sector object
DSWActor* sp_child; // child sprite that holds info for the sector object
union
{

View file

@ -2557,8 +2557,9 @@ void DoPlayerMoveVehicle(PLAYERp pp)
int z;
int floor_dist;
short save_sectnum;
SPRITEp sp = pp->sop->sp_child;
USERp u = User[sp - sprite].Data();
auto actor = pp->sop->sp_child;
SPRITEp sp = &actor->s();
USERp u = actor->u();
int save_cstat;
int x[4], y[4], ox[4], oy[4];
int wallcount;
@ -5015,7 +5016,7 @@ void DoPlayerBeginOperate(PLAYERp pp)
if (pp->InventoryAmount[INVENTORY_REPAIR_KIT])
{
UseInventoryRepairKit(pp);
sop->max_damage = User[sop->sp_child - sprite]->MaxHealth;
sop->max_damage = sop->sp_child->u()->MaxHealth;
VehicleSetSmoke(sop, nullptr);
RESET(sop->flags, SOBJ_BROKEN);
}
@ -5102,7 +5103,7 @@ void DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
if (pp->InventoryAmount[INVENTORY_REPAIR_KIT])
{
UseInventoryRepairKit(pp);
sop->max_damage = User[sop->sp_child - sprite]->MaxHealth;
sop->max_damage = sop->sp_child->u()->MaxHealth;
VehicleSetSmoke(sop, nullptr);
RESET(sop->flags, SOBJ_BROKEN);
}

View file

@ -729,7 +729,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
bool FoundOutsideLoop = false;
bool SectorInBounds;
SECTORp *sectp;
USERp u = User[sop->sp_child - sprite].Data();
USERp u = sop->sp_child->u();
static unsigned char StatList[] =
{
@ -1123,10 +1123,10 @@ SetupSectorObject(short sectnum, short tag)
sop->track = HIGH_TAG(sectnum);
// spawn a sprite to make it easier to integrate with sprite routines
New = SpawnSprite(STAT_SO_SP_CHILD, 0, nullptr, sectnum,
auto actorNew = SpawnActor(STAT_SO_SP_CHILD, 0, nullptr, sectnum,
sop->xmid, sop->ymid, sop->zmid, 0, 0);
sop->sp_child = &sprite[New];
u = User[New].Data();
sop->sp_child = actorNew;
u = actorNew->u();
u->sop_parent = sop;
SET(u->Flags2, SPR2_SPRITE_FAKE_BLOCK); // for damage test
@ -1711,8 +1711,8 @@ MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny)
PlayerMove = false;
// move child sprite along also
sop->sp_child->x = sop->xmid;
sop->sp_child->y = sop->ymid;
sop->sp_child->s().x = sop->xmid;
sop->sp_child->s().y = sop->ymid;
//updatesector(sop->xmid, sop->ymid, &sop->sectnum);
@ -2923,10 +2923,9 @@ DoTornadoObject(SECTOR_OBJECTp sop)
void
DoAutoTurretObject(SECTOR_OBJECTp sop)
{
short SpriteNum = short(sop->sp_child - sprite);
auto actor = &swActors[SpriteNum];
auto actor = sop->sp_child;
SPRITEp shootp;
USERp u = User[SpriteNum].Data();
USERp u = actor->u();
short delta_ang;
int diff;
short i;

View file

@ -4500,7 +4500,7 @@ WeaponMoveHit(short SpriteNum)
if ((sop = DetectSectorObject(sectp)))
{
//if (sop->max_damage != -9999)
DoDamage(short(sop->sp_child - sprite), SpriteNum);
DoDamage(sop->sp_child->GetSpriteIndex(), SpriteNum);
return true;
}
}
@ -4613,7 +4613,7 @@ WeaponMoveHit(short SpriteNum)
if ((sop = DetectSectorObjectByWall(wph)))
{
if (sop->max_damage != -999)
DoDamage(short(sop->sp_child - sprite), SpriteNum);
DoDamage(sop->sp_child->GetSpriteIndex(), SpriteNum);
return true;
}
}
@ -5361,8 +5361,8 @@ ActorHealth(short SpriteNum, short amt)
int
SopDamage(SECTOR_OBJECTp sop, short amt)
{
SPRITEp sp = sop->sp_child;
USERp u = User[sp - sprite].Data();
SPRITEp sp = &sop->sp_child->s();
USERp u = sop->sp_child->u();
// does not have damage
if (sop->max_damage == -9999)