summaryrefslogtreecommitdiff
path: root/src/ui/ui_main.c
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-15 17:22:08 +0200
committer/dev/humancontroller <devhc@example.com>2017-04-15 17:23:08 +0200
commit6d4cacd5ad49d654e99c458f5002c70732c9e0a6 (patch)
treed1d29524dd7baf15e2309cb14bec4c94c3cd6c9c /src/ui/ui_main.c
parent8f6cc0930258d39570676d349db062b0c54ba1ad (diff)
multi-protocol: largely port the (gamelogic part of the) multi-protocol code to the 1.1-ish code base
also update .gitignore accordingly
Diffstat (limited to 'src/ui/ui_main.c')
-rw-r--r--src/ui/ui_main.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index addbccd..33f0012 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -36,6 +36,13 @@ USER INTERFACE MAIN
uiInfo_t uiInfo;
+#ifdef MODULE_INTERFACE_11
+#undef AS_GLOBAL
+#undef AS_LOCAL
+#define AS_GLOBAL 2
+#define AS_LOCAL 0
+#endif
+
static const char *MonthAbbrev[] = {
"Jan","Feb","Mar",
"Apr","May","Jun",
@@ -56,9 +63,15 @@ static const int numSkillLevels = sizeof(skillLevels) / sizeof(const char*);
static const char *netSources[] = {
+#ifdef MODULE_INTERFACE_11
"LAN",
"Mplayer",
"Internet",
+#else
+ "Internet",
+ "Mplayer",
+ "LAN",
+#endif
"Favorites"
};
static const int numNetSources = sizeof(netSources) / sizeof(const char*);
@@ -157,6 +170,8 @@ void _UI_Init( qboolean );
void _UI_Shutdown( void );
void _UI_KeyEvent( int key, qboolean down );
void _UI_MouseEvent( int dx, int dy );
+int _UI_MousePosition( void );
+void _UI_SetMousePosition( int x, int y );
void _UI_Refresh( int realtime );
qboolean _UI_IsFullscreen( void );
Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3,
@@ -182,6 +197,15 @@ Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3,
_UI_MouseEvent( arg0, arg1 );
return 0;
+#ifndef MODULE_INTERFACE_11
+ case UI_MOUSE_POSITION:
+ return _UI_MousePosition( );
+
+ case UI_SET_MOUSE_POSITION:
+ _UI_SetMousePosition( arg0, arg1 );
+ return 0;
+#endif
+
case UI_REFRESH:
_UI_Refresh( arg0 );
return 0;
@@ -5733,6 +5757,31 @@ void _UI_MouseEvent( int dx, int dy )
}
+/*
+=================
+UI_MousePosition
+=================
+*/
+int _UI_MousePosition( void )
+{
+ return (int)rint( uiInfo.uiDC.cursorx ) |
+ (int)rint( uiInfo.uiDC.cursory ) << 16;
+}
+
+/*
+=================
+UI_SetMousePosition
+=================
+*/
+void _UI_SetMousePosition( int x, int y )
+{
+ uiInfo.uiDC.cursorx = x;
+ uiInfo.uiDC.cursory = y;
+
+ if( Menu_Count( ) > 0 )
+ Display_MouseMove( NULL, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory );
+}
+
void UI_LoadNonIngame( void ) {
const char *menuSet = UI_Cvar_VariableString("ui_menuFiles");
if (menuSet == NULL || menuSet[0] == '\0') {