mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 16:10:52 +00:00
- SW: first batch of spr.pos wraps.
This commit is contained in:
parent
43bd8acb31
commit
871f0c4ec6
8 changed files with 49 additions and 48 deletions
|
@ -293,9 +293,10 @@ void validateSprite(spritetype& spr, int sectnum, int index)
|
||||||
|
|
||||||
static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)
|
static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)
|
||||||
{
|
{
|
||||||
spr.pos.X = fr.ReadInt32();
|
int x = fr.ReadInt32();
|
||||||
spr.pos.Y = fr.ReadInt32();
|
int y = fr.ReadInt32();
|
||||||
spr.pos.Z = fr.ReadInt32();
|
int z = fr.ReadInt32();
|
||||||
|
spr.SetMapPos(x, y, z);
|
||||||
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
|
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
|
||||||
spr.picnum = fr.ReadInt16();
|
spr.picnum = fr.ReadInt16();
|
||||||
spr.shade = fr.ReadInt8();
|
spr.shade = fr.ReadInt8();
|
||||||
|
@ -321,9 +322,10 @@ static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)
|
||||||
|
|
||||||
static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno)
|
static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno)
|
||||||
{
|
{
|
||||||
spr.pos.X = fr.ReadInt32();
|
int x = fr.ReadInt32();
|
||||||
spr.pos.Y = fr.ReadInt32();
|
int y = fr.ReadInt32();
|
||||||
spr.pos.Z = fr.ReadInt32();
|
int z = fr.ReadInt32();
|
||||||
|
spr.SetMapPos(x, y, z);
|
||||||
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
|
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
|
||||||
spr.shade = fr.ReadInt8();
|
spr.shade = fr.ReadInt8();
|
||||||
spr.pal = fr.ReadUInt8();
|
spr.pal = fr.ReadUInt8();
|
||||||
|
@ -351,9 +353,10 @@ static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno)
|
||||||
|
|
||||||
static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno)
|
static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno)
|
||||||
{
|
{
|
||||||
spr.pos.X = fr.ReadInt32();
|
int x = fr.ReadInt32();
|
||||||
spr.pos.Y = fr.ReadInt32();
|
int y = fr.ReadInt32();
|
||||||
spr.pos.Z = fr.ReadInt32();
|
int z = fr.ReadInt32();
|
||||||
|
spr.SetMapPos(x, y, z);
|
||||||
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
|
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
|
||||||
spr.shade = fr.ReadInt8();
|
spr.shade = fr.ReadInt8();
|
||||||
spr.xrepeat = fr.ReadUInt8();
|
spr.xrepeat = fr.ReadUInt8();
|
||||||
|
|
|
@ -470,6 +470,11 @@ struct spritetypebase
|
||||||
uint8_t yrepeat;
|
uint8_t yrepeat;
|
||||||
int8_t xoffset;
|
int8_t xoffset;
|
||||||
int8_t yoffset;
|
int8_t yoffset;
|
||||||
|
|
||||||
|
void SetMapPos(int x, int y, int z)
|
||||||
|
{
|
||||||
|
pos = { x, y, z };
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -514,7 +514,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
||||||
// was swimming but have now stopped
|
// was swimming but have now stopped
|
||||||
actor->user.Flags &= ~(SPR_SWIMMING);
|
actor->user.Flags &= ~(SPR_SWIMMING);
|
||||||
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
|
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
|
||||||
actor->user.oz = actor->spr.pos.Z = actor->user.loz;
|
actor->spr.pos.Z = actor->user.oz = actor->user.loz;
|
||||||
actor->backupz();
|
actor->backupz();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// are swimming
|
// are swimming
|
||||||
actor->user.oz = actor->spr.pos.Z = actor->user.loz - Z(depth);
|
actor->spr.pos.Z = actor->user.oz = actor->user.loz - Z(depth);
|
||||||
actor->backupz();
|
actor->backupz();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -534,7 +534,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
||||||
if (actor->user.Rot == actor->user.ActorActionSet->Run || actor->user.Rot == actor->user.ActorActionSet->Swim)
|
if (actor->user.Rot == actor->user.ActorActionSet->Run || actor->user.Rot == actor->user.ActorActionSet->Swim)
|
||||||
{
|
{
|
||||||
NewStateGroup(actor, actor->user.ActorActionSet->Swim);
|
NewStateGroup(actor, actor->user.ActorActionSet->Swim);
|
||||||
actor->user.oz = actor->spr.pos.Z = actor->user.loz - Z(depth);
|
actor->spr.pos.Z = actor->user.oz = actor->user.loz - Z(depth);
|
||||||
actor->backupz();
|
actor->backupz();
|
||||||
actor->user.Flags |= (SPR_SWIMMING);
|
actor->user.Flags |= (SPR_SWIMMING);
|
||||||
actor->spr.cstat |= (CSTAT_SPRITE_YCENTER);
|
actor->spr.cstat |= (CSTAT_SPRITE_YCENTER);
|
||||||
|
@ -543,7 +543,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
||||||
{
|
{
|
||||||
actor->user.Flags &= ~(SPR_SWIMMING);
|
actor->user.Flags &= ~(SPR_SWIMMING);
|
||||||
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
|
actor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
|
||||||
actor->user.oz = actor->spr.pos.Z = actor->user.loz;
|
actor->spr.pos.Z = actor->user.oz = actor->user.loz;
|
||||||
actor->backupz();
|
actor->backupz();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,7 +558,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
||||||
#if 1
|
#if 1
|
||||||
if (actor->user.Flags & (SPR_MOVED))
|
if (actor->user.Flags & (SPR_MOVED))
|
||||||
{
|
{
|
||||||
actor->user.oz = actor->spr.pos.Z = actor->user.loz;
|
actor->spr.pos.Z = actor->user.oz = actor->user.loz;
|
||||||
actor->backupz();
|
actor->backupz();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -568,7 +568,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
||||||
FAFgetzrangepoint(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->sector(),
|
FAFgetzrangepoint(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->sector(),
|
||||||
&ceilz, &ctrash, &florz, &ftrash);
|
&ceilz, &ctrash, &florz, &ftrash);
|
||||||
|
|
||||||
actor->user.oz = actor->spr.pos.Z = florz;
|
actor->spr.pos.Z = actor->user.oz = florz;
|
||||||
actor->backupz();
|
actor->backupz();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1366,9 +1366,7 @@ Collision move_scan(DSWActor* actor, int ang, int dist, int *stopx, int *stopy,
|
||||||
*stopz = actor->spr.pos.Z;
|
*stopz = actor->spr.pos.Z;
|
||||||
|
|
||||||
// reset position information
|
// reset position information
|
||||||
actor->spr.pos.X = x;
|
actor->set_int_pos({ x, y, z });
|
||||||
actor->spr.pos.Y = y;
|
|
||||||
actor->spr.pos.Z = z;
|
|
||||||
actor->spr.ang = sang;
|
actor->spr.ang = sang;
|
||||||
actor->user.loz = loz;
|
actor->user.loz = loz;
|
||||||
actor->user.hiz = hiz;
|
actor->user.hiz = hiz;
|
||||||
|
|
|
@ -1024,8 +1024,7 @@ int DoBunnyQuickJump(DSWActor* actor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actor->spr.pos.X = hitActor->spr.pos.X; // Mount up little bunny
|
actor->set_int_xy(hitActor->spr.pos.X, hitActor->spr.pos.Y);
|
||||||
actor->spr.pos.Y = hitActor->spr.pos.Y;
|
|
||||||
actor->spr.ang = hitActor->spr.ang;
|
actor->spr.ang = hitActor->spr.ang;
|
||||||
actor->spr.ang = NORM_ANGLE(actor->spr.ang + 1024);
|
actor->spr.ang = NORM_ANGLE(actor->spr.ang + 1024);
|
||||||
HelpMissileLateral(actor, 2000);
|
HelpMissileLateral(actor, 2000);
|
||||||
|
@ -1169,9 +1168,7 @@ DSWActor* BunnyHatch2(DSWActor* actor)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto actorNew = insertActor(actor->sector(), STAT_DEFAULT);
|
auto actorNew = insertActor(actor->sector(), STAT_DEFAULT);
|
||||||
actorNew->spr.pos.X = actor->spr.pos.X;
|
actorNew->set_int_pos(actor->spr.pos);
|
||||||
actorNew->spr.pos.Y = actor->spr.pos.Y;
|
|
||||||
actorNew->spr.pos.Z = actor->spr.pos.Z;
|
|
||||||
actorNew->spr.xrepeat = 30; // Baby size
|
actorNew->spr.xrepeat = 30; // Baby size
|
||||||
actorNew->spr.yrepeat = 24;
|
actorNew->spr.yrepeat = 24;
|
||||||
actorNew->spr.ang = RANDOM_P2(2048);
|
actorNew->spr.ang = RANDOM_P2(2048);
|
||||||
|
|
|
@ -173,8 +173,7 @@ void CopySectorMatch(int match)
|
||||||
src_yoff = sy - itActor->spr.pos.Y;
|
src_yoff = sy - itActor->spr.pos.Y;
|
||||||
|
|
||||||
// move sprite to dest sector
|
// move sprite to dest sector
|
||||||
itActor->spr.pos.X = dx - src_xoff;
|
itActor->set_int_xy(dx - src_xoff, dy - src_yoff);
|
||||||
itActor->spr.pos.Y = dy - src_yoff;
|
|
||||||
|
|
||||||
// change sector
|
// change sector
|
||||||
ChangeActorSect(itActor, dsectp);
|
ChangeActorSect(itActor, dsectp);
|
||||||
|
|
|
@ -445,8 +445,7 @@ int DoBloodSpray(DSWActor* actor)
|
||||||
|
|
||||||
actor->spr.xvel = actor->spr.yvel = actor->user.change.X = actor->user.change.Y = 0;
|
actor->spr.xvel = actor->spr.yvel = actor->user.change.X = actor->user.change.Y = 0;
|
||||||
actor->spr.xrepeat = actor->spr.yrepeat = 70 - RandomRange(25);
|
actor->spr.xrepeat = actor->spr.yrepeat = 70 - RandomRange(25);
|
||||||
actor->spr.pos.X = bldActor->spr.pos.X;
|
actor->set_int_xy(bldActor->spr.pos.X, bldActor->spr.pos.Y);
|
||||||
actor->spr.pos.Y = bldActor->spr.pos.Y;
|
|
||||||
|
|
||||||
// !FRANK! bit of a hack
|
// !FRANK! bit of a hack
|
||||||
// yvel is the hit_wall
|
// yvel is the hit_wall
|
||||||
|
|
|
@ -1738,8 +1738,7 @@ void UpdatePlayerSprite(PLAYER* pp)
|
||||||
|
|
||||||
// Update sprite representation of player
|
// Update sprite representation of player
|
||||||
|
|
||||||
actor->spr.pos.X = pp->pos.X;
|
actor->set_int_xy(pp->pos.X, pp->pos.Y);
|
||||||
actor->spr.pos.Y = pp->pos.Y;
|
|
||||||
|
|
||||||
// there are multiple death functions
|
// there are multiple death functions
|
||||||
if (pp->Flags & (PF_DEAD))
|
if (pp->Flags & (PF_DEAD))
|
||||||
|
@ -3194,27 +3193,29 @@ void DoPlayerClimb(PLAYER* pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// sprite
|
// sprite
|
||||||
if (plActor->spr.pos.X != plActor->user.pos.X)
|
auto pos = plActor->int_pos();
|
||||||
|
if (pos.X != plActor->user.pos.X)
|
||||||
{
|
{
|
||||||
if (plActor->spr.pos.X < plActor->user.pos.X)
|
if (pos.X < plActor->user.pos.X)
|
||||||
plActor->spr.pos.X += ADJ_AMT;
|
pos.X += ADJ_AMT;
|
||||||
else if (plActor->spr.pos.X > plActor->user.pos.X)
|
else if (pos.X > plActor->user.pos.X)
|
||||||
plActor->spr.pos.X -= ADJ_AMT;
|
pos.X -= ADJ_AMT;
|
||||||
|
|
||||||
if (labs(plActor->spr.pos.X - plActor->user.pos.X) <= ADJ_AMT)
|
if (labs(pos.X - plActor->user.pos.X) <= ADJ_AMT)
|
||||||
plActor->spr.pos.X = plActor->user.pos.X;
|
pos.X = plActor->user.pos.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plActor->spr.pos.Y != plActor->user.pos.Y)
|
if (pos.Y != plActor->user.pos.Y)
|
||||||
{
|
{
|
||||||
if (plActor->spr.pos.Y < plActor->user.pos.Y)
|
if (pos.Y < plActor->user.pos.Y)
|
||||||
plActor->spr.pos.Y += ADJ_AMT;
|
pos.Y += ADJ_AMT;
|
||||||
else if (plActor->spr.pos.Y > plActor->user.pos.Y)
|
else if (pos.Y > plActor->user.pos.Y)
|
||||||
plActor->spr.pos.Y -= ADJ_AMT;
|
pos.Y -= ADJ_AMT;
|
||||||
|
|
||||||
if (labs(plActor->spr.pos.Y - plActor->user.pos.Y) <= ADJ_AMT)
|
if (labs(pos.Y - plActor->user.pos.Y) <= ADJ_AMT)
|
||||||
plActor->spr.pos.Y = plActor->user.pos.Y;
|
pos.Y = plActor->user.pos.Y;
|
||||||
}
|
}
|
||||||
|
plActor->set_int_pos(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5748,9 +5749,7 @@ void DoPlayerDeathCheckKeys(PLAYER* pp)
|
||||||
plActor->spr.picnum = plActor->user.State->Pic;
|
plActor->spr.picnum = plActor->user.State->Pic;
|
||||||
plActor->spr.xrepeat = plActor->spr.yrepeat = PLAYER_NINJA_XREPEAT;
|
plActor->spr.xrepeat = plActor->spr.yrepeat = PLAYER_NINJA_XREPEAT;
|
||||||
plActor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
|
plActor->spr.cstat &= ~(CSTAT_SPRITE_YCENTER);
|
||||||
plActor->spr.pos.X = pp->pos.X;
|
plActor->set_int_pos({ pp->pos.X, pp->pos.Y, pp->pos.Z + PLAYER_HEIGHT });
|
||||||
plActor->spr.pos.Y = pp->pos.Y;
|
|
||||||
plActor->spr.pos.Z = pp->pos.Z+PLAYER_HEIGHT;
|
|
||||||
plActor->spr.ang = pp->angle.ang.asbuild();
|
plActor->spr.ang = pp->angle.ang.asbuild();
|
||||||
|
|
||||||
DoSpawnTeleporterEffect(plActor);
|
DoSpawnTeleporterEffect(plActor);
|
||||||
|
@ -5922,8 +5921,9 @@ void DoPlayerDeathMoveHead(PLAYER* pp)
|
||||||
{
|
{
|
||||||
pp->cursector = pp->lv_sector;
|
pp->cursector = pp->lv_sector;
|
||||||
ChangeActorSect(pp->actor, pp->lv_sector);
|
ChangeActorSect(pp->actor, pp->lv_sector);
|
||||||
pp->pos.X = plActor->spr.pos.X = pp->lv.X;
|
pp->pos.X = pp->lv.X;
|
||||||
pp->pos.Y = plActor->spr.pos.Y = pp->lv.Y;
|
pp->pos.Y = pp->lv.Y;
|
||||||
|
plActor->set_int_xy(pp->pos.X, pp->pos.Y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue