Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: farbrausch/fr_public
base: 5cc8bd8815
...
head fork: farbrausch/fr_public
compare: d2987b2842
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 6 files changed
  • 0 commit comments
  • 3 contributors
View
23 werkkzeug3/_start.cpp
@@ -6147,6 +6147,29 @@ sU8 *sSystem_::LoadFile(const sChar *name)
/****************************************************************************/
+
+#if !sINTRO
+//----------------------------------------------------------------------------
+// get base name of current exe
+//----------------------------------------------------------------------------
+void sSystem_::GetModuleBaseName(sChar *buffer,sInt size)
+{
+ // Retrieves the full path for the file that contains the specified module
+ char str[MAX_PATH];
+ GetModuleFileName(NULL, str, MAX_PATH);
+
+ // strip path
+ sCopyString(buffer,sFileFromPathString(str),size);
+
+ // remove extension (if present) to just keep base name
+ sChar *ext = sFileExtensionString(buffer);
+ if (ext)
+ *ext = 0;
+}
+#endif
+
+/****************************************************************************/
+
sU8 *sSystem_::LoadFileIfNewerThan(const sChar *name,const sChar *other,sInt &size)
{
WIN32_FILE_ATTRIBUTE_DATA fa1,fa2;
View
3  werkkzeug3/_start.hpp
@@ -990,8 +990,7 @@ struct sSystem_
sBool DeleteFile(const sChar *name); // delete file from disk
void GetCurrentDir(sChar *buffer,sInt size); // get current dir as "c:/nxn/genthree"
sU32 GetDriveMask(); // get bitmask of available drives
-
-
+ void GetModuleBaseName(sChar *buffer,sInt size); // get base name of current exe
sBitmap *LoadBitmap(const sU8 *data,sInt size); // load bitmap using windows loader
sBool LoadBitmapCore(const sU8 *data,sInt size,sInt &x,sInt &y,sU8 *&d); // simplified version for intro
View
13 werkkzeug3/mainplayer.cpp
@@ -245,19 +245,22 @@ sBool sAppHandler(sInt code,sDInt value)
#if !LINKEDIN
data = PtrTable[0];
-//#if !sINTRO
+#if !sINTRO
if(((sInt)data)==0x54525450)
{
data = sSystem->LoadFile(sSystem->GetCmdLine());
if(data==0)
{
-
- data = sSystem->LoadFile("id08.kx");
- if(data==0)
+ // get module name and load a .kx file with the same name
+ sChar kxData[256];
+ sSystem->GetModuleBaseName(kxData, sizeof(kxData));
+ sAppendString(kxData, ".kx", sizeof(kxData));
+ data = sSystem->LoadFile(kxData);
+ if(data==0)
sSystem->Abort("need data file");
}
}
-//#endif
+#endif
#else
data = DebugData;
#endif
View
17 werkkzeug3/werkkzeug.cpp
@@ -313,6 +313,7 @@ WerkkzeugApp::WerkkzeugApp()
NovaMode = 0;
HelpSystemLocation = 0;
HideSplashScreen = 1;
+ KeyboardLayout = 0; // default = qwerty;
Status = new sStatusBorder;
AddBorder(Status);
@@ -1545,7 +1546,10 @@ sBool WerkkzeugApp::SaveConfig()
*data++ = HideSplashScreen;
*data++ = HelpSystemLocation;
*data++ = GenBitmapDefaultFormat;
- *data++ = 0;
+ *data++ = KeyboardLayout;
+
+ // dummy fields, currently unassigned - so you can add extra flags
+ // without breaking the format or bumping up the version number.
*data++ = 0;
*data++ = 0;
*data++ = 0;
@@ -1671,7 +1675,8 @@ sBool WerkkzeugApp::LoadConfig()
HideSplashScreen = *data++;
HelpSystemLocation = *data++;
GenBitmapDefaultFormat = *data++;
- data += 4;
+ KeyboardLayout = *data++;
+ data += 3;
if(!GenBitmapDefaultFormat)
GenBitmapDefaultFormat = sTF_A8R8G8B8;
@@ -2957,6 +2962,14 @@ void WinEditPara::SetApp(WerkkzeugApp *app)
line++;
+ // add qwerty/azerty keyboard layout selection
+ con = new sControl;
+ con->EditCycle(0x111,&App->KeyboardLayout,"Keyboard Layout","QWERTY|AZERTY");
+ con->Style |= sCS_SIDELABEL;
+ con->LabelWidth = lw;
+ con->LayoutInfo.Init(0,line,16,line+1); line++;
+ Grid->AddChild(con);
+
con = new sControl;
con->EditCycle(0x111,&GSTitle,"Title Bar","No Title Bar|Title Bar");
con->Style |= sCS_SIDELABEL;
View
1  werkkzeug3/werkkzeug.hpp
@@ -913,6 +913,7 @@ class WerkkzeugApp : public sDummyFrame
sInt AutoSaveTimer; // time of last save
sInt HideSplashScreen;
sInt HelpSystemLocation;
+ sInt KeyboardLayout; // 0=qwerty 1=azerty
sChar UserName[KK_NAME]; // user name for multiuser sync
sInt UserCount; // count for user usage
sInt MusicVolume; // 0..256
View
99 werkkzeug3/winview.cpp
@@ -778,10 +778,27 @@ void WinView::OnPaint3d(sViewport &viewPort)
void WinView::OnKey(sU32 key)
{
+ const sChar *quake_keymap;
+ sU32 key_freecam;
+ sU32 keym = key&(0x8001ffff|sKEYQ_SHIFT|sKEYQ_CTRL|sKEYQ_ALT);
+
if(key&sKEYQ_CTRL) key |= sKEYQ_CTRL;
if(key&sKEYQ_SHIFT) key |= sKEYQ_SHIFT;
- switch(key&(0x8001ffff|sKEYQ_SHIFT|sKEYQ_CTRL|sKEYQ_ALT))
+ switch (App->KeyboardLayout)
+ {
+ case 0: // qwerty
+ default:
+ quake_keymap = "wsdaqe"; // forward, back, right, left, up, down
+ key_freecam = 'z';
+ break;
+ case 1: // azerty
+ quake_keymap = "zsdqae"; // forward, back, right, left, up, down
+ key_freecam = 'w';
+ break;
+ }
+
+ switch(keym)
{
// uijyxbnm
case sKEY_APPPOPUP:
@@ -821,14 +838,6 @@ void WinView::OnKey(sU32 key)
if(!App->TextureMode)
OnCommand(CMD_VIEW_LINKEDIT);
break;
- case 'z': // mesh: free camera
- if(!App->TextureMode)
- OnCommand(CMD_VIEW_FREECAMERA);
- break;
- case 'Z'|sKEYQ_SHIFT: // mesh: viewport to free camera
- if(!App->TextureMode)
- OnCommand(CMD_VIEW_GOFREECAMERA);
- break;
case 'f': // mesh: wireoptions
OnCommand(CMD_VIEW_WIREOPT);
break;
@@ -950,6 +959,15 @@ void WinView::OnKey(sU32 key)
case sKEY_ENTER:
OnCommand(CMD_VIEW_EXPORTBITMAP);
break;
+ default:
+ if (!App->TextureMode)
+ {
+ if (keym == key_freecam) // mesh: free camera
+ OnCommand(CMD_VIEW_FREECAMERA);
+ else if (keym == ((key_freecam-0x20)|sKEYQ_SHIFT)) // mesh: viewport to free camera
+ OnCommand(CMD_VIEW_GOFREECAMERA);
+ }
+ break;
/*
case '0'|sKEYQ_CTRL:
@@ -972,57 +990,20 @@ void WinView::OnKey(sU32 key)
// quake cam
if(!((DragCID==KC_MESH || DragCID == KC_MINMESH || DragCID==KC_SCENE || DragCID==KC_IPP || DragCID==KC_DEMO || DragCID==KC_SMESH || DragCID==KC_EFFECT) && GameMode && Game.OnKey(key)))
- if(DragCID!=KC_BITMAP)
- switch(key&(0x8001ffff))
+ if(DragCID!=KC_BITMAP)
{
- case 'w':
- case 'W':
- QuakeMask |= 1;
- break;
- case 's':
- case 'S':
- QuakeMask |= 2;
- break;
- case 'd':
- case 'D':
- QuakeMask |= 4;
- break;
- case 'a':
- case 'A':
- QuakeMask |= 8;
- break;
- case 'q':
- case 'Q':
- QuakeMask |= 16;
- break;
- case 'e':
- case 'E':
- QuakeMask |= 32;
- break;
- case 'w'|sKEYQ_BREAK:
- case 'W'|sKEYQ_BREAK:
- QuakeMask &= ~1;
- break;
- case 's'|sKEYQ_BREAK:
- case 'S'|sKEYQ_BREAK:
- QuakeMask &= ~2;
- break;
- case 'd'|sKEYQ_BREAK:
- case 'D'|sKEYQ_BREAK:
- QuakeMask &= ~4;
- break;
- case 'a'|sKEYQ_BREAK:
- case 'A'|sKEYQ_BREAK:
- QuakeMask &= ~8;
- break;
- case 'q'|sKEYQ_BREAK:
- case 'Q'|sKEYQ_BREAK:
- QuakeMask &= ~16;
- break;
- case 'e'|sKEYQ_BREAK:
- case 'E'|sKEYQ_BREAK:
- QuakeMask &= ~32;
- break;
+ sU32 realkey=key&0x1ffff;
+ sU32 mask=0;
+ if(realkey>='A' && realkey<='Z') realkey+=0x20; // lower case
+
+ for(sInt i=0;i<6;i++)
+ if(realkey==quake_keymap[i])
+ mask = 1<<i;
+
+ if(key&sKEYQ_BREAK)
+ QuakeMask &= ~mask;
+ else
+ QuakeMask |= mask;
}
}

No commit comments for this range

Something went wrong with that request. Please try again.