mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
Merge remote-tracking branch 'remotes/origin/master' into back_to_basics2
This commit is contained in:
commit
8a1206edbc
24 changed files with 163 additions and 180 deletions
|
@ -170,16 +170,19 @@ void ctrlGetInput(void)
|
|||
cl_crosshair = !cl_crosshair;
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonPressed(gamefunc_Next_Weapon))
|
||||
if (gPlayer[myconnectindex].nextWeapon == 0)
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Next_Weapon);
|
||||
gInput.keyFlags.nextWeapon = 1;
|
||||
}
|
||||
if (buttonMap.ButtonPressed(gamefunc_Next_Weapon))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Next_Weapon);
|
||||
gInput.keyFlags.nextWeapon = 1;
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonPressed(gamefunc_Previous_Weapon))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Previous_Weapon);
|
||||
gInput.keyFlags.prevWeapon = 1;
|
||||
if (buttonMap.ButtonPressed(gamefunc_Previous_Weapon))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Previous_Weapon);
|
||||
gInput.keyFlags.prevWeapon = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Show_Opponents_Weapon))
|
||||
|
@ -303,10 +306,10 @@ void ctrlGetInput(void)
|
|||
if (gInput.forward < keyMove && gInput.forward > -keyMove)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
||||
gInput.forward += keyMove;
|
||||
input.forward += keyMove;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
||||
gInput.forward -= keyMove;
|
||||
input.forward -= keyMove;
|
||||
}
|
||||
|
||||
if (gInput.strafe < keyMove && gInput.strafe > -keyMove)
|
||||
|
@ -342,6 +345,10 @@ void ctrlGetInput(void)
|
|||
static int32_t lastInputClock; // MED
|
||||
int32_t const elapsedTics = (int32_t)totalclock - lastInputClock;
|
||||
|
||||
// Blood's q16mlook scaling is different from the other games, therefore use the below constant to attenuate
|
||||
// the speed to match the other games.
|
||||
float const mlookScale = 3.25f;
|
||||
|
||||
lastInputClock = (int32_t) totalclock;
|
||||
|
||||
if (turnLeft || turnRight)
|
||||
|
@ -358,25 +365,28 @@ void ctrlGetInput(void)
|
|||
input.q16turn <<= 1;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
input.strafe -= info.mousex;
|
||||
{
|
||||
input.strafe -= info.mousex * 32.f;
|
||||
input.strafe -= scaleAdjustmentToInterval(info.dyaw * keyMove);
|
||||
}
|
||||
else
|
||||
input.q16turn = fix16_sadd(input.q16turn, fix16_sdiv(fix16_from_int(info.mousex), fix16_from_int(32)));
|
||||
{
|
||||
input.q16turn = fix16_sadd(input.q16turn, fix16_from_float(info.mousex));
|
||||
input.q16turn = fix16_sadd(input.q16turn, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
}
|
||||
|
||||
input.strafe -= -(info.dx<<5);
|
||||
input.strafe -= scaleAdjustmentToInterval(info.dx * keyMove);
|
||||
input.forward -= scaleAdjustmentToInterval(info.dz * keyMove);
|
||||
|
||||
#if 0
|
||||
if (info.dz < 0)
|
||||
gInput.mlook = ClipRange((info.dz+127)>>7, -127, 127);
|
||||
else
|
||||
gInput.mlook = ClipRange(info.dz>>7, -127, 127);
|
||||
#endif
|
||||
if (mouseaim)
|
||||
input.q16mlook = fix16_sadd(input.q16mlook, fix16_sdiv(fix16_from_int(info.mousey), fix16_from_int(208)));
|
||||
input.q16mlook = fix16_sadd(input.q16mlook, fix16_from_float(info.mousey / mlookScale));
|
||||
else
|
||||
input.forward -= info.mousey;
|
||||
input.forward -= info.mousey * 64.f;
|
||||
if (!in_mouseflip)
|
||||
input.q16mlook = -input.q16mlook;
|
||||
|
||||
input.q16mlook = fix16_ssub(input.q16mlook, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch / mlookScale)));
|
||||
|
||||
if (!gViewMap.bFollowMode && gViewMode == 4)
|
||||
{
|
||||
gViewMap.turn += input.q16turn<<2;
|
||||
|
|
|
@ -3271,7 +3271,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
memcpy(bakMirrorGotpic, gotpic + 510, 2);
|
||||
memcpy(gotpic + 510, otherMirrorGotpic, 2);
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * pOther->visibility, 0) * (numplayers > 1 ? 1.f : r_ambientlightrecip));
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * pOther->visibility, 0));
|
||||
int vc4, vc8;
|
||||
getzsofslope(vcc, vd8, vd4, &vc8, &vc4);
|
||||
if (vd0 >= vc4)
|
||||
|
@ -3345,7 +3345,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
nSprite = nextspritestat[nSprite];
|
||||
}
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0) * (numplayers > 1 ? 1.f : r_ambientlightrecip));
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0));
|
||||
cA = (cA + interpolateangfix16(fix16_from_int(deliriumTurnO), fix16_from_int(deliriumTurn), gInterpolate)) & 0x7ffffff;
|
||||
int vfc, vf8;
|
||||
getzsofslope(nSectnum, cX, cY, &vfc, &vf8);
|
||||
|
|
|
@ -578,6 +578,7 @@ typedef struct {
|
|||
int8_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<lognumtiles): tile offset relative to basetile
|
||||
|
||||
int32_t yscale;
|
||||
int combinedtile;
|
||||
} psky_t;
|
||||
|
||||
// Index of map-global (legacy) multi-sky:
|
||||
|
@ -649,8 +650,6 @@ EXTERN uint8_t gotpic[(MAXTILES+7)>>3];
|
|||
EXTERN char gotsector[(MAXSECTORS+7)>>3];
|
||||
|
||||
|
||||
EXTERN char editwall[(MAXWALLS+7)>>3];
|
||||
|
||||
extern uint32_t drawlinepat;
|
||||
|
||||
extern void faketimerhandler(void);
|
||||
|
|
|
@ -108,5 +108,6 @@ EDUKE32_STATIC_ASSERT(DAMETH_NARROW_MASKPROPS(DAMETH_MASKPROPS) == DAMETH_MASK);
|
|||
|
||||
extern float fcosglobalang, fsinglobalang;
|
||||
extern float fxdim, fydim, fydimen, fviewingrange;
|
||||
extern int32_t viewingrangerecip;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1104,7 +1104,7 @@ static int32_t globaluclip, globaldclip;
|
|||
//char globparaceilclip, globparaflorclip;
|
||||
|
||||
int32_t xyaspect;
|
||||
static int32_t viewingrangerecip;
|
||||
int32_t viewingrangerecip;
|
||||
|
||||
static char globalxshift, globalyshift;
|
||||
static int32_t globalxpanning, globalypanning;
|
||||
|
@ -3460,7 +3460,6 @@ static void enginePrepareLoadBoard(FileReader & fr, vec3_t *dapos, int16_t *daan
|
|||
show2dsector.Zero();
|
||||
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
|
||||
Bmemset(show2dwall, 0, sizeof(show2dwall));
|
||||
Bmemset(editwall, 0, sizeof(editwall));
|
||||
#ifdef USE_STRUCT_TRACKERS
|
||||
Bmemset(sectorchanged, 0, sizeof(sectorchanged));
|
||||
Bmemset(spritechanged, 0, sizeof(spritechanged));
|
||||
|
@ -4864,22 +4863,6 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (editstatus)
|
||||
{
|
||||
int32_t w;
|
||||
// TODO: extern a separate bitmap instead?
|
||||
for (w=0; w<numwalls; w++)
|
||||
if (walbitmap[w>>3] & pow2char[w&7])
|
||||
{
|
||||
editwall[w>>3] |= 1<<(w&7);
|
||||
if (flags&2)
|
||||
{
|
||||
int wn = lastwall(w);
|
||||
editwall[wn>>3] |= 1<<(wn&7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -266,7 +266,7 @@ static void polymost_updaterotmat(void)
|
|||
};
|
||||
multiplyMatrix4f(matrix, tiltmatrix);
|
||||
renderSetViewMatrix(matrix);
|
||||
renderSetVisibility(g_visibility * fviewingrange * (4.f / (65536.f * 65536.f)));
|
||||
renderSetVisibility(mulscale16(g_visibility, mulscale16(xdimenscale, viewingrangerecip)) * fviewingrange * (1.f / (65536.f * 65536.f)) / r_ambientlight);
|
||||
}
|
||||
|
||||
static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, int32_t method, const vec2_16_t& tilesiz);
|
||||
|
|
|
@ -739,7 +739,7 @@ void C_SetDefaultKeys(const char* baseconfig)
|
|||
//
|
||||
//
|
||||
//=============================================================================
|
||||
CVAR(Int, cl_defaultconfiguration, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, cl_defaultconfiguration, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
|
||||
void C_BindDefaults()
|
||||
|
|
|
@ -225,14 +225,10 @@ static void MouseRead ()
|
|||
}
|
||||
|
||||
SDL_GetRelativeMouseState (&x, &y);
|
||||
if (!m_noprescale)
|
||||
{
|
||||
x *= 3;
|
||||
y *= 2;
|
||||
}
|
||||
|
||||
if (x | y)
|
||||
{
|
||||
PostMouseMove (x, -y);
|
||||
PostMouseMove (m_noprescale ? x : x << 2, -y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,21 @@ char* G_GetSubString(const char *text, const char *end, const int32_t iter, cons
|
|||
|
||||
#define USERQUOTE_RIGHTOFFSET 14
|
||||
|
||||
static int GetStringTile(int font, const char* t, int f)
|
||||
{
|
||||
int ret = gi->GetStringTile(font, t, f);
|
||||
auto tex = tileGetTexture(ret);
|
||||
if (!tex || !tex->isValid())
|
||||
{
|
||||
if (*t >= 'a' && *t <= 'z')
|
||||
{
|
||||
char tt = *t - 32;
|
||||
ret = gi->GetStringTile(font, &tt, f);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// qstrdim
|
||||
vec2_t G_ScreenTextSize(const int32_t font,
|
||||
|
@ -171,7 +186,7 @@ vec2_t G_ScreenTextSize(const int32_t font,
|
|||
}
|
||||
|
||||
// translate the character to a tilenum
|
||||
tile = gi->GetStringTile(font, &t, f);
|
||||
tile = GetStringTile(font, &t, f);
|
||||
|
||||
// reset this here because we haven't printed anything yet this loop
|
||||
extent.x = 0;
|
||||
|
@ -192,7 +207,7 @@ vec2_t G_ScreenTextSize(const int32_t font,
|
|||
char space = '.'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILESPACE)
|
||||
space = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &space, f);
|
||||
tile = GetStringTile(font, &space, f);
|
||||
|
||||
extent.x += (tilesiz[tile].x * z);
|
||||
}
|
||||
|
@ -206,7 +221,7 @@ vec2_t G_ScreenTextSize(const int32_t font,
|
|||
char line = 'A'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILELINE)
|
||||
line = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &line, f);
|
||||
tile = GetStringTile(font, &line, f);
|
||||
|
||||
tempyextent += tilesiz[tile].y * z;
|
||||
}
|
||||
|
@ -239,7 +254,7 @@ vec2_t G_ScreenTextSize(const int32_t font,
|
|||
char line = 'A'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILELINE)
|
||||
line = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &line, f);
|
||||
tile = GetStringTile(font, &line, f);
|
||||
|
||||
tempyextent += tilesiz[tile].y * z;
|
||||
}
|
||||
|
@ -267,7 +282,7 @@ vec2_t G_ScreenTextSize(const int32_t font,
|
|||
if (NUMHACKACTIVE)
|
||||
{
|
||||
char numeral = '0'; // this is subject to change as an implementation detail
|
||||
extent.x = (tilesiz[gi->GetStringTile(font, &numeral, f)].x-1) * z;
|
||||
extent.x = (tilesiz[GetStringTile(font, &numeral, f)].x-1) * z;
|
||||
}
|
||||
|
||||
// height
|
||||
|
@ -328,7 +343,7 @@ vec2_t G_ScreenTextSize(const int32_t font,
|
|||
char line = 'A'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILELINE)
|
||||
line = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &line, f);
|
||||
tile = GetStringTile(font, &line, f);
|
||||
|
||||
tempyextent += tilesiz[tile].y * z;
|
||||
}
|
||||
|
@ -559,7 +574,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
}
|
||||
|
||||
// translate the character to a tilenum
|
||||
tile = gi->GetStringTile(font, &t, f);
|
||||
tile = GetStringTile(font, &t, f);
|
||||
|
||||
switch (t)
|
||||
{
|
||||
|
@ -601,7 +616,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
char space = '.'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILESPACE)
|
||||
space = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &space, f);
|
||||
tile = GetStringTile(font, &space, f);
|
||||
|
||||
extent.x += (tilesiz[tile].x * z);
|
||||
}
|
||||
|
@ -615,7 +630,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
char line = 'A'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILELINE)
|
||||
line = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &line, f);
|
||||
tile = GetStringTile(font, &line, f);
|
||||
|
||||
tempyextent += tilesiz[tile].y * z;
|
||||
}
|
||||
|
@ -643,7 +658,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
char line = 'A'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILELINE)
|
||||
line = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &line, f);
|
||||
tile = GetStringTile(font, &line, f);
|
||||
|
||||
tempyextent += tilesiz[tile].y * z;
|
||||
}
|
||||
|
@ -694,7 +709,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
if (NUMHACKACTIVE)
|
||||
{
|
||||
char numeral = '0'; // this is subject to change as an implementation detail
|
||||
extent.x = (tilesiz[gi->GetStringTile(font, &numeral, f)].x-1) * z;
|
||||
extent.x = (tilesiz[GetStringTile(font, &numeral, f)].x-1) * z;
|
||||
}
|
||||
|
||||
// height
|
||||
|
@ -752,7 +767,7 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
char line = 'A'; // this is subject to change as an implementation detail
|
||||
if (f & TEXT_TILELINE)
|
||||
line = '\x7F'; // tile after '~'
|
||||
tile = gi->GetStringTile(font, &line, f);
|
||||
tile = GetStringTile(font, &line, f);
|
||||
|
||||
tempyextent += tilesiz[tile].y * z;
|
||||
}
|
||||
|
|
|
@ -337,13 +337,10 @@ CUSTOM_CVARD(Int, r_showfpsperiod, 0, 0, "time in seconds before averaging min a
|
|||
if (self < 0 || self > 5) self = 1;
|
||||
}
|
||||
|
||||
float r_ambientlightrecip;
|
||||
|
||||
CUSTOM_CVARD(Float, r_ambientlight, 1.0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "sets the global map light level")
|
||||
{
|
||||
if (self < 0.1f) self = 0.1f;
|
||||
else if (self > 10.f) self = 10.f;
|
||||
else r_ambientlightrecip = 1.f / self;
|
||||
}
|
||||
|
||||
CVARD(Bool, r_shadows, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable sprite and model shadows")
|
||||
|
|
|
@ -115,7 +115,6 @@ EXTERN_CVAR(Int, playercolor)
|
|||
EXTERN_CVAR(Int, playerteam)
|
||||
|
||||
extern bool gNoAutoLoad;
|
||||
extern float r_ambientlightrecip;
|
||||
extern int hud_statusbarrange; // will be set by the game's configuration setup.
|
||||
bool G_ChangeHudLayout(int direction);
|
||||
bool G_CheckAutorun(bool button);
|
||||
|
|
|
@ -46,22 +46,24 @@
|
|||
|
||||
void InputState::GetMouseDelta(ControlInfo * info)
|
||||
{
|
||||
vec2_t input;
|
||||
vec2f_t input, finput;
|
||||
|
||||
input = g_mousePos;
|
||||
g_mousePos = {};
|
||||
|
||||
vec2f_t finput = { float(input.x) / 3.0f, float(input.y) };
|
||||
|
||||
if (in_mousesmoothing)
|
||||
{
|
||||
static vec2_t last;
|
||||
finput = { float(input.x + last.x) * 0.5f, float(input.y + last.y) * 0.5f };
|
||||
static vec2f_t last;
|
||||
finput = { (input.x + last.x) * 0.5f, (input.y + last.y) * 0.5f };
|
||||
last = input;
|
||||
}
|
||||
else
|
||||
{
|
||||
finput = { input.x, input.y };
|
||||
}
|
||||
|
||||
info->mousex = int(finput.x * (16.f) * in_mousesensitivity * in_mousescalex);
|
||||
info->mousey = int(finput.y * (16.f) * in_mousesensitivity * in_mousescaley);
|
||||
info->mousex = finput.x * (16.f / 32.f) * in_mousesensitivity * in_mousescalex / 3.f;
|
||||
info->mousey = finput.y * (16.f / 64.f) * in_mousesensitivity * in_mousescaley;
|
||||
|
||||
// todo: Use these when the mouse is used for moving instead of turning.
|
||||
//info->mousex = int(finput.x * (4.f) * in_mousesensitivity * in_mouseside);
|
||||
|
@ -69,7 +71,7 @@ void InputState::GetMouseDelta(ControlInfo * info)
|
|||
|
||||
if (in_mousebias)
|
||||
{
|
||||
if (abs(info->mousex) > abs(info->mousey))
|
||||
if (fabs(info->mousex) > fabs(info->mousey))
|
||||
info->mousey /= in_mousebias;
|
||||
else
|
||||
info->mousex /= in_mousebias;
|
||||
|
@ -195,9 +197,9 @@ void CONTROL_GetInput(ControlInfo* info)
|
|||
|
||||
I_GetAxes(joyaxes);
|
||||
|
||||
info->dyaw += -joyaxes[JOYAXIS_Yaw] * joyaxesScale;
|
||||
info->dx += -joyaxes[JOYAXIS_Side] * joyaxesScale;
|
||||
info->dz += -joyaxes[JOYAXIS_Forward] * joyaxesScale;
|
||||
info->dpitch += -joyaxes[JOYAXIS_Pitch] * joyaxesScale;
|
||||
info->dyaw += -joyaxes[JOYAXIS_Yaw] * 45.f;
|
||||
info->dx += -joyaxes[JOYAXIS_Side] * 0.75f;
|
||||
info->dz += -joyaxes[JOYAXIS_Forward] * 0.75f;
|
||||
info->dpitch += -joyaxes[JOYAXIS_Pitch] * 22.5f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ typedef uint16_t kb_scancode;
|
|||
|
||||
struct ControlInfo
|
||||
{
|
||||
int32_t dx;
|
||||
int32_t dy;
|
||||
int32_t dz;
|
||||
int32_t dyaw;
|
||||
int32_t dpitch;
|
||||
int32_t droll;
|
||||
int32_t mousex;
|
||||
int32_t mousey;
|
||||
float dx;
|
||||
float dy;
|
||||
float dz;
|
||||
float dyaw;
|
||||
float dpitch;
|
||||
float droll;
|
||||
float mousex;
|
||||
float mousey;
|
||||
};
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ class InputState
|
|||
uint8_t g_keyAsciiPos;
|
||||
uint8_t g_keyAsciiEnd;
|
||||
|
||||
vec2_t g_mousePos;
|
||||
vec2f_t g_mousePos;
|
||||
|
||||
void keySetState(int32_t key, int32_t state);
|
||||
|
||||
|
@ -140,11 +140,11 @@ public:
|
|||
|
||||
void AddEvent(const event_t* ev);
|
||||
|
||||
void MouseSetPos(int x, int y)
|
||||
void MouseSetPos(float x, float y)
|
||||
{
|
||||
g_mousePos = { x, y };
|
||||
}
|
||||
void MouseAddToPos(int x, int y)
|
||||
void MouseAddToPos(float x, float y)
|
||||
{
|
||||
g_mousePos.x += x;
|
||||
g_mousePos.y += y;
|
||||
|
@ -179,9 +179,6 @@ public:
|
|||
|
||||
extern InputState inputState;
|
||||
|
||||
const int analogExtent = 32767; // used as a divisor for scaling joystick input.
|
||||
const float joyaxesScale = (float)analogExtent * 0.75f; // used as a multiplier for scaling joystick input.
|
||||
|
||||
void CONTROL_GetInput(ControlInfo* info);
|
||||
int32_t handleevents(void);
|
||||
|
||||
|
|
|
@ -649,7 +649,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
smoothRatio = 65536;
|
||||
|
||||
int const playerVis = pPlayer->visibility;
|
||||
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis * (numplayers > 1 ? 1.f : r_ambientlightrecip));
|
||||
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis);
|
||||
|
||||
CAMERA(sect) = pPlayer->cursectnum;
|
||||
|
||||
|
|
|
@ -3084,36 +3084,31 @@ void P_GetInput(int const playerNum)
|
|||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const turnAmount = playerRunning ? (NORMALTURN << 1) : NORMALTURN;
|
||||
constexpr int analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
|
||||
input_t input {};
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
input.svel = -(info.mousex + strafeyaw) >> 3;
|
||||
strafeyaw = (info.mousex + strafeyaw) % 8;
|
||||
|
||||
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove / analogExtent);
|
||||
input.svel -= info.mousex * 4.f;
|
||||
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove);
|
||||
}
|
||||
else
|
||||
{
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw * analogTurnAmount / (analogExtent >> 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
}
|
||||
|
||||
if (mouseaim)
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_sdiv(fix16_from_int(info.mousey), F16(64)));
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_from_float(info.mousey));
|
||||
else
|
||||
input.fvel = -(info.mousey >> 3);
|
||||
input.fvel -= info.mousey * 8.f;
|
||||
|
||||
if (!in_mouseflip) input.q16horz = -input.q16horz;
|
||||
|
||||
input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch * analogTurnAmount / analogExtent)));
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove / analogExtent);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove / analogExtent);
|
||||
input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch)));
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
|
|
|
@ -30,8 +30,6 @@ int32_t registerosdcommands(void);
|
|||
void GAME_onshowosd(int shown);
|
||||
void GAME_clearbackground(int numcols, int numrows);
|
||||
|
||||
//extern float r_ambientlight,r_ambientlightrecip;
|
||||
|
||||
extern const char *const ConsoleButtons[];
|
||||
|
||||
//extern uint32_t cl_cheatmask;
|
||||
|
|
|
@ -188,35 +188,30 @@ void PlayerInterruptKeys()
|
|||
int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const turnAmount = playerRunning ? 12 : 8;
|
||||
int const keyMove = playerRunning ? 12 : 6;
|
||||
int const analogTurnAmount = 12;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
input.xVel = -(info.mousex + strafeyaw) >> 6;
|
||||
strafeyaw = (info.mousex + strafeyaw) % 64;
|
||||
|
||||
input.xVel -= scaleAdjustmentToInterval(info.dyaw * keyMove / analogExtent);
|
||||
input.xVel -= info.mousex * 4.f;
|
||||
input.xVel -= info.dyaw * keyMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
input.nAngle = fix16_sadd(input.nAngle, fix16_sdiv(fix16_from_int(info.mousex), fix16_from_int(32)));
|
||||
input.nAngle = fix16_sadd(input.nAngle, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw * analogTurnAmount / (analogExtent >> 1))));
|
||||
input.nAngle = fix16_sadd(input.nAngle, fix16_from_float(info.mousex));
|
||||
input.nAngle = fix16_sadd(input.nAngle, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
}
|
||||
|
||||
g_MyAimMode = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
|
||||
|
||||
if (g_MyAimMode)
|
||||
input.horizon = fix16_sadd(input.horizon, fix16_sdiv(fix16_from_int(info.mousey), fix16_from_int(64)));
|
||||
input.horizon = fix16_sadd(input.horizon, fix16_from_float(info.mousey));
|
||||
else
|
||||
input.yVel = -(info.mousey >> 6);
|
||||
input.yVel -= info.mousey * 8.f;
|
||||
|
||||
if (!in_mouseflip) input.horizon = -input.horizon;
|
||||
|
||||
input.horizon = fix16_ssub(input.horizon, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch * analogTurnAmount / analogExtent)));
|
||||
input.xVel -= scaleAdjustmentToInterval(info.dx * keyMove / analogExtent);
|
||||
input.yVel -= scaleAdjustmentToInterval(info.dz * keyMove / analogExtent);
|
||||
input.horizon = fix16_ssub(input.horizon, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch)));
|
||||
input.xVel -= info.dx * keyMove;
|
||||
input.yVel -= info.dz * keyMove;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
|
|
|
@ -577,6 +577,7 @@ void PlayFX2(unsigned short nSound, short nSprite)
|
|||
|
||||
if (nSprite >= 0)
|
||||
{
|
||||
if (soundEngine->IsSourcePlayingSomething(SOURCE_Actor, &sprite[nSprite], CHAN_BODY, nSound + 1)) return;
|
||||
soundEngine->StartSound(SOURCE_Actor, &sprite[nSprite], nullptr, CHAN_BODY, CHANF_OVERLAP, nSound+1, nVolume / 255.f, ATTN_NORM, nullptr, (11025 + nPitch) / 11025.f);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#include "hw_renderstate.h"
|
||||
#include "hw_cvars.h"
|
||||
|
||||
CVAR(Bool, gl_texture, true, 0)
|
||||
|
||||
F2DDrawer twodpsp;
|
||||
static int BufferLock = 0;
|
||||
|
||||
|
@ -166,7 +168,7 @@ void PolymostRenderState::Apply(FRenderState& state, GLState& oldState)
|
|||
}
|
||||
else
|
||||
{
|
||||
state.EnableTexture(true);
|
||||
state.EnableTexture(gl_texture);
|
||||
state.SetMaterial(mMaterial.mMaterial, mMaterial.mClampMode, mMaterial.mTranslation, mMaterial.mOverrideShader);
|
||||
}
|
||||
/* todo: bind indexed textures */
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
|
||||
void SetShade(int32_t shade, int numshades)
|
||||
{
|
||||
renderState.Shade = clamp(shade, 0, numshades-1);
|
||||
renderState.Shade = std::min(shade, numshades-1);
|
||||
}
|
||||
|
||||
void SetVisibility(float visibility)
|
||||
|
|
|
@ -834,7 +834,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
pPlayer->visibility = ud.const_visibility;
|
||||
|
||||
int const playerVis = pPlayer->visibility;
|
||||
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis * (numplayers > 1 ? 1.f : r_ambientlightrecip));
|
||||
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis);
|
||||
|
||||
CAMERA(sect) = pPlayer->cursectnum;
|
||||
|
||||
|
|
|
@ -3254,36 +3254,31 @@ void P_GetInput(int const playerNum)
|
|||
|
||||
int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const turnAmount = playerRunning ? (NORMALTURN << 1) : NORMALTURN;
|
||||
int const analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
|
||||
input_t input {};
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
input.svel = -(info.mousex + strafeyaw) >> 3;
|
||||
strafeyaw = (info.mousex + strafeyaw) % 8;
|
||||
|
||||
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove / analogExtent);
|
||||
input.svel -= info.mousex * 4.f;
|
||||
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove);
|
||||
}
|
||||
else
|
||||
{
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw * analogTurnAmount / (analogExtent >> 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
}
|
||||
|
||||
if (mouseaim)
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_sdiv(fix16_from_int(info.mousey), F16(64)));
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_from_float(info.mousey));
|
||||
else
|
||||
input.fvel = -(info.mousey >> 3);
|
||||
input.fvel -= info.mousey * 8.f;
|
||||
|
||||
if (!in_mouseflip) input.q16horz = -input.q16horz;
|
||||
|
||||
input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch * analogTurnAmount / analogExtent)));
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove / analogExtent);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove / analogExtent);
|
||||
input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch)));
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
|
@ -3668,16 +3663,15 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
|
||||
input_t input {};
|
||||
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw * analogTurnAmount / (analogExtent >> 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove / analogExtent);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove / analogExtent);
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove);
|
||||
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
||||
|
@ -3918,16 +3912,15 @@ void P_GetInputBoat(int playerNum)
|
|||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
|
||||
input_t input {};
|
||||
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw * analogTurnAmount / (analogExtent >> 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove / analogExtent);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove / analogExtent);
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove);
|
||||
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
||||
|
@ -4159,36 +4152,31 @@ void P_DHGetInput(int const playerNum)
|
|||
int const playerCrouch = sub_299D8();
|
||||
int const playerJump = buttonMap.ButtonDown(gamefunc_Jump) && !(pPlayer->cursectnum >= 0 && sector[pPlayer->cursectnum].hitag == 2003);
|
||||
int const turnAmount = playerCrouch ? 2 : (playerRunning ? 16 : 8);
|
||||
int const analogTurnAmount = 16;
|
||||
int const keyMove = playerCrouch ? 3 : (playerRunning ? 24 : 12);
|
||||
|
||||
input_t input {};
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
input.svel = -(info.mousex + strafeyaw) >> 3;
|
||||
strafeyaw = (info.mousex + strafeyaw) % 8;
|
||||
|
||||
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove / analogExtent);
|
||||
input.svel -= info.mousex * 4.f;
|
||||
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove);
|
||||
}
|
||||
else
|
||||
{
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw * analogTurnAmount / (analogExtent >> 1))));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
}
|
||||
|
||||
if (mouseaim)
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_sdiv(fix16_from_int(info.mousey), F16(64)));
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_from_float(info.mousey));
|
||||
else
|
||||
input.fvel = -(info.mousey >> 3);
|
||||
input.fvel -= info.mousey * 8.f;
|
||||
|
||||
if (!in_mouseflip) input.q16horz = -input.q16horz;
|
||||
|
||||
input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch * analogTurnAmount / analogExtent)));
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove / analogExtent);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove / analogExtent);
|
||||
input.q16horz = fix16_ssub(input.q16horz, fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch)));
|
||||
input.svel -= scaleAdjustmentToInterval(info.dx * keyMove);
|
||||
input.fvel -= scaleAdjustmentToInterval(info.dz * keyMove);
|
||||
|
||||
auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); };
|
||||
|
||||
|
|
|
@ -2996,7 +2996,12 @@ getinput(SW_PACKET *loc, SWBOOL tied)
|
|||
|
||||
// The function DoPlayerTurn() scales the player's q16angvel by 1.40625, so store as constant
|
||||
// and use to scale back player's aim and ang values for a consistent feel between games.
|
||||
float const inputScale = 1.40625f;
|
||||
float const angvelScale = 1.40625f;
|
||||
float const aimvelScale = 1.203125f;
|
||||
|
||||
// Shadow Warrior has a ticrate of 40, 25% more than the other games, so store below constant
|
||||
// for dividing controller input to match speed input speed of other games.
|
||||
float const ticrateScale = 0.75f;
|
||||
|
||||
if (running)
|
||||
{
|
||||
|
@ -3025,26 +3030,26 @@ getinput(SW_PACKET *loc, SWBOOL tied)
|
|||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
||||
{
|
||||
svel = -info.mousex;
|
||||
svel -= scaleAdjustmentToInterval(info.dyaw * keymove / analogExtent);
|
||||
svel -= (info.mousex * ticrateScale) * 4.f;
|
||||
svel -= info.dyaw * keymove;
|
||||
}
|
||||
else
|
||||
{
|
||||
q16angvel = fix16_div(fix16_from_int(info.mousex), fix16_from_int(inputScale * 32));
|
||||
q16angvel += fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw * turnamount / (inputScale * (analogExtent >> 1))));
|
||||
q16angvel = fix16_sadd(q16angvel, fix16_from_float(info.mousex / angvelScale));
|
||||
q16angvel = fix16_sadd(q16angvel, fix16_from_dbl(scaleAdjustmentToInterval((info.dyaw * ticrateScale) / angvelScale)));
|
||||
}
|
||||
|
||||
if (mouseaim)
|
||||
q16aimvel = -fix16_div(fix16_from_int(info.mousey), fix16_from_int((inputScale / 2) * 64));
|
||||
q16aimvel = fix16_ssub(q16aimvel, fix16_from_float(info.mousey / aimvelScale));
|
||||
else
|
||||
vel = -(info.mousey >> 6);
|
||||
vel -= (info.mousey * ticrateScale) * 8.f;
|
||||
|
||||
if (in_mouseflip)
|
||||
q16aimvel = -q16aimvel;
|
||||
|
||||
q16aimvel -= fix16_from_dbl(scaleAdjustmentToInterval(info.dpitch * turnamount / ((inputScale / 2) * analogExtent)));
|
||||
svel -= scaleAdjustmentToInterval(info.dx * keymove / analogExtent);
|
||||
vel -= scaleAdjustmentToInterval(info.dz * keymove / analogExtent);
|
||||
q16aimvel -= fix16_from_dbl(scaleAdjustmentToInterval((info.dpitch * ticrateScale) / aimvelScale));
|
||||
svel -= info.dx * keymove;
|
||||
vel -= info.dz * keymove;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
||||
{
|
||||
|
@ -3190,7 +3195,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
|
|||
}
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Next_Weapon))
|
||||
if (buttonMap.ButtonPressed(gamefunc_Next_Weapon))
|
||||
{
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
short next_weapon = u->WeaponNum + 1;
|
||||
|
@ -3230,7 +3235,7 @@ getinput(SW_PACKET *loc, SWBOOL tied)
|
|||
}
|
||||
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Previous_Weapon))
|
||||
if (buttonMap.ButtonPressed(gamefunc_Previous_Weapon))
|
||||
{
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
short prev_weapon = u->WeaponNum - 1;
|
||||
|
|
|
@ -2531,9 +2531,9 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
mfsvel -= scrl_input.dyaw>>2;
|
||||
mfsvel -= scrl_input.dx>>2;
|
||||
mfvel = -scrl_input.dz>>2;
|
||||
mfsvel -= scrl_input.dyaw / 4;
|
||||
mfsvel -= scrl_input.dx / 4;
|
||||
mfvel = -scrl_input.dz /4;
|
||||
|
||||
#if 0
|
||||
int const running = !!BUTTON(gamefunc_Run) ^ !!TEST(pp->Flags, PF_LOCK_RUN);
|
||||
|
|
Loading…
Reference in a new issue