mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Merge branch 'newrenderer2' of https://github.com/coelckers/Raze-private into newrenderer2
This commit is contained in:
commit
798cf2f973
34 changed files with 239 additions and 428 deletions
|
@ -317,39 +317,41 @@ struct spritetype
|
|||
|
||||
int32_t interpolatedx(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return ox + MulScale(x - ox, smoothratio, scale);
|
||||
return interpolatedvalue(ox, x, smoothratio, scale);
|
||||
}
|
||||
|
||||
int32_t interpolatedy(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return oy + MulScale(y - oy, smoothratio, scale);
|
||||
return interpolatedvalue(oy, y, smoothratio, scale);
|
||||
}
|
||||
|
||||
int32_t interpolatedz(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return oz + MulScale(z - oz, smoothratio, scale);
|
||||
return interpolatedvalue(oz, z, smoothratio, scale);
|
||||
}
|
||||
|
||||
vec2_t interpolatedvec2(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return vec2_t({
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale)
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
vec3_t interpolatedvec3(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return vec3_t({
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale),
|
||||
interpolatedz(smoothratio, scale)
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
int16_t interpolatedang(double const smoothratio)
|
||||
{
|
||||
return oang + MulScale(((ang + 1024 - oang) & 2047) - 1024, smoothratio, 16);
|
||||
return interpolatedangle(oang, ang, smoothratio, 16);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ enum
|
|||
//---------------------------------------------------------------------------
|
||||
|
||||
constexpr double BAngRadian = pi::pi() * (1. / 1024.);
|
||||
constexpr double BRadAngScale = 1. / BAngRadian;
|
||||
constexpr double BAngToDegree = 360. / 2048.;
|
||||
|
||||
extern int16_t sintable[2048];
|
||||
|
@ -108,134 +107,6 @@ inline constexpr int64_t BAngToBAM(int ang)
|
|||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class lookangle
|
||||
{
|
||||
int32_t value;
|
||||
|
||||
constexpr lookangle(int32_t v) : value(v) {}
|
||||
|
||||
friend constexpr lookangle bamlook(int32_t v);
|
||||
friend constexpr lookangle q16look(int32_t v);
|
||||
friend constexpr lookangle buildlook(int32_t v);
|
||||
friend lookangle buildflook(double v);
|
||||
friend lookangle radlook(double v);
|
||||
friend lookangle deglook(double v);
|
||||
|
||||
friend FSerializer &Serialize(FSerializer &arc, const char *key, lookangle &obj, lookangle *defval);
|
||||
|
||||
friend class binangle;
|
||||
|
||||
public:
|
||||
lookangle() = default;
|
||||
lookangle(const lookangle &other) = default;
|
||||
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
|
||||
constexpr short asbuild() const { return value >> 21; }
|
||||
constexpr double asbuildf() const { return value * (1. / BAMUNIT); }
|
||||
constexpr fixed_t asq16() const { return value >> 5; }
|
||||
constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); }
|
||||
constexpr double asdeg() const { return AngleToFloat(value); }
|
||||
constexpr int32_t asbam() const { return value; }
|
||||
|
||||
double fsin() const { return g_sin(asrad()); }
|
||||
double fcos() const { return g_cos(asrad()); }
|
||||
double ftan() const { return g_tan(asrad()); }
|
||||
int bsin(const int8_t& shift = 0) const { return ::bsin(asbuild(), shift); }
|
||||
int bcos(const int8_t& shift = 0) const { return ::bcos(asbuild(), shift); }
|
||||
|
||||
bool operator< (lookangle other) const
|
||||
{
|
||||
return value < other.value;
|
||||
}
|
||||
|
||||
bool operator> (lookangle other) const
|
||||
{
|
||||
return value > other.value;
|
||||
}
|
||||
|
||||
bool operator<= (lookangle other) const
|
||||
{
|
||||
return value <= other.value;
|
||||
}
|
||||
|
||||
bool operator>= (lookangle other) const
|
||||
{
|
||||
return value >= other.value;
|
||||
}
|
||||
constexpr bool operator== (lookangle other) const
|
||||
{
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
constexpr bool operator!= (lookangle other) const
|
||||
{
|
||||
return value != other.value;
|
||||
}
|
||||
|
||||
constexpr lookangle &operator+= (lookangle other)
|
||||
{
|
||||
value += other.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr lookangle &operator-= (lookangle other)
|
||||
{
|
||||
value -= other.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr lookangle operator+ (lookangle other) const
|
||||
{
|
||||
return lookangle(value + other.value);
|
||||
}
|
||||
|
||||
constexpr lookangle operator- (lookangle other) const
|
||||
{
|
||||
return lookangle(value - other.value);
|
||||
}
|
||||
|
||||
constexpr lookangle &operator<<= (const uint8_t shift)
|
||||
{
|
||||
value <<= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr lookangle &operator>>= (const uint8_t shift)
|
||||
{
|
||||
value >>= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr lookangle operator<< (const uint8_t shift) const
|
||||
{
|
||||
return lookangle(value << shift);
|
||||
}
|
||||
|
||||
constexpr lookangle operator>> (const uint8_t shift) const
|
||||
{
|
||||
return lookangle(value >> shift);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline constexpr lookangle bamlook(int32_t v) { return lookangle(v); }
|
||||
inline constexpr lookangle q16look(int32_t v) { return lookangle(v << 5); }
|
||||
inline constexpr lookangle buildlook(int32_t v) { return lookangle(v << BAMBITS); }
|
||||
inline lookangle buildflook(double v) { return lookangle(xs_CRoundToInt(v * BAMUNIT)); }
|
||||
inline lookangle radlook(double v) { return lookangle(xs_CRoundToInt(v * (0x80000000u / pi::pi()))); }
|
||||
inline lookangle deglook(double v) { return lookangle(FloatToAngle(v)); }
|
||||
|
||||
inline FSerializer &Serialize(FSerializer &arc, const char *key, lookangle &obj, lookangle *defval)
|
||||
{
|
||||
return Serialize(arc, key, obj.value, defval ? &defval->value : nullptr);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -261,12 +132,19 @@ public:
|
|||
binangle() = default;
|
||||
binangle(const binangle &other) = default;
|
||||
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
|
||||
constexpr int32_t tosigned() const { return value > BAngToBAM(1024) ? int64_t(value) - BAngToBAM(2048) : value; }
|
||||
constexpr short asbuild() const { return value >> 21; }
|
||||
constexpr double asbuildf() const { return value * (1. / BAMUNIT); }
|
||||
constexpr fixed_t asq16() const { return value >> 5; }
|
||||
constexpr uint32_t asbam() const { return value; }
|
||||
constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); }
|
||||
constexpr double asdeg() const { return AngleToFloat(value); }
|
||||
constexpr uint32_t asbam() const { return value; }
|
||||
constexpr short signedbuild() const { return tosigned() >> 21; }
|
||||
constexpr double signedbuildf() const { return tosigned() * (1. / BAMUNIT); }
|
||||
constexpr fixed_t signedq16() const { return tosigned() >> 5; }
|
||||
constexpr int32_t signedbam() const { return tosigned(); }
|
||||
constexpr double signedrad() const { return tosigned() * (pi::pi() / 0x80000000u); }
|
||||
constexpr double signeddeg() const { return AngleToFloat(tosigned()); }
|
||||
|
||||
double fsin() const { return g_sin(asrad()); }
|
||||
double fcos() const { return g_cos(asrad()); }
|
||||
|
@ -306,28 +184,6 @@ public:
|
|||
return binangle(value - other.value);
|
||||
}
|
||||
|
||||
constexpr binangle &operator+= (lookangle other)
|
||||
{
|
||||
value += other.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr binangle &operator-= (lookangle other)
|
||||
{
|
||||
value -= other.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr binangle operator+ (lookangle other) const
|
||||
{
|
||||
return binangle(value + other.value);
|
||||
}
|
||||
|
||||
constexpr binangle operator- (lookangle other) const
|
||||
{
|
||||
return binangle(value - other.value);
|
||||
}
|
||||
|
||||
constexpr binangle &operator<<= (const uint8_t shift)
|
||||
{
|
||||
value <<= shift;
|
||||
|
@ -510,3 +366,30 @@ inline binangle bvectangbam(int32_t x, int32_t y)
|
|||
{
|
||||
return radang(atan2(y, x));
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Interpolation functions for use throughout games.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
inline int32_t interpolatedvalue(int32_t oval, int32_t val, double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return oval + MulScale(val - oval, smoothratio, scale);
|
||||
}
|
||||
|
||||
inline double interpolatedvaluef(double oval, double val, double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return oval + MulScaleF(val - oval, smoothratio, scale);
|
||||
}
|
||||
|
||||
inline int32_t interpolatedangle(int32_t oang, int32_t ang, double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return oang + MulScale(((ang + 1024 - oang) & 2047) - 1024, smoothratio, scale);
|
||||
}
|
||||
|
||||
inline binangle interpolatedangle(binangle oang, binangle ang, double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return bamang(oang.asbam() + MulScale(((ang.asbam() + 0x80000000 - oang.asbam()) & 0xFFFFFFFF) - 0x80000000, smoothratio, scale));
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ fixed_t getincangleq16(fixed_t a, fixed_t na)
|
|||
return na-a;
|
||||
}
|
||||
|
||||
lookangle getincanglebam(binangle a, binangle na)
|
||||
binangle getincanglebam(binangle a, binangle na)
|
||||
{
|
||||
int64_t cura = a.asbam() & 0xFFFFFFFF;
|
||||
int64_t newa = na.asbam() & 0xFFFFFFFF;
|
||||
|
@ -89,7 +89,7 @@ lookangle getincanglebam(binangle a, binangle na)
|
|||
if(cura > BAngToBAM(1024)) cura -= BAngToBAM(2048);
|
||||
}
|
||||
|
||||
return bamlook(newa-cura);
|
||||
return bamang(newa-cura);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -318,10 +318,10 @@ void sethorizon(PlayerHorizon* horizon, float const horz, ESyncBits* actions, do
|
|||
// return to center if conditions met.
|
||||
if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
|
||||
{
|
||||
if (abs(horizon->horiz.asq16()) > FloatToFixed(0.25))
|
||||
if (abs(horizon->horiz.asq16()) > (FRACUNIT >> 2))
|
||||
{
|
||||
// move horiz back to 0
|
||||
horizon->horiz -= q16horiz(xs_CRoundToInt(scaleAdjust * horizon->horiz.asq16() * (10. / GameTicRate)));
|
||||
horizon->horiz -= buildfhoriz(scaleAdjust * horizon->horiz.asbuildf() * (10. / GameTicRate));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -346,63 +346,63 @@ void sethorizon(PlayerHorizon* horizon, float const horz, ESyncBits* actions, do
|
|||
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust)
|
||||
{
|
||||
// return q16rotscrnang to 0 and set to 0 if less than a quarter of a unit
|
||||
angle->rotscrnang -= bamlook(xs_CRoundToInt(scaleAdjust * angle->rotscrnang.asbam() * (15. / GameTicRate)));
|
||||
if (abs(angle->rotscrnang.asbam()) < (BAMUNIT >> 2)) angle->rotscrnang = bamlook(0);
|
||||
angle->rotscrnang -= buildfang(scaleAdjust * angle->rotscrnang.signedbuildf() * (15. / GameTicRate));
|
||||
if (abs(angle->rotscrnang.signedbam()) < (BAMUNIT >> 2)) angle->rotscrnang = bamang(0);
|
||||
|
||||
// return q16look_ang to 0 and set to 0 if less than a quarter of a unit
|
||||
angle->look_ang -= bamlook(xs_CRoundToInt(scaleAdjust * angle->look_ang.asbam() * (7.5 / GameTicRate)));
|
||||
if (abs(angle->look_ang.asbam()) < (BAMUNIT >> 2)) angle->look_ang = bamlook(0);
|
||||
angle->look_ang -= buildfang(scaleAdjust * angle->look_ang.signedbuildf() * (7.5 / GameTicRate));
|
||||
if (abs(angle->look_ang.signedbam()) < (BAMUNIT >> 2)) angle->look_ang = bamang(0);
|
||||
|
||||
if (*actions & SB_LOOK_LEFT)
|
||||
{
|
||||
// start looking left
|
||||
angle->look_ang -= bamlook(xs_CRoundToInt(scaleAdjust * (4560. / GameTicRate) * BAMUNIT));
|
||||
angle->rotscrnang += bamlook(xs_CRoundToInt(scaleAdjust * (720. / GameTicRate) * BAMUNIT));
|
||||
angle->look_ang += buildfang(scaleAdjust * -(4560. / GameTicRate));
|
||||
angle->rotscrnang += buildfang(scaleAdjust * (720. / GameTicRate));
|
||||
}
|
||||
|
||||
if (*actions & SB_LOOK_RIGHT)
|
||||
{
|
||||
// start looking right
|
||||
angle->look_ang += bamlook(xs_CRoundToInt(scaleAdjust * (4560. / GameTicRate) * BAMUNIT));
|
||||
angle->rotscrnang -= bamlook(xs_CRoundToInt(scaleAdjust * (720. / GameTicRate) * BAMUNIT));
|
||||
angle->look_ang += buildfang(scaleAdjust * (4560. / GameTicRate));
|
||||
angle->rotscrnang += buildfang(scaleAdjust * -(720. / GameTicRate));
|
||||
}
|
||||
|
||||
if (!angle->targetset())
|
||||
{
|
||||
if (*actions & SB_TURNAROUND)
|
||||
{
|
||||
if (angle->spin.asbam() == 0)
|
||||
if (angle->spin == 0)
|
||||
{
|
||||
// currently not spinning, so start a spin
|
||||
angle->spin = buildlook(-1024);
|
||||
angle->spin = -1024.;
|
||||
}
|
||||
*actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
|
||||
if (angle->spin.asbam() < 0)
|
||||
if (angle->spin < 0)
|
||||
{
|
||||
// return spin to 0
|
||||
lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!(*actions & SB_CROUCH) ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
|
||||
double add = scaleAdjust * ((!(*actions & SB_CROUCH) ? 3840. : 1920.) / GameTicRate);
|
||||
angle->spin += add;
|
||||
if (angle->spin.asbam() > 0)
|
||||
if (angle->spin > 0)
|
||||
{
|
||||
// Don't overshoot our target. With variable factor this is possible.
|
||||
add -= angle->spin;
|
||||
angle->spin = bamlook(0);
|
||||
angle->spin = 0;
|
||||
}
|
||||
angle->ang += bamang(add.asbam());
|
||||
angle->ang += buildfang(add);
|
||||
}
|
||||
|
||||
if (avel)
|
||||
{
|
||||
// add player's input
|
||||
angle->ang += degang(avel);
|
||||
angle->spin = bamlook(0);
|
||||
angle->spin = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
angle->spin = bamlook(0);
|
||||
angle->spin = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
int getincangle(int a, int na);
|
||||
double getincanglef(double a, double na);
|
||||
fixed_t getincangleq16(fixed_t a, fixed_t na);
|
||||
lookangle getincanglebam(binangle a, binangle na);
|
||||
binangle getincanglebam(binangle a, binangle na);
|
||||
|
||||
struct PlayerHorizon
|
||||
{
|
||||
|
@ -29,7 +29,12 @@ struct PlayerHorizon
|
|||
|
||||
void addadjustment(double value)
|
||||
{
|
||||
__addadjustment(q16horiz(FloatToFixed(value)));
|
||||
__addadjustment(buildfhoriz(value));
|
||||
}
|
||||
|
||||
void addadjustment(fixedhoriz value)
|
||||
{
|
||||
__addadjustment(value);
|
||||
}
|
||||
|
||||
void resetadjustment()
|
||||
|
@ -37,11 +42,6 @@ struct PlayerHorizon
|
|||
adjustment = 0;
|
||||
}
|
||||
|
||||
void settarget(int value, bool backup = false)
|
||||
{
|
||||
__settarget(buildhoriz(clamp(value, FixedToInt(gi->playerHorizMin()), FixedToInt(gi->playerHorizMax()))), backup);
|
||||
}
|
||||
|
||||
void settarget(double value, bool backup = false)
|
||||
{
|
||||
__settarget(buildfhoriz(clamp(value, FixedToFloat(gi->playerHorizMin()), FixedToFloat(gi->playerHorizMax()))), backup);
|
||||
|
@ -61,11 +61,11 @@ struct PlayerHorizon
|
|||
{
|
||||
if (targetset())
|
||||
{
|
||||
auto delta = (target - horiz).asq16();
|
||||
auto delta = (target - horiz).asbuildf();
|
||||
|
||||
if (abs(delta) > FRACUNIT)
|
||||
if (abs(delta) > 1)
|
||||
{
|
||||
horiz += q16horiz(xs_CRoundToInt(scaleAdjust * delta));
|
||||
horiz += buildfhoriz(scaleAdjust * delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ struct PlayerHorizon
|
|||
}
|
||||
else if (adjustment)
|
||||
{
|
||||
horiz += q16horiz(xs_CRoundToInt(scaleAdjust * adjustment));
|
||||
horiz += buildfhoriz(scaleAdjust * adjustment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,10 +91,7 @@ struct PlayerHorizon
|
|||
|
||||
fixedhoriz interpolatedsum(double const smoothratio)
|
||||
{
|
||||
double const ratio = smoothratio * (1. / FRACUNIT);
|
||||
fixed_t const prev = osum().asq16();
|
||||
fixed_t const curr = sum().asq16();
|
||||
return q16horiz(prev + xs_CRoundToInt(ratio * (curr - prev)));
|
||||
return q16horiz(interpolatedvalue(osum().asq16(), sum().asq16(), smoothratio));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -105,7 +102,7 @@ private:
|
|||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asq16();
|
||||
adjustment += value.asbuildf();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -113,7 +110,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void __settarget(fixedhoriz value, bool backup = false)
|
||||
void __settarget(fixedhoriz value, bool backup)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
|
@ -130,8 +127,8 @@ private:
|
|||
|
||||
struct PlayerAngle
|
||||
{
|
||||
binangle ang, oang;
|
||||
lookangle look_ang, olook_ang, rotscrnang, orotscrnang, spin;
|
||||
binangle ang, oang, look_ang, olook_ang, rotscrnang, orotscrnang;
|
||||
double spin;
|
||||
|
||||
void backup()
|
||||
{
|
||||
|
@ -147,24 +144,14 @@ struct PlayerAngle
|
|||
rotscrnang = orotscrnang;
|
||||
}
|
||||
|
||||
void addadjustment(int value)
|
||||
{
|
||||
__addadjustment(buildlook(value));
|
||||
}
|
||||
|
||||
void addadjustment(double value)
|
||||
{
|
||||
__addadjustment(buildflook(value));
|
||||
}
|
||||
|
||||
void addadjustment(lookangle value)
|
||||
{
|
||||
__addadjustment(value);
|
||||
__addadjustment(buildfang(value));
|
||||
}
|
||||
|
||||
void addadjustment(binangle value)
|
||||
{
|
||||
__addadjustment(bamlook(value.asbam()));
|
||||
__addadjustment(value);
|
||||
}
|
||||
|
||||
void resetadjustment()
|
||||
|
@ -172,14 +159,9 @@ struct PlayerAngle
|
|||
adjustment = 0;
|
||||
}
|
||||
|
||||
void settarget(int value, bool backup = false)
|
||||
{
|
||||
__settarget(buildang(value & 2047), backup);
|
||||
}
|
||||
|
||||
void settarget(double value, bool backup = false)
|
||||
{
|
||||
__settarget(buildfang(fmod(value, 2048)), backup);
|
||||
__settarget(buildfang(value), backup);
|
||||
}
|
||||
|
||||
void settarget(binangle value, bool backup = false)
|
||||
|
@ -196,11 +178,11 @@ struct PlayerAngle
|
|||
{
|
||||
if (targetset())
|
||||
{
|
||||
auto delta = getincanglebam(ang, target).asbam();
|
||||
auto delta = getincanglebam(ang, target).signedbuildf();
|
||||
|
||||
if (delta > BAMUNIT)
|
||||
if (abs(delta) > 1)
|
||||
{
|
||||
ang += bamang(xs_CRoundToUInt(scaleAdjust * delta));
|
||||
ang += buildfang(scaleAdjust * delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -210,7 +192,7 @@ struct PlayerAngle
|
|||
}
|
||||
else if (adjustment)
|
||||
{
|
||||
ang += bamang(xs_CRoundToUInt(scaleAdjust * adjustment));
|
||||
ang += buildfang(scaleAdjust * adjustment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,39 +208,33 @@ struct PlayerAngle
|
|||
|
||||
binangle interpolatedsum(double const smoothratio)
|
||||
{
|
||||
double const ratio = smoothratio * (1. / FRACUNIT);
|
||||
uint32_t const dang = UINT32_MAX >> 1;
|
||||
int64_t const prev = osum().asbam();
|
||||
int64_t const curr = sum().asbam();
|
||||
return bamang(prev + xs_CRoundToUInt(ratio * (((curr + dang - prev) & 0xFFFFFFFF) - dang)));
|
||||
return interpolatedangle(osum(), sum(), smoothratio);
|
||||
}
|
||||
|
||||
lookangle interpolatedlookang(double const smoothratio)
|
||||
binangle interpolatedlookang(double const smoothratio)
|
||||
{
|
||||
double const ratio = smoothratio * (1. / FRACUNIT);
|
||||
return bamlook(olook_ang.asbam() + xs_CRoundToInt(ratio * (look_ang - olook_ang).asbam()));
|
||||
return interpolatedangle(olook_ang, look_ang, smoothratio);
|
||||
}
|
||||
|
||||
lookangle interpolatedrotscrn(double const smoothratio)
|
||||
binangle interpolatedrotscrn(double const smoothratio)
|
||||
{
|
||||
double const ratio = smoothratio * (1. / FRACUNIT);
|
||||
return bamlook(orotscrnang.asbam() + xs_CRoundToInt(ratio * (rotscrnang - orotscrnang).asbam()));
|
||||
return interpolatedangle(orotscrnang, rotscrnang, smoothratio);
|
||||
}
|
||||
|
||||
double look_anghalf(double const smoothratio)
|
||||
{
|
||||
return (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).asbam() * (0.5 / BAMUNIT); // Used within draw code for weapon and crosshair when looking left/right.
|
||||
return (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).signedbuildf() * 0.5; // Used within draw code for weapon and crosshair when looking left/right.
|
||||
}
|
||||
|
||||
private:
|
||||
binangle target;
|
||||
double adjustment;
|
||||
|
||||
void __addadjustment(lookangle value)
|
||||
void __addadjustment(binangle value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asbam();
|
||||
adjustment += value.signedbuildf();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -266,7 +242,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void __settarget(binangle value, bool backup = false)
|
||||
void __settarget(binangle value, bool backup)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ void RenderViewpoint(FRenderViewpoint& mainvp, IntRect* bounds, float fov, float
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
FRenderViewpoint SetupViewpoint(spritetype* cam, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang)
|
||||
FRenderViewpoint SetupViewpoint(spritetype* cam, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang)
|
||||
{
|
||||
FRenderViewpoint r_viewpoint{};
|
||||
r_viewpoint.CameraSprite = cam;
|
||||
|
@ -275,7 +275,7 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
|
||||
void animatecamsprite(double s);
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang)
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang)
|
||||
{
|
||||
checkRotatedWalls();
|
||||
|
||||
|
@ -328,7 +328,7 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
|||
All.Unclock();
|
||||
}
|
||||
|
||||
void render_camtex(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
void render_camtex(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
{
|
||||
int16_t sect = sectnum;
|
||||
updatesector(position.x, position.y, §);
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
class FSerializer;
|
||||
struct IntRect;
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang);
|
||||
void render_camtex(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio);
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang);
|
||||
void render_camtex(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio);
|
||||
|
||||
struct PortalDesc
|
||||
{
|
||||
|
|
|
@ -52,9 +52,9 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
|
|||
pTSprite->owner = pSprite->index;
|
||||
pTSprite->extra = pSprite->extra;
|
||||
pTSprite->flags = pSprite->hitag | 0x200;
|
||||
pTSprite->x = dx + interpolate(pSprite->ox, pSprite->x, interpolation);
|
||||
pTSprite->y = dy + interpolate(pSprite->oy, pSprite->y, interpolation);
|
||||
pTSprite->z = dz + interpolate(pSprite->oz, pSprite->z, interpolation);
|
||||
pTSprite->x = dx + interpolatedvalue(pSprite->ox, pSprite->x, interpolation);
|
||||
pTSprite->y = dy + interpolatedvalue(pSprite->oy, pSprite->y, interpolation);
|
||||
pTSprite->z = dz + interpolatedvalue(pSprite->oz, pSprite->z, interpolation);
|
||||
pTSprite->ang = pSprite->interpolatedang(interpolation);
|
||||
|
||||
int nAnim = 0;
|
||||
|
@ -147,7 +147,7 @@ RORHACK:
|
|||
int ror_status[16];
|
||||
for (int i = 0; i < 16; i++)
|
||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||
fixed_t deliriumPitchI = interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
||||
fixed_t deliriumPitchI = interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
||||
DrawMirrors(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, gInterpolate, gViewIndex);
|
||||
int bakCstat = gView->pSprite->cstat;
|
||||
if (gViewPos == 0)
|
||||
|
|
|
@ -527,36 +527,6 @@ inline int ClipRange(int a, int b, int c)
|
|||
return a;
|
||||
}
|
||||
|
||||
inline int interpolate(int a, int b, int c)
|
||||
{
|
||||
return a+MulScale(b-a,c, 16);
|
||||
}
|
||||
|
||||
inline double finterpolate(double a, double b, double c)
|
||||
{
|
||||
return a+MulScaleF(b-a,c, 16);
|
||||
}
|
||||
|
||||
inline int interpolateang(int a, int b, int c)
|
||||
{
|
||||
return a+MulScale(((b-a+1024)&2047)-1024, c, 16);
|
||||
}
|
||||
|
||||
inline fixed_t interpolateangfix16(fixed_t a, fixed_t b, int c)
|
||||
{
|
||||
return a+MulScale(((b-a+0x4000000)&0x7ffffff)-0x4000000, c, 16);
|
||||
}
|
||||
|
||||
inline binangle interpolateangbin(uint32_t a, uint32_t b, double c)
|
||||
{
|
||||
return bamang(xs_CRoundToUInt(a + MulScaleF(b - a, c, 16)));
|
||||
}
|
||||
|
||||
inline lookangle interpolateanglook(int32_t a, int32_t b, double c)
|
||||
{
|
||||
return bamlook(xs_CRoundToUInt(a + MulScaleF(b - a, c, 16)));
|
||||
}
|
||||
|
||||
inline char Chance(int a1)
|
||||
{
|
||||
return wrand() < (a1>>1);
|
||||
|
|
|
@ -700,7 +700,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
pPlayer->restTime = 0;
|
||||
pPlayer->kickPower = 0;
|
||||
pPlayer->laughCount = 0;
|
||||
pPlayer->angle.spin = buildlook(0);
|
||||
pPlayer->angle.spin = 0;
|
||||
pPlayer->posture = 0;
|
||||
pPlayer->voodooTarget = -1;
|
||||
pPlayer->voodooTargets = 0;
|
||||
|
@ -1640,14 +1640,14 @@ void playerProcess(PLAYER *pPlayer)
|
|||
}
|
||||
ProcessInput(pPlayer);
|
||||
int nSpeed = approxDist(xvel[nSprite], yvel[nSprite]);
|
||||
pPlayer->zViewVel = interpolate(pPlayer->zViewVel, zvel[nSprite], 0x7000);
|
||||
pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, zvel[nSprite], 0x7000);
|
||||
int dz = pPlayer->pSprite->z-pPosture->eyeAboveZ-pPlayer->zView;
|
||||
if (dz > 0)
|
||||
pPlayer->zViewVel += MulScale(dz<<8, 0xa000, 16);
|
||||
else
|
||||
pPlayer->zViewVel += MulScale(dz<<8, 0x1800, 16);
|
||||
pPlayer->zView += pPlayer->zViewVel>>8;
|
||||
pPlayer->zWeaponVel = interpolate(pPlayer->zWeaponVel, zvel[nSprite], 0x5000);
|
||||
pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, zvel[nSprite], 0x5000);
|
||||
dz = pPlayer->pSprite->z-pPosture->weaponAboveZ-pPlayer->zWeapon;
|
||||
if (dz > 0)
|
||||
pPlayer->zWeaponVel += MulScale(dz<<8, 0x8000, 16);
|
||||
|
|
|
@ -165,9 +165,9 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
if (pInput->avel)
|
||||
predict.angle = degang(pInput->avel);
|
||||
if (pInput->actions & SB_TURNAROUND)
|
||||
if (!predict.spin.asbuild())
|
||||
predict.spin = buildlook(-1024);
|
||||
if (predict.spin.asbuild() < 0)
|
||||
if (!predict.spin)
|
||||
predict.spin = -1024;
|
||||
if (predict.spin < 0)
|
||||
{
|
||||
int speed;
|
||||
if (predict.at48 == 1)
|
||||
|
@ -175,7 +175,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
else
|
||||
speed = 128;
|
||||
|
||||
predict.spin = buildlook(min(predict.spin.asbuild()+speed, 0));
|
||||
predict.spin = min(int(predict.spin) + speed, 0);
|
||||
predict.angle += buildang(speed);
|
||||
}
|
||||
|
||||
|
@ -249,12 +249,12 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
if (nSector2 == nSector)
|
||||
{
|
||||
int z2 = getflorzofslope(nSector2, x2, y2);
|
||||
predict.horizoff = q16horiz(interpolate(predict.horizoff.asq16(), IntToFixed(z1 - z2) >> 3, 0x4000));
|
||||
predict.horizoff = q16horiz(interpolatedvalue(predict.horizoff.asq16(), IntToFixed(z1 - z2) >> 3, 0x4000));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
predict.horizoff = q16horiz(interpolate(predict.horizoff.asq16(), 0, 0x4000));
|
||||
predict.horizoff = q16horiz(interpolatedvalue(predict.horizoff.asq16(), 0, 0x4000));
|
||||
if (abs(predict.horizoff.asq16()) < 4)
|
||||
predict.horizoff = q16horiz(0);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
|||
|
||||
int nSpeed = approxDist(predict.xvel, predict.yvel);
|
||||
|
||||
predict.at3c = interpolate(predict.at3c, predict.zvel, 0x7000);
|
||||
predict.at3c = interpolatedvalue(predict.at3c, predict.zvel, 0x7000);
|
||||
int dz = predict.z-pPosture->eyeAboveZ-predict.viewz;
|
||||
if (dz > 0)
|
||||
predict.at3c += MulScale(dz<<8, 0xa000, 16);
|
||||
|
@ -296,7 +296,7 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
|||
predict.at3c += MulScale(dz<<8, 0x1800, 16);
|
||||
predict.viewz += predict.at3c>>8;
|
||||
|
||||
predict.at44 = interpolate(predict.at44, predict.zvel, 0x5000);
|
||||
predict.at44 = interpolatedvalue(predict.at44, predict.zvel, 0x5000);
|
||||
dz = predict.z-pPosture->weaponAboveZ-predict.at40;
|
||||
if (dz > 0)
|
||||
predict.at44 += MulScale(dz<<8, 0x8000, 16);
|
||||
|
|
|
@ -839,14 +839,14 @@ void TranslateSector(int nSector, int a2, int a3, int a4, int a5, int a6, int a7
|
|||
int x, y;
|
||||
int nXSector = sector[nSector].extra;
|
||||
XSECTOR *pXSector = &xsector[nXSector];
|
||||
int v20 = interpolate(a6, a9, a2);
|
||||
int vc = interpolate(a6, a9, a3);
|
||||
int v20 = interpolatedvalue(a6, a9, a2);
|
||||
int vc = interpolatedvalue(a6, a9, a3);
|
||||
int v28 = vc - v20;
|
||||
int v24 = interpolate(a7, a10, a2);
|
||||
int v8 = interpolate(a7, a10, a3);
|
||||
int v24 = interpolatedvalue(a7, a10, a2);
|
||||
int v8 = interpolatedvalue(a7, a10, a3);
|
||||
int v2c = v8 - v24;
|
||||
int v44 = interpolate(a8, a11, a2);
|
||||
int vbp = interpolate(a8, a11, a3);
|
||||
int v44 = interpolatedvalue(a8, a11, a2);
|
||||
int vbp = interpolatedvalue(a8, a11, a3);
|
||||
int v14 = vbp - v44;
|
||||
int nWall = sector[nSector].wallptr;
|
||||
if (a12)
|
||||
|
|
|
@ -446,15 +446,15 @@ static void DrawMap(spritetype* pSprite)
|
|||
tm = 1;
|
||||
}
|
||||
VIEW* pView = &gPrevView[gViewIndex];
|
||||
int x = interpolate(pView->x, pSprite->x, gInterpolate);
|
||||
int y = interpolate(pView->y, pSprite->y, gInterpolate);
|
||||
int x = interpolatedvalue(pView->x, pSprite->x, gInterpolate);
|
||||
int y = interpolatedvalue(pView->y, pSprite->y, gInterpolate);
|
||||
int ang = (!SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate)).asbuild();
|
||||
DrawOverheadMap(x, y, ang, gInterpolate);
|
||||
if (tm)
|
||||
setViewport(hud_size);
|
||||
}
|
||||
|
||||
void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSectnum, double& zDelta, double& shakeX, double& shakeY, lookangle& rotscrnang)
|
||||
void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSectnum, double& zDelta, double& shakeX, double& shakeY, binangle& rotscrnang)
|
||||
{
|
||||
int bobWidth, bobHeight;
|
||||
|
||||
|
@ -462,14 +462,14 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSe
|
|||
if (numplayers > 1 && gView == gMe && gPrediction && gMe->pXSprite->health > 0)
|
||||
{
|
||||
nSectnum = predict.sectnum;
|
||||
cX = interpolate(predictOld.x, predict.x, gInterpolate);
|
||||
cY = interpolate(predictOld.y, predict.y, gInterpolate);
|
||||
cZ = interpolate(predictOld.viewz, predict.viewz, gInterpolate);
|
||||
zDelta = finterpolate(predictOld.weaponZ, predict.weaponZ, gInterpolate);
|
||||
bobWidth = interpolate(predictOld.bobWidth, predict.bobWidth, gInterpolate);
|
||||
bobHeight = interpolate(predictOld.bobHeight, predict.bobHeight, gInterpolate);
|
||||
shakeX = finterpolate(predictOld.shakeBobX, predict.shakeBobX, gInterpolate);
|
||||
shakeY = finterpolate(predictOld.shakeBobY, predict.shakeBobY, gInterpolate);
|
||||
cX = interpolatedvalue(predictOld.x, predict.x, gInterpolate);
|
||||
cY = interpolatedvalue(predictOld.y, predict.y, gInterpolate);
|
||||
cZ = interpolatedvalue(predictOld.viewz, predict.viewz, gInterpolate);
|
||||
zDelta = interpolatedvaluef(predictOld.weaponZ, predict.weaponZ, gInterpolate);
|
||||
bobWidth = interpolatedvalue(predictOld.bobWidth, predict.bobWidth, gInterpolate);
|
||||
bobHeight = interpolatedvalue(predictOld.bobHeight, predict.bobHeight, gInterpolate);
|
||||
shakeX = interpolatedvaluef(predictOld.shakeBobX, predict.shakeBobX, gInterpolate);
|
||||
shakeY = interpolatedvaluef(predictOld.shakeBobY, predict.shakeBobY, gInterpolate);
|
||||
|
||||
if (!SyncInput())
|
||||
{
|
||||
|
@ -479,28 +479,28 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSe
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32_t oang = predictOld.angle.asbam() + predictOld.look_ang.asbam();
|
||||
uint32_t ang = predict.angle.asbam() + predict.look_ang.asbam();
|
||||
cA = interpolateangbin(oang, ang, gInterpolate);
|
||||
auto oang = predictOld.angle + predictOld.look_ang;
|
||||
auto ang = predict.angle + predict.look_ang;
|
||||
cA = interpolatedangle(oang, ang, gInterpolate);
|
||||
|
||||
fixed_t ohoriz = (predictOld.horiz + predictOld.horizoff).asq16();
|
||||
fixed_t horiz = (predict.horiz + predict.horizoff).asq16();
|
||||
cH = q16horiz(interpolate(ohoriz, horiz, gInterpolate));
|
||||
cH = q16horiz(interpolatedvalue(ohoriz, horiz, gInterpolate));
|
||||
|
||||
rotscrnang = interpolateanglook(predictOld.rotscrnang.asbam(), predict.rotscrnang.asbam(), gInterpolate);
|
||||
rotscrnang = interpolatedangle(predictOld.rotscrnang, predict.rotscrnang, gInterpolate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VIEW* pView = &gPrevView[gViewIndex];
|
||||
cX = interpolate(pView->x, gView->pSprite->x, gInterpolate);
|
||||
cY = interpolate(pView->y, gView->pSprite->y, gInterpolate);
|
||||
cZ = interpolate(pView->viewz, gView->zView, gInterpolate);
|
||||
zDelta = finterpolate(pView->weaponZ, gView->zWeapon - gView->zView - (12 << 8), gInterpolate);
|
||||
bobWidth = interpolate(pView->bobWidth, gView->bobWidth, gInterpolate);
|
||||
bobHeight = interpolate(pView->bobHeight, gView->bobHeight, gInterpolate);
|
||||
shakeX = finterpolate(pView->shakeBobX, gView->swayWidth, gInterpolate);
|
||||
shakeY = finterpolate(pView->shakeBobY, gView->swayHeight, gInterpolate);
|
||||
cX = interpolatedvalue(pView->x, gView->pSprite->x, gInterpolate);
|
||||
cY = interpolatedvalue(pView->y, gView->pSprite->y, gInterpolate);
|
||||
cZ = interpolatedvalue(pView->viewz, gView->zView, gInterpolate);
|
||||
zDelta = interpolatedvaluef(pView->weaponZ, gView->zWeapon - gView->zView - (12 << 8), gInterpolate);
|
||||
bobWidth = interpolatedvalue(pView->bobWidth, gView->bobWidth, gInterpolate);
|
||||
bobHeight = interpolatedvalue(pView->bobHeight, gView->bobHeight, gInterpolate);
|
||||
shakeX = interpolatedvaluef(pView->shakeBobX, gView->swayWidth, gInterpolate);
|
||||
shakeY = interpolatedvaluef(pView->shakeBobY, gView->swayHeight, gInterpolate);
|
||||
|
||||
if (!SyncInput())
|
||||
{
|
||||
|
@ -681,10 +681,10 @@ void viewDrawScreen(bool sceneonly)
|
|||
int nSectnum;
|
||||
double zDelta;
|
||||
double shakeX, shakeY;
|
||||
lookangle rotscrnang;
|
||||
binangle rotscrnang;
|
||||
SetupView(cX, cY, cZ, cA, cH, nSectnum, zDelta, shakeX, shakeY, rotscrnang);
|
||||
|
||||
int tilt = interpolateang(gScreenTiltO, gScreenTilt, gInterpolate);
|
||||
int tilt = interpolatedangle(gScreenTiltO, gScreenTilt, gInterpolate);
|
||||
uint8_t v14 = 0;
|
||||
uint8_t v10 = 0;
|
||||
bool bDelirium = powerupCheck(gView, kPwUpDeliriumShroom) > 0;
|
||||
|
@ -693,7 +693,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
uint8_t otherview = powerupCheck(gView, kPwUpCrystalBall) > 0;
|
||||
if (tilt || bDelirium)
|
||||
{
|
||||
rotscrnang = buildlook(tilt);
|
||||
rotscrnang = buildang(tilt);
|
||||
}
|
||||
else if (otherview && gNetPlayers > 1)
|
||||
{
|
||||
|
@ -741,7 +741,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
}
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - brightness, 0));
|
||||
cA += q16ang(interpolateangfix16(IntToFixed(deliriumTurnO), IntToFixed(deliriumTurn), gInterpolate));
|
||||
cA += interpolatedangle(buildang(deliriumTurnO), buildang(deliriumTurn), gInterpolate);
|
||||
|
||||
int ceilingZ, floorZ;
|
||||
getzsofslope(nSectnum, cX, cY, &ceilingZ, &floorZ);
|
||||
|
@ -769,7 +769,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
|
||||
if (testnewrenderer)
|
||||
{
|
||||
fixedhoriz deliriumPitchI = q16horiz(interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate));
|
||||
fixedhoriz deliriumPitchI = q16horiz(interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate));
|
||||
int bakCstat = gView->pSprite->cstat;
|
||||
gView->pSprite->cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANSLUCENT_INVERT;
|
||||
render_drawrooms(gView->pSprite, { cX, cY, cZ }, nSectnum, cA, cH + deliriumPitchI, rotscrnang);
|
||||
|
|
|
@ -50,7 +50,7 @@ struct VIEW {
|
|||
int at40;
|
||||
int at44;
|
||||
int at48; // posture
|
||||
lookangle spin; // spin
|
||||
double spin; // spin
|
||||
int x; // x
|
||||
int y; // y
|
||||
int z; // z
|
||||
|
@ -66,8 +66,8 @@ struct VIEW {
|
|||
char at72; // underwater
|
||||
short at73; // sprite flags
|
||||
SPRITEHIT at75;
|
||||
lookangle look_ang;
|
||||
lookangle rotscrnang;
|
||||
binangle look_ang;
|
||||
binangle rotscrnang;
|
||||
};
|
||||
|
||||
extern VIEW gPrevView[kMaxPlayers];
|
||||
|
|
|
@ -466,9 +466,9 @@ void UpdateAimVector(PLAYER * pPlayer)
|
|||
aim2 = aim;
|
||||
RotateVector((int*)&aim2.dx, (int*)&aim2.dy, -pPSprite->ang);
|
||||
aim2.dz -= pPlayer->slope;
|
||||
pPlayer->relAim.dx = interpolate(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dy = interpolate(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dz = interpolate(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->aimSpeedVert);
|
||||
pPlayer->relAim.dx = interpolatedvalue(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dy = interpolatedvalue(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->aimSpeedHorz);
|
||||
pPlayer->relAim.dz = interpolatedvalue(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->aimSpeedVert);
|
||||
pPlayer->aim = pPlayer->relAim;
|
||||
RotateVector((int*)&pPlayer->aim.dx, (int*)&pPlayer->aim.dy, pPSprite->ang);
|
||||
pPlayer->aim.dz += pPlayer->slope;
|
||||
|
|
|
@ -464,7 +464,7 @@ void moveplayers(void)
|
|||
|
||||
if (p->actorsqu != nullptr)
|
||||
{
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s.x - p->posx, p->actorsqu->s.y - p->posy)) >> 2);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s.x - p->posx, p->actorsqu->s.y - p->posy)).signedbuild() >> 2);
|
||||
}
|
||||
|
||||
if (spri->extra > 0)
|
||||
|
@ -487,7 +487,7 @@ void moveplayers(void)
|
|||
|
||||
if (p->wackedbyactor != nullptr && p->wackedbyactor->s.statnum < MAXSTATUS)
|
||||
{
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s.x - p->posx, p->wackedbyactor->s.y - p->posy)) >> 1);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s.x - p->posx, p->wackedbyactor->s.y - p->posy)).signedbuild() >> 1);
|
||||
}
|
||||
}
|
||||
spri->ang = p->angle.ang.asbuild();
|
||||
|
|
|
@ -177,7 +177,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
{
|
||||
t->x -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx, 16);
|
||||
t->y -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy, 16);
|
||||
t->z = ps[s->yvel].oposz + MulScale(smoothratio, ps[s->yvel].posz - ps[s->yvel].oposz, 16);
|
||||
t->z = interpolatedvalue(ps[s->yvel].oposz, ps[s->yvel].posz, smoothratio);
|
||||
t->z += (40 << 8);
|
||||
}
|
||||
else if (s->picnum != CRANEPOLE)
|
||||
|
@ -328,10 +328,10 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
t->cstat |= 2;
|
||||
if (screenpeek == myconnectindex && numplayers >= 2)
|
||||
{
|
||||
t->x = omyx + MulScale((int)(myx - omyx), smoothratio, 16);
|
||||
t->y = omyy + MulScale((int)(myy - omyy), smoothratio, 16);
|
||||
t->z = omyz + MulScale((int)(myz - omyz), smoothratio, 16) + (40 << 8);
|
||||
t->ang = myang.asbuild() + MulScale((((myang.asbuild() + 1024 - myang.asbuild()) & 2047) - 1024), smoothratio, 16);
|
||||
t->x = interpolatedvalue(omyx, myx, smoothratio);
|
||||
t->y = interpolatedvalue(omyy, myy, smoothratio);
|
||||
t->z = interpolatedvalue(omyz, myz, smoothratio) + (40 << 8);
|
||||
t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild();
|
||||
t->sectnum = mycursectnum;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
{
|
||||
t->x -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx, 16);
|
||||
t->y -= MulScale(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy, 16);
|
||||
t->z = ps[s->yvel].oposz + MulScale(smoothratio, ps[s->yvel].posz - ps[s->yvel].oposz, 16);
|
||||
t->z = interpolatedvalue(ps[s->yvel].oposz, ps[s->yvel].posz, smoothratio);
|
||||
t->z += (40 << 8);
|
||||
s->xrepeat = 24;
|
||||
s->yrepeat = 17;
|
||||
|
@ -374,10 +374,10 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
|
|||
t->cstat |= 2;
|
||||
if (screenpeek == myconnectindex && numplayers >= 2)
|
||||
{
|
||||
t->x = omyx + MulScale((int)(myx - omyx), smoothratio, 16);
|
||||
t->y = omyy + MulScale((int)(myy - omyy), smoothratio, 16);
|
||||
t->z = omyz + MulScale((int)(myz - omyz), smoothratio, 16) + (40 << 8);
|
||||
t->ang = omyang.asbuild() + MulScale((((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024), smoothratio, 16);
|
||||
t->x = interpolatedvalue(omyx, myx, smoothratio);
|
||||
t->y = interpolatedvalue(omyy, myy, smoothratio);
|
||||
t->z = interpolatedvalue(omyz, myz, smoothratio) + (40 << 8);
|
||||
t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild();
|
||||
t->sectnum = mycursectnum;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,15 +265,15 @@ void drawoverlays(double smoothratio)
|
|||
{
|
||||
if (screenpeek == myconnectindex && numplayers > 1)
|
||||
{
|
||||
cposx = omyx + MulScale(myx - omyx, smoothratio, 16);
|
||||
cposy = omyy + MulScale(myy - omyy, smoothratio, 16);
|
||||
cang = !SyncInput() ? myang.asbuild() : omyang.asbuild() + MulScale(((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024, smoothratio, 16);
|
||||
cposx = interpolatedvalue(omyx, myx, smoothratio);
|
||||
cposy = interpolatedvalue(omyy, myy, smoothratio);
|
||||
cang = (!SyncInput() ? myang : interpolatedangle(omyang, myang, smoothratio)).asbuild();
|
||||
}
|
||||
else
|
||||
{
|
||||
cposx = pp->oposx + MulScale(pp->posx - pp->oposx, smoothratio, 16);
|
||||
cposy = pp->oposy + MulScale(pp->posy - pp->oposy, smoothratio, 16);
|
||||
cang = !SyncInput() ? pp->angle.ang.asbuild() : pp->angle.oang.asbuild() + MulScale(((pp->angle.ang.asbuild() + 1024 - pp->angle.oang.asbuild()) & 2047) - 1024, smoothratio, 16);
|
||||
cposx = interpolatedvalue(pp->oposx, pp->posx, smoothratio);
|
||||
cposy = interpolatedvalue(pp->oposy, pp->posy, smoothratio);
|
||||
cang = (!SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio)).asbuild();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -484,7 +484,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_LOOK_ANG:
|
||||
if (bSet) ps[iPlayer].angle.look_ang = buildlook(lValue);
|
||||
if (bSet) ps[iPlayer].angle.look_ang = buildang(lValue);
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.look_ang.asbuild(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
|
@ -645,8 +645,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_ONE_EIGHTY_COUNT:
|
||||
if (bSet) ps[iPlayer].angle.spin = buildlook(lValue);
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.spin.asbuild(), sActor, sPlayer);
|
||||
if (bSet) ps[iPlayer].angle.spin = lValue;
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.spin, sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_CHEAT_PHASE:
|
||||
|
@ -705,7 +705,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
break;
|
||||
|
||||
case PLAYER_ROTSCRNANG:
|
||||
if (bSet) ps[iPlayer].angle.rotscrnang = buildlook(lValue);
|
||||
if (bSet) ps[iPlayer].angle.rotscrnang = buildang(lValue);
|
||||
else SetGameVarID(lVar2, ps[iPlayer].angle.rotscrnang.asbuild(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
|
@ -2267,7 +2267,7 @@ int ParseState::parse(void)
|
|||
ps[g_p].weapreccnt = 0;
|
||||
ps[g_p].ftq = 0;
|
||||
ps[g_p].posxv = ps[g_p].posyv = 0;
|
||||
if (!isRR()) ps[g_p].angle.orotscrnang = ps[g_p].angle.rotscrnang = buildlook(0);
|
||||
if (!isRR()) ps[g_p].angle.orotscrnang = ps[g_p].angle.rotscrnang = buildang(0);
|
||||
|
||||
ps[g_p].falling_counter = 0;
|
||||
|
||||
|
|
|
@ -284,10 +284,10 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
horiz16th = get16thOfHoriz(snum, SyncInput(), smoothratio);
|
||||
look_anghalf = p->angle.look_anghalf(smoothratio);
|
||||
looking_arc = fabs(look_anghalf) / 4.5;
|
||||
weapon_sway = p->oweapon_sway + MulScaleF(p->weapon_sway - p->oweapon_sway, smoothratio, 16);
|
||||
kickback_pic = p->okickback_pic + MulScaleF(*kb - p->okickback_pic, smoothratio, 16);
|
||||
random_club_frame = p->orandom_club_frame + MulScaleF(p->random_club_frame - p->orandom_club_frame, smoothratio, 16);
|
||||
hard_landing = p->ohard_landing + MulScaleF(p->hard_landing - p->ohard_landing, smoothratio, 16);
|
||||
weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio);
|
||||
kickback_pic = interpolatedvaluef(p->okickback_pic, p->kickback_pic, smoothratio);
|
||||
random_club_frame = interpolatedvaluef(p->orandom_club_frame, p->random_club_frame, smoothratio);
|
||||
hard_landing = interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio);
|
||||
|
||||
shade = p->GetActor()->s.shade;
|
||||
if(shade > 24) shade = 24;
|
||||
|
@ -301,9 +301,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
animateknee(shade,snum,hard_landing,look_anghalf,horiz16th);
|
||||
|
||||
int opos = p->oweapon_pos * p->oweapon_pos;
|
||||
int npos = p->weapon_pos * p->weapon_pos;
|
||||
gun_pos = 80 - (opos + MulScaleF(npos - opos, smoothratio, 16));
|
||||
gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio);
|
||||
|
||||
weapon_xoffset = (160)-90;
|
||||
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
|
||||
|
|
|
@ -127,8 +127,8 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
|
||||
look_anghalf = p->angle.look_anghalf(smoothratio);
|
||||
looking_arc = fabs(look_anghalf) / 4.5;
|
||||
weapon_sway = p->oweapon_sway + MulScaleF((p->weapon_sway - p->oweapon_sway), smoothratio, 16);
|
||||
TiltStatus = !SyncInput() ? p->TiltStatus : p->oTiltStatus + MulScaleF((p->TiltStatus - p->oTiltStatus), smoothratio, 16);
|
||||
weapon_sway = interpolatedvaluef(p->oweapon_sway, p->weapon_sway, smoothratio);
|
||||
TiltStatus = !SyncInput() ? p->TiltStatus : interpolatedvaluef(p->oTiltStatus, p->TiltStatus, smoothratio);
|
||||
|
||||
if (shadedsector[p->cursectnum] == 1)
|
||||
shade = 16;
|
||||
|
@ -139,9 +139,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0))
|
||||
return;
|
||||
|
||||
int opos = p->oweapon_pos * p->oweapon_pos;
|
||||
int npos = p->weapon_pos * p->weapon_pos;
|
||||
gun_pos = 80 - (opos + MulScaleF(npos - opos, smoothratio, 16));
|
||||
gun_pos = 80 - interpolatedvaluef(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, smoothratio);
|
||||
|
||||
weapon_xoffset = (160)-90;
|
||||
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
|
||||
|
@ -150,7 +148,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
gun_pos -= fabs(bsinf(weapon_sway * 4., -9));
|
||||
else gun_pos -= fabs(bsinf(weapon_sway * 0.5, -10));
|
||||
|
||||
gun_pos -= (p->ohard_landing + MulScaleF(p->hard_landing - p->ohard_landing, smoothratio, 16)) * 8.;
|
||||
gun_pos -= interpolatedvaluef(p->ohard_landing, p->hard_landing, smoothratio) * 8.;
|
||||
|
||||
if(p->last_weapon >= 0)
|
||||
cw = p->last_weapon;
|
||||
|
|
|
@ -477,7 +477,7 @@ void hud_input(int plnum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerInput(plnum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane == nullptr)
|
||||
if (PlayerInput(plnum, SB_TURNAROUND) && p->angle.spin == 0 && p->on_crane == nullptr)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_TURNAROUND, plnum, nullptr, -1);
|
||||
|
|
|
@ -121,7 +121,7 @@ void forceplayerangle(int snum)
|
|||
|
||||
p->horizon.addadjustment(64);
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
p->angle.rotscrnang = p->angle.look_ang = buildlook(n >> 1);
|
||||
p->angle.rotscrnang = p->angle.look_ang = buildang(n >> 1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -630,7 +630,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
|||
pushmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 128L, (4 << 8), (20 << 8), CLIPMASK0);
|
||||
|
||||
if (fz > cz + (16 << 8) && s->pal != 1)
|
||||
p->angle.rotscrnang = buildlook(p->dead_flag + ((fz + p->posz) >> 7));
|
||||
p->angle.rotscrnang = buildang(p->dead_flag + ((fz + p->posz) >> 7));
|
||||
|
||||
p->on_warping_sector = 0;
|
||||
|
||||
|
@ -741,16 +741,16 @@ void player_struct::apply_seasick(double factor)
|
|||
if (SeaSick < 250)
|
||||
{
|
||||
if (SeaSick >= 180)
|
||||
angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
angle.rotscrnang += bamang(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
else if (SeaSick >= 130)
|
||||
angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
angle.rotscrnang -= bamang(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
else if (SeaSick >= 70)
|
||||
angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
angle.rotscrnang += bamang(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
else if (SeaSick >= 20)
|
||||
angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
angle.rotscrnang -= bamang(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
}
|
||||
if (SeaSick < 250)
|
||||
angle.look_ang = bamlook(xs_CRoundToUInt(((krand() & 255) - 128) * factor * BAMUNIT));
|
||||
angle.look_ang = bamang(xs_CRoundToUInt(((krand() & 255) - 128) * factor * BAMUNIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1773,7 +1773,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
|||
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight))
|
||||
{
|
||||
velAdjustment = p->vehTurnLeft ? -10 : 10;
|
||||
auto angAdjustment = buildlook(velAdjustment < 0 ? 350 : -350);
|
||||
auto angAdjustment = (velAdjustment < 0 ? 350 : -350) << BAMBITS;
|
||||
|
||||
if (p->moto_on_mud || p->moto_on_oil || !p->NotOnWater)
|
||||
{
|
||||
|
@ -1811,7 +1811,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
|||
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - angAdjustment));
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment)));
|
||||
}
|
||||
else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil))
|
||||
{
|
||||
|
@ -2040,7 +2040,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
|||
{
|
||||
int currSpeed = p->MotoSpeed * 4.;
|
||||
short velAdjustment = p->vehTurnLeft ? -10 : 10;
|
||||
auto angAdjustment = buildlook(velAdjustment < 0 ? 350 : -350);
|
||||
auto angAdjustment = (velAdjustment < 0 ? 350 : -350) << BAMBITS;
|
||||
|
||||
if (p->moto_do_bump)
|
||||
{
|
||||
|
@ -2055,7 +2055,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
|||
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - angAdjustment));
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment)));
|
||||
}
|
||||
if (p->NotOnWater && p->MotoSpeed > 50)
|
||||
p->MotoSpeed -= (p->MotoSpeed / 2.);
|
||||
|
|
|
@ -140,8 +140,8 @@ void resetplayerstats(int snum)
|
|||
p->jetpack_on = 0;
|
||||
p->holoduke_on = nullptr;
|
||||
|
||||
p->angle.olook_ang = p->angle.look_ang = buildlook(512 - ((currentLevel->levelNumber & 1) << 10));
|
||||
p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0);
|
||||
p->angle.olook_ang = p->angle.look_ang = buildang(512 - ((currentLevel->levelNumber & 1) << 10));
|
||||
p->angle.orotscrnang = p->angle.rotscrnang = buildang(0);
|
||||
|
||||
p->newOwner =nullptr;
|
||||
p->jumping_counter = 0;
|
||||
|
@ -152,7 +152,7 @@ void resetplayerstats(int snum)
|
|||
p->fric.x = 0;
|
||||
p->fric.y = 0;
|
||||
p->somethingonplayer =nullptr;
|
||||
p->angle.spin = bamlook(0);
|
||||
p->angle.spin = 0;
|
||||
|
||||
p->on_crane = nullptr;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ BEGIN_DUKE_NS
|
|||
/*static*/ int tempsectorpicnum[MAXSECTORS];
|
||||
//short tempcursectnum;
|
||||
|
||||
void renderView(spritetype* playersprite, int sectnum, int x, int y, int z, binangle a, fixedhoriz h, lookangle rotscrnang, int smoothratio)
|
||||
void renderView(spritetype* playersprite, int sectnum, int x, int y, int z, binangle a, fixedhoriz h, binangle rotscrnang, int smoothratio)
|
||||
{
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ void GameInterface::UpdateCameras(double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
render_camtex(camera, camera->pos, camera->sectnum, ang, buildhoriz(camera->shade), buildlook(0), tex, rect, smoothratio);
|
||||
render_camtex(camera, camera->pos, camera->sectnum, ang, buildhoriz(camera->shade), buildang(0), tex, rect, smoothratio);
|
||||
}
|
||||
display_mirror = 0;
|
||||
});
|
||||
|
@ -257,8 +257,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
{
|
||||
int cposx, cposy, cposz, fz, cz;
|
||||
short sect;
|
||||
binangle cang;
|
||||
lookangle rotscrnang;
|
||||
binangle cang, rotscrnang;
|
||||
fixedhoriz choriz;
|
||||
struct player_struct* p;
|
||||
int tiltcs = 0; // JBF 20030807
|
||||
|
@ -299,10 +298,10 @@ void displayrooms(int snum, double smoothratio)
|
|||
if (s->yvel < 0) s->yvel = -100;
|
||||
else if (s->yvel > 199) s->yvel = 300;
|
||||
|
||||
cang = buildfang(ud.cameraactor->tempang + MulScaleF(((s->ang + 1024 - ud.cameraactor->tempang) & 2047) - 1024, smoothratio, 16));
|
||||
cang = buildang(interpolatedangle(ud.cameraactor->tempang, s->ang, smoothratio));
|
||||
|
||||
auto bh = buildhoriz(s->yvel);
|
||||
renderView(s, s->sectnum, s->x, s->y, s->z - (4 << 8), cang, bh, buildlook(0), smoothratio);
|
||||
renderView(s, s->sectnum, s->x, s->y, s->z - (4 << 8), cang, bh, buildang(0), smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -320,15 +319,13 @@ void displayrooms(int snum, double smoothratio)
|
|||
|
||||
if ((snum == myconnectindex) && (numplayers > 1))
|
||||
{
|
||||
cposx = omyx + xs_CRoundToInt(MulScaleF(myx - omyx, smoothratio, 16));
|
||||
cposy = omyy + xs_CRoundToInt(MulScaleF(myy - omyy, smoothratio, 16));
|
||||
cposz = omyz + xs_CRoundToInt(MulScaleF(myz - omyz, smoothratio, 16));
|
||||
cposx = interpolatedvalue(omyx, myx, smoothratio);
|
||||
cposy = interpolatedvalue(omyy, myy, smoothratio);
|
||||
cposz = interpolatedvalue(omyz, myz, smoothratio);
|
||||
if (SyncInput())
|
||||
{
|
||||
fixed_t ohorz = (omyhoriz + omyhorizoff).asq16();
|
||||
fixed_t horz = (myhoriz + myhorizoff).asq16();
|
||||
choriz = q16horiz(ohorz + xs_CRoundToInt(MulScaleF(horz - ohorz, smoothratio, 16)));
|
||||
cang = bamang(xs_CRoundToUInt(omyang.asbam() + MulScaleF((myang - omyang).asbam(), smoothratio, 16)));
|
||||
choriz = q16horiz(interpolatedvalue((omyhoriz + omyhorizoff).asq16(), (myhoriz + myhorizoff).asq16(), smoothratio));
|
||||
cang = interpolatedangle(omyang, myang, smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -339,9 +336,9 @@ void displayrooms(int snum, double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
cposx = p->oposx + xs_CRoundToInt(MulScaleF(p->posx - p->oposx, smoothratio, 16));
|
||||
cposy = p->oposy + xs_CRoundToInt(MulScaleF(p->posy - p->oposy, smoothratio, 16));
|
||||
cposz = p->oposz + xs_CRoundToInt(MulScaleF(p->posz - p->oposz, smoothratio, 16));
|
||||
cposx = interpolatedvalue(p->oposx, p->posx, smoothratio);
|
||||
cposy = interpolatedvalue(p->oposy, p->posy, smoothratio);
|
||||
cposz = interpolatedvalue(p->oposz, p->posz, smoothratio);;
|
||||
if (SyncInput())
|
||||
{
|
||||
// Original code for when the values are passed through the sync struct
|
||||
|
@ -366,13 +363,13 @@ void displayrooms(int snum, double smoothratio)
|
|||
cposy = spr->pos.y;
|
||||
cposz = spr->pos.z;
|
||||
sect = spr->sectnum;
|
||||
rotscrnang = buildlook(0);
|
||||
rotscrnang = buildang(0);
|
||||
smoothratio = MaxSmoothRatio;
|
||||
viewer = spr;
|
||||
}
|
||||
else if (p->over_shoulder_on == 0)
|
||||
{
|
||||
if (cl_viewbob) cposz += p->opyoff + xs_CRoundToInt(MulScaleF(p->pyoff - p->opyoff, smoothratio, 16));
|
||||
if (cl_viewbob) cposz += interpolatedvalue(p->opyoff, p->pyoff, smoothratio);
|
||||
viewer = &p->GetActor()->s;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -965,8 +965,8 @@ void DrawWeapons(double smooth)
|
|||
if (cl_weaponsway)
|
||||
{
|
||||
// CHECKME - not & 0x7FF?
|
||||
double nBobAngle = obobangle + MulScaleF(((bobangle + 1024 - obobangle) & 2047) - 1024, smooth, 16);
|
||||
double nVal = (ototalvel[nLocalPlayer] + MulScaleF(totalvel[nLocalPlayer] - ototalvel[nLocalPlayer], smooth, 16)) * 0.5;
|
||||
double nBobAngle = interpolatedangle(buildang(obobangle), buildang(bobangle), smooth).asbuildf();
|
||||
double nVal = interpolatedvaluef(ototalvel[nLocalPlayer], totalvel[nLocalPlayer], smooth, 17);
|
||||
yOffset = MulScaleF(nVal, bsinf(fmod(nBobAngle, 1024.), -8), 9);
|
||||
|
||||
if (var_34 == 1)
|
||||
|
|
|
@ -193,11 +193,6 @@ void ResetView()
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline int interpolate16(int a, int b, int smooth)
|
||||
{
|
||||
return a + MulScale(b - a, smooth, 16);
|
||||
}
|
||||
|
||||
static TextOverlay subtitleOverlay;
|
||||
|
||||
void DrawView(double smoothRatio, bool sceneonly)
|
||||
|
@ -206,9 +201,8 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
int playerY;
|
||||
int playerZ;
|
||||
short nSector;
|
||||
binangle nAngle;
|
||||
binangle nAngle, rotscrnang;
|
||||
fixedhoriz pan;
|
||||
lookangle rotscrnang;
|
||||
|
||||
fixed_t dang = IntToFixed(1024);
|
||||
|
||||
|
@ -230,7 +224,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
playerZ = sprite[nSprite].z;
|
||||
nSector = sprite[nSprite].sectnum;
|
||||
nAngle = buildang(sprite[nSprite].ang);
|
||||
rotscrnang = buildlook(0);
|
||||
rotscrnang = buildang(0);
|
||||
|
||||
SetGreenPal();
|
||||
|
||||
|
@ -251,7 +245,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
auto psp = &sprite[nPlayerSprite];
|
||||
playerX = psp->interpolatedx(smoothRatio);
|
||||
playerY = psp->interpolatedy(smoothRatio);
|
||||
playerZ = psp->interpolatedz(smoothRatio) + interpolate16(oeyelevel[nLocalPlayer], eyelevel[nLocalPlayer], smoothRatio);
|
||||
playerZ = psp->interpolatedz(smoothRatio) + interpolatedvalue(oeyelevel[nLocalPlayer], eyelevel[nLocalPlayer], smoothRatio);
|
||||
|
||||
nSector = nPlayerViewSect[nLocalPlayer];
|
||||
updatesector(playerX, playerY, &nSector);
|
||||
|
|
|
@ -43,10 +43,5 @@ extern int gFov;
|
|||
extern spritetype* mytsprite;
|
||||
extern int* myspritesortcnt;
|
||||
|
||||
static inline int angle_interpolate16(int a, int b, int smooth)
|
||||
{
|
||||
return a + MulScale(((b+1024-a)&2047)-1024, smooth, 16);
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
||||
|
|
|
@ -218,9 +218,9 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
|
|||
|
||||
mirrorinview = true;
|
||||
|
||||
// tx = pp->oposx + MulScale(pp->posx - pp->oposx, smoothratio, 16);
|
||||
// ty = pp->oposy + MulScale(pp->posy - pp->oposy, smoothratio, 16);
|
||||
// tz = pp->oposz + MulScale(pp->posz - pp->oposz, smoothratio, 16);
|
||||
// tx = interpolatedvalue(pp->oposx, pp->posx, smoothratio);
|
||||
// ty = interpolatedvalue(pp->oposy, pp->posy, smoothratio);
|
||||
// tz = interpolatedvalue(pp->oposz, pp->posz, smoothratio);
|
||||
// tpq16ang = pp->angle.ang.asq16();
|
||||
|
||||
|
||||
|
|
|
@ -1466,8 +1466,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
{
|
||||
extern bool CameraTestMode;
|
||||
int tx, ty, tz;
|
||||
lookangle trotscrnang;
|
||||
binangle tang;
|
||||
binangle tang, trotscrnang;
|
||||
fixedhoriz thoriz;
|
||||
short tsectnum;
|
||||
short i,j;
|
||||
|
@ -1503,9 +1502,9 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
else
|
||||
camerapp = pp;
|
||||
|
||||
tx = camerapp->oposx + xs_CRoundToInt(MulScaleF(camerapp->posx - camerapp->oposx, smoothratio, 16));
|
||||
ty = camerapp->oposy + xs_CRoundToInt(MulScaleF(camerapp->posy - camerapp->oposy, smoothratio, 16));
|
||||
tz = camerapp->oposz + xs_CRoundToInt(MulScaleF(camerapp->posz - camerapp->oposz, smoothratio, 16));
|
||||
tx = interpolatedvalue(camerapp->oposx, camerapp->posx, smoothratio);
|
||||
ty = interpolatedvalue(camerapp->oposy, camerapp->posy, smoothratio);
|
||||
tz = interpolatedvalue(camerapp->oposz, camerapp->posz, smoothratio);
|
||||
|
||||
// Interpolate the player's angle while on a sector object, just like VoidSW.
|
||||
// This isn't needed for the turret as it was fixable, but moving sector objects are problematic.
|
||||
|
@ -1594,7 +1593,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
if (cl_viewbob)
|
||||
{
|
||||
tz += bob_amt;
|
||||
tz += pp->obob_z + xs_CRoundToInt(MulScaleF(pp->bob_z - pp->obob_z, smoothratio, 16));
|
||||
tz += interpolatedvalue(pp->obob_z, pp->bob_z, smoothratio);
|
||||
}
|
||||
|
||||
// recoil only when not in camera
|
||||
|
|
|
@ -480,7 +480,7 @@ void drawroomstotile(int daposx, int daposy, int daposz,
|
|||
}
|
||||
else
|
||||
{
|
||||
render_camtex(nullptr, { daposx, daposy, daposz }, dacursectnum, ang, horiz, buildlook(0), tileGetTexture(tilenume), rect, smoothratio);
|
||||
render_camtex(nullptr, { daposx, daposy, daposz }, dacursectnum, ang, horiz, buildang(0), tileGetTexture(tilenume), rect, smoothratio);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -6905,8 +6905,8 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
|
|||
ang = psp->rotate_ang;
|
||||
shade = 0;
|
||||
flags = 0;
|
||||
x = (psp->ox + MulScaleF(psp->x - psp->ox, smoothratio, 16)) - look_anghalf;
|
||||
y = (psp->oy + MulScaleF(psp->y - psp->oy, smoothratio, 16)) + looking_arc;
|
||||
x = interpolatedvaluef(psp->ox, psp->x, smoothratio) - look_anghalf;
|
||||
y = interpolatedvaluef(psp->oy, psp->y, smoothratio) + looking_arc;
|
||||
// initilize pal here - jack with it below
|
||||
pal = psp->pal;
|
||||
|
||||
|
|
|
@ -1606,8 +1606,7 @@ DoPlayerTurnVehicleRect(PLAYERp pp, int *x, int *y, int *ox, int *oy)
|
|||
void
|
||||
DoPlayerTurnTurret(PLAYERp pp, float avel)
|
||||
{
|
||||
lookangle diff;
|
||||
binangle new_ang;
|
||||
binangle new_ang, diff;
|
||||
SECTOR_OBJECTp sop = pp->sop;
|
||||
|
||||
if (sop->drive_angspeed)
|
||||
|
@ -6126,7 +6125,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
|
|||
|
||||
if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum))
|
||||
{
|
||||
pp->angle.addadjustment(getincanglebam(pp->angle.ang, bvectangbam(kp->x - pp->posx, kp->y - pp->posy)) >> 4);
|
||||
pp->angle.addadjustment(getincanglebam(pp->angle.ang, bvectangbam(kp->x - pp->posx, kp->y - pp->posy)).signedbuild() >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue