summaryrefslogtreecommitdiff
path: root/src/ui
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
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')
-rw-r--r--src/ui/ui_main.c49
-rw-r--r--src/ui/ui_public.h22
-rw-r--r--src/ui/ui_syscalls.asm120
-rw-r--r--src/ui/ui_syscalls_11.asm98
4 files changed, 231 insertions, 58 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') {
diff --git a/src/ui/ui_public.h b/src/ui/ui_public.h
index 00b6e53..f62b8b9 100644
--- a/src/ui/ui_public.h
+++ b/src/ui/ui_public.h
@@ -63,6 +63,9 @@ typedef enum {
UI_R_ADDLIGHTTOSCENE,
UI_R_RENDERSCENE,
UI_R_SETCOLOR,
+#ifndef MODULE_INTERFACE_11
+ UI_R_SETCLIPREGION,
+#endif
UI_R_DRAWSTRETCHPIC,
UI_UPDATESCREEN,
UI_CM_LERPTAG,
@@ -91,11 +94,13 @@ typedef enum {
UI_MEMORY_REMAINING,
UI_R_REGISTERFONT,
UI_R_MODELBOUNDS,
+#ifdef MODULE_INTERFACE_11
UI_PARSE_ADD_GLOBAL_DEFINE,
UI_PARSE_LOAD_SOURCE,
UI_PARSE_FREE_SOURCE,
UI_PARSE_READ_TOKEN,
UI_PARSE_SOURCE_FILE_AND_LINE,
+#endif
UI_S_STOPBACKGROUNDTRACK,
UI_S_STARTBACKGROUNDTRACK,
UI_REAL_TIME,
@@ -123,6 +128,15 @@ typedef enum {
UI_FS_SEEK,
UI_SET_PBCLSTATUS,
+#ifndef MODULE_INTERFACE_11
+ UI_PARSE_ADD_GLOBAL_DEFINE,
+ UI_PARSE_LOAD_SOURCE,
+ UI_PARSE_FREE_SOURCE,
+ UI_PARSE_READ_TOKEN,
+ UI_PARSE_SOURCE_FILE_AND_LINE,
+ UI_GETNEWS,
+#endif
+
UI_MEMSET = 100,
UI_MEMCPY,
UI_STRNCPY,
@@ -165,6 +179,14 @@ typedef enum {
UI_MOUSE_EVENT,
// void UI_MouseEvent( int dx, int dy );
+#ifndef MODULE_INTERFACE_11
+ UI_MOUSE_POSITION,
+// int UI_MousePosition( void );
+
+ UI_SET_MOUSE_POSITION,
+// void UI_SetMousePosition( int x, int y );
+#endif
+
UI_REFRESH,
// void UI_Refresh( int time );
diff --git a/src/ui/ui_syscalls.asm b/src/ui/ui_syscalls.asm
index 1b236fe..1e797a9 100644
--- a/src/ui/ui_syscalls.asm
+++ b/src/ui/ui_syscalls.asm
@@ -27,64 +27,68 @@ equ trap_R_AddPolyToScene -24
equ trap_R_AddLightToScene -25
equ trap_R_RenderScene -26
equ trap_R_SetColor -27
-equ trap_R_DrawStretchPic -28
-equ trap_UpdateScreen -29
-equ trap_CM_LerpTag -30
-equ trap_CM_LoadModel -31
-equ trap_S_RegisterSound -32
-equ trap_S_StartLocalSound -33
-equ trap_Key_KeynumToStringBuf -34
-equ trap_Key_GetBindingBuf -35
-equ trap_Key_SetBinding -36
-equ trap_Key_IsDown -37
-equ trap_Key_GetOverstrikeMode -38
-equ trap_Key_SetOverstrikeMode -39
-equ trap_Key_ClearStates -40
-equ trap_Key_GetCatcher -41
-equ trap_Key_SetCatcher -42
-equ trap_GetClipboardData -43
-equ trap_GetGlconfig -44
-equ trap_GetClientState -45
-equ trap_GetConfigString -46
-equ trap_LAN_GetPingQueueCount -47
-equ trap_LAN_ClearPing -48
-equ trap_LAN_GetPing -49
-equ trap_LAN_GetPingInfo -50
-equ trap_Cvar_Register -51
-equ trap_Cvar_Update -52
-equ trap_MemoryRemaining -53
-equ trap_R_RegisterFont -54
-equ trap_R_ModelBounds -55
-equ trap_Parse_AddGlobalDefine -56
-equ trap_Parse_LoadSource -57
-equ trap_Parse_FreeSource -58
-equ trap_Parse_ReadToken -59
-equ trap_Parse_SourceFileAndLine -60
-equ trap_S_StopBackgroundTrack -61
-equ trap_S_StartBackgroundTrack -62
-equ trap_RealTime -63
-equ trap_LAN_GetServerCount -64
-equ trap_LAN_GetServerAddressString -65
-equ trap_LAN_GetServerInfo -66
-equ trap_LAN_MarkServerVisible -67
-equ trap_LAN_UpdateVisiblePings -68
-equ trap_LAN_ResetPings -69
-equ trap_LAN_LoadCachedServers -70
-equ trap_LAN_SaveCachedServers -71
-equ trap_LAN_AddServer -72
-equ trap_LAN_RemoveServer -73
-equ trap_CIN_PlayCinematic -74
-equ trap_CIN_StopCinematic -75
-equ trap_CIN_RunCinematic -76
-equ trap_CIN_DrawCinematic -77
-equ trap_CIN_SetExtents -78
-equ trap_R_RemapShader -79
-equ trap_LAN_ServerStatus -80
-equ trap_LAN_GetServerPing -81
-equ trap_LAN_ServerIsVisible -82
-equ trap_LAN_CompareServers -83
-equ trap_FS_Seek -84
-equ trap_SetPbClStatus -85
+equ trap_R_SetClipRegion -28
+equ trap_R_DrawStretchPic -29
+equ trap_UpdateScreen -30
+equ trap_CM_LerpTag -31
+equ trap_CM_LoadModel -32
+equ trap_S_RegisterSound -33
+equ trap_S_StartLocalSound -34
+equ trap_Key_KeynumToStringBuf -35
+equ trap_Key_GetBindingBuf -36
+equ trap_Key_SetBinding -37
+equ trap_Key_IsDown -38
+equ trap_Key_GetOverstrikeMode -39
+equ trap_Key_SetOverstrikeMode -40
+equ trap_Key_ClearStates -41
+equ trap_Key_GetCatcher -42
+equ trap_Key_SetCatcher -43
+equ trap_GetClipboardData -44
+equ trap_GetGlconfig -45
+equ trap_GetClientState -46
+equ trap_GetConfigString -47
+equ trap_LAN_GetPingQueueCount -48
+equ trap_LAN_ClearPing -49
+equ trap_LAN_GetPing -50
+equ trap_LAN_GetPingInfo -51
+equ trap_Cvar_Register -52
+equ trap_Cvar_Update -53
+equ trap_MemoryRemaining -54
+equ trap_R_RegisterFont -55
+equ trap_R_ModelBounds -56
+equ trap_S_StopBackgroundTrack -57
+equ trap_S_StartBackgroundTrack -58
+equ trap_RealTime -59
+equ trap_LAN_GetServerCount -60
+equ trap_LAN_GetServerAddressString -61
+equ trap_LAN_GetServerInfo -62
+equ trap_LAN_MarkServerVisible -63
+equ trap_LAN_UpdateVisiblePings -64
+equ trap_LAN_ResetPings -65
+equ trap_LAN_LoadCachedServers -66
+equ trap_LAN_SaveCachedServers -67
+equ trap_LAN_AddServer -68
+equ trap_LAN_RemoveServer -69
+equ trap_CIN_PlayCinematic -70
+equ trap_CIN_StopCinematic -71
+equ trap_CIN_RunCinematic -72
+equ trap_CIN_DrawCinematic -73
+equ trap_CIN_SetExtents -74
+equ trap_R_RemapShader -75
+equ trap_LAN_ServerStatus -76
+equ trap_LAN_GetServerPing -77
+equ trap_LAN_ServerIsVisible -78
+equ trap_LAN_CompareServers -79
+equ trap_FS_Seek -80
+equ trap_SetPbClStatus -81
+
+equ trap_Parse_AddGlobalDefine -82
+equ trap_Parse_LoadSource -83
+equ trap_Parse_FreeSource -84
+equ trap_Parse_ReadToken -85
+equ trap_Parse_SourceFileAndLine -86
+
+equ trap_GetNews -87
equ memset -101
equ memcpy -102
diff --git a/src/ui/ui_syscalls_11.asm b/src/ui/ui_syscalls_11.asm
new file mode 100644
index 0000000..64d2ca3
--- /dev/null
+++ b/src/ui/ui_syscalls_11.asm
@@ -0,0 +1,98 @@
+code
+
+equ trap_Error -1
+equ trap_Print -2
+equ trap_Milliseconds -3
+equ trap_Cvar_Set -4
+equ trap_Cvar_VariableValue -5
+equ trap_Cvar_VariableStringBuffer -6
+equ trap_Cvar_SetValue -7
+equ trap_Cvar_Reset -8
+equ trap_Cvar_Create -9
+equ trap_Cvar_InfoStringBuffer -10
+equ trap_Argc -11
+equ trap_Argv -12
+equ trap_Cmd_ExecuteText -13
+equ trap_FS_FOpenFile -14
+equ trap_FS_Read -15
+equ trap_FS_Write -16
+equ trap_FS_FCloseFile -17
+equ trap_FS_GetFileList -18
+equ trap_R_RegisterModel -19
+equ trap_R_RegisterSkin -20
+equ trap_R_RegisterShaderNoMip -21
+equ trap_R_ClearScene -22
+equ trap_R_AddRefEntityToScene -23
+equ trap_R_AddPolyToScene -24
+equ trap_R_AddLightToScene -25
+equ trap_R_RenderScene -26
+equ trap_R_SetColor -27
+equ trap_R_DrawStretchPic -28
+equ trap_UpdateScreen -29
+equ trap_CM_LerpTag -30
+equ trap_CM_LoadModel -31
+equ trap_S_RegisterSound -32
+equ trap_S_StartLocalSound -33
+equ trap_Key_KeynumToStringBuf -34
+equ trap_Key_GetBindingBuf -35
+equ trap_Key_SetBinding -36
+equ trap_Key_IsDown -37
+equ trap_Key_GetOverstrikeMode -38
+equ trap_Key_SetOverstrikeMode -39
+equ trap_Key_ClearStates -40
+equ trap_Key_GetCatcher -41
+equ trap_Key_SetCatcher -42
+equ trap_GetClipboardData -43
+equ trap_GetGlconfig -44
+equ trap_GetClientState -45
+equ trap_GetConfigString -46
+equ trap_LAN_GetPingQueueCount -47
+equ trap_LAN_ClearPing -48
+equ trap_LAN_GetPing -49
+equ trap_LAN_GetPingInfo -50
+equ trap_Cvar_Register -51
+equ trap_Cvar_Update -52
+equ trap_MemoryRemaining -53
+equ trap_R_RegisterFont -54
+equ trap_R_ModelBounds -55
+equ trap_Parse_AddGlobalDefine -56
+equ trap_Parse_LoadSource -57
+equ trap_Parse_FreeSource -58
+equ trap_Parse_ReadToken -59
+equ trap_Parse_SourceFileAndLine -60
+equ trap_S_StopBackgroundTrack -61
+equ trap_S_StartBackgroundTrack -62
+equ trap_RealTime -63
+equ trap_LAN_GetServerCount -64
+equ trap_LAN_GetServerAddressString -65
+equ trap_LAN_GetServerInfo -66
+equ trap_LAN_MarkServerVisible -67
+equ trap_LAN_UpdateVisiblePings -68
+equ trap_LAN_ResetPings -69
+equ trap_LAN_LoadCachedServers -70
+equ trap_LAN_SaveCachedServers -71
+equ trap_LAN_AddServer -72
+equ trap_LAN_RemoveServer -73
+equ trap_CIN_PlayCinematic -74
+equ trap_CIN_StopCinematic -75
+equ trap_CIN_RunCinematic -76
+equ trap_CIN_DrawCinematic -77
+equ trap_CIN_SetExtents -78
+equ trap_R_RemapShader -79
+equ trap_LAN_ServerStatus -80
+equ trap_LAN_GetServerPing -81
+equ trap_LAN_ServerIsVisible -82
+equ trap_LAN_CompareServers -83
+equ trap_FS_Seek -84
+equ trap_SetPbClStatus -85
+
+equ memset -101
+equ memcpy -102
+equ strncpy -103
+equ sin -104
+equ cos -105
+equ atan2 -106
+equ sqrt -107
+equ floor -108
+equ ceil -109
+