- mainly handling angle literals.

This commit is contained in:
Christoph Oelckers 2022-09-03 18:35:02 +02:00
parent a85bcebd09
commit 4f9ffc9437
5 changed files with 19 additions and 8 deletions

View file

@ -463,7 +463,7 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14
int x = actor->int_pos().X + MulScale(nDist, Cos(nAngle), 28);
int y = actor->int_pos().Y + MulScale(nDist, Sin(nAngle), 28);
gFX.fxSpawnActor(FX_48, actor->sector(), x, y, actor->int_pos().Z, 0);
if (actor->int_ang() == 1024)
if (actor->spr.angle == DAngle180)
{
int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid...
sfxPlay3DSound(actor, 385, nChannel, 1);
@ -649,7 +649,7 @@ void fxPodBloodSplat(DBloodActor* actor, sectortype*) // 19
int nDist = Random(16) << 4;
int x = actor->int_pos().X + MulScale(nDist, Cos(nAngle), 28);
int y = actor->int_pos().Y + MulScale(nDist, Sin(nAngle), 28);
if (actor->int_ang() == 1024 && actor->spr.type == 53)
if (actor->spr.angle == DAngle180 && actor->spr.type == 53)
{
int nChannel = 28 + (actor->GetIndex() & 2);
assert(nChannel < 32);

View file

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "v_text.h"
#include "seqcb.h"
#include "coreactor.h"
#include "vectors.h"
BEGIN_BLD_NS
@ -541,6 +542,11 @@ inline unsigned int Random(int a1)
return MulScale(wrand(), a1, 15);
}
inline DAngle RandomAngle(int base = 2048)
{
return DAngle::fromBuild(MulScale(wrand(), base, 15));
}
inline int Random2(int a1)
{
return MulScale(wrand(), a1, 14) - a1;

View file

@ -1119,7 +1119,7 @@ void movetouchplate(DDukeActor* actor, int plate)
if (actor->temp_data[5] == 1) return;
p = checkcursectnums(actor->sector());
if (p >= 0 && (ps[p].on_ground || actor->int_ang() == 512))
if (p >= 0 && (ps[p].on_ground || actor->spr.angle == DAngle90))
{
if (actor->temp_data[0] == 0 && !check_activator_motion(actor->spr.lotag))
{
@ -3639,7 +3639,7 @@ void handle_se13(DDukeActor* actor)
{
int j = (actor->spr.yint << 5) | 1;
if (actor->int_ang() == 512)
if (actor->spr.angle == DAngle90)
{
if (actor->spriteextra)
{
@ -3671,7 +3671,7 @@ void handle_se13(DDukeActor* actor)
actor->temp_data[3]++;
sc->ceilingstat ^= CSTAT_SECTOR_SKY;
if (actor->int_ang() == 512)
if (actor->spr.angle == DAngle90)
{
for (auto& wal : wallsofsector(sc))
wal.shade = actor->spr.shade;

View file

@ -42,6 +42,11 @@ inline int movesprite_ex(DDukeActor* actor, int xchange, int ychange, int zchang
return f(actor, xchange, ychange, zchange, cliptype, result);
}
inline int movesprite_ex(DDukeActor* actor, const DVector3& change, unsigned int cliptype, Collision& result)
{
auto f = isRR() ? movesprite_ex_r : movesprite_ex_d;
return f(actor, change.X * worldtoint, change.Y * worldtoint, change.Z * zworldtoint, cliptype, result);
}
END_DUKE_NS

View file

@ -700,7 +700,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
bool ceiling = (abs(actor->temp_data[0] - actor->int_pos().Z) < abs(actor->temp_data[1] - actor->int_pos().Z));
actor->spriteextra = ceiling;
if (actor->int_ang() == 512)
if (actor->spr.angle == DAngle90)
{
if (ceiling)
sectp->setceilingz(actor->spr.pos.Z);
@ -718,7 +718,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
sectp->ceilingstat ^= CSTAT_SECTOR_SKY;
actor->temp_data[3] = 1;
if (!ceiling && actor->int_ang() == 512)
if (!ceiling && actor->spr.angle == DAngle90)
{
sectp->ceilingstat ^= CSTAT_SECTOR_SKY;
actor->temp_data[3] = 0;
@ -727,7 +727,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
sectp->ceilingshade =
sectp->floorshade;
if (actor->int_ang() == 512)
if (actor->spr.angle == DAngle90)
{
for (auto& wl : wallsofsector(sectp))
{