mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
Merge branch 'master'
This commit is contained in:
commit
037a000590
11 changed files with 149 additions and 75 deletions
|
@ -1,26 +1,31 @@
|
|||
// DOOM 3 BFG models definition file (.fgd) generated by RBDOOM 3 BFG 1.5.1
|
||||
// DOOM 3 BFG models definition file (.fgd) generated by RBDOOM 3 BFG 1.6.0
|
||||
|
||||
@SolidClass color(0 0 0) = worldspawn : "Every map should have exactly one worldspawn."
|
||||
[
|
||||
spawnclass(string) : "" : "idWorldspawn"
|
||||
spawnclass(string) : "" : "idWorldspawn"
|
||||
]
|
||||
|
||||
@SolidClass color(0 127 204) = func_static : "A brush model that just sits there, doing nothing. Can be used for conditional walls and models. When triggered, toggles between visible and hidden (see hide). Entity is non-solid when hidden."
|
||||
[
|
||||
spawnclass(string) : "" : "idStaticEntity"
|
||||
solid(boolean) : "whether the object should be solid or not." : 1
|
||||
noclipmodel(boolean) : "0 by default. Sets whether or not to generate a collision model for an ASE/LWO func_static at level load. (Set to 1 for stuff the player can't interact with. This will save memory.)" : 0
|
||||
hide(boolean) : "whether the object should be visible when spawned. you need to set a value for triggering on/off to work"
|
||||
gui_noninteractive(boolean) : "any gui attached will not be interactive"
|
||||
inline(boolean) : "If true, turn the model into map geometry at dmap time"
|
||||
angles(string) : "" : "0 0 0"
|
||||
gui(string) : "gui attached to this static, gui2 and gui3 also work"
|
||||
gui_demonic(string) : "demonic gui attached to this statit, gui_demonic2 and gui_demonic3 also work"
|
||||
spawnclass(string) : "" : "idStaticEntity"
|
||||
solid(boolean) : "whether the object should be solid or not." : 1
|
||||
noclipmodel(boolean) : "0 by default. Sets whether or not to generate a collision model for an ASE/LWO func_static at level load. (Set to 1 for stuff the player can't interact with. This will save memory.)" : 0
|
||||
hide(boolean) : "whether the object should be visible when spawned. you need to set a value for triggering on/off to work"
|
||||
gui_noninteractive(boolean) : "any gui attached will not be interactive"
|
||||
inline(boolean) : "If true, turn the model into map geometry at dmap time"
|
||||
angles(string) : "" : "0 0 0"
|
||||
gui(string) : "gui attached to this static, gui2 and gui3 also work"
|
||||
gui_demonic(string) : "demonic gui attached to this statit, gui_demonic2 and gui_demonic3 also work"
|
||||
]
|
||||
|
||||
@PointClass base(func_static) color(0 127 204) model({ "path" : proxymodel }) = misc_model : "Just a model"
|
||||
@PointClass base(func_static) color(0 127 204) model({{
|
||||
proxymodel -> { "path": proxymodel },
|
||||
{ "path": model }
|
||||
}}) = misc_model : "Just a model"
|
||||
[
|
||||
angles(string) : "" : "0 0 0"
|
||||
model(string) : "Model Selection (ex mapobjects/model.obj)"
|
||||
model(string) : " A proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom"
|
||||
]
|
||||
|
||||
@PointClass base(misc_model) = auto_generated_model : "Entity definition for a specific model" []
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// DOOM 3 BFG models definition file (.def) generated by RBDOOM 3 BFG 1.5.1
|
||||
// DOOM 3 BFG models definition file (.def) generated by RBDOOM 3 BFG 1.6.0
|
||||
|
||||
entityDef genmodel_characters_player_character_helmet_d3xp_cine_helmet_lo
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2012-2014 Robert Beckebans
|
||||
Copyright (C) 2012-2025 Robert Beckebans
|
||||
Copyright (C) 2022 Stephen Pridham
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
@ -97,12 +97,13 @@ idCVar net_inviteOnly( "net_inviteOnly", "1", CVAR_BOOL | CVAR_ARCHIVE, "whether
|
|||
// DG: add cvar for pause
|
||||
idCVar com_pause( "com_pause", "0", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "set to 1 to pause game, to 0 to unpause again" );
|
||||
// DG end
|
||||
idCVar com_activeApp( "com_activeApp", "1", CVAR_BOOL | CVAR_SYSTEM | CVAR_NOCHEAT, "this is set to 0 if running in background" );
|
||||
|
||||
extern idCVar g_demoMode;
|
||||
|
||||
idCVar com_engineHz( "com_engineHz", "60", CVAR_FLOAT | CVAR_ARCHIVE, "Frames per second the engine runs at", 10.0f, 1024.0f );
|
||||
float com_engineHz_latched = 60.0f; // Latched version of cvar, updated between map loads
|
||||
int64 com_engineHz_numerator = 100LL * 1000LL;
|
||||
const int64 com_engineHz_numerator = 100LL * 1000LL;
|
||||
int64 com_engineHz_denominator = 100LL * 60LL;
|
||||
|
||||
// RB begin
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2014-2016 Robert Beckebans
|
||||
Copyright (C) 2014-2025 Robert Beckebans
|
||||
Copyright (C) 2014-2016 Kot in Action Creative Artel
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
@ -41,7 +41,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
extern idCVar com_engineHz;
|
||||
extern float com_engineHz_latched;
|
||||
extern int64 com_engineHz_numerator;
|
||||
extern const int64 com_engineHz_numerator;
|
||||
extern int64 com_engineHz_denominator;
|
||||
|
||||
// Returns the msec the frame starts on
|
||||
|
|
|
@ -718,7 +718,7 @@ CONSOLE_COMMAND_SHIP( convertMapToValve220, "Convert .map file to the Valve 220
|
|||
// make sure we have access to all .bimage files for that map
|
||||
fileSystem->BeginLevelLoad( filename, NULL, 0 );
|
||||
|
||||
map.ConvertToValve220Format();
|
||||
map.ConvertToValve220Format( true );
|
||||
|
||||
fileSystem->EndLevelLoad();
|
||||
|
||||
|
|
|
@ -3154,24 +3154,26 @@ void idDeclManagerLocal::ExportModelsToTrenchBroom_f( const idCmdArgs& args )
|
|||
fgdFile->Printf( "// DOOM 3 BFG models definition file (.fgd) generated by %s\n\n", ENGINE_VERSION );
|
||||
|
||||
fgdFile->Printf( "@SolidClass color(0 0 0) = worldspawn : \"Every map should have exactly one worldspawn.\"\n[\n" );
|
||||
fgdFile->Printf( "\t spawnclass(string) : \"\" : \"idWorldspawn\"\n" );
|
||||
fgdFile->Printf( "\tspawnclass(string) : \"\" : \"idWorldspawn\"\n" );
|
||||
fgdFile->Printf( "]\n\n" );
|
||||
|
||||
fgdFile->Printf( "@SolidClass color(0 127 204) = func_static : \"A brush model that just sits there, doing nothing. Can be used for conditional walls and models. When triggered, toggles between visible and hidden (see hide). Entity is non-solid when hidden.\"\n[\n" );
|
||||
//fgdFile->Printf( "name(string) : \"\" : \"\"\n" );
|
||||
fgdFile->Printf( "\t spawnclass(string) : \"\" : \"idStaticEntity\"\n" );
|
||||
fgdFile->Printf( "\t solid(boolean) : \"whether the object should be solid or not.\" : 1\n" );
|
||||
fgdFile->Printf( "\t noclipmodel(boolean) : \"0 by default. Sets whether or not to generate a collision model for an ASE/LWO func_static at level load. (Set to 1 for stuff the player can't interact with. This will save memory.)\" : 0\n" );
|
||||
fgdFile->Printf( "\t hide(boolean) : \"whether the object should be visible when spawned. you need to set a value for triggering on/off to work\"\n" );
|
||||
fgdFile->Printf( "\t gui_noninteractive(boolean) : \"any gui attached will not be interactive\"\n" );
|
||||
fgdFile->Printf( "\t inline(boolean) : \"If true, turn the model into map geometry at dmap time\"\n" );
|
||||
fgdFile->Printf( "\t angles(string) : \"\" : \"0 0 0\"\n" );
|
||||
fgdFile->Printf( "\t gui(string) : \"gui attached to this static, gui2 and gui3 also work\"\n" );
|
||||
fgdFile->Printf( "\t gui_demonic(string) : \"demonic gui attached to this statit, gui_demonic2 and gui_demonic3 also work\"\n]\n\n" );
|
||||
fgdFile->Printf( "\tspawnclass(string) : \"\" : \"idStaticEntity\"\n" );
|
||||
fgdFile->Printf( "\tsolid(boolean) : \"whether the object should be solid or not.\" : 1\n" );
|
||||
fgdFile->Printf( "\tnoclipmodel(boolean) : \"0 by default. Sets whether or not to generate a collision model for an ASE/LWO func_static at level load. (Set to 1 for stuff the player can't interact with. This will save memory.)\" : 0\n" );
|
||||
fgdFile->Printf( "\thide(boolean) : \"whether the object should be visible when spawned. you need to set a value for triggering on/off to work\"\n" );
|
||||
fgdFile->Printf( "\tgui_noninteractive(boolean) : \"any gui attached will not be interactive\"\n" );
|
||||
fgdFile->Printf( "\tinline(boolean) : \"If true, turn the model into map geometry at dmap time\"\n" );
|
||||
fgdFile->Printf( "\tangles(string) : \"\" : \"0 0 0\"\n" );
|
||||
fgdFile->Printf( "\tgui(string) : \"gui attached to this static, gui2 and gui3 also work\"\n" );
|
||||
fgdFile->Printf( "\tgui_demonic(string) : \"demonic gui attached to this statit, gui_demonic2 and gui_demonic3 also work\"\n]\n\n" );
|
||||
|
||||
fgdFile->Printf( "@PointClass base(func_static) color(0 127 204) model({ \"path\" : proxymodel }) = misc_model : \"Just a model\"\n[\n" );
|
||||
fgdFile->Printf( "@PointClass base(func_static) color(0 127 204) model({{\n\tproxymodel -> { \"path\": proxymodel },\n\t{ \"path\": model }\n}}) = misc_model : \"Just a model\"\n[\n" );
|
||||
//fgdFile->Printf( "name(string) : \"\" : \"\"\n" );
|
||||
fgdFile->Printf( "\t angles(string) : \"\" : \"0 0 0\"\n" );
|
||||
fgdFile->Printf( "\tmodel(string) : \"Model Selection (ex mapobjects/model.obj)\"\n" );
|
||||
fgdFile->Printf( "\tmodel(string) : \"\tA proxy model in OBJ file format automatically set by RBDoom so it can be displayed in TrenchBroom\"\n" );
|
||||
fgdFile->Printf( "]\n\n" );
|
||||
|
||||
fgdFile->Printf( "@PointClass base(misc_model) = auto_generated_model : \"Entity definition for a specific model\" []\n\n" );
|
||||
|
@ -3580,7 +3582,7 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
|||
int totalModelsCount = 0;
|
||||
int totalEntitiesCount = 0;
|
||||
|
||||
idFileList* files = fileSystem->ListFilesTree( "generated", ".blwo|.base|.bdae|.bobj|.bmd5mesh", true, true );
|
||||
idFileList* files = fileSystem->ListFilesTree( "generated", ".blwo|.base|.bglb|.bobj|.bmd5mesh", true, true );
|
||||
|
||||
idStr mapName( "maps/zoomaps/zoo_models.map" );
|
||||
idMapFile mapFile;
|
||||
|
@ -3740,9 +3742,9 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
|||
modelName.SetFileExtension( "ase" );
|
||||
}
|
||||
|
||||
if( ext.Icmp( "bdae" ) == 0 )
|
||||
if( ext.Icmp( "bglb" ) == 0 )
|
||||
{
|
||||
modelName.SetFileExtension( "dae" );
|
||||
modelName.SetFileExtension( "glb" );
|
||||
}
|
||||
|
||||
if( ext.Icmp( "bobj" ) == 0 )
|
||||
|
@ -3837,18 +3839,24 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
|||
idMapEntity* mapEnt = new( TAG_SYSTEM ) idMapEntity();
|
||||
mapFile.AddEntity( mapEnt );
|
||||
|
||||
// build TB compatible model name
|
||||
idStrStatic< MAX_OSPATH > exportedModelFileName;
|
||||
exportedModelFileName = "_tb/";
|
||||
exportedModelFileName.AppendPath( modelName );
|
||||
exportedModelFileName.SetFileExtension( ".obj" );
|
||||
|
||||
idStrStatic< MAX_OSPATH > entityName;
|
||||
entityName.Format( "misc_model_%d", mapFile.GetNumEntities() );
|
||||
|
||||
mapEnt->epairs.Set( "classname", "misc_model" );
|
||||
mapEnt->epairs.Set( "name", entityName );
|
||||
mapEnt->epairs.Set( "proxymodel", exportedModelFileName );
|
||||
|
||||
// .glb models are the fastest to load into TrenchBroom so skip proxymodel
|
||||
if( ext.Icmp( "bglb" ) != 0 )
|
||||
{
|
||||
// build TB compatible model name
|
||||
idStrStatic< MAX_OSPATH > exportedModelFileName;
|
||||
exportedModelFileName = "_tb/";
|
||||
exportedModelFileName.AppendPath( modelName );
|
||||
exportedModelFileName.SetFileExtension( ".obj" );
|
||||
|
||||
mapEnt->epairs.Set( "proxymodel", exportedModelFileName );
|
||||
}
|
||||
|
||||
mapEnt->epairs.Set( "model", modelName );
|
||||
|
||||
EntityInfo_t* entInfo = new( TAG_SYSTEM ) EntityInfo_t;
|
||||
|
@ -4126,10 +4134,12 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
|||
#endif
|
||||
}
|
||||
|
||||
mapFile.ConvertToValve220Format();
|
||||
mapFile.ConvertToValve220Format( false );
|
||||
|
||||
worldspawn->epairs.Set( "_tb_textures", "textures/common;textures/editor;textures/decals;textures/rock" );
|
||||
worldspawn->epairs.Set( "_tb_def", "external:base/_tb/fgd/DOOM-3-models.fgd" );
|
||||
worldspawn->epairs.Set( "_tb_def", "external:base/_tb/fgd/DOOM-3-slim.fgd" );
|
||||
|
||||
// TODO add fs_game if it is set like "_tb_mod" "mod_unittests"
|
||||
|
||||
mapFile.Write( mapName, ".map" );
|
||||
|
||||
|
|
|
@ -520,6 +520,7 @@ void idCommonLocal::ProcessGameReturn( const gameReturn_t& ret )
|
|||
extern idCVar com_forceGenericSIMD;
|
||||
|
||||
extern idCVar com_pause;
|
||||
extern idCVar com_activeApp;
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -641,6 +642,21 @@ void idCommonLocal::Frame()
|
|||
}
|
||||
frameTiming.finishSyncTime = Sys_Microseconds();
|
||||
|
||||
// RB: slow down engine in background so it does not eat up so many resources along other 3D tools
|
||||
if( !com_activeApp.GetBool() /* and not VR */ )
|
||||
{
|
||||
const float backgroundEngineHz = 15.0f;
|
||||
com_engineHz_denominator = 100LL * backgroundEngineHz;
|
||||
com_engineHz_latched = backgroundEngineHz;
|
||||
}
|
||||
else
|
||||
{
|
||||
// allow com_engineHz to be changed between map loads
|
||||
com_engineHz_denominator = 100LL * com_engineHz.GetFloat();
|
||||
com_engineHz_latched = com_engineHz.GetFloat();
|
||||
}
|
||||
// RB end
|
||||
|
||||
//--------------------------------------------
|
||||
// Determine how many game tics we are going to run,
|
||||
// now that the previous frame is completely finished.
|
||||
|
@ -688,12 +704,16 @@ void idCommonLocal::Frame()
|
|||
gameTimeResidual += clampedDeltaMilliseconds * timescale.GetFloat();
|
||||
|
||||
// don't run any frames when paused
|
||||
/*
|
||||
RB moved down
|
||||
|
||||
if( pauseGame )
|
||||
{
|
||||
gameFrame++;
|
||||
gameTimeResidual = 0;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
// debug cvar to force multiple game tics
|
||||
if( com_fixedTic.GetInteger() > 0 )
|
||||
|
@ -753,6 +773,14 @@ void idCommonLocal::Frame()
|
|||
}
|
||||
}
|
||||
|
||||
// don't run any frames when paused
|
||||
// RB: reset numGameFrames here so we use the sleep above
|
||||
// and don't run as many frames as possible on the GPU
|
||||
if( pauseGame )
|
||||
{
|
||||
numGameFrames = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// It would be better to push as much of this as possible
|
||||
// either before or after the renderSystem->SwapCommandBuffers(),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2015-2023 Robert Beckebans
|
||||
Copyright (C) 2015-2025 Robert Beckebans
|
||||
Copyright (C) 2020 Admer (id Tech Fox)
|
||||
Copyright (C) 2022 Harrie van Ginneken
|
||||
|
||||
|
@ -145,33 +145,6 @@ void idMapBrushSide::ConvertToValve220Format( const idMat4& entityTransform, idS
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// create p1, p2, p3
|
||||
idVec3 forward = plane.Normal();
|
||||
idVec3 p1 = forward * plane.Dist();
|
||||
|
||||
// create tangents right,up similar as in Quake's MakeNormalVectors
|
||||
idVec3 right = forward;
|
||||
right[1] = -forward[0];
|
||||
right[2] = forward[1];
|
||||
right[0] = forward[2];
|
||||
|
||||
float d = right * forward;
|
||||
right = right + ( -d * forward );
|
||||
right.Normalize();
|
||||
|
||||
idVec3 up = right.Cross( forward );
|
||||
|
||||
// offset p1 by tangents to have 3 points in a plane
|
||||
idVec3 p2 = p1 + right;
|
||||
idVec3 p3 = p1 + up;
|
||||
|
||||
// move planepts from entity space to world space because TrenchBroom can only handle brushes in world space
|
||||
planepts[0] = entityTransform * p1;
|
||||
planepts[1] = entityTransform * p2;
|
||||
planepts[2] = entityTransform * p3;
|
||||
|
||||
#else
|
||||
// from DoomEdit's void BrushPrimit_Parse( brush_t* b, bool newFormat, const idVec3 origin )
|
||||
|
||||
idVec3 origin = entityTransform.GetTranslation();
|
||||
|
@ -188,7 +161,6 @@ void idMapBrushSide::ConvertToValve220Format( const idMat4& entityTransform, idS
|
|||
planepts[j].y = w[j].y + origin.y;
|
||||
planepts[j].z = w[j].z + origin.z;
|
||||
}
|
||||
#endif
|
||||
|
||||
idVec3 texX, texY;
|
||||
|
||||
|
@ -2996,7 +2968,7 @@ bool idMapFile::ConvertToPolygonMeshFormat()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool idMapFile::ConvertToValve220Format()
|
||||
bool idMapFile::ConvertToValve220Format( bool recalcPlanePoints )
|
||||
{
|
||||
valve220Format = true;
|
||||
|
||||
|
@ -3237,9 +3209,12 @@ bool idMapFile::ConvertToValve220Format()
|
|||
side->ConvertToValve220Format( transform, textureCollections );
|
||||
}
|
||||
|
||||
// RB: this is not necessary but the initial plane definitions are at the border of the max world size
|
||||
// RB: this shouldn't necessary but the initial plane definitions are at the border of the max world size
|
||||
// so with this function we get sane values that are within the brush boundaries
|
||||
brushPrim->SetPlanePointsFromWindings( transform.GetTranslation(), j, i );
|
||||
if( recalcPlanePoints )
|
||||
{
|
||||
brushPrim->SetPlanePointsFromWindings( transform.GetTranslation(), j, i );
|
||||
}
|
||||
}
|
||||
else if( mapPrim->GetType() == idMapPrimitive::TYPE_PATCH )
|
||||
{
|
||||
|
|
|
@ -504,7 +504,7 @@ public:
|
|||
// RB begin
|
||||
bool WriteJSON( const char* fileName, const char* ext, bool fromBasePath = true );
|
||||
bool ConvertToPolygonMeshFormat();
|
||||
bool ConvertToValve220Format();
|
||||
bool ConvertToValve220Format( bool recalcPlanePoints );
|
||||
|
||||
void ClassifyEntitiesForTrenchBroom( idDict& classTypeOverview );
|
||||
|
||||
|
|
|
@ -452,6 +452,7 @@ sysEvent_t Sys_GetEvent()
|
|||
// DG: un-pause the game when focus is gained, that also re-grabs the input
|
||||
// disabling the cursor is now done once in GLimp_Init() because it should always be disabled
|
||||
cvarSystem->SetCVarBool( "com_pause", false );
|
||||
cvarSystem->SetCVarBool( "com_activeApp", true );
|
||||
// DG end
|
||||
break;
|
||||
}
|
||||
|
@ -459,6 +460,7 @@ sysEvent_t Sys_GetEvent()
|
|||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
// DG: pause the game when focus is lost, that also un-grabs the input
|
||||
cvarSystem->SetCVarBool( "com_pause", true );
|
||||
cvarSystem->SetCVarBool( "com_activeApp", false );
|
||||
// DG end
|
||||
break;
|
||||
|
||||
|
@ -694,22 +696,59 @@ sysEvent_t Sys_GetEvent()
|
|||
|
||||
// GameController
|
||||
case SDL_JOYAXISMOTION:
|
||||
case SDL_JOYBALLMOTION:
|
||||
case SDL_JOYHATMOTION:
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
case SDL_JOYBUTTONUP:
|
||||
case SDL_JOYDEVICEADDED:
|
||||
case SDL_JOYDEVICEREMOVED:
|
||||
case SDL_JOYBATTERYUPDATED:
|
||||
// Avoid 'unknown event' spam
|
||||
continue;
|
||||
|
||||
case SDL_CONTROLLERAXISMOTION:
|
||||
{
|
||||
extern idCVar joy_deadZone;
|
||||
static int controllerAxisRemap[][2] =
|
||||
{
|
||||
{K_JOY_STICK1_LEFT, K_JOY_STICK1_RIGHT}, // Left Stick X Axis: SDL_CONTROLLER_AXIS_LEFTX
|
||||
{K_JOY_STICK1_UP, K_JOY_STICK1_DOWN}, // Left Stick Y Axis: SDL_CONTROLLER_AXIS_LEFTY
|
||||
{K_JOY_STICK2_LEFT, K_JOY_STICK2_RIGHT}, // Right Stick X Axis: SDL_CONTROLLER_AXIS_RIGHTX
|
||||
{K_JOY_STICK2_UP, K_JOY_STICK2_DOWN}, // Right Stick Y Axis: SDL_CONTROLLER_AXIS_RIGHTY
|
||||
{K_NONE, K_NONE}, // Null padding: SDL_CONTROLLER_AXIS_TRIGGERLEFT
|
||||
{K_NONE, K_NONE}, // Null padding: SDL_CONTROLLER_AXIS_TRIGGERRIGHT
|
||||
};
|
||||
|
||||
res.evType = SE_JOYSTICK;
|
||||
res.evValue = J_AXIS_LEFT_X + ( ev.caxis.axis - SDL_CONTROLLER_AXIS_LEFTX );
|
||||
res.evValue2 = ev.caxis.value;
|
||||
|
||||
joystick_polls.Append( joystick_poll_t( res.evValue, res.evValue2 ) );
|
||||
return res;
|
||||
|
||||
// SRS - Synthesize joystick axis key presses to enable navigation in game menus and the PDA
|
||||
if( ev.caxis.axis <= SDL_CONTROLLER_AXIS_RIGHTY )
|
||||
{
|
||||
int axisIndex = ( ev.caxis.axis - SDL_CONTROLLER_AXIS_LEFTX );
|
||||
bool stickNeg = static_cast<float>( ev.caxis.value ) / 32767.0f < - joy_deadZone.GetFloat();
|
||||
bool stickPos = static_cast<float>( ev.caxis.value ) / 32767.0f > joy_deadZone.GetFloat();
|
||||
|
||||
if( buttonStates[controllerAxisRemap[axisIndex][0]] != stickNeg )
|
||||
{
|
||||
buttonStates[controllerAxisRemap[axisIndex][0]] = stickNeg;
|
||||
res.evType = SE_KEY;
|
||||
res.evValue = controllerAxisRemap[axisIndex][0];
|
||||
res.evValue2 = stickNeg ? 1 : 0;
|
||||
}
|
||||
else if( buttonStates[controllerAxisRemap[axisIndex][1]] != stickPos )
|
||||
{
|
||||
buttonStates[controllerAxisRemap[axisIndex][1]] = stickPos;
|
||||
res.evType = SE_KEY;
|
||||
res.evValue = controllerAxisRemap[axisIndex][1];
|
||||
res.evValue2 = stickPos ? 1 : 0;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
case SDL_CONTROLLERBUTTONDOWN:
|
||||
case SDL_CONTROLLERBUTTONUP:
|
||||
static int controllerButtonRemap[][2] =
|
||||
|
@ -738,6 +777,18 @@ sysEvent_t Sys_GetEvent()
|
|||
joystick_polls.Append( joystick_poll_t( controllerButtonRemap[ev.cbutton.button][1], res.evValue2 ) );
|
||||
return res;
|
||||
|
||||
case SDL_CONTROLLERDEVICEADDED:
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
case SDL_CONTROLLERDEVICEREMAPPED:
|
||||
case SDL_CONTROLLERTOUCHPADDOWN:
|
||||
case SDL_CONTROLLERTOUCHPADMOTION:
|
||||
case SDL_CONTROLLERTOUCHPADUP:
|
||||
case SDL_CONTROLLERSENSORUPDATE:
|
||||
case SDL_CONTROLLERUPDATECOMPLETE_RESERVED_FOR_SDL3:
|
||||
case SDL_CONTROLLERSTEAMHANDLEUPDATED:
|
||||
// Avoid more 'unknown event' spam
|
||||
continue;
|
||||
|
||||
case SDL_QUIT:
|
||||
PushConsoleEvent( "quit" );
|
||||
res = no_more_events; // don't handle next event, just quit.
|
||||
|
@ -756,7 +807,10 @@ sysEvent_t Sys_GetEvent()
|
|||
}
|
||||
continue; // just handle next event
|
||||
|
||||
// Avoid 'unknown event' spam
|
||||
case SDL_TEXTEDITING:
|
||||
case SDL_KEYMAPCHANGED:
|
||||
case SDL_CLIPBOARDUPDATE:
|
||||
continue; // just handle next event
|
||||
|
||||
default:
|
||||
|
|
|
@ -296,6 +296,7 @@ LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
// DG: set com_pause so game pauses when focus is lost
|
||||
// and continues when focus is regained
|
||||
cvarSystem->SetCVarBool( "com_pause", !win32.activeApp );
|
||||
cvarSystem->SetCVarBool( "com_activeApp", win32.activeApp );
|
||||
// DG end
|
||||
|
||||
// we do not actually grab or release the mouse here,
|
||||
|
|
Loading…
Reference in a new issue