mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- floatified player_struct::pos.
This commit is contained in:
parent
86076b2871
commit
e878ecb511
10 changed files with 47 additions and 61 deletions
|
@ -2850,8 +2850,8 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
|||
{
|
||||
if (po[p].os == actor->sector())
|
||||
{
|
||||
po[p].opos.X += m;
|
||||
po[p].opos.Y += x;
|
||||
po[p].opos.X += m * inttoworld;
|
||||
po[p].opos.Y += x * inttoworld;
|
||||
}
|
||||
|
||||
if (actor->sector() == psp->sector())
|
||||
|
@ -3042,8 +3042,8 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
|||
|
||||
if (po[p].os == actor->sector())
|
||||
{
|
||||
po[p].opos.X += l;
|
||||
po[p].opos.Y += x;
|
||||
po[p].opos.X += l * inttoworld;
|
||||
po[p].opos.Y += x * inttoworld;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1837,7 +1837,7 @@ void movetransports_d(void)
|
|||
ps[p].backupz();
|
||||
|
||||
auto pa = ps[p].GetActor();
|
||||
pa->opos = DVector3(ps[p].__int_pos.X * inttoworld, ps[p].__int_pos.Y * inttoworld, ps[p].__int_pos.Z * zinttoworld);
|
||||
pa->opos = ps[p].pos;
|
||||
|
||||
ChangeActorSect(act2, Owner->sector());
|
||||
ps[p].setCursector(Owner->sector());
|
||||
|
|
|
@ -1522,12 +1522,12 @@ int ParseState::parse(void)
|
|||
parseifelse(ifcanshoottarget(g_ac, g_p, g_x));
|
||||
break;
|
||||
case concmd_ifcanseetarget:
|
||||
j = cansee(g_ac->int_pos().X, g_ac->int_pos().Y, g_ac->int_pos().Z - ((krand() & 41) << 8), g_ac->sector(), ps[g_p].player_int_pos().X, ps[g_p].player_int_pos().Y, ps[g_p].__int_pos.Z/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->sector());
|
||||
j = cansee(g_ac->spr.pos.plusZ(krand() & 41), g_ac->sector(), ps[g_p].pos, ps[g_p].GetActor()->sector());
|
||||
parseifelse(j);
|
||||
if (j) g_ac->timetosleep = SLEEPTIME;
|
||||
break;
|
||||
case concmd_ifnocover:
|
||||
j = cansee(g_ac->int_pos().X, g_ac->int_pos().Y, g_ac->int_pos().Z, g_ac->sector(), ps[g_p].player_int_pos().X, ps[g_p].player_int_pos().Y, ps[g_p].player_int_pos().Z, ps[g_p].GetActor()->sector());
|
||||
j = cansee(g_ac->spr.pos, g_ac->sector(), ps[g_p].pos, ps[g_p].GetActor()->sector());
|
||||
parseifelse(j);
|
||||
if (j) g_ac->timetosleep = SLEEPTIME;
|
||||
break;
|
||||
|
@ -2792,7 +2792,7 @@ int ParseState::parse(void)
|
|||
case concmd_pstomp:
|
||||
insptr++;
|
||||
if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->spr.xrepeat >= (isRR()? 9: 40) )
|
||||
if( cansee(g_ac->int_pos().X,g_ac->int_pos().Y,g_ac->int_pos().Z-(4<<8),g_ac->sector(),ps[g_p].player_int_pos().X,ps[g_p].player_int_pos().Y,ps[g_p].__int_pos.Z+(16<<8),ps[g_p].GetActor()->sector()) )
|
||||
if (cansee(g_ac->spr.pos.plusZ(-4), g_ac->sector(), ps[g_p].pos.plusZ(16), ps[g_p].GetActor()->sector()))
|
||||
{
|
||||
ps[g_p].knee_incs = 1;
|
||||
if(ps[g_p].weapon_pos == 0)
|
||||
|
|
|
@ -247,10 +247,4 @@ inline ESpriteFlags randomXFlip()
|
|||
return CSTAT_SPRITE_XFLIP;
|
||||
}
|
||||
|
||||
inline int pushmove_p(player_struct* actor, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
|
||||
uint32_t const cliptype, bool clear = true)
|
||||
{
|
||||
return ::pushmove(&actor->__int_pos, sect, walldist, ceildist, flordist, cliptype, clear);
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -622,7 +622,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
|||
}
|
||||
|
||||
Collision coll;
|
||||
clipmove(p->__int_pos, &p->cursector, 0, 0, 164, (4 << 8), (4 << 8), CLIPMASK0, coll);
|
||||
clipmove(p->pos, &p->cursector, 0, 0, 164, (4 << 8), (4 << 8), CLIPMASK0, coll);
|
||||
}
|
||||
|
||||
backupplayer(p);
|
||||
|
@ -631,7 +631,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
|||
|
||||
updatesector(p->player_int_pos().X, p->player_int_pos().Y, &p->cursector);
|
||||
|
||||
pushmove_p(p, &p->cursector, 128L, (4 << 8), (20 << 8), CLIPMASK0);
|
||||
pushmove(p->pos, &p->cursector, 128L, (4 << 8), (20 << 8), CLIPMASK0);
|
||||
|
||||
if (fz > cz + (16 << 8) && actor->spr.pal != 1)
|
||||
p->angle.rotscrnang = buildang(p->dead_flag + ((fz + p->player_int_pos().Z) >> 7));
|
||||
|
|
|
@ -3031,7 +3031,7 @@ HORIZONLY:
|
|||
ChangeActorSect(pact, p->cursector);
|
||||
}
|
||||
else
|
||||
clipmove(p->__int_pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), ii, CLIPMASK0, clip);
|
||||
clipmove(p->pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), ii, CLIPMASK0, clip);
|
||||
|
||||
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
|
||||
p->player_add_int_z(32 << 8);
|
||||
|
@ -3082,7 +3082,7 @@ HORIZONLY:
|
|||
while (ud.clipping == 0)
|
||||
{
|
||||
int blocked;
|
||||
blocked = (pushmove_p(p, &p->cursector, 164, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
blocked = (pushmove(p->pos, &p->cursector, 164, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
|
||||
if (fabs(pact->floorz - pact->ceilingz) < 48 || blocked)
|
||||
{
|
||||
|
@ -3093,8 +3093,7 @@ HORIZONLY:
|
|||
{
|
||||
if (!retry++)
|
||||
{
|
||||
p->opos = oldpos;
|
||||
p->restorexyz();
|
||||
p->pos = p->opos = oldpos;
|
||||
continue;
|
||||
}
|
||||
quickkill(p);
|
||||
|
|
|
@ -3800,7 +3800,7 @@ HORIZONLY:
|
|||
ChangeActorSect(pact, p->cursector);
|
||||
}
|
||||
else
|
||||
clipmove(p->__int_pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), i, CLIPMASK0, clip);
|
||||
clipmove(p->pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), i, CLIPMASK0, clip);
|
||||
|
||||
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
|
||||
p->player_add_int_z(32 << 8);
|
||||
|
@ -3829,10 +3829,10 @@ HORIZONLY:
|
|||
if (wal->lotag < 44)
|
||||
{
|
||||
dofurniture(clip.hitWall, p->cursector, snum);
|
||||
pushmove_p(p, &p->cursector, 172L, (4L << 8), (4L << 8), CLIPMASK0);
|
||||
pushmove(p->pos, &p->cursector, 172L, (4L << 8), (4L << 8), CLIPMASK0);
|
||||
}
|
||||
else
|
||||
pushmove_p(p, &p->cursector, 172L, (4L << 8), (4L << 8), CLIPMASK0);
|
||||
pushmove(p->pos, &p->cursector, 172L, (4L << 8), (4L << 8), CLIPMASK0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3933,9 +3933,9 @@ HORIZONLY:
|
|||
{
|
||||
int blocked;
|
||||
if (pact->spr.clipdist == 64)
|
||||
blocked = (pushmove_p(p, &p->cursector, 128, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
blocked = (pushmove(p->pos, &p->cursector, 128, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
else
|
||||
blocked = (pushmove_p(p, &p->cursector, 16, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
blocked = (pushmove(p->pos, &p->cursector, 16, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
|
||||
|
||||
if (fabs(pact->floorz - pact->ceilingz) < 48 || blocked)
|
||||
{
|
||||
|
@ -3946,8 +3946,7 @@ HORIZONLY:
|
|||
{
|
||||
if (!retry++)
|
||||
{
|
||||
p->opos = oldpos;
|
||||
p->restorexyz();
|
||||
p->pos = p->opos = oldpos;
|
||||
continue;
|
||||
}
|
||||
quickkill(p);
|
||||
|
|
|
@ -95,7 +95,7 @@ void pickrandomspot(int snum)
|
|||
i = krand()%numplayersprites;
|
||||
else i = snum;
|
||||
|
||||
p->__int_pos = po[i].opos;
|
||||
p->pos = po[i].opos;
|
||||
p->backupxyz();
|
||||
p->setbobpos();
|
||||
p->angle.oang = p->angle.ang = buildang(po[i].oa);
|
||||
|
@ -615,7 +615,7 @@ void resetpspritevars(int g)
|
|||
firsty = ps[0].player_int_pos().Y;
|
||||
}
|
||||
|
||||
po[numplayersprites].opos = act->int_pos();
|
||||
po[numplayersprites].opos = act->spr.pos;
|
||||
po[numplayersprites].oa = act->spr.ang;
|
||||
po[numplayersprites].os = act->sector();
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
|
|||
SpawnSpriteDef sprites;
|
||||
vec3_t pos;
|
||||
loadMap(mi->fileName, isShareware(), &pos, &lbang, §, sprites);
|
||||
p->__int_pos = pos;
|
||||
p->pos = { pos.X * inttoworld, pos.Y * inttoworld, pos.Z * zinttoworld };
|
||||
p->cursector = §or[sect];
|
||||
|
||||
SECRET_SetMapName(mi->DisplayName(), mi->name);
|
||||
|
|
|
@ -107,9 +107,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
{
|
||||
if (arc.BeginObject(keyname))
|
||||
{
|
||||
arc("posx", w.__int_pos.X)
|
||||
("posy", w.__int_pos.Y)
|
||||
("posz", w.__int_pos.Z)
|
||||
arc("posx", w.pos.X)
|
||||
("posy", w.pos.Y)
|
||||
("posz", w.pos.Z)
|
||||
("angle", w.angle)
|
||||
("horizon", w.horizon)
|
||||
.Array("gotweapon", w.gotweapon, MAX_WEAPONS)
|
||||
|
|
|
@ -189,7 +189,7 @@ struct user_defs
|
|||
|
||||
struct player_orig
|
||||
{
|
||||
vec3_t opos;
|
||||
DVector3 opos;
|
||||
short oa;
|
||||
sectortype* os;
|
||||
};
|
||||
|
@ -203,12 +203,8 @@ struct CraneDef
|
|||
|
||||
struct player_struct
|
||||
{
|
||||
// This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze.
|
||||
|
||||
// The sound code wants to read a vector out of this so we need to define one for the main coordinate.
|
||||
vec3_t __int_pos, vel;
|
||||
|
||||
DVector3 opos;
|
||||
vec3_t vel;
|
||||
DVector3 pos, opos;
|
||||
|
||||
// player's horizon and angle structs.
|
||||
PlayerHorizon horizon;
|
||||
|
@ -362,55 +358,51 @@ struct player_struct
|
|||
|
||||
void backupxyz()
|
||||
{
|
||||
opos.X = __int_pos.X * inttoworld;
|
||||
opos.Y = __int_pos.Y * inttoworld;
|
||||
opos.Z = __int_pos.Z * zinttoworld;
|
||||
opos = pos;
|
||||
}
|
||||
|
||||
void restorexyz()
|
||||
{
|
||||
__int_pos.X = opos.X * worldtoint;
|
||||
__int_pos.Y = opos.Y * worldtoint;
|
||||
__int_pos.Z = opos.Z * zworldtoint;
|
||||
pos = opos;
|
||||
}
|
||||
|
||||
void backupxy()
|
||||
{
|
||||
opos.X = __int_pos.X * inttoworld;
|
||||
opos.Y = __int_pos.Y * inttoworld;
|
||||
opos.X = pos.X;
|
||||
opos.Y = pos.Y;
|
||||
}
|
||||
|
||||
void restorexy()
|
||||
{
|
||||
__int_pos.X = opos.X * worldtoint;
|
||||
__int_pos.Y = opos.Y * worldtoint;
|
||||
pos.X = opos.X;
|
||||
pos.Y = opos.Y;
|
||||
}
|
||||
|
||||
void backupz()
|
||||
{
|
||||
opos.Z = __int_pos.Z * zinttoworld;
|
||||
opos.Z = pos.Z;
|
||||
}
|
||||
|
||||
void setbobpos()
|
||||
{
|
||||
bobpos = __int_pos.vec2;
|
||||
bobpos = player_int_pos().vec2;
|
||||
}
|
||||
|
||||
void getposfromactor(DCoreActor* actor, double addz = 0)
|
||||
{
|
||||
__int_pos = actor->int_pos();
|
||||
if (addz) __int_pos.Z += int(addz * worldtoint);
|
||||
pos = actor->spr.pos;
|
||||
if (addz) pos.Z += addz;
|
||||
}
|
||||
|
||||
void getxyfromactor(DCoreActor* actor)
|
||||
{
|
||||
__int_pos.X = actor->int_pos().X;
|
||||
__int_pos.Y = actor->int_pos().Y;
|
||||
pos.X = actor->spr.pos.X;
|
||||
pos.Y = actor->spr.pos.Y;
|
||||
}
|
||||
|
||||
vec3_t player_int_pos() const
|
||||
{
|
||||
return __int_pos;
|
||||
return { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
|
||||
}
|
||||
|
||||
vec3_t player_int_opos() const
|
||||
|
@ -420,20 +412,22 @@ struct player_struct
|
|||
|
||||
void player_add_int_z(int z)
|
||||
{
|
||||
__int_pos.Z += z;
|
||||
pos.Z += z * zinttoworld;
|
||||
}
|
||||
|
||||
void player_set_int_z(int z)
|
||||
{
|
||||
__int_pos.Z = z;
|
||||
pos.Z = z * zinttoworld;
|
||||
}
|
||||
void player_add_int_xy(const vec2_t& v)
|
||||
{
|
||||
__int_pos.vec2 += v;
|
||||
pos.X += v.X * inttoworld;
|
||||
pos.Y += v.Y * inttoworld;
|
||||
}
|
||||
void player_set_int_xy(const vec2_t& v)
|
||||
{
|
||||
__int_pos.vec2 = v;
|
||||
pos.X = v.X * inttoworld;
|
||||
pos.Y = v.Y * inttoworld;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue