mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
Merge branch 'master' into newrenderer2
This commit is contained in:
commit
55ad51ee1f
29 changed files with 264 additions and 231 deletions
20
.github/workflows/continuous_integration.yml
vendored
20
.github/workflows/continuous_integration.yml
vendored
|
@ -25,43 +25,43 @@ jobs:
|
|||
- {
|
||||
name: "macOS",
|
||||
os: macos-10.15,
|
||||
extra_options: "-DDYN_FLUIDSYNTH=OFF -DDYN_OPENAL=OFF -DDYN_SNDFILE=OFF -DDYN_MPG123=OFF",
|
||||
deps_cmdline: "brew install libvpx",
|
||||
build_type: "Release"
|
||||
}
|
||||
- {
|
||||
name: "macOS",
|
||||
os: macos-10.15,
|
||||
extra_options: "-DDYN_FLUIDSYNTH=OFF -DDYN_OPENAL=OFF -DDYN_SNDFILE=OFF -DDYN_MPG123=OFF",
|
||||
deps_cmdline: "brew install libvpx fluidsynth mpg123 libsndfile",
|
||||
build_type: "Debug"
|
||||
}
|
||||
- {
|
||||
name: "Linux GCC 7",
|
||||
os: ubuntu-20.04,
|
||||
extra_options: "-DCMAKE_C_COMPILER=/usr/bin/gcc-7 -DCMAKE_CXX_COMPILER=/usr/bin/g++-7",
|
||||
deps_cmdline: "sudo apt update && sudo apt install libsdl2-dev libvpx-dev libgtk2.0-dev gcc-7 g++-7",
|
||||
extra_options: "-DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7",
|
||||
deps_cmdline: "sudo apt update && sudo apt install g++-7 libsdl2-dev libvpx-dev libgtk2.0-dev",
|
||||
build_type: "RelWithDebInfo"
|
||||
}
|
||||
- {
|
||||
name: "Linux GCC 10",
|
||||
os: ubuntu-20.04,
|
||||
extra_options: "-DCMAKE_C_COMPILER=/usr/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/bin/g++-10",
|
||||
deps_cmdline: "sudo apt update && sudo apt install libsdl2-dev libvpx-dev libgtk-3-dev",
|
||||
extra_options: "-DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10",
|
||||
deps_cmdline: "sudo apt update && sudo apt install g++-10 libsdl2-dev libvpx-dev libgtk-3-dev",
|
||||
build_type: "MinSizeRel"
|
||||
}
|
||||
- {
|
||||
name: "Linux Clang 6",
|
||||
os: ubuntu-20.04,
|
||||
extra_options: "-DCMAKE_C_COMPILER=/usr/bin/clang-6.0 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-6.0 \
|
||||
extra_options: "-DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 \
|
||||
-DDYN_FLUIDSYNTH=OFF -DDYN_OPENAL=OFF -DDYN_SNDFILE=OFF -DDYN_MPG123=OFF",
|
||||
deps_cmdline: "sudo apt update && sudo apt install clang-6.0 libsdl2-dev libvpx-dev libopenal-dev libfluidsynth-dev libmpg123-dev libsndfile1-dev",
|
||||
build_type: "Debug"
|
||||
}
|
||||
- {
|
||||
name: "Linux Clang 10",
|
||||
name: "Linux Clang 11",
|
||||
os: ubuntu-20.04,
|
||||
extra_options: "-DCMAKE_C_COMPILER=/usr/bin/clang-10 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10",
|
||||
deps_cmdline: "sudo apt update && sudo apt install libsdl2-dev libvpx-dev",
|
||||
extra_options: "-DCMAKE_C_COMPILER=clang-11 -DCMAKE_CXX_COMPILER=clang++-11",
|
||||
deps_cmdline: "sudo apt update && sudo apt install clang-11 libsdl2-dev libvpx-dev",
|
||||
build_type: "Release"
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ jobs:
|
|||
cd build
|
||||
git clone https://github.com/coelckers/ZMusic.git
|
||||
cd ZMusic
|
||||
git checkout 1.1.4
|
||||
git checkout 1.1.6
|
||||
cd ..
|
||||
cmake -B zmusic_build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_INSTALL_PREFIX=`pwd`/zmusic_install ${{ matrix.config.extra_options }} ZMusic
|
||||
cmake --build zmusic_build --target install --parallel 3
|
||||
|
|
|
@ -181,6 +181,10 @@ enum
|
|||
CSTAT_SPRITE_RESERVED5 = 1u<<14u, // used by Duke 3D (Polymer), Shadow Warrior, Blood
|
||||
|
||||
CSTAT_SPRITE_INVISIBLE = 1u<<15u,
|
||||
|
||||
// Raze extensions, using the higher bits to avoid conflitcs with the reserved and undocumented bits above.
|
||||
CSTAT_SPRITE_MDLROTATE = 1u<<16u, // Only for tsprites: rotate if this is a model or voxel.
|
||||
|
||||
};
|
||||
enum
|
||||
{
|
||||
|
@ -212,6 +216,7 @@ enum
|
|||
CSTAT_WALL_RESERVED1 = 1u<<13u,
|
||||
CSTAT_WALL_RESERVED2 = 1u<<14u, // used by Shadow Warrior, Blood
|
||||
CSTAT_WALL_RESERVED3 = 1u<<15u, // used by Shadow Warrior, Blood
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -234,7 +239,7 @@ struct spritetype
|
|||
};
|
||||
vec3_t opos;
|
||||
};
|
||||
uint16_t cstat;
|
||||
uint32_t cstat;
|
||||
int16_t picnum;
|
||||
int8_t shade;
|
||||
uint8_t pal, clipdist, blend;
|
||||
|
|
|
@ -210,7 +210,7 @@ EXTERN voxmodel_t *voxmodels[MAXVOXELS];
|
|||
|
||||
void voxfree(voxmodel_t *m);
|
||||
voxmodel_t *voxload(int lumpnum);
|
||||
int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr);
|
||||
int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr, bool rotate);
|
||||
|
||||
#endif // defined USE_OPENGL
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
extern tspritetype pm_tsprite[MAXSPRITESONSCREEN];
|
||||
extern int pm_spritesortcnt;
|
||||
extern int pm_smoothratio;
|
||||
|
||||
|
||||
namespace Polymost
|
||||
|
|
|
@ -1532,7 +1532,7 @@ int32_t polymost_mddraw(tspriteptr_t tspr)
|
|||
mdmodel_t *const vm = models[tile2model[Ptile2tile(tspr->picnum,
|
||||
(tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal)].modelid];
|
||||
if (vm->mdnum == 1)
|
||||
return polymost_voxdraw((voxmodel_t *)vm,tspr);
|
||||
return polymost_voxdraw((voxmodel_t *)vm,tspr, false); // can't access rotating info anymore
|
||||
else if (vm->mdnum == 3)
|
||||
return polymost_md3draw((md3model_t *)vm,tspr);
|
||||
return 0;
|
||||
|
|
|
@ -25,6 +25,7 @@ Ken Silverman's official web site: http://www.advsys.net/ken
|
|||
#include "gamefuncs.h"
|
||||
#include "hw_drawinfo.h"
|
||||
#include "gamestruct.h"
|
||||
#include "gamestruct.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -46,6 +47,7 @@ CVARD(Bool, hw_animsmoothing, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/di
|
|||
CVARD(Bool, hw_models, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable model rendering")
|
||||
CVARD(Bool, hw_parallaxskypanning, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable parallaxed floor/ceiling panning when drawing a parallaxing sky")
|
||||
CVARD(Float, hw_shadescale, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "multiplier for shading")
|
||||
int pm_smoothratio;
|
||||
|
||||
|
||||
//{ "r_yshearing", "enable/disable y-shearing", (void*)&r_yshearing, CVAR_BOOL, 0, 1 }, disabled because not fully functional
|
||||
|
@ -2747,13 +2749,15 @@ void polymost_drawsprite(int32_t snum)
|
|||
{
|
||||
if ((tspr->cstat & 48) != 48 && tiletovox[tspr->picnum] >= 0 && voxmodels[tiletovox[tspr->picnum]])
|
||||
{
|
||||
if (polymost_voxdraw(voxmodels[tiletovox[tspr->picnum]], tspr)) return;
|
||||
int num = tiletovox[tspr->picnum];
|
||||
if (polymost_voxdraw(voxmodels[num], tspr, voxrotate[num>>3] & (1<<(num&7)))) return;
|
||||
break; // else, render as flat sprite
|
||||
}
|
||||
|
||||
if ((tspr->cstat & 48) == 48 && tspr->picnum < MAXVOXELS && voxmodels[tspr->picnum])
|
||||
{
|
||||
polymost_voxdraw(voxmodels[tspr->picnum], tspr);
|
||||
int num = tspr->picnum;
|
||||
polymost_voxdraw(voxmodels[tspr->picnum], tspr, voxrotate[num >> 3] & (1 << (num & 7)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "hw_renderstate.h"
|
||||
#include "texturemanager.h"
|
||||
#include "voxels.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "hw_models.h"
|
||||
#include "printf.h"
|
||||
|
||||
|
@ -50,7 +51,7 @@ voxmodel_t *voxload(int lumpnum)
|
|||
}
|
||||
|
||||
//Draw voxel model as perfect cubes
|
||||
int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr)
|
||||
int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate)
|
||||
{
|
||||
float f, g, k0, zoff;
|
||||
|
||||
|
@ -60,6 +61,13 @@ int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr)
|
|||
if ((tspr->cstat & 48) == 32)
|
||||
return 0;
|
||||
|
||||
if ((tspr->cstat & CSTAT_SPRITE_MDLROTATE) || rotate)
|
||||
{
|
||||
int myclock = (PlayClock << 3) + MulScale(4 << 3, pm_smoothratio, 16);
|
||||
tspr->ang = (tspr->ang + myclock) & 2047; // will be applied in md3_vox_calcmat_common.
|
||||
}
|
||||
|
||||
|
||||
vec3f_t m0 = { m->scale, m->scale, m->scale };
|
||||
vec3f_t a0 = { 0, 0, m->zadd*m->scale };
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
extern FString currentGame;
|
||||
extern FString LumpFilter;
|
||||
extern int PlayClock;
|
||||
class FArgs;
|
||||
extern bool GUICapture;
|
||||
extern bool AppActive;
|
||||
|
|
|
@ -272,60 +272,68 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust)
|
||||
void sethorizon(PlayerHorizon* horizon, float const horz, ESyncBits* actions, double const scaleAdjust)
|
||||
{
|
||||
// Store current horizon as true pitch.
|
||||
double pitch = horiz->aspitch();
|
||||
|
||||
if (horz)
|
||||
// Process only if no targeted horizon set.
|
||||
if (!horizon->targetset())
|
||||
{
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
pitch += horz;
|
||||
}
|
||||
// Store current horizon as true pitch.
|
||||
double pitch = horizon->horiz.aspitch();
|
||||
|
||||
// this is the locked type
|
||||
if (*actions & (SB_AIM_UP|SB_AIM_DOWN))
|
||||
{
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
double const amount = HorizToPitch(250. / GameTicRate);
|
||||
|
||||
if (*actions & SB_AIM_DOWN)
|
||||
pitch -= scaleAdjust * amount;
|
||||
|
||||
if (*actions & SB_AIM_UP)
|
||||
pitch += scaleAdjust * amount;
|
||||
}
|
||||
|
||||
// this is the unlocked type
|
||||
if (*actions & (SB_LOOK_UP|SB_LOOK_DOWN))
|
||||
{
|
||||
*actions |= SB_CENTERVIEW;
|
||||
double const amount = HorizToPitch(500. / GameTicRate);
|
||||
|
||||
if (*actions & SB_LOOK_DOWN)
|
||||
pitch -= scaleAdjust * amount;
|
||||
|
||||
if (*actions & SB_LOOK_UP)
|
||||
pitch += scaleAdjust * amount;
|
||||
}
|
||||
|
||||
// clamp before converting back to horizon
|
||||
*horiz = q16horiz(clamp(PitchToHoriz(pitch), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
|
||||
// return to center if conditions met.
|
||||
if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
|
||||
{
|
||||
if (abs(horiz->asq16()) > FloatToFixed(0.25))
|
||||
if (horz)
|
||||
{
|
||||
// move horiz back to 0
|
||||
*horiz -= q16horiz(xs_CRoundToInt(scaleAdjust * horiz->asq16() * (10. / GameTicRate)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// not looking anymore because horiz is back at 0
|
||||
*horiz = q16horiz(0);
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
pitch += horz;
|
||||
}
|
||||
|
||||
// this is the locked type
|
||||
if (*actions & (SB_AIM_UP|SB_AIM_DOWN))
|
||||
{
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
double const amount = HorizToPitch(250. / GameTicRate);
|
||||
|
||||
if (*actions & SB_AIM_DOWN)
|
||||
pitch -= scaleAdjust * amount;
|
||||
|
||||
if (*actions & SB_AIM_UP)
|
||||
pitch += scaleAdjust * amount;
|
||||
}
|
||||
|
||||
// this is the unlocked type
|
||||
if (*actions & (SB_LOOK_UP|SB_LOOK_DOWN))
|
||||
{
|
||||
*actions |= SB_CENTERVIEW;
|
||||
double const amount = HorizToPitch(500. / GameTicRate);
|
||||
|
||||
if (*actions & SB_LOOK_DOWN)
|
||||
pitch -= scaleAdjust * amount;
|
||||
|
||||
if (*actions & SB_LOOK_UP)
|
||||
pitch += scaleAdjust * amount;
|
||||
}
|
||||
|
||||
// clamp before converting back to horizon
|
||||
horizon->horiz = q16horiz(clamp(PitchToHoriz(pitch), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
|
||||
// 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))
|
||||
{
|
||||
// move horiz back to 0
|
||||
horizon->horiz -= q16horiz(xs_CRoundToInt(scaleAdjust * horizon->horiz.asq16() * (10. / GameTicRate)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// not looking anymore because horiz is back at 0
|
||||
horizon->horiz = q16horiz(0);
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,34 +367,41 @@ void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double
|
|||
angle->rotscrnang -= bamlook(xs_CRoundToInt(scaleAdjust * (720. / GameTicRate) * BAMUNIT));
|
||||
}
|
||||
|
||||
if (*actions & SB_TURNAROUND)
|
||||
if (!angle->targetset())
|
||||
{
|
||||
if (angle->spin.asbam() == 0)
|
||||
if (*actions & SB_TURNAROUND)
|
||||
{
|
||||
// currently not spinning, so start a spin
|
||||
angle->spin = buildlook(-1024);
|
||||
if (angle->spin.asbam() == 0)
|
||||
{
|
||||
// currently not spinning, so start a spin
|
||||
angle->spin = buildlook(-1024);
|
||||
}
|
||||
*actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
*actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
|
||||
if (angle->spin.asbam() < 0)
|
||||
{
|
||||
// return spin to 0
|
||||
lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!(*actions & SB_CROUCH) ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
|
||||
angle->spin += add;
|
||||
if (angle->spin.asbam() > 0)
|
||||
if (angle->spin.asbam() < 0)
|
||||
{
|
||||
// Don't overshoot our target. With variable factor this is possible.
|
||||
add -= angle->spin;
|
||||
// return spin to 0
|
||||
lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!(*actions & SB_CROUCH) ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
|
||||
angle->spin += add;
|
||||
if (angle->spin.asbam() > 0)
|
||||
{
|
||||
// Don't overshoot our target. With variable factor this is possible.
|
||||
add -= angle->spin;
|
||||
angle->spin = bamlook(0);
|
||||
}
|
||||
angle->ang += bamang(add.asbam());
|
||||
}
|
||||
|
||||
if (avel)
|
||||
{
|
||||
// add player's input
|
||||
angle->ang += degang(avel);
|
||||
angle->spin = bamlook(0);
|
||||
}
|
||||
angle->ang += bamang(add.asbam());
|
||||
}
|
||||
|
||||
if (avel)
|
||||
else
|
||||
{
|
||||
// add player's input
|
||||
angle->ang += degang(avel);
|
||||
angle->spin = bamlook(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "m_fixed.h"
|
||||
#include "binaryangle.h"
|
||||
#include "gamecvars.h"
|
||||
#include "gamestruct.h"
|
||||
#include "packet.h"
|
||||
|
||||
int getincangle(int a, int na);
|
||||
|
@ -12,8 +13,7 @@ lookangle getincanglebam(binangle a, binangle na);
|
|||
|
||||
struct PlayerHorizon
|
||||
{
|
||||
fixedhoriz horiz, ohoriz, horizoff, ohorizoff, target;
|
||||
double adjustment;
|
||||
fixedhoriz horiz, ohoriz, horizoff, ohorizoff;
|
||||
|
||||
void backup()
|
||||
{
|
||||
|
@ -29,14 +29,7 @@ struct PlayerHorizon
|
|||
|
||||
void addadjustment(double value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value * FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
horiz += q16horiz(FloatToFixed(value));
|
||||
}
|
||||
__addadjustment(q16horiz(FloatToFixed(value)));
|
||||
}
|
||||
|
||||
void resetadjustment()
|
||||
|
@ -46,53 +39,35 @@ struct PlayerHorizon
|
|||
|
||||
void settarget(int value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = buildhoriz(value);
|
||||
if (target.asq16() == 0) target = q16horiz(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
horiz = buildhoriz(value);
|
||||
if (backup) ohoriz = horiz;
|
||||
}
|
||||
__settarget(buildhoriz(clamp(value, FixedToInt(gi->playerHorizMin()), FixedToInt(gi->playerHorizMax()))), backup);
|
||||
}
|
||||
|
||||
void settarget(double value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = buildfhoriz(value);
|
||||
if (target.asq16() == 0) target = q16horiz(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
horiz = buildfhoriz(value);
|
||||
if (backup) ohoriz = horiz;
|
||||
}
|
||||
__settarget(buildfhoriz(clamp(value, FixedToFloat(gi->playerHorizMin()), FixedToFloat(gi->playerHorizMax()))), backup);
|
||||
}
|
||||
|
||||
void settarget(fixedhoriz value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = value;
|
||||
if (target.asq16() == 0) target = q16horiz(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
horiz = value;
|
||||
if (backup) ohoriz = horiz;
|
||||
}
|
||||
__settarget(q16horiz(clamp(value.asq16(), gi->playerHorizMin(), gi->playerHorizMax())), backup);
|
||||
}
|
||||
|
||||
bool targetset()
|
||||
{
|
||||
return target.asq16();
|
||||
}
|
||||
|
||||
void processhelpers(double const scaleAdjust)
|
||||
{
|
||||
if (target.asq16())
|
||||
if (targetset())
|
||||
{
|
||||
horiz += q16horiz(xs_CRoundToInt(scaleAdjust * (target - horiz).asq16()));
|
||||
auto delta = (target - horiz).asq16();
|
||||
|
||||
if (abs((horiz - target).asq16()) < FRACUNIT)
|
||||
if (abs(delta) > FRACUNIT)
|
||||
{
|
||||
horiz += q16horiz(xs_CRoundToInt(scaleAdjust * delta));
|
||||
}
|
||||
else
|
||||
{
|
||||
horiz = target;
|
||||
target = q16horiz(0);
|
||||
|
@ -121,13 +96,42 @@ struct PlayerHorizon
|
|||
fixed_t const curr = sum().asq16();
|
||||
return q16horiz(prev + xs_CRoundToInt(ratio * (curr - prev)));
|
||||
}
|
||||
|
||||
private:
|
||||
fixedhoriz target;
|
||||
double adjustment;
|
||||
|
||||
void __addadjustment(fixedhoriz value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asq16();
|
||||
}
|
||||
else
|
||||
{
|
||||
horiz += value;
|
||||
}
|
||||
}
|
||||
|
||||
void __settarget(fixedhoriz value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = value;
|
||||
if (!targetset()) target = q16horiz(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
horiz = value;
|
||||
if (backup) ohoriz = horiz;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct PlayerAngle
|
||||
{
|
||||
binangle ang, oang, target;
|
||||
binangle ang, oang;
|
||||
lookangle look_ang, olook_ang, rotscrnang, orotscrnang, spin;
|
||||
double adjustment;
|
||||
|
||||
void backup()
|
||||
{
|
||||
|
@ -145,50 +149,22 @@ struct PlayerAngle
|
|||
|
||||
void addadjustment(int value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += BAngToBAM(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ang += buildang(value);
|
||||
}
|
||||
__addadjustment(buildang(value));
|
||||
}
|
||||
|
||||
void addadjustment(double value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value * BAMUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ang += bamang(xs_CRoundToUInt(value * BAMUNIT));
|
||||
}
|
||||
__addadjustment(buildfang(value));
|
||||
}
|
||||
|
||||
void addadjustment(lookangle value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asbam();
|
||||
}
|
||||
else
|
||||
{
|
||||
ang += bamang(value.asbam());
|
||||
}
|
||||
__addadjustment(bamang(value.asbam()));
|
||||
}
|
||||
|
||||
void addadjustment(binangle value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asbam();
|
||||
}
|
||||
else
|
||||
{
|
||||
ang += value;
|
||||
}
|
||||
__addadjustment(value);
|
||||
}
|
||||
|
||||
void resetadjustment()
|
||||
|
@ -198,53 +174,35 @@ struct PlayerAngle
|
|||
|
||||
void settarget(int value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = buildang(value & 2047);
|
||||
if (target.asbam() == 0) target = bamang(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = buildang(value & 2047);
|
||||
if (backup) oang = ang;
|
||||
}
|
||||
__settarget(buildang(value & 2047), backup);
|
||||
}
|
||||
|
||||
void settarget(double value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = buildfang(fmod(value, 2048));
|
||||
if (target.asbam() == 0) target = bamang(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = buildfang(fmod(value, 2048));
|
||||
if (backup) oang = ang;
|
||||
}
|
||||
__settarget(buildfang(fmod(value, 2048)), backup);
|
||||
}
|
||||
|
||||
void settarget(binangle value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = value;
|
||||
if (target.asbam() == 0) target = bamang(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = value;
|
||||
if (backup) oang = ang;
|
||||
}
|
||||
__settarget(value, backup);
|
||||
}
|
||||
|
||||
bool targetset()
|
||||
{
|
||||
return target.asbam();
|
||||
}
|
||||
|
||||
void processhelpers(double const scaleAdjust)
|
||||
{
|
||||
if (target.asbam())
|
||||
if (targetset())
|
||||
{
|
||||
ang += bamang(xs_CRoundToUInt(scaleAdjust * getincanglebam(ang, target).asbam()));
|
||||
auto delta = getincanglebam(ang, target).asbam();
|
||||
|
||||
if (getincanglebam(ang, target).asbam() < BAMUNIT)
|
||||
if (delta > BAMUNIT)
|
||||
{
|
||||
ang += bamang(xs_CRoundToUInt(scaleAdjust * delta));
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = target;
|
||||
target = bamang(0);
|
||||
|
@ -291,6 +249,36 @@ struct PlayerAngle
|
|||
{
|
||||
return (!SyncInput() ? look_ang : interpolatedlookang(smoothratio)).asbam() * (0.5 / BAMUNIT); // Used within draw code for weapon and crosshair when looking left/right.
|
||||
}
|
||||
|
||||
private:
|
||||
binangle target;
|
||||
double adjustment;
|
||||
|
||||
void __addadjustment(binangle value)
|
||||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.asbam();
|
||||
}
|
||||
else
|
||||
{
|
||||
ang += value;
|
||||
}
|
||||
}
|
||||
|
||||
void __settarget(binangle value, bool backup = false)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = value;
|
||||
if (!targetset()) target = bamang(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = value;
|
||||
if (backup) oang = ang;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class FSerializer;
|
||||
|
@ -302,6 +290,6 @@ void updateTurnHeldAmt(double const scaleAdjust);
|
|||
bool const isTurboTurnTime();
|
||||
void resetTurnHeldAmt();
|
||||
void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1);
|
||||
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust = 1);
|
||||
void sethorizon(PlayerHorizon* horizon, float const horz, ESyncBits* actions, double const scaleAdjust = 1);
|
||||
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust = 1);
|
||||
void calcviewpitch(vec2_t const pos, fixedhoriz* horizoff, binangle const ang, bool const aimmode, bool const canslopetilt, int const cursectnum, double const scaleAdjust = 1, bool const climbing = false);
|
||||
|
|
|
@ -574,8 +574,8 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
|
|||
|
||||
int const nVoxel = tiletovox[pTSprite->picnum];
|
||||
|
||||
if (nVoxel != -1 && ((voxrotate[nVoxel >> 3] & (1 << (nVoxel & 7))) != 0 || (picanm[nRootTile].extra & 7) == 7))
|
||||
pTSprite->ang = (pTSprite->ang + myclock) & 2047;
|
||||
if (nVoxel != -1 && (picanm[nRootTile].extra & 7) == 7)
|
||||
pTSprite->cstat |= CSTAT_SPRITE_MDLROTATE; // per-sprite rotation setting.
|
||||
}
|
||||
|
||||
if ((pTSprite->cstat&48) != 48 && hw_models && !(spriteext[nSprite].flags&SPREXT_NOTMD))
|
||||
|
@ -590,7 +590,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
|
|||
pTSprite->xoffset += tileLeftOffset(nAnimTile);
|
||||
|
||||
if ((picanm[nRootTile].extra&7) == 7)
|
||||
pTSprite->ang = (pTSprite->ang+myclock)&2047;
|
||||
pTSprite->cstat |= CSTAT_SPRITE_MDLROTATE; // per-sprite rotation setting.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
if (gView->pXSprite->health != 0)
|
||||
{
|
||||
applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust);
|
||||
sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
|
||||
sethorizon(&pPlayer->horizon, input.horz, &pPlayer->input.actions, scaleAdjust);
|
||||
doslopetilting(pPlayer, scaleAdjust);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ void playlogos()
|
|||
jobs[job++] = { Create<DImageScreen>(2518, DScreenJob::fadein) };
|
||||
|
||||
RunScreenJob(jobs, job, [](bool) {
|
||||
Mus_Stop();
|
||||
gameaction = ga_mainmenu;
|
||||
}, true, true);
|
||||
}
|
||||
|
|
|
@ -1327,7 +1327,8 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
else if (pPlayer->restTime >= 0)
|
||||
pPlayer->restTime += 4;
|
||||
|
||||
pPlayer->isRunning = !!(pInput->actions & SB_RUN) && pPlayer->restTime <= 10;
|
||||
// This was just too broken. Every single place in the game depending on 'isRunning' will misbehave if this is set because originally it never worked as intended.
|
||||
pPlayer->isRunning = false;// !!(pInput->actions& SB_RUN) && pPlayer->restTime <= 10;
|
||||
|
||||
WeaponProcess(pPlayer);
|
||||
if (pXSprite->health == 0)
|
||||
|
@ -1548,7 +1549,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
|
||||
if (SyncInput())
|
||||
{
|
||||
sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions);
|
||||
sethorizon(&pPlayer->horizon, pInput->horz, &pInput->actions);
|
||||
doslopetilting(pPlayer);
|
||||
}
|
||||
|
||||
|
|
|
@ -623,8 +623,8 @@ private:
|
|||
else
|
||||
DrawStatSprite(nTile, x, y, 40, 5);
|
||||
}
|
||||
DrawStatMaskedSprite(2202, 118.5, 185.5, pPlayer->isRunning ? 16 : 40);
|
||||
DrawStatMaskedSprite(2202, 201.5, 185.5, pPlayer->isRunning ? 16 : 40);
|
||||
DrawStatMaskedSprite(2202, 118.5, 185.5, /*pPlayer->isRunning ? 16 :*/ 40);
|
||||
DrawStatMaskedSprite(2202, 201.5, 185.5, /*pPlayer->isRunning ? 16 :*/ 40);
|
||||
if (pPlayer->throwPower)
|
||||
{
|
||||
TileHGauge(2260, 124, 175.5, pPlayer->throwPower, 65536);
|
||||
|
|
|
@ -652,6 +652,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
gInterpolate = I_GetTimeFrac() * MaxSmoothRatio;
|
||||
}
|
||||
else gInterpolate = MaxSmoothRatio;
|
||||
pm_smoothratio = (int)gInterpolate;
|
||||
|
||||
if (cl_interpolate)
|
||||
{
|
||||
|
|
|
@ -1002,7 +1002,7 @@ void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (sj->statnum == 6)
|
||||
else if (sj->statnum == STAT_STANDABLE)
|
||||
{
|
||||
if (sj->picnum == spectype1 || sj->picnum == spectype2) // SEENINE and OOZFILTER
|
||||
{
|
||||
|
@ -1010,7 +1010,12 @@ void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2)
|
|||
}
|
||||
}
|
||||
}
|
||||
deletesprite(actor);
|
||||
// we cannot delete this because it may be used as a sound source.
|
||||
// This originally depended on undefined behavior as the deleted sprite was still used for the sound
|
||||
// with no checking if it got reused in the mean time.
|
||||
spri->picnum = 0; // give it a picnum without any behavior attached, just in case
|
||||
spri->cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
changespritestat(actor->GetIndex(), STAT_REMOVED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2556,26 +2556,29 @@ static void greenslime(DDukeActor *actor)
|
|||
{
|
||||
auto s5 = actor->temp_actor;
|
||||
makeitfall(actor);
|
||||
s5->s.xvel = 0;
|
||||
|
||||
int l = s5->s.ang;
|
||||
|
||||
s->z = s5->s.z;
|
||||
s->x = s5->s.x + bcos(l, -11);
|
||||
s->y = s5->s.y + bsin(l, -11);
|
||||
|
||||
s->picnum = GREENSLIME + 2 + (global_random & 1);
|
||||
|
||||
if (s->yrepeat < 64) s->yrepeat += 2;
|
||||
else
|
||||
if (s5)
|
||||
{
|
||||
if (s->xrepeat < 32) s->xrepeat += 4;
|
||||
s5->s.xvel = 0;
|
||||
|
||||
int l = s5->s.ang;
|
||||
|
||||
s->z = s5->s.z;
|
||||
s->x = s5->s.x + bcos(l, -11);
|
||||
s->y = s5->s.y + bsin(l, -11);
|
||||
|
||||
s->picnum = GREENSLIME + 2 + (global_random & 1);
|
||||
|
||||
if (s->yrepeat < 64) s->yrepeat += 2;
|
||||
else
|
||||
{
|
||||
t[0] = -1;
|
||||
x = ldist(actor, s5);
|
||||
if (x < 768) {
|
||||
s5->s.xrepeat = 0;
|
||||
if (s->xrepeat < 32) s->xrepeat += 4;
|
||||
else
|
||||
{
|
||||
t[0] = -1;
|
||||
x = ldist(actor, s5);
|
||||
if (x < 768) {
|
||||
s5->s.xrepeat = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,6 +256,7 @@ enum
|
|||
|
||||
STAT_DESTRUCT = 100,
|
||||
STAT_BOWLING = 105,
|
||||
STAT_REMOVED = MAXSTATUS-2,
|
||||
STAT_NETALLOC = MAXSTATUS-1
|
||||
};
|
||||
|
||||
|
|
|
@ -842,7 +842,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
doslopetilting(p, scaleAdjust);
|
||||
applylook(&p->angle, p->adjustavel(input.avel), &p->sync.actions, scaleAdjust);
|
||||
p->apply_seasick(scaleAdjust);
|
||||
sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
|
||||
sethorizon(&p->horizon, input.horz, &p->sync.actions, scaleAdjust);
|
||||
}
|
||||
|
||||
p->angle.processhelpers(scaleAdjust);
|
||||
|
|
|
@ -3139,7 +3139,7 @@ HORIZONLY:
|
|||
|
||||
if (SyncInput())
|
||||
{
|
||||
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
||||
sethorizon(&p->horizon, PlayerHorizon(snum), &p->sync.actions);
|
||||
}
|
||||
|
||||
p->checkhardlanding();
|
||||
|
|
|
@ -4001,7 +4001,7 @@ HORIZONLY:
|
|||
|
||||
if (SyncInput())
|
||||
{
|
||||
sethorizon(&p->horizon.horiz, PlayerHorizon(snum), &p->sync.actions);
|
||||
sethorizon(&p->horizon, PlayerHorizon(snum), &p->sync.actions);
|
||||
}
|
||||
|
||||
p->checkhardlanding();
|
||||
|
|
|
@ -263,6 +263,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
int tiltcs = 0; // JBF 20030807
|
||||
|
||||
p = &ps[snum];
|
||||
pm_smoothratio = (int)smoothratio;
|
||||
|
||||
if (automapMode == am_full || p->cursectnum == -1)
|
||||
return;
|
||||
|
|
|
@ -445,10 +445,6 @@ void GameInterface::UpdateSounds(void)
|
|||
|
||||
int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel, EChanFlags flags)
|
||||
{
|
||||
if (sndnum == GENERIC_AMBIENCE1 || sndnum == DUMPSTER_MOVE)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
auto const pl = &ps[myconnectindex];
|
||||
if (!soundEngine->isValidSoundId(sndnum+1) || !SoundEnabled() || actor == nullptr || !playrunning() ||
|
||||
(pl->timebeforeexit > 0 && pl->timebeforeexit <= REALGAMETICSPERSEC * 3)) return -1;
|
||||
|
|
|
@ -125,7 +125,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
if (!nFreeze)
|
||||
{
|
||||
applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
|
||||
sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
|
||||
sethorizon(&pPlayer->horizon, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
|
||||
}
|
||||
|
||||
pPlayer->angle.processhelpers(scaleAdjust);
|
||||
|
|
|
@ -2656,7 +2656,7 @@ loc_1BD2E:
|
|||
if (SyncInput())
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions);
|
||||
sethorizon(&pPlayer->horizon, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions);
|
||||
}
|
||||
}
|
||||
else // else, player's health is less than 0
|
||||
|
|
|
@ -216,6 +216,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
zbob = bsin(2 * bobangle, -3);
|
||||
|
||||
DoInterpolations(smoothRatio / 65536.);
|
||||
pm_smoothratio = (int)smoothRatio;
|
||||
|
||||
int nPlayerSprite = PlayerList[nLocalPlayer].nSprite;
|
||||
int nPlayerOldCstat = sprite[nPlayerSprite].cstat;
|
||||
|
|
|
@ -1489,6 +1489,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
PreDraw();
|
||||
|
||||
PreUpdatePanel(smoothratio);
|
||||
pm_smoothratio = (int)smoothratio;
|
||||
|
||||
if (!ScreenSavePic)
|
||||
{
|
||||
|
|
|
@ -1669,7 +1669,7 @@ DoPlayerHorizon(PLAYERp pp, float const horz, double const scaleAdjust)
|
|||
{
|
||||
bool const canslopetilt = !TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE);
|
||||
calcviewpitch(pp->pos.vec2, &pp->horizon.horizoff, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursectnum, scaleAdjust, TEST(pp->Flags, PF_CLIMBING));
|
||||
sethorizon(&pp->horizon.horiz, horz, &pp->input.actions, scaleAdjust);
|
||||
sethorizon(&pp->horizon, horz, &pp->input.actions, scaleAdjust);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue