mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
- backend update fromGZDoom.
most importantly this addresses issues with key down/key up events being sent in the same tic not having an effect on game actions that require a key being held down.
This commit is contained in:
parent
1228cb6044
commit
b7c7328cdd
13 changed files with 55 additions and 15 deletions
|
@ -686,6 +686,17 @@ void ReadBindings(int lump, bool override)
|
|||
FKeyBindings* dest = &Bindings;
|
||||
int key;
|
||||
|
||||
if (sc.Compare("unbind"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
if (override)
|
||||
{
|
||||
// This is only for games to clear unsuitable base defaults, not for mods.
|
||||
dest->UnbindKey(sc.String);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// bind destination is optional and is the same as the console command
|
||||
if (sc.Compare("bind"))
|
||||
{
|
||||
|
@ -722,7 +733,18 @@ void ReadBindings(int lump, bool override)
|
|||
void C_SetDefaultKeys(const char* baseconfig)
|
||||
{
|
||||
auto lump = fileSystem.CheckNumForFullName("engine/commonbinds.txt");
|
||||
if (lump >= 0) ReadBindings(lump, true);
|
||||
if (lump >= 0)
|
||||
{
|
||||
// Bail out if a mod tries to override this. Main game resources are allowed to do this, though.
|
||||
auto fileno2 = fileSystem.GetFileContainer(lump);
|
||||
if (fileno2 > fileSystem.GetMaxIwadNum())
|
||||
{
|
||||
I_FatalError("File %s is overriding core lump %s.",
|
||||
fileSystem.GetResourceFileFullName(fileno2), "engine/commonbinds.txt");
|
||||
}
|
||||
|
||||
ReadBindings(lump, true);
|
||||
}
|
||||
int lastlump = 0;
|
||||
|
||||
while ((lump = fileSystem.FindLumpFullName(baseconfig, &lastlump)) != -1)
|
||||
|
|
|
@ -67,11 +67,21 @@ CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
void D_ProcessEvents (void)
|
||||
{
|
||||
event_t *ev;
|
||||
FixedBitArray<NUM_KEYS> keywasdown;
|
||||
TArray<event_t> delayedevents;
|
||||
|
||||
keywasdown.Zero();
|
||||
while (eventtail != eventhead)
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
event_t *ev = &events[eventtail];
|
||||
eventtail = (eventtail + 1) & (MAXEVENTS - 1);
|
||||
|
||||
if (ev->type == EV_KeyUp && keywasdown[ev->data1])
|
||||
{
|
||||
delayedevents.Push(*ev);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ev->type == EV_None)
|
||||
continue;
|
||||
if (ev->type == EV_DeviceChange)
|
||||
|
@ -85,7 +95,12 @@ void D_ProcessEvents (void)
|
|||
continue; // menu ate the event
|
||||
}
|
||||
|
||||
G_Responder (ev);
|
||||
if (G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1);
|
||||
}
|
||||
|
||||
for (auto& ev: delayedevents)
|
||||
{
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
struct GrpInfo
|
||||
struct GrpHeader
|
||||
{
|
||||
uint32_t Magic[3];
|
||||
uint32_t NumLumps;
|
||||
|
@ -95,7 +95,7 @@ FGrpFile::FGrpFile(const char *filename, FileReader &file)
|
|||
|
||||
bool FGrpFile::Open(bool quiet, LumpFilterInfo*)
|
||||
{
|
||||
GrpInfo header;
|
||||
GrpHeader header;
|
||||
|
||||
Reader.Read(&header, sizeof(header));
|
||||
NumLumps = LittleLong(header.NumLumps);
|
||||
|
@ -105,7 +105,7 @@ bool FGrpFile::Open(bool quiet, LumpFilterInfo*)
|
|||
|
||||
Lumps.Resize(NumLumps);
|
||||
|
||||
int Position = sizeof(GrpInfo) + NumLumps * sizeof(GrpLump);
|
||||
int Position = sizeof(GrpHeader) + NumLumps * sizeof(GrpLump);
|
||||
|
||||
for(uint32_t i = 0; i < NumLumps; i++)
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ void I_InitGraphics ()
|
|||
#ifdef __APPLE__
|
||||
SDL_SetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, "0");
|
||||
#endif // __APPLE__
|
||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||
|
||||
if (SDL_InitSubSystem (SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "v_video.h"
|
||||
#include "m_png.h"
|
||||
#include "templates.h"
|
||||
|
||||
#include "r_videoscale.h"
|
||||
#include "i_time.h"
|
||||
#include "v_text.h"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "templates.h"
|
||||
|
||||
#include "c_cvars.h"
|
||||
#include "hw_material.h"
|
||||
#include "hw_cvars.h"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "polyrenderer/backend/poly_renderstate.h"
|
||||
#include "polyrenderer/backend/poly_framebuffer.h"
|
||||
#include "polyrenderer/backend/poly_hwtexture.h"
|
||||
#include "templates.h"
|
||||
|
||||
#include "hw_skydome.h"
|
||||
#include "hw_viewpointuniforms.h"
|
||||
#include "hw_lightbuffer.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "templates.h"
|
||||
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "v_video.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "templates.h"
|
||||
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "v_video.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "templates.h"
|
||||
|
||||
#include "poly_thread.h"
|
||||
#include "screen_scanline_setup.h"
|
||||
#include <cmath>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "templates.h"
|
||||
#include "poly_thread.h"
|
||||
#include "screen_scanline_setup.h"
|
||||
#include <cmath>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "templates.h"
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "v_video.h"
|
||||
|
|
|
@ -866,6 +866,10 @@ FString ExpandEnvVars(const char *searchpathstring)
|
|||
FString NicePath(const char *path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (*path == '\0')
|
||||
{
|
||||
return FString(".");
|
||||
}
|
||||
return ExpandEnvVars(path);
|
||||
#else
|
||||
if (path == NULL || *path == '\0')
|
||||
|
|
Loading…
Reference in a new issue