mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-21 19:11:06 +00:00
- floatified most of movetripbomb and ovel
This commit is contained in:
parent
1c50801c64
commit
38a8e15ff9
5 changed files with 30 additions and 36 deletions
|
@ -4945,7 +4945,7 @@ DAngle furthestangle(DDukeActor *actor, int angs)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day)
|
int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, DVector2& pos)
|
||||||
{
|
{
|
||||||
int j, angincs;
|
int j, angincs;
|
||||||
HitInfo hit{};
|
HitInfo hit{};
|
||||||
|
@ -4966,8 +4966,7 @@ int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day
|
||||||
if (d < da && hit.hitSector)
|
if (d < da && hit.hitSector)
|
||||||
if (cansee(hit.hitpos, hit.hitSector, actor->spr.pos.plusZ(-16), actor->sector()))
|
if (cansee(hit.hitpos, hit.hitSector, actor->spr.pos.plusZ(-16), actor->sector()))
|
||||||
{
|
{
|
||||||
*dax = hit.int_hitpos().X;
|
pos = hit.hitpos.XY();
|
||||||
*day = hit.int_hitpos().Y;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5012,7 +5011,7 @@ void alterang(int ang, DDukeActor* actor, int playernum)
|
||||||
|
|
||||||
auto Owner = actor->GetOwner();
|
auto Owner = actor->GetOwner();
|
||||||
if (Owner->isPlayer())
|
if (Owner->isPlayer())
|
||||||
goalang = VecToAngle(actor->ovel.X - actor->int_pos().X, actor->ovel.Y - actor->int_pos().Y);
|
goalang = VecToAngle(actor->ovel - actor->spr.pos.XY());
|
||||||
else
|
else
|
||||||
goalang = VecToAngle(Owner->spr.pos.XY() - actor->spr.pos.XY());
|
goalang = VecToAngle(Owner->spr.pos.XY() - actor->spr.pos.XY());
|
||||||
|
|
||||||
|
|
|
@ -802,7 +802,8 @@ void movefallers_d(void)
|
||||||
|
|
||||||
static void movetripbomb(DDukeActor *actor)
|
static void movetripbomb(DDukeActor *actor)
|
||||||
{
|
{
|
||||||
int j, x;
|
int j;
|
||||||
|
double x;
|
||||||
int lTripBombControl = GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, nullptr, -1).safeValue();
|
int lTripBombControl = GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, nullptr, -1).safeValue();
|
||||||
if (lTripBombControl & TRIPBOMB_TIMER)
|
if (lTripBombControl & TRIPBOMB_TIMER)
|
||||||
{
|
{
|
||||||
|
@ -824,14 +825,14 @@ static void movetripbomb(DDukeActor *actor)
|
||||||
{
|
{
|
||||||
S_PlayActorSound(LASERTRIP_EXPLODE, actor);
|
S_PlayActorSound(LASERTRIP_EXPLODE, actor);
|
||||||
for (j = 0; j < 5; j++) RANDOMSCRAP(actor);
|
for (j = 0; j < 5; j++) RANDOMSCRAP(actor);
|
||||||
x = actor->spr.extra;
|
int ex = actor->spr.extra;
|
||||||
fi.hitradius(actor, gs.tripbombblastradius, x >> 2, x >> 1, x - (x >> 2), x);
|
fi.hitradius(actor, gs.tripbombblastradius, ex >> 2, ex >> 1, ex - (ex >> 2), ex);
|
||||||
|
|
||||||
auto spawned = spawn(actor, EXPLOSION2);
|
auto spawned = spawn(actor, EXPLOSION2);
|
||||||
if (spawned)
|
if (spawned)
|
||||||
{
|
{
|
||||||
spawned->spr.angle = actor->spr.angle;
|
spawned->spr.angle = actor->spr.angle;
|
||||||
spawned->set_int_xvel(348);
|
spawned->vel.X = 348 / 16.;
|
||||||
ssp(spawned, CLIPMASK0);
|
ssp(spawned, CLIPMASK0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,25 +850,25 @@ static void movetripbomb(DDukeActor *actor)
|
||||||
{
|
{
|
||||||
x = actor->spr.extra;
|
x = actor->spr.extra;
|
||||||
actor->spr.extra = 1;
|
actor->spr.extra = 1;
|
||||||
int16_t l = actor->int_ang();
|
auto ang = actor->spr.angle;
|
||||||
j = fi.ifhitbyweapon(actor);
|
j = fi.ifhitbyweapon(actor);
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
{
|
{
|
||||||
actor->temp_data[2] = 16;
|
actor->temp_data[2] = 16;
|
||||||
}
|
}
|
||||||
actor->spr.extra = x;
|
actor->spr.extra = x;
|
||||||
actor->set_int_ang(l);
|
actor->spr.angle = ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actor->temp_data[0] < 32)
|
if (actor->temp_data[0] < 32)
|
||||||
{
|
{
|
||||||
findplayer(actor, &x);
|
findplayer(actor, &x);
|
||||||
if (x > 768) actor->temp_data[0]++;
|
if (x > 48) actor->temp_data[0]++;
|
||||||
else if (actor->temp_data[0] > 16) actor->temp_data[0]++;
|
else if (actor->temp_data[0] > 16) actor->temp_data[0]++;
|
||||||
}
|
}
|
||||||
if (actor->temp_data[0] == 32)
|
if (actor->temp_data[0] == 32)
|
||||||
{
|
{
|
||||||
int16_t l = actor->int_ang();
|
auto ang = actor->spr.angle;
|
||||||
actor->spr.angle = actor->temp_angle;
|
actor->spr.angle = actor->temp_angle;
|
||||||
|
|
||||||
actor->temp_pos.XY() = actor->spr.pos.XY();
|
actor->temp_pos.XY() = actor->spr.pos.XY();
|
||||||
|
@ -882,11 +883,11 @@ static void movetripbomb(DDukeActor *actor)
|
||||||
ChangeActorSect(actor, curSect);
|
ChangeActorSect(actor, curSect);
|
||||||
|
|
||||||
DDukeActor* hit;
|
DDukeActor* hit;
|
||||||
x = hitasprite(actor, &hit);
|
x = hitasprite(actor, &hit) * inttoworld;
|
||||||
|
|
||||||
actor->ovel.X = x;
|
actor->ovel.X = x;
|
||||||
|
|
||||||
actor->set_int_ang(l);
|
actor->spr.angle = ang;
|
||||||
|
|
||||||
if (lTripBombControl & TRIPBOMB_TRIPWIRE)
|
if (lTripBombControl & TRIPBOMB_TRIPWIRE)
|
||||||
{
|
{
|
||||||
|
@ -900,12 +901,12 @@ static void movetripbomb(DDukeActor *actor)
|
||||||
spawned->spr.hitag = actor->spr.hitag;
|
spawned->spr.hitag = actor->spr.hitag;
|
||||||
spawned->temp_data[1] = spawned->int_pos().Z;
|
spawned->temp_data[1] = spawned->int_pos().Z;
|
||||||
|
|
||||||
if (x < 1024)
|
if (x < 64)
|
||||||
{
|
{
|
||||||
spawned->spr.xrepeat = x >> 5;
|
spawned->spr.xrepeat = x / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
x -= 1024;
|
x -= 64;
|
||||||
|
|
||||||
actor->spr.pos += actor->temp_angle.ToVector() * 64;
|
actor->spr.pos += actor->temp_angle.ToVector() * 64;
|
||||||
updatesectorneighbor(actor->spr.pos, &curSect, 128);
|
updatesectorneighbor(actor->spr.pos, &curSect, 128);
|
||||||
|
@ -943,7 +944,7 @@ static void movetripbomb(DDukeActor *actor)
|
||||||
actor->spr.pos.Z -= 3;
|
actor->spr.pos.Z -= 3;
|
||||||
SetActor(actor, actor->spr.pos);
|
SetActor(actor, actor->spr.pos);
|
||||||
|
|
||||||
x = hitasprite(actor, nullptr);
|
x = hitasprite(actor, nullptr) * inttoworld;
|
||||||
|
|
||||||
actor->spr.pos.XY() = actor->temp_pos.XY();
|
actor->spr.pos.XY() = actor->temp_pos.XY();
|
||||||
actor->spr.pos.Z += 3;
|
actor->spr.pos.Z += 3;
|
||||||
|
|
|
@ -80,7 +80,7 @@ struct ParseState
|
||||||
void parseifelse(int condition);
|
void parseifelse(int condition);
|
||||||
};
|
};
|
||||||
|
|
||||||
int furthestcanseepoint(DDukeActor* i, DDukeActor* ts, int* dax, int* day);
|
int furthestcanseepoint(DDukeActor* i, DDukeActor* ts, DVector2& pos);
|
||||||
bool ifsquished(DDukeActor* i, int p);
|
bool ifsquished(DDukeActor* i, int p);
|
||||||
void fakebubbaspawn(DDukeActor* actor, int g_p);
|
void fakebubbaspawn(DDukeActor* actor, int g_p);
|
||||||
void tearitup(sectortype* sect);
|
void tearitup(sectortype* sect);
|
||||||
|
@ -1307,12 +1307,12 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
||||||
else SetGameVarID(lVar2, act->ceilingz * (1/zmaptoworld), sActor, sPlayer);
|
else SetGameVarID(lVar2, act->ceilingz * (1/zmaptoworld), sActor, sPlayer);
|
||||||
break;
|
break;
|
||||||
case ACTOR_HTLASTVX:
|
case ACTOR_HTLASTVX:
|
||||||
if (bSet) act->ovel.X = lValue;
|
if (bSet) act->ovel.X = lValue * maptoworld;
|
||||||
else SetGameVarID(lVar2, act->ovel.X, sActor, sPlayer);
|
else SetGameVarID(lVar2, act->ovel.X / maptoworld, sActor, sPlayer);
|
||||||
break;
|
break;
|
||||||
case ACTOR_HTLASTVY:
|
case ACTOR_HTLASTVY:
|
||||||
if (bSet) act->ovel.Y = lValue;
|
if (bSet) act->ovel.Y = lValue * maptoworld;
|
||||||
else SetGameVarID(lVar2, act->ovel.Y, sActor, sPlayer);
|
else SetGameVarID(lVar2, act->ovel.Y / maptoworld, sActor, sPlayer);
|
||||||
break;
|
break;
|
||||||
case ACTOR_HTG_T0:
|
case ACTOR_HTG_T0:
|
||||||
if (bSet) act->temp_data[0] = lValue;
|
if (bSet) act->temp_data[0] = lValue;
|
||||||
|
@ -1475,14 +1475,13 @@ static bool ifcansee(DDukeActor* actor, int pnum)
|
||||||
{
|
{
|
||||||
// search around for target player
|
// search around for target player
|
||||||
// also modifies 'target' x&y if found.
|
// also modifies 'target' x&y if found.
|
||||||
j = furthestcanseepoint(actor, tosee, &actor->ovel.X, &actor->ovel.Y);
|
j = furthestcanseepoint(actor, tosee, actor->ovel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// else, they did see it.
|
// else, they did see it.
|
||||||
// save where we were looking..
|
// save where we were looking..
|
||||||
actor->ovel.X = tosee->int_pos().X;
|
actor->ovel = tosee->spr.pos;
|
||||||
actor->ovel.Y = tosee->int_pos().Y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j == 1 && (actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_STANDABLE))
|
if (j == 1 && (actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_STANDABLE))
|
||||||
|
@ -3120,14 +3119,11 @@ int ParseState::parse(void)
|
||||||
}
|
}
|
||||||
case concmd_getangletotarget:
|
case concmd_getangletotarget:
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int ang;
|
|
||||||
|
|
||||||
insptr++;
|
insptr++;
|
||||||
i = *(insptr++); // ID of def
|
int i = *(insptr++); // ID of def
|
||||||
|
|
||||||
// g_ac->lastvx and lastvy are last known location of target.
|
// g_ac->lastvx and lastvy are last known location of target.
|
||||||
ang = getangle(g_ac->ovel.X - g_ac->int_pos().X, g_ac->ovel.Y - g_ac->int_pos().Y);
|
int ang = VecToAngle(g_ac->ovel - g_ac->spr.pos.XY()).Buildang();
|
||||||
SetGameVarID(i, ang, g_ac, g_p);
|
SetGameVarID(i, ang, g_ac, g_p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,7 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, in
|
||||||
act->spr.lotag = 0;
|
act->spr.lotag = 0;
|
||||||
act->backuploc();
|
act->backuploc();
|
||||||
|
|
||||||
act->ovel.X = 0;
|
act->ovel.Zero();
|
||||||
act->ovel.Y = 0;
|
|
||||||
|
|
||||||
act->timetosleep = 0;
|
act->timetosleep = 0;
|
||||||
act->actorstayput = nullptr;
|
act->actorstayput = nullptr;
|
||||||
|
@ -154,8 +153,7 @@ bool initspriteforspawn(DDukeActor* act)
|
||||||
act->floorz = act->sector()->floorz;
|
act->floorz = act->sector()->floorz;
|
||||||
act->ceilingz = act->sector()->ceilingz;
|
act->ceilingz = act->sector()->ceilingz;
|
||||||
|
|
||||||
act->ovel.X = 0;
|
act->ovel.Zero();
|
||||||
act->ovel.Y = 0;
|
|
||||||
act->actorstayput = nullptr;
|
act->actorstayput = nullptr;
|
||||||
|
|
||||||
act->temp_data[0] = act->temp_data[1] = act->temp_data[2] = act->temp_data[3] = act->temp_data[4] = act->temp_data[5] = 0;
|
act->temp_data[0] = act->temp_data[1] = act->temp_data[2] = act->temp_data[3] = act->temp_data[4] = act->temp_data[5] = 0;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
short attackertype, hitextra, movflag;
|
short attackertype, hitextra, movflag;
|
||||||
short tempang, dispicnum, basepicnum;
|
short tempang, dispicnum, basepicnum;
|
||||||
short timetosleep;
|
short timetosleep;
|
||||||
vec2_t ovel;
|
DVector2 ovel;
|
||||||
DAngle hitang;
|
DAngle hitang;
|
||||||
double floorz, ceilingz;
|
double floorz, ceilingz;
|
||||||
union
|
union
|
||||||
|
|
Loading…
Reference in a new issue