From d6910022961c89bd3939df5893439acefdcf7a05 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sun, 18 Jan 2015 12:13:24 +0100 Subject: [PATCH] Bumped engine version to 1.0.3 to prepare for new release --- neo/d3xp/Achievements.cpp | 2 +- neo/d3xp/Game_local.cpp | 4 +- neo/d3xp/Player.cpp | 10 +- neo/d3xp/Pvs.cpp | 6 +- neo/d3xp/Trigger.cpp | 2 +- neo/d3xp/gamesys/Event.cpp | 8 +- .../menus/MenuScreen_Shell_SystemOptions.cpp | 8 +- neo/d3xp/physics/Physics_AF.cpp | 2 +- neo/framework/KeyInput.cpp | 8 +- neo/framework/Licensee.h | 2 +- neo/idlib/containers/HashTable.h | 4 +- neo/idlib/math/Lcp.cpp | 4 +- neo/renderer/OpenGL/gl_Image.cpp | 4 +- neo/renderer/OpenGL/gl_backend.cpp | 4 +- neo/renderer/RenderProgs_GLSL.cpp | 8 +- neo/swf/SWF_ScriptFunction.cpp | 10 +- neo/sys/Snapshot_Jobs.cpp | 2 +- neo/sys/sdl/sdl2_scancode_mappings.h | 119 ++--- neo/sys/sdl/sdl_events.cpp | 458 +++++++++--------- neo/sys/sys_public.h | 4 +- neo/sys/win32/win_syscon.cpp | 38 +- neo/sys/win32/win_wndproc.cpp | 2 +- 22 files changed, 355 insertions(+), 354 deletions(-) diff --git a/neo/d3xp/Achievements.cpp b/neo/d3xp/Achievements.cpp index 505fa0ea..a2eacd31 100644 --- a/neo/d3xp/Achievements.cpp +++ b/neo/d3xp/Achievements.cpp @@ -633,6 +633,6 @@ CONSOLE_COMMAND( AchievementsList, "Lists achievements and status", NULL ) achievementDescription_t data; bool descriptionValid = session->GetAchievementSystem().GetAchievementDescription( user, i, data ); -idLib::Printf( "%02d: %2d/%2d | %12.12s | %12.12s | %s%s\n", i, count, achievementInfo[i].required, pInfo, sInfo, descriptionValid ? data.hidden ? "(hidden) " : "" : "(unknown) ", descriptionValid ? data.name : "" ); + idLib::Printf( "%02d: %2d/%2d | %12.12s | %12.12s | %s%s\n", i, count, achievementInfo[i].required, pInfo, sInfo, descriptionValid ? data.hidden ? "(hidden) " : "" : "(unknown) ", descriptionValid ? data.name : "" ); } } diff --git a/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp index 52321931..03482cf1 100644 --- a/neo/d3xp/Game_local.cpp +++ b/neo/d3xp/Game_local.cpp @@ -5317,7 +5317,7 @@ idEntity* idGameLocal::SelectInitialSpawnPoint( idPlayer* player ) } // sort the list - qsort( ( void* )teamSpawnSpots[ team ].Ptr(), teamSpawnSpots[ team ].Num(), sizeof( spawnSpot_t ), ( int (* )( const void*, const void* ) )sortSpawnPoints ); + qsort( ( void* )teamSpawnSpots[ team ].Ptr(), teamSpawnSpots[ team ].Num(), sizeof( spawnSpot_t ), ( int ( * )( const void*, const void* ) )sortSpawnPoints ); // choose a random one in the top half which = random.RandomInt( teamSpawnSpots[ team ].Num() / 2 ); @@ -5350,7 +5350,7 @@ idEntity* idGameLocal::SelectInitialSpawnPoint( idPlayer* player ) } // sort the list - qsort( ( void* )spawnSpots.Ptr(), spawnSpots.Num(), sizeof( spawnSpot_t ), ( int (* )( const void*, const void* ) )sortSpawnPoints ); + qsort( ( void* )spawnSpots.Ptr(), spawnSpots.Num(), sizeof( spawnSpot_t ), ( int ( * )( const void*, const void* ) )sortSpawnPoints ); // choose a random one in the top half which = random.RandomInt( spawnSpots.Num() / 2 ); diff --git a/neo/d3xp/Player.cpp b/neo/d3xp/Player.cpp index d350bbe1..e97907c3 100644 --- a/neo/d3xp/Player.cpp +++ b/neo/d3xp/Player.cpp @@ -4515,11 +4515,11 @@ void idPlayer::ClearPowerup( int i ) StopSound( SND_CHANNEL_DEMONIC, false ); } } - /*case HASTE: { - if(common->IsMultiplayer()) { - StopSound( SND_CHANNEL_DEMONIC, false ); - } - }*/ + /*case HASTE: { + if(common->IsMultiplayer()) { + StopSound( SND_CHANNEL_DEMONIC, false ); + } + }*/ } } diff --git a/neo/d3xp/Pvs.cpp b/neo/d3xp/Pvs.cpp index 5ea43df6..a6bbf657 100644 --- a/neo/d3xp/Pvs.cpp +++ b/neo/d3xp/Pvs.cpp @@ -145,7 +145,7 @@ void idPVS::CreatePVSData() memset( pvsAreas, 0, numAreas * sizeof( *pvsAreas ) ); cp = 0; - portalPtrs = new( TAG_PVS ) pvsPortal_t*[numPortals]; + portalPtrs = new( TAG_PVS ) pvsPortal_t* [numPortals]; for( i = 0; i < numAreas; i++ ) { @@ -929,7 +929,7 @@ void idPVS::Init() connectedAreas = new( TAG_PVS ) bool[numAreas]; areaQueue = new( TAG_PVS ) int[numAreas]; - areaVisBytes = ( ( ( numAreas + 31 )&~31 ) >> 3 ); + areaVisBytes = ( ( ( numAreas + 31 ) & ~31 ) >> 3 ); // RB: 64 bit fixes, changed long to int areaVisLongs = areaVisBytes / sizeof( int ); // RB end @@ -939,7 +939,7 @@ void idPVS::Init() numPortals = GetPortalCount(); - portalVisBytes = ( ( ( numPortals + 31 )&~31 ) >> 3 ); + portalVisBytes = ( ( ( numPortals + 31 ) & ~31 ) >> 3 ); // RB: 64 bit fixes, changed long to int portalVisLongs = portalVisBytes / sizeof( int ); // RB end diff --git a/neo/d3xp/Trigger.cpp b/neo/d3xp/Trigger.cpp index b8616f4b..fc7df795 100644 --- a/neo/d3xp/Trigger.cpp +++ b/neo/d3xp/Trigger.cpp @@ -1532,7 +1532,7 @@ void idTrigger_Flag::Event_Touch( idEntity* other, trace_t* trace ) flag->PostEventMS( eventFlag, 0 ); break; - // RB: 64 bit fixes, changed NULL to 0 + // RB: 64 bit fixes, changed NULL to 0 case 1 : flag->PostEventMS( eventFlag, 0, 0 ); break; diff --git a/neo/d3xp/gamesys/Event.cpp b/neo/d3xp/gamesys/Event.cpp index 9f6c4372..c3ce01dc 100644 --- a/neo/d3xp/gamesys/Event.cpp +++ b/neo/d3xp/gamesys/Event.cpp @@ -886,7 +886,7 @@ void idEvent::Save( idSaveGame* savefile ) savefile->WriteInt( *reinterpret_cast( dataPtr ) ); size += sizeof( intptr_t ); break; - // RB end + // RB end case D_EVENT_ENTITY : case D_EVENT_ENTITY_NULL : // RB: 64 bit fix, changed alignment to sizeof( intptr_t ) @@ -901,7 +901,7 @@ void idEvent::Save( idSaveGame* savefile ) // RB end break; #if 1 - // RB: added missing D_EVENT_STRING case + // RB: added missing D_EVENT_STRING case case D_EVENT_STRING : s.Clear(); s.Append( reinterpret_cast( dataPtr ) ); @@ -1034,7 +1034,7 @@ void idEvent::Restore( idRestoreGame* savefile ) savefile->ReadInt( *reinterpret_cast( dataPtr ) ); size += sizeof( intptr_t ); break; - // RB end + // RB end case D_EVENT_ENTITY : case D_EVENT_ENTITY_NULL : // RB: 64 bit fix, changed alignment to sizeof( intptr_t ) @@ -1049,7 +1049,7 @@ void idEvent::Restore( idRestoreGame* savefile ) // RB end break; #if 1 - // RB: added missing D_EVENT_STRING case + // RB: added missing D_EVENT_STRING case case D_EVENT_STRING : savefile->ReadString( s ); //idStr::Copynz(reinterpret_cast( dataPtr ), s, s.Length() ); diff --git a/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp b/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp index 4caffeb1..d0ad3e88 100644 --- a/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp +++ b/neo/d3xp/menus/MenuScreen_Shell_SystemOptions.cpp @@ -607,7 +607,7 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings return "#str_swf_disabled"; } return va( "%dx", idMath::IPow( 2, r_motionBlur.GetInteger() ) ); - // RB begin + // RB begin case SYSTEM_FIELD_SHADOWMAPPING: if( r_useShadowMapping.GetInteger() == 1 ) { @@ -617,9 +617,9 @@ idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings { return "#str_swf_disabled"; } - //case SYSTEM_FIELD_LODBIAS: - // return LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f ); - // RB end + //case SYSTEM_FIELD_LODBIAS: + // return LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f ); + // RB end case SYSTEM_FIELD_BRIGHTNESS: return LinearAdjust( r_lightScale.GetFloat(), 2.0f, 4.0f, 0.0f, 100.0f ); case SYSTEM_FIELD_VOLUME: diff --git a/neo/d3xp/physics/Physics_AF.cpp b/neo/d3xp/physics/Physics_AF.cpp index 8f4b91d9..8b1d8ece 100644 --- a/neo/d3xp/physics/Physics_AF.cpp +++ b/neo/d3xp/physics/Physics_AF.cpp @@ -5748,7 +5748,7 @@ void idPhysics_AF::AuxiliaryForces( float timeStep ) } // NOTE: the rows are 16 byte padded - jmk.SetData( numAuxConstraints, ( ( numAuxConstraints + 3 )&~3 ), MATX_ALLOCA( numAuxConstraints * ( ( numAuxConstraints + 3 )&~3 ) ) ); + jmk.SetData( numAuxConstraints, ( ( numAuxConstraints + 3 ) & ~3 ), MATX_ALLOCA( numAuxConstraints * ( ( numAuxConstraints + 3 ) & ~3 ) ) ); tmp.SetData( 6, VECX_ALLOCA( 6 ) ); // create constraint matrix for auxiliary constraints using a mass matrix adjusted for the primary constraints diff --git a/neo/framework/KeyInput.cpp b/neo/framework/KeyInput.cpp index 23f1ffc0..564bf989 100644 --- a/neo/framework/KeyInput.cpp +++ b/neo/framework/KeyInput.cpp @@ -192,7 +192,7 @@ keyname_t keynames[] = NAMEKEY2( MAIL ), NAMEKEY2( MEDIASELECT ), // DG end - + // -- NAMEKEY( MOUSE1, "#str_07054" ), @@ -419,9 +419,9 @@ const char* idKeyInput::LocalizedKeyName( keyNum_t keynum ) } } #else // DG: for !Windows I introduced Sys_GetKeyName() to get key label for current keyboard layout - + const char* ret = nullptr; - + if( keynum < K_JOY1 ) // only for keyboard keys, not joystick or mouse { ret = Sys_GetKeyName( keynum ); @@ -432,7 +432,7 @@ const char* idKeyInput::LocalizedKeyName( keyNum_t keynum ) return ret; } #endif - + // check for a key string for( keyname_t* kn = keynames; kn->name; kn++ ) { diff --git a/neo/framework/Licensee.h b/neo/framework/Licensee.h index c24112c3..16e40c0d 100644 --- a/neo/framework/Licensee.h +++ b/neo/framework/Licensee.h @@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms // RB: changed home folder so we don't break the savegame of the original game #define SAVE_PATH "\\id Software\\RBDOOM 3 BFG" -#define ENGINE_VERSION "RBDOOM 3 BFG 1.0.2" // printed in console +#define ENGINE_VERSION "RBDOOM 3 BFG 1.0.3" // printed in console // RB end #define BASE_GAMEDIR "base" diff --git a/neo/idlib/containers/HashTable.h b/neo/idlib/containers/HashTable.h index 7bff171f..6f795670 100644 --- a/neo/idlib/containers/HashTable.h +++ b/neo/idlib/containers/HashTable.h @@ -208,7 +208,7 @@ ID_INLINE idHashTableT<_key_, _value_>::idHashTableT( const int tableSize ) this->tableSize = tableSize; - heads = new( TAG_IDLIB_HASH ) hashnode_t *[ tableSize ]; + heads = new( TAG_IDLIB_HASH ) hashnode_t* [ tableSize ]; memset( heads, 0, sizeof( hashnode_t* ) * tableSize ); numEntries = 0; @@ -575,7 +575,7 @@ ID_INLINE void idHashTableT<_key_, _value_>::Copy( const idHashTableT& other ) assert( other.tableSize > 0 ); tableSize = other.tableSize; - heads = new( TAG_IDLIB_HASH ) hashnode_t *[ tableSize ]; + heads = new( TAG_IDLIB_HASH ) hashnode_t* [ tableSize ]; numEntries = other.numEntries; tableSizeMask = other.tableSizeMask; diff --git a/neo/idlib/math/Lcp.cpp b/neo/idlib/math/Lcp.cpp index 807bb270..7ab0a18a 100644 --- a/neo/idlib/math/Lcp.cpp +++ b/neo/idlib/math/Lcp.cpp @@ -2254,7 +2254,7 @@ bool idLCP_Square::Solve( const idMatX& o_m, idVecX& o_x, const idVecX& o_b, con { // true when the matrix rows are 16 byte padded - padded = ( ( o_m.GetNumRows() + 3 )&~3 ) == o_m.GetNumColumns(); + padded = ( ( o_m.GetNumRows() + 3 ) & ~3 ) == o_m.GetNumColumns(); assert( padded || o_m.GetNumRows() == o_m.GetNumColumns() ); assert( o_x.GetSize() == o_m.GetNumRows() ); @@ -3034,7 +3034,7 @@ bool idLCP_Symmetric::Solve( const idMatX& o_m, idVecX& o_x, const idVecX& o_b, { // true when the matrix rows are 16 byte padded - padded = ( ( o_m.GetNumRows() + 3 )&~3 ) == o_m.GetNumColumns(); + padded = ( ( o_m.GetNumRows() + 3 ) & ~3 ) == o_m.GetNumColumns(); assert( padded || o_m.GetNumRows() == o_m.GetNumColumns() ); assert( o_x.GetSize() == o_m.GetNumRows() ); diff --git a/neo/renderer/OpenGL/gl_Image.cpp b/neo/renderer/OpenGL/gl_Image.cpp index b3f8447a..a8e51ac3 100644 --- a/neo/renderer/OpenGL/gl_Image.cpp +++ b/neo/renderer/OpenGL/gl_Image.cpp @@ -170,11 +170,11 @@ void idImage::SetTexParameters() case TT_CUBIC: target = GL_TEXTURE_CUBE_MAP; break; - // RB begin + // RB begin case TT_2D_ARRAY: target = GL_TEXTURE_2D_ARRAY; break; - // RB end + // RB end default: idLib::FatalError( "%s: bad texture type %d", GetName(), opts.textureType ); return; diff --git a/neo/renderer/OpenGL/gl_backend.cpp b/neo/renderer/OpenGL/gl_backend.cpp index 10850f8f..37031590 100644 --- a/neo/renderer/OpenGL/gl_backend.cpp +++ b/neo/renderer/OpenGL/gl_backend.cpp @@ -460,8 +460,8 @@ void RB_StereoRenderExecuteBackEndCommands( const emptyCommand_t* const allCmds RB_DrawElementsWithCounters( &backEnd.unitSquareSurface ); break; } - // a non-warped side-by-side-uncompressed (dual input cable) is rendered - // just like STEREO3D_SIDE_BY_SIDE_COMPRESSED, so fall through. + // a non-warped side-by-side-uncompressed (dual input cable) is rendered + // just like STEREO3D_SIDE_BY_SIDE_COMPRESSED, so fall through. case STEREO3D_SIDE_BY_SIDE_COMPRESSED: GL_SelectTexture( 0 ); stereoRenderImages[0]->Bind(); diff --git a/neo/renderer/RenderProgs_GLSL.cpp b/neo/renderer/RenderProgs_GLSL.cpp index 0b4ad2a3..0b913244 100644 --- a/neo/renderer/RenderProgs_GLSL.cpp +++ b/neo/renderer/RenderProgs_GLSL.cpp @@ -1137,10 +1137,10 @@ void ParseInOutStruct( idLexer& src, int attribType, int attribIgnoreType, idLis // RB: ignore reserved builtin gl_ uniforms switch( glConfig.driverType ) { - //case GLDRV_OPENGL32_CORE_PROFILE: - //case GLDRV_OPENGL_ES2: - //case GLDRV_OPENGL_ES3: - //case GLDRV_OPENGL_MESA: + //case GLDRV_OPENGL32_CORE_PROFILE: + //case GLDRV_OPENGL_ES2: + //case GLDRV_OPENGL_ES3: + //case GLDRV_OPENGL_MESA: default: { for( int i = 0; attribsPC[i].semantic != NULL; i++ ) diff --git a/neo/swf/SWF_ScriptFunction.cpp b/neo/swf/SWF_ScriptFunction.cpp index 5afeb765..ce620a94 100644 --- a/neo/swf/SWF_ScriptFunction.cpp +++ b/neo/swf/SWF_ScriptFunction.cpp @@ -331,7 +331,7 @@ const char* GetSwfActionName( swfAction_t code ) case Action_End: return "Action_End"; - // swf 3 + // swf 3 case Action_NextFrame: return "Action_NextFrame"; case Action_PrevFrame: @@ -356,7 +356,7 @@ const char* GetSwfActionName( swfAction_t code ) case Action_GoToLabel: return "Action_GoToLabel"; - // swf 4 + // swf 4 case Action_Add: return "Action_Add"; case Action_Subtract: @@ -441,7 +441,7 @@ const char* GetSwfActionName( swfAction_t code ) case Action_GotoFrame2: return "Action_GotoFrame2"; - // swf 5 + // swf 5 case Action_Delete: return "Action_Delete"; case Action_Delete2: @@ -516,7 +516,7 @@ const char* GetSwfActionName( swfAction_t code ) case Action_DefineFunction: return "Action_DefineFunction"; - // swf 6 + // swf 6 case Action_InstanceOf: return "Action_InstanceOf"; case Action_Enumerate2: @@ -528,7 +528,7 @@ const char* GetSwfActionName( swfAction_t code ) case Action_StringGreater: return "Action_StringGreater"; - // swf 7 + // swf 7 case Action_Extends: return "Action_Extends"; case Action_CastOp: diff --git a/neo/sys/Snapshot_Jobs.cpp b/neo/sys/Snapshot_Jobs.cpp index b0b086eb..cdfa596b 100644 --- a/neo/sys/Snapshot_Jobs.cpp +++ b/neo/sys/Snapshot_Jobs.cpp @@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms uint32 SnapObjChecksum( const uint8* data, int length ) { // RB: 64 bit fixes, changed long to int - extern unsigned int CRC32_BlockChecksum( const void * data, int length ); + extern unsigned int CRC32_BlockChecksum( const void* data, int length ); // RB end return CRC32_BlockChecksum( data, length ); diff --git a/neo/sys/sdl/sdl2_scancode_mappings.h b/neo/sys/sdl/sdl2_scancode_mappings.h index d8d2d24f..540c7954 100644 --- a/neo/sys/sdl/sdl2_scancode_mappings.h +++ b/neo/sys/sdl/sdl2_scancode_mappings.h @@ -17,19 +17,20 @@ #ifndef _SDL2_SCANCODE_TO_DINPUT_MAPPINGS_H_ #define _SDL2_SCANCODE_TO_DINPUT_MAPPINGS_H_ - // TODO: map the following keys, if possible: - // #define DIK_UNDERLINE 0x93 /* (NEC PC98) */ - // #define DIK_KANJI 0x94 /* (Japanese keyboard) */ - // #define DIK_AX 0x96 /* (Japan AX) */ - // #define DIK_UNLABELED 0x97 /* (J3100) */ - // - // #define DIK_WAKE 0xE3 /* System Wake */ - // - // (#define DIK_ABNT_C2 0x7E /* Numpad . on Brazilian keyboard */ - system should map this to KP_COMMA or something, - // according to USB doc, so probably it doesn't need mapping here) +// TODO: map the following keys, if possible: +// #define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +// #define DIK_KANJI 0x94 /* (Japanese keyboard) */ +// #define DIK_AX 0x96 /* (Japan AX) */ +// #define DIK_UNLABELED 0x97 /* (J3100) */ +// +// #define DIK_WAKE 0xE3 /* System Wake */ +// +// (#define DIK_ABNT_C2 0x7E /* Numpad . on Brazilian keyboard */ - system should map this to KP_COMMA or something, +// according to USB doc, so probably it doesn't need mapping here) // maps SDL2 scancodes to directinput keynums/scancodes - dinput_key = scanCodeToKeyNum[(int)your_sdl2_scancode]; -static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { +static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = +{ 0x0, // SDL_SCANCODE_UNKNOWN = 0, => 0 should also work for dinput codes as "not assigned/unknown" 0x0, // // 1 (unused) 0x0, // // 2 (unused) @@ -60,7 +61,7 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x2D, // SDL_SCANCODE_X = 27, - DIK_X 0x15, // SDL_SCANCODE_Y = 28, - DIK_Y 0x2C, // SDL_SCANCODE_Z = 29, - DIK_Z - + 0x02, // SDL_SCANCODE_1 = 30, - DIK_1 0x03, // SDL_SCANCODE_2 = 31, - DIK_2 0x04, // SDL_SCANCODE_3 = 32, - DIK_3 @@ -71,13 +72,13 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x09, // SDL_SCANCODE_8 = 37, - DIK_8 0x0A, // SDL_SCANCODE_9 = 38, - DIK_9 0x0B, // SDL_SCANCODE_0 = 39, - DIK_0 - + 0x1C, // SDL_SCANCODE_RETURN = 40, - DIK_RETURN 0x01, // SDL_SCANCODE_ESCAPE = 41, - DIK_ESCAPE 0x0E, // SDL_SCANCODE_BACKSPACE = 42, - DIK_BACK 0x0F, // SDL_SCANCODE_TAB = 43, - DIK_TAB 0x39, // SDL_SCANCODE_SPACE = 44, - DIK_SPACE - + 0x0C, // SDL_SCANCODE_MINUS = 45, - DIK_MINUS 0x0D, // SDL_SCANCODE_EQUALS = 46, - DIK_EQUALS 0x1A, // SDL_SCANCODE_LEFTBRACKET = 47, - DIK_LBRACKET @@ -90,9 +91,9 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x33, // SDL_SCANCODE_COMMA = 54, - DIK_COMMA 0x34, // SDL_SCANCODE_PERIOD = 55, - DIK_PERIOD 0x35, // SDL_SCANCODE_SLASH = 56, - DIK_SLASH - + 0x3A, // SDL_SCANCODE_CAPSLOCK = 57, - DIK_CAPITAL - + 0x3B, // SDL_SCANCODE_F1 = 58, - DIK_F1 0x3C, // SDL_SCANCODE_F2 = 59, - DIK_F2 0x3D, // SDL_SCANCODE_F3 = 60, - DIK_F3 @@ -105,9 +106,9 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x44, // SDL_SCANCODE_F10 = 67, - DIK_F10 0x57, // SDL_SCANCODE_F11 = 68, - DIK_F11 0x58, // SDL_SCANCODE_F12 = 69, - DIK_F12 - + 0xB7, // SDL_SCANCODE_PRINTSCREEN = 70, // - DIK_SYSRQ; SDL_SCANCODE_SYSREQ also maps to this! - + 0x46, // SDL_SCANCODE_SCROLLLOCK = 71, - DIK_SCROLL 0xC5, // SDL_SCANCODE_PAUSE = 72, - DIK_PAUSE 0xD2, // SDL_SCANCODE_INSERT = 73, // insert on PC, help on some Mac keyboards (but does send code 73, not 117) - DIK_INSERT @@ -120,9 +121,9 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0xCB, // SDL_SCANCODE_LEFT = 80, - DIK_LEFT 0xD0, // SDL_SCANCODE_DOWN = 81, - DIK_DOWN 0xC8, // SDL_SCANCODE_UP = 82, - DIK_UP - + 0x45, // SDL_SCANCODE_NUMLOCKCLEAR = 83, // num lock on PC, clear on Mac keyboards - DIK_NUMLOCK - + 0xB5, // SDL_SCANCODE_KP_DIVIDE = 84, - DIK_DIVIDE 0x37, // SDL_SCANCODE_KP_MULTIPLY = 85, - DIK_MULTIPLY 0x4A, // SDL_SCANCODE_KP_MINUS = 86, - DIK_SUBTRACT @@ -139,11 +140,11 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x49, // SDL_SCANCODE_KP_9 = 97, - DIK_NUMPAD9 0x52, // SDL_SCANCODE_KP_0 = 98, - DIK_NUMPAD0 0x53, // SDL_SCANCODE_KP_PERIOD = 99, - DIK_DECIMAL - + 0x56, // SDL_SCANCODE_NONUSBACKSLASH = 100, // [<>|] on german keyboard, next to left shift - DIK_OEM_102 0xDD, // SDL_SCANCODE_APPLICATION = 101, // windows contextual menu, compose - DIK_APPS 0xDE, // SDL_SCANCODE_POWER = 102, // should be a status flag, but some mac keyboards have a power key - DIK_POWER - + 0x8D, // SDL_SCANCODE_KP_EQUALS = 103, - DIK_NUMPADEQUALS 0x64, // SDL_SCANCODE_F13 = 104, - DIK_F13 0x65, // SDL_SCANCODE_F14 = 105, - DIK_F14 @@ -157,14 +158,14 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x6D, // SDL_SCANCODE_F22 = 113, 0x6E, // SDL_SCANCODE_F23 = 114, 0x6F, // SDL_SCANCODE_F24 = 115, - + 0x0, // SDL_SCANCODE_EXECUTE = 116, 0x0, // SDL_SCANCODE_HELP = 117, 0x0, // SDL_SCANCODE_MENU = 118, 0x0, // SDL_SCANCODE_SELECT = 119, - + 0x95, // SDL_SCANCODE_STOP = 120, - DIK_STOP - + 0x0, // SDL_SCANCODE_AGAIN = 121, // redo 0x0, // SDL_SCANCODE_UNDO = 122, 0x0, // SDL_SCANCODE_CUT = 123, @@ -172,19 +173,19 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x0, // SDL_SCANCODE_PASTE = 125, 0x0, // SDL_SCANCODE_FIND = 126, 0x0, // SDL_SCANCODE_MUTE = 127, - + 0xB0, // SDL_SCANCODE_VOLUMEUP = 128, - DIK_VOLUMEUP 0xAE, // SDL_SCANCODE_VOLUMEDOWN = 129, - DIK_VOLUMEDOWN - - // /* not sure whether there's a reason to enable these */ + + // /* not sure whether there's a reason to enable these */ 0x0, // /* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */ 0x0, // /* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */ 0x0, // /* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */ - + 0xB3, // SDL_SCANCODE_KP_COMMA = 133, - DIK_NUMPADCOMMA - + 0x0, // SDL_SCANCODE_KP_EQUALSAS400 = 134, - + 0x73, // SDL_SCANCODE_INTERNATIONAL1 = 135, // this is really brazilian / and ? - DIK_ABNT_C1 0x0, // SDL_SCANCODE_INTERNATIONAL2 = 136, // TODO: Hut1_12v2.pdf page 60, footnote 16 0x7D, // SDL_SCANCODE_INTERNATIONAL3 = 137, - DIK_YEN @@ -203,11 +204,11 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x0, // SDL_SCANCODE_LANG7 = 150, // reserved 0x0, // SDL_SCANCODE_LANG8 = 151, // reserved 0x0, // SDL_SCANCODE_LANG9 = 152, // reserved - + 0x0, // SDL_SCANCODE_ALTERASE = 153, // Erase-Eaze - + 0xB7, // SDL_SCANCODE_SYSREQ = 154, - DIK_SYSRQ; SDL_SCANCODE_PRINTSCREEN also maps to this! - + 0x0, // SDL_SCANCODE_CANCEL = 155, 0x0, // SDL_SCANCODE_CLEAR = 156, 0x0, // SDL_SCANCODE_PRIOR = 157, @@ -218,7 +219,7 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x0, // SDL_SCANCODE_CLEARAGAIN = 162, 0x0, // SDL_SCANCODE_CRSEL = 163, 0x0, // SDL_SCANCODE_EXSEL = 164, - + 0x0, // 165 (unused) 0x0, // 166 (unused) 0x0, // 167 (unused) @@ -230,7 +231,7 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x0, // 173 (unused) 0x0, // 174 (unused) 0x0, // 175 (unused) - + 0x0, // SDL_SCANCODE_KP_00 = 176, 0x0, // SDL_SCANCODE_KP_000 = 177, 0x0, // SDL_SCANCODE_THOUSANDSSEPARATOR = 178, @@ -258,14 +259,14 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x0, // SDL_SCANCODE_KP_DBLAMPERSAND = 200, 0x0, // SDL_SCANCODE_KP_VERTICALBAR = 201, 0x0, // SDL_SCANCODE_KP_DBLVERTICALBAR = 202, - + 0x92, // SDL_SCANCODE_KP_COLON = 203, - DIK_COLON - + 0x0, // SDL_SCANCODE_KP_HASH = 204, 0x0, // SDL_SCANCODE_KP_SPACE = 205, - + 0x91, // SDL_SCANCODE_KP_AT = 206, - DIK_AT - + 0x0, // SDL_SCANCODE_KP_EXCLAM = 207, 0x0, // SDL_SCANCODE_KP_MEMSTORE = 208, 0x0, // SDL_SCANCODE_KP_MEMRECALL = 209, @@ -281,10 +282,10 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x0, // SDL_SCANCODE_KP_OCTAL = 219, 0x0, // SDL_SCANCODE_KP_DECIMAL = 220, 0x0, // SDL_SCANCODE_KP_HEXADECIMAL = 221, - + 0x0, // 222 (unused) 0x0, // 223 (unused) - + 0x1D, // SDL_SCANCODE_LCTRL = 224, - DIK_LCONTROL 0x2A, // SDL_SCANCODE_LSHIFT = 225, - DIK_LSHIFT 0x38, // SDL_SCANCODE_LALT = 226, // left Alt, option - DIK_LMENU @@ -293,24 +294,24 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x36, // SDL_SCANCODE_RSHIFT = 229, - DIK_RSHIFT 0xB8, // SDL_SCANCODE_RALT = 230, // right Alt/AltGr, option - DIK_RMENU, also used for SDL_SCANCODE_MODE! 0xDC, // SDL_SCANCODE_RGUI = 231, // left windows, command (apple), meta - DIK_RWIN - - // 232 - 256 unused + + // 232 - 256 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, // 232 - 240 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 241-250 unused 0, 0, 0, 0, 0, 0, // 251-256 unused - + 0xB8, // SDL_SCANCODE_MODE = 257, // this seems to be the AltGr Key? - DIK_RMENU (right alt) - - // These values are mapped from usage page 0x0C (USB consumer page). + + // These values are mapped from usage page 0x0C (USB consumer page). 0x99, // SDL_SCANCODE_AUDIONEXT = 258, - DIK_NEXTTRACK 0x90, // SDL_SCANCODE_AUDIOPREV = 259, - DIK_PREVTRACK, which is DIK_CIRCUMFLEX on japanese keyboards 0xA4, // SDL_SCANCODE_AUDIOSTOP = 260, - DIK_MEDIASTOP 0xA2, // SDL_SCANCODE_AUDIOPLAY = 261, - DIK_PLAYPAUSE 0xA0, // SDL_SCANCODE_AUDIOMUTE = 262, - DIK_MUTE 0xED, // SDL_SCANCODE_MEDIASELECT = 263, - DIK_MEDIASELECT - + 0x0, // SDL_SCANCODE_WWW = 264, - + 0xEC, // SDL_SCANCODE_MAIL = 265, - DIK_MAIL 0xA1, // SDL_SCANCODE_CALCULATOR = 266, - DIK_CALCULATOR 0xEB, // SDL_SCANCODE_COMPUTER = 267, - DIK_MYCOMPUTER @@ -321,8 +322,8 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0xE8, // SDL_SCANCODE_AC_STOP = 272, - DIK_WEBSTOP 0xE7, // SDL_SCANCODE_AC_REFRESH = 273, - DIK_WEBREFRESH 0xE6, // SDL_SCANCODE_AC_BOOKMARKS = 274, - DIK_WEBFAVORITES - - // These are values that Christian Walther added (for mac keyboard?). + + // These are values that Christian Walther added (for mac keyboard?). 0x0, // SDL_SCANCODE_BRIGHTNESSDOWN = 275, 0x0, // SDL_SCANCODE_BRIGHTNESSUP = 276, 0x0, // SDL_SCANCODE_DISPLAYSWITCH = 277, // display mirroring/dual display switch, video mode switch @@ -330,30 +331,30 @@ static int scanCodeToKeyNum[SDL_NUM_SCANCODES] = { 0x0, // SDL_SCANCODE_KBDILLUMDOWN = 279, 0x0, // SDL_SCANCODE_KBDILLUMUP = 280, 0x0, // SDL_SCANCODE_EJECT = 281, - + 0xDF, // SDL_SCANCODE_SLEEP = 282, - DIK_SLEEP - + 0x0, // SDL_SCANCODE_APP1 = 283, 0x0, // SDL_SCANCODE_APP2 = 284, - // end of Walther-keys - + // end of Walther-keys + // the rest up to 511 are currently not named in SDL - + 0, 0, 0, 0, 0, 0, // 285-290 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 291-300 unused - + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 301-320 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 321-340 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 341-360 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 361-380 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 381-400 unused - + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 401-420 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 421-440 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 441-460 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 461-480 unused 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 481-500 unused - + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 501-511 unused }; diff --git a/neo/sys/sdl/sdl_events.cpp b/neo/sys/sdl/sdl_events.cpp index 15230ce5..fe7a8224 100644 --- a/neo/sys/sdl/sdl_events.cpp +++ b/neo/sys/sdl/sdl_events.cpp @@ -140,23 +140,23 @@ int SDL_joystick_has_hat = 0; #include "sdl2_scancode_mappings.h" -static int SDLScanCodeToKeyNum(SDL_Scancode sc) +static int SDLScanCodeToKeyNum( SDL_Scancode sc ) { - int idx = int(sc); - assert(idx >= 0 && idx < SDL_NUM_SCANCODES); - + int idx = int( sc ); + assert( idx >= 0 && idx < SDL_NUM_SCANCODES ); + return scanCodeToKeyNum[idx]; } -static SDL_Scancode KeyNumToSDLScanCode(int keyNum) +static SDL_Scancode KeyNumToSDLScanCode( int keyNum ) { - if(keyNum < K_JOY1) + if( keyNum < K_JOY1 ) { - for(int i=0; i= SDLK_SPACE && key < SDLK_DELETE ) { isChar = true; //return key;// & 0xff; } - + switch( key ) { case SDLK_ESCAPE: return K_ESCAPE; - + case SDLK_SPACE: return K_SPACE; - - //case SDLK_EXCLAIM: - /* - SDLK_QUOTEDBL: - SDLK_HASH: - SDLK_DOLLAR: - SDLK_AMPERSAND: - SDLK_QUOTE = 39, - SDLK_LEFTPAREN = 40, - SDLK_RIGHTPAREN = 41, - SDLK_ASTERISK = 42, - SDLK_PLUS = 43, - SDLK_COMMA = 44, - SDLK_MINUS = 45, - SDLK_PERIOD = 46, - SDLK_SLASH = 47, - */ + + //case SDLK_EXCLAIM: + /* + SDLK_QUOTEDBL: + SDLK_HASH: + SDLK_DOLLAR: + SDLK_AMPERSAND: + SDLK_QUOTE = 39, + SDLK_LEFTPAREN = 40, + SDLK_RIGHTPAREN = 41, + SDLK_ASTERISK = 42, + SDLK_PLUS = 43, + SDLK_COMMA = 44, + SDLK_MINUS = 45, + SDLK_PERIOD = 46, + SDLK_SLASH = 47, + */ case SDLK_0: return K_0; - + case SDLK_1: return K_1; - + case SDLK_2: return K_2; - + case SDLK_3: return K_3; - + case SDLK_4: return K_4; - + case SDLK_5: return K_5; - + case SDLK_6: return K_6; - + case SDLK_7: return K_7; - + case SDLK_8: return K_8; - + case SDLK_9: return K_9; - - // DG: add some missing keys.. + + // DG: add some missing keys.. case SDLK_UNDERSCORE: return K_UNDERLINE; - + case SDLK_MINUS: return K_MINUS; - + case SDLK_COMMA: return K_COMMA; - + case SDLK_COLON: return K_COLON; - + case SDLK_SEMICOLON: return K_SEMICOLON; - + case SDLK_PERIOD: return K_PERIOD; - + case SDLK_AT: return K_AT; - + case SDLK_EQUALS: return K_EQUALS; - // DG end - - /* - SDLK_COLON = 58, - SDLK_SEMICOLON = 59, - SDLK_LESS = 60, - SDLK_EQUALS = 61, - SDLK_GREATER = 62, - SDLK_QUESTION = 63, - SDLK_AT = 64, - */ - /* - Skip uppercase letters - */ - /* - SDLK_LEFTBRACKET = 91, - SDLK_BACKSLASH = 92, - SDLK_RIGHTBRACKET = 93, - SDLK_CARET = 94, - SDLK_UNDERSCORE = 95, - SDLK_BACKQUOTE = 96, - */ - + // DG end + + /* + SDLK_COLON = 58, + SDLK_SEMICOLON = 59, + SDLK_LESS = 60, + SDLK_EQUALS = 61, + SDLK_GREATER = 62, + SDLK_QUESTION = 63, + SDLK_AT = 64, + */ + /* + Skip uppercase letters + */ + /* + SDLK_LEFTBRACKET = 91, + SDLK_BACKSLASH = 92, + SDLK_RIGHTBRACKET = 93, + SDLK_CARET = 94, + SDLK_UNDERSCORE = 95, + SDLK_BACKQUOTE = 96, + */ + case SDLK_a: return K_A; - + case SDLK_b: return K_B; - + case SDLK_c: return K_C; - + case SDLK_d: return K_D; - + case SDLK_e: return K_E; - + case SDLK_f: return K_F; - + case SDLK_g: return K_G; - + case SDLK_h: return K_H; - + case SDLK_i: return K_I; - + case SDLK_j: return K_J; - + case SDLK_k: return K_K; - + case SDLK_l: return K_L; - + case SDLK_m: return K_M; - + case SDLK_n: return K_N; - + case SDLK_o: return K_O; - + case SDLK_p: return K_P; - + case SDLK_q: return K_Q; - + case SDLK_r: return K_R; - + case SDLK_s: return K_S; - + case SDLK_t: return K_T; - + case SDLK_u: return K_U; - + case SDLK_v: return K_V; - + case SDLK_w: return K_W; - + case SDLK_x: return K_X; - + case SDLK_y: return K_Y; - + case SDLK_z: return K_Z; - + case SDLK_RETURN: return K_ENTER; - + case SDLK_BACKSPACE: return K_BACKSPACE; - + case SDLK_PAUSE: return K_PAUSE; - - // DG: add tab key support + + // DG: add tab key support case SDLK_TAB: return K_TAB; - // DG end - - //case SDLK_APPLICATION: - // return K_COMMAND; + // DG end + + //case SDLK_APPLICATION: + // return K_COMMAND; case SDLK_CAPSLOCK: return K_CAPSLOCK; - + case SDLK_SCROLLLOCK: return K_SCROLL; - + case SDLK_POWER: return K_POWER; - + case SDLK_UP: return K_UPARROW; - + case SDLK_DOWN: return K_DOWNARROW; - + case SDLK_LEFT: return K_LEFTARROW; - + case SDLK_RIGHT: return K_RIGHTARROW; - + case SDLK_LGUI: return K_LWIN; - + case SDLK_RGUI: return K_RWIN; - //case SDLK_MENU: - // return K_MENU; - + //case SDLK_MENU: + // return K_MENU; + case SDLK_LALT: return K_LALT; - + case SDLK_RALT: return K_RALT; - + case SDLK_RCTRL: return K_RCTRL; - + case SDLK_LCTRL: return K_LCTRL; - + case SDLK_RSHIFT: return K_RSHIFT; - + case SDLK_LSHIFT: return K_LSHIFT; - + case SDLK_INSERT: return K_INS; - + case SDLK_DELETE: return K_DEL; - + case SDLK_PAGEDOWN: return K_PGDN; - + case SDLK_PAGEUP: return K_PGUP; - + case SDLK_HOME: return K_HOME; - + case SDLK_END: return K_END; - + case SDLK_F1: return K_F1; - + case SDLK_F2: return K_F2; - + case SDLK_F3: return K_F3; - + case SDLK_F4: return K_F4; - + case SDLK_F5: return K_F5; - + case SDLK_F6: return K_F6; - + case SDLK_F7: return K_F7; - + case SDLK_F8: return K_F8; - + case SDLK_F9: return K_F9; - + case SDLK_F10: return K_F10; - + case SDLK_F11: return K_F11; - + case SDLK_F12: return K_F12; - // K_INVERTED_EXCLAMATION; - + // K_INVERTED_EXCLAMATION; + case SDLK_F13: return K_F13; - + case SDLK_F14: return K_F14; - + case SDLK_F15: return K_F15; - + case SDLK_KP_7: return K_KP_7; - + case SDLK_KP_8: return K_KP_8; - + case SDLK_KP_9: return K_KP_9; - + case SDLK_KP_4: return K_KP_4; - + case SDLK_KP_5: return K_KP_5; - + case SDLK_KP_6: return K_KP_6; - + case SDLK_KP_1: return K_KP_1; - + case SDLK_KP_2: return K_KP_2; - + case SDLK_KP_3: return K_KP_3; - + case SDLK_KP_ENTER: return K_KP_ENTER; - + case SDLK_KP_0: return K_KP_0; - + case SDLK_KP_PERIOD: return K_KP_DOT; - + case SDLK_KP_DIVIDE: return K_KP_SLASH; - // K_SUPERSCRIPT_TWO; - + // K_SUPERSCRIPT_TWO; + case SDLK_KP_MINUS: return K_KP_MINUS; - // K_ACUTE_ACCENT; - + // K_ACUTE_ACCENT; + case SDLK_KP_PLUS: return K_KP_PLUS; - + case SDLK_NUMLOCKCLEAR: return K_NUMLOCK; - + case SDLK_KP_MULTIPLY: return K_KP_STAR; - + case SDLK_KP_EQUALS: return K_KP_EQUALS; - - // K_MASCULINE_ORDINATOR; - // K_GRAVE_A; - // K_AUX1; - // K_CEDILLA_C; - // K_GRAVE_E; - // K_AUX2; - // K_AUX3; - // K_AUX4; - // K_GRAVE_I; - // K_AUX5; - // K_AUX6; - // K_AUX7; - // K_AUX8; - // K_TILDE_N; - // K_GRAVE_O; - // K_AUX9; - // K_AUX10; - // K_AUX11; - // K_AUX12; - // K_AUX13; - // K_AUX14; - // K_GRAVE_U; - // K_AUX15; - // K_AUX16; - + + // K_MASCULINE_ORDINATOR; + // K_GRAVE_A; + // K_AUX1; + // K_CEDILLA_C; + // K_GRAVE_E; + // K_AUX2; + // K_AUX3; + // K_AUX4; + // K_GRAVE_I; + // K_AUX5; + // K_AUX6; + // K_AUX7; + // K_AUX8; + // K_TILDE_N; + // K_GRAVE_O; + // K_AUX9; + // K_AUX10; + // K_AUX11; + // K_AUX12; + // K_AUX13; + // K_AUX14; + // K_GRAVE_U; + // K_AUX15; + // K_AUX16; + case SDLK_PRINTSCREEN: return K_PRINTSCREEN; - + case SDLK_MODE: return K_RALT; } - + return 0; } #endif // SDL2 @@ -797,10 +797,10 @@ sysEvent_t Sys_GetEvent() // when this is returned, it's assumed that there are no more events! static const sysEvent_t no_more_events = { SE_NONE, 0, 0, 0, NULL }; - + // WM0110: previous state of joystick hat - static int previous_hat_state = SDL_HAT_CENTERED; - + static int previous_hat_state = SDL_HAT_CENTERED; + #if SDL_VERSION_ATLEAST(2, 0, 0) static char str[SDL_TEXTINPUTEVENT_TEXT_SIZE] = {0}; static size_t str_pos = 0; @@ -879,7 +879,7 @@ sysEvent_t Sys_GetEvent() // DG end break; - // DG: handle resizing and moving of window + // DG: handle resizing and moving of window case SDL_WINDOWEVENT_RESIZED: { int w = ev.window.data1; @@ -900,7 +900,7 @@ sysEvent_t Sys_GetEvent() r_windowY.SetInteger( y ); break; } - // DG end + // DG end } continue; // handle next event @@ -933,7 +933,7 @@ sysEvent_t Sys_GetEvent() case SDL_VIDEOEXPOSE: continue; // handle next event - // DG: handle resizing and moving of window + // DG: handle resizing and moving of window case SDL_VIDEORESIZE: { int w = ev.resize.w; @@ -947,7 +947,7 @@ sysEvent_t Sys_GetEvent() PushConsoleEvent( "vid_restart" ); continue; // handle next event } - // DG end + // DG end #endif case SDL_KEYDOWN: @@ -988,7 +988,7 @@ sysEvent_t Sys_GetEvent() // DG end #endif - // fall through + // fall through case SDL_KEYUP: { bool isChar; @@ -1002,7 +1002,7 @@ sysEvent_t Sys_GetEvent() else { #if SDL_VERSION_ATLEAST(2, 0, 0) - key = SDLScanCodeToKeyNum(ev.key.keysym.scancode); + key = SDLScanCodeToKeyNum( ev.key.keysym.scancode ); if( key == 0 ) { @@ -1014,7 +1014,7 @@ sysEvent_t Sys_GetEvent() } #else key = SDL_KeyToDoom3Key( ev.key.keysym.sym, isChar ); - + if( key == 0 ) { unsigned char uc = ev.key.keysym.unicode & 0xff; @@ -1026,20 +1026,20 @@ sysEvent_t Sys_GetEvent() } else { - if(c) + if( c ) { res.evType = SE_CHAR; res.evValue = c; - + c = 0; - + return res; } - + if( ev.type == SDL_KEYDOWN ) // FIXME: don't complain if this was an ASCII char and the console is open? common->Warning( "unmapped SDL key %d (0x%x) scancode %d", ev.key.keysym.sym, ev.key.keysym.unicode, ev.key.keysym.scancode ); - - + + continue; // just handle next event } } @@ -1066,7 +1066,7 @@ sysEvent_t Sys_GetEvent() if( ev.text.text[1] ) { // more than 1 char => handle the next chars later - idStr::Copynz( str, ev.text.text+1, sizeof( str ) ); + idStr::Copynz( str, ev.text.text + 1, sizeof( str ) ); } // return an event with the first/only char res.evType = SE_CHAR; @@ -1165,12 +1165,12 @@ sysEvent_t Sys_GetEvent() return res; - // WM0110 - // NOTE: it seems that the key bindings for the GUI and for the game are - // totally independant. I think the event returned by this function seems to work - // on the GUI and the event returned by Sys_ReturnJoystickInputEvent() works on - // the game. - // Also, remember that joystick keys must be binded to actions in order to work! + // WM0110 + // NOTE: it seems that the key bindings for the GUI and for the game are + // totally independant. I think the event returned by this function seems to work + // on the GUI and the event returned by Sys_ReturnJoystickInputEvent() works on + // the game. + // Also, remember that joystick keys must be binded to actions in order to work! case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: // sys_public.h: evValue is an axis number and evValue2 is the current state (-127 to 127) @@ -1233,7 +1233,7 @@ sysEvent_t Sys_GetEvent() joystick_polls.Append( joystick_poll_t( J_ACTION11, ev.jbutton.state == SDL_PRESSED ? 1 : 0 ) ); break; - // D-PAD left (XBox 360 wireless) + // D-PAD left (XBox 360 wireless) case 11: // If joystick has a hat, then use the hat as D-PAD. If not, D-PAD is mapped // to buttons. @@ -1249,7 +1249,7 @@ sysEvent_t Sys_GetEvent() } break; - // D-PAD right + // D-PAD right case 12: if( SDL_joystick_has_hat ) { @@ -1263,7 +1263,7 @@ sysEvent_t Sys_GetEvent() } break; - // D-PAD up + // D-PAD up case 13: if( SDL_joystick_has_hat ) { @@ -1277,7 +1277,7 @@ sysEvent_t Sys_GetEvent() } break; - // D-PAD down + // D-PAD down case 14: if( SDL_joystick_has_hat ) { @@ -1390,7 +1390,7 @@ sysEvent_t Sys_GetEvent() { int trigger_value; - // LEFT trigger + // LEFT trigger case 2: // Convert TRIGGER value from space (-32768, 32767) to (0, 32767) trigger_value = ( ev.jaxis.value + 32768 ) / 2; @@ -1399,7 +1399,7 @@ sysEvent_t Sys_GetEvent() joystick_polls.Append( joystick_poll_t( J_AXIS_LEFT_TRIG, trigger_value ) ); break; - // Right trigger + // Right trigger case 5: trigger_value = ( ev.jaxis.value + 32768 ) / 2; // common->Printf("Sys_GetEvent: RIGHT trigger value = %i / converted value = %i\n", ev.jaxis.value, trigger_value); @@ -1407,25 +1407,25 @@ sysEvent_t Sys_GetEvent() joystick_polls.Append( joystick_poll_t( J_AXIS_RIGHT_TRIG, trigger_value ) ); break; - // LEFT X + // LEFT X case 0: res.evValue = J_AXIS_LEFT_X; joystick_polls.Append( joystick_poll_t( J_AXIS_LEFT_X, ev.jaxis.value ) ); break; - // LEFT Y + // LEFT Y case 1: res.evValue = J_AXIS_LEFT_Y; joystick_polls.Append( joystick_poll_t( J_AXIS_LEFT_Y, ev.jaxis.value ) ); break; - // RIGHT X + // RIGHT X case 3: res.evValue = J_AXIS_RIGHT_X; joystick_polls.Append( joystick_poll_t( J_AXIS_RIGHT_X, ev.jaxis.value ) ); break; - // RIGHT Y + // RIGHT Y case 4: res.evValue = J_AXIS_RIGHT_Y; joystick_polls.Append( joystick_poll_t( J_AXIS_RIGHT_Y, ev.jaxis.value ) ); @@ -1437,8 +1437,8 @@ sysEvent_t Sys_GetEvent() } return res; - // WM0110 - + // WM0110 + case SDL_QUIT: PushConsoleEvent( "quit" ); return no_more_events; // don't handle next event, just quit. @@ -1562,12 +1562,12 @@ const char* Sys_GetKeyName( keyNum_t keynum ) // unfortunately, in SDL1.2 there is no way to get the keycode for a scancode, so this doesn't work there. // so this is SDL2-only. #if SDL_VERSION_ATLEAST(2, 0, 0) - + SDL_Scancode scancode = KeyNumToSDLScanCode( ( int )keynum ); SDL_Keycode keycode = SDL_GetKeyFromScancode( scancode ); - - const char* ret = SDL_GetKeyName(keycode); - if(ret != NULL && ret[0] != '\0') + + const char* ret = SDL_GetKeyName( keycode ); + if( ret != NULL && ret[0] != '\0' ) { return ret; } diff --git a/neo/sys/sys_public.h b/neo/sys/sys_public.h index e71d3f9e..efc34c11 100644 --- a/neo/sys/sys_public.h +++ b/neo/sys/sys_public.h @@ -304,7 +304,7 @@ enum keyNum_t K_VOLUMEDOWN = 0xAE, K_VOLUMEUP = 0xB0, K_WEBHOME = 0xB2, - + K_KP_COMMA = 0xB3, K_KP_SLASH = 0xB5, K_PRINTSCREEN = 0xB7, // aka SysRq @@ -337,7 +337,7 @@ enum keyNum_t K_MYCOMPUTER = 0xEB, K_MAIL = 0xEC, K_MEDIASELECT = 0xED, - + //------------------------ // K_JOY codes must be contiguous, too //------------------------ diff --git a/neo/sys/win32/win_syscon.cpp b/neo/sys/win32/win_syscon.cpp index 108890f8..9325e4f5 100644 --- a/neo/sys/win32/win_syscon.cpp +++ b/neo/sys/win32/win_syscon.cpp @@ -177,26 +177,26 @@ static LONG WINAPI ConWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara s_wcd.hbrErrorBackground = CreateSolidBrush( RGB( 0x80, 0x80, 0x80 ) ); SetTimer( hWnd, 1, 1000, NULL ); break; - /* - case WM_ERASEBKGND: - HGDIOBJ oldObject; - HDC hdcScaled; - hdcScaled = CreateCompatibleDC( ( HDC ) wParam ); - assert( hdcScaled != 0 ); - if ( hdcScaled ) { - oldObject = SelectObject( ( HDC ) hdcScaled, s_wcd.hbmLogo ); - assert( oldObject != 0 ); - if ( oldObject ) - { - StretchBlt( ( HDC ) wParam, 0, 0, s_wcd.windowWidth, s_wcd.windowHeight, - hdcScaled, 0, 0, 512, 384, - SRCCOPY ); - } - DeleteDC( hdcScaled ); - hdcScaled = 0; + /* + case WM_ERASEBKGND: + HGDIOBJ oldObject; + HDC hdcScaled; + hdcScaled = CreateCompatibleDC( ( HDC ) wParam ); + assert( hdcScaled != 0 ); + if ( hdcScaled ) { + oldObject = SelectObject( ( HDC ) hdcScaled, s_wcd.hbmLogo ); + assert( oldObject != 0 ); + if ( oldObject ) + { + StretchBlt( ( HDC ) wParam, 0, 0, s_wcd.windowWidth, s_wcd.windowHeight, + hdcScaled, 0, 0, 512, 384, + SRCCOPY ); } - return 1; - */ + DeleteDC( hdcScaled ); + hdcScaled = 0; + } + return 1; + */ case WM_TIMER: if( wParam == 1 ) { diff --git a/neo/sys/win32/win_wndproc.cpp b/neo/sys/win32/win_wndproc.cpp index 5eec81eb..e33850f5 100644 --- a/neo/sys/win32/win_wndproc.cpp +++ b/neo/sys/win32/win_wndproc.cpp @@ -319,7 +319,7 @@ LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "vid_restart\n" ); return 0; } - // fall through for other keys + // fall through for other keys case WM_KEYDOWN: key = ( ( lParam >> 16 ) & 0xFF ) | ( ( ( lParam >> 24 ) & 1 ) << 7 ); if( key == K_LCTRL || key == K_LALT || key == K_RCTRL || key == K_RALT )