diff options
author | Tim Angus <tim@ngus.net> | 2006-05-16 20:41:57 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2006-05-16 20:41:57 +0000 |
commit | 5c0efda0ef811b2bafedb2b4f53b083a9b90e1b4 (patch) | |
tree | 972db3bf7fabe5293b383bb51fcb1aa74cc0e309 /src/ui | |
parent | f68a49a146f20c7b6fc8e19dd1c4e6d58cf473e9 (diff) |
* Removal of bot code
* Refactored botlib parsing code into qcommon
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui_main.c | 46 | ||||
-rw-r--r-- | src/ui/ui_public.h | 11 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 34 | ||||
-rw-r--r-- | src/ui/ui_shared.h | 10 | ||||
-rw-r--r-- | src/ui/ui_syscalls.asm | 60 | ||||
-rw-r--r-- | src/ui/ui_syscalls.c | 20 |
6 files changed, 91 insertions, 90 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 7873fb63..32750a57 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -790,7 +790,7 @@ qboolean Asset_Parse(int handle) { pc_token_t token; const char *tempStr; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (Q_stricmp(token.string, "{") != 0) { return qfalse; @@ -800,7 +800,7 @@ qboolean Asset_Parse(int handle) { memset(&token, 0, sizeof(pc_token_t)); - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (Q_stricmp(token.string, "}") == 0) { @@ -958,14 +958,14 @@ void UI_ParseMenu(const char *menuFile) { /*Com_Printf("Parsing menu file:%s\n", menuFile);*/ - handle = trap_PC_LoadSource(menuFile); + handle = trap_Parse_LoadSource(menuFile); if (!handle) { return; } while ( 1 ) { memset(&token, 0, sizeof(pc_token_t)); - if (!trap_PC_ReadToken( handle, &token )) { + if (!trap_Parse_ReadToken( handle, &token )) { break; } @@ -996,7 +996,7 @@ void UI_ParseMenu(const char *menuFile) { Menu_New(handle); } } - trap_PC_FreeSource(handle); + trap_Parse_FreeSource(handle); } /* @@ -1038,14 +1038,14 @@ qboolean UI_LoadInfoPane( int handle ) { memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; if( !Q_stricmp( token.string, "name" ) ) { memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].name = String_Alloc( token.string ); @@ -1057,7 +1057,7 @@ qboolean UI_LoadInfoPane( int handle ) memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; graphic = &uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].numGraphics; @@ -1075,7 +1075,7 @@ qboolean UI_LoadInfoPane( int handle ) memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; if( !Q_stricmp( token.string, "center" ) ) @@ -1085,7 +1085,7 @@ qboolean UI_LoadInfoPane( int handle ) memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].graphic = @@ -1093,14 +1093,14 @@ qboolean UI_LoadInfoPane( int handle ) memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].width = token.intvalue; memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].graphics[ *graphic ].height = token.intvalue; @@ -1115,7 +1115,7 @@ qboolean UI_LoadInfoPane( int handle ) { memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; Q_strcat( uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].text, MAX_INFOPANE_TEXT, token.string ); @@ -1124,7 +1124,7 @@ qboolean UI_LoadInfoPane( int handle ) { memset( &token, 0, sizeof( pc_token_t ) ); - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; if( !Q_stricmp( token.string, "left" ) ) @@ -1167,7 +1167,7 @@ void UI_LoadInfoPanes( const char *file ) uiInfo.tremInfoPaneCount = count = 0; - handle = trap_PC_LoadSource( file ); + handle = trap_Parse_LoadSource( file ); if( !handle ) { @@ -1177,7 +1177,7 @@ void UI_LoadInfoPanes( const char *file ) while( 1 ) { - if( !trap_PC_ReadToken( handle, &token ) ) + if( !trap_Parse_ReadToken( handle, &token ) ) break; if( token.string[ 0 ] == 0 ) @@ -1193,13 +1193,13 @@ void UI_LoadInfoPanes( const char *file ) } } - trap_PC_FreeSource( handle ); + trap_Parse_FreeSource( handle ); } qboolean Load_Menu(int handle) { pc_token_t token; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (token.string[0] != '{') { return qfalse; @@ -1207,7 +1207,7 @@ qboolean Load_Menu(int handle) { while ( 1 ) { - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if ( token.string[0] == 0 ) { @@ -1230,10 +1230,10 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) { start = trap_Milliseconds(); - handle = trap_PC_LoadSource( menuFile ); + handle = trap_Parse_LoadSource( menuFile ); if (!handle) { trap_Error( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) ); - handle = trap_PC_LoadSource( "ui/menus.txt" ); + handle = trap_Parse_LoadSource( "ui/menus.txt" ); if (!handle) { trap_Error( va( S_COLOR_RED "default menu file not found: ui/menus.txt, unable to continue!\n", menuFile ) ); } @@ -1246,7 +1246,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) { } while ( 1 ) { - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) break; if( token.string[0] == 0 || token.string[0] == '}') { break; @@ -1267,7 +1267,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset) { Com_Printf("UI menu load time = %d milli seconds\n", trap_Milliseconds() - start); - trap_PC_FreeSource( handle ); + trap_Parse_FreeSource( handle ); } void UI_Load( void ) { diff --git a/src/ui/ui_public.h b/src/ui/ui_public.h index 9e39d52b..3f26a8ba 100644 --- a/src/ui/ui_public.h +++ b/src/ui/ui_public.h @@ -91,11 +91,6 @@ typedef enum { UI_MEMORY_REMAINING, UI_R_REGISTERFONT, UI_R_MODELBOUNDS, - UI_PC_ADD_GLOBAL_DEFINE, - UI_PC_LOAD_SOURCE, - UI_PC_FREE_SOURCE, - UI_PC_READ_TOKEN, - UI_PC_SOURCE_FILE_AND_LINE, UI_S_STOPBACKGROUNDTRACK, UI_S_STARTBACKGROUNDTRACK, UI_REAL_TIME, @@ -123,6 +118,12 @@ typedef enum { UI_FS_SEEK, UI_SET_PBCLSTATUS, + UI_PARSE_ADD_GLOBAL_DEFINE, + UI_PARSE_LOAD_SOURCE, + UI_PARSE_FREE_SOURCE, + UI_PARSE_READ_TOKEN, + UI_PARSE_SOURCE_FILE_AND_LINE, + UI_MEMSET = 100, UI_MEMCPY, UI_STRNCPY, diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index d5001b10..041ea7ec 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -271,7 +271,7 @@ void PC_SourceWarning(int handle, char *format, ...) { filename[0] = '\0'; line = 0; - trap_PC_SourceFileAndLine(handle, filename, &line); + trap_Parse_SourceFileAndLine(handle, filename, &line); Com_Printf(S_COLOR_YELLOW "WARNING: %s, line %d: %s\n", filename, line, string); } @@ -293,7 +293,7 @@ void PC_SourceError(int handle, char *format, ...) { filename[0] = '\0'; line = 0; - trap_PC_SourceFileAndLine(handle, filename, &line); + trap_Parse_SourceFileAndLine(handle, filename, &line); Com_Printf(S_COLOR_RED "ERROR: %s, line %d: %s\n", filename, line, string); } @@ -343,10 +343,10 @@ qboolean PC_Float_Parse(int handle, float *f) { pc_token_t token; int negative = qfalse; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (token.string[0] == '-') { - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; negative = qtrue; } @@ -423,10 +423,10 @@ qboolean PC_Int_Parse(int handle, int *i) { pc_token_t token; int negative = qfalse; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (token.string[0] == '-') { - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; negative = qtrue; } @@ -500,7 +500,7 @@ PC_String_Parse qboolean PC_String_Parse(int handle, const char **out) { pc_token_t token; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; *(out) = String_Alloc(token.string); @@ -520,14 +520,14 @@ qboolean PC_Script_Parse(int handle, const char **out) { // scripts start with { and have ; separated command lists.. commands are command, arg.. // basically we want everything between the { } as it will be interpreted at run time - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (Q_stricmp(token.string, "{") != 0) { return qfalse; } while ( 1 ) { - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (Q_stricmp(token.string, "}") == 0) { @@ -5225,7 +5225,7 @@ qboolean ItemParse_cvarStrList( itemDef_t *item, int handle ) { multiPtr->count = 0; multiPtr->strDef = qtrue; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (*token.string != '{') { return qfalse; @@ -5233,7 +5233,7 @@ qboolean ItemParse_cvarStrList( itemDef_t *item, int handle ) { pass = 0; while ( 1 ) { - if (!trap_PC_ReadToken(handle, &token)) { + if (!trap_Parse_ReadToken(handle, &token)) { PC_SourceError(handle, "end of file inside menu item\n"); return qfalse; } @@ -5273,14 +5273,14 @@ qboolean ItemParse_cvarFloatList( itemDef_t *item, int handle ) { multiPtr->count = 0; multiPtr->strDef = qfalse; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (*token.string != '{') { return qfalse; } while ( 1 ) { - if (!trap_PC_ReadToken(handle, &token)) { + if (!trap_Parse_ReadToken(handle, &token)) { PC_SourceError(handle, "end of file inside menu item\n"); return qfalse; } @@ -5459,13 +5459,13 @@ qboolean Item_Parse(int handle, itemDef_t *item) { keywordHash_t *key; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (*token.string != '{') { return qfalse; } while ( 1 ) { - if (!trap_PC_ReadToken(handle, &token)) { + if (!trap_Parse_ReadToken(handle, &token)) { PC_SourceError(handle, "end of file inside menu item\n"); return qfalse; } @@ -5860,7 +5860,7 @@ qboolean Menu_Parse(int handle, menuDef_t *menu) { pc_token_t token; keywordHash_t *key; - if (!trap_PC_ReadToken(handle, &token)) + if (!trap_Parse_ReadToken(handle, &token)) return qfalse; if (*token.string != '{') { return qfalse; @@ -5869,7 +5869,7 @@ qboolean Menu_Parse(int handle, menuDef_t *menu) { while ( 1 ) { memset(&token, 0, sizeof(pc_token_t)); - if (!trap_PC_ReadToken(handle, &token)) { + if (!trap_Parse_ReadToken(handle, &token)) { PC_SourceError(handle, "end of file inside menu\n"); return qfalse; } diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index 09de834e..202cda52 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -442,11 +442,11 @@ void Controls_SetDefaults( void ); //for cg_draw.c void Item_Text_AutoWrapped_Paint( itemDef_t *item ); -int trap_PC_AddGlobalDefine( char *define ); -int trap_PC_LoadSource( const char *filename ); -int trap_PC_FreeSource( int handle ); -int trap_PC_ReadToken( int handle, pc_token_t *pc_token ); -int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ); +int trap_Parse_AddGlobalDefine( char *define ); +int trap_Parse_LoadSource( const char *filename ); +int trap_Parse_FreeSource( int handle ); +int trap_Parse_ReadToken( int handle, pc_token_t *pc_token ); +int trap_Parse_SourceFileAndLine( int handle, char *filename, int *line ); void BindingFromName( const char *cvar ); extern char g_nameBind1[ 32 ]; diff --git a/src/ui/ui_syscalls.asm b/src/ui/ui_syscalls.asm index fa30bf70..fb37c736 100644 --- a/src/ui/ui_syscalls.asm +++ b/src/ui/ui_syscalls.asm @@ -55,37 +55,37 @@ equ trap_Cvar_Update -52 equ trap_MemoryRemaining -53 equ trap_R_RegisterFont -54 equ trap_R_ModelBounds -55 -equ trap_PC_AddGlobalDefine -56 -equ trap_PC_LoadSource -57 -equ trap_PC_FreeSource -58 -equ trap_PC_ReadToken -59 -equ trap_PC_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_S_StopBackgroundTrack -56 +equ trap_S_StartBackgroundTrack -57 +equ trap_RealTime -58 +equ trap_LAN_GetServerCount -59 +equ trap_LAN_GetServerAddressString -60 +equ trap_LAN_GetServerInfo -61 +equ trap_LAN_MarkServerVisible -62 +equ trap_LAN_UpdateVisiblePings -63 +equ trap_LAN_ResetPings -64 +equ trap_LAN_LoadCachedServers -65 +equ trap_LAN_SaveCachedServers -66 +equ trap_LAN_AddServer -67 +equ trap_LAN_RemoveServer -68 +equ trap_CIN_PlayCinematic -69 +equ trap_CIN_StopCinematic -70 +equ trap_CIN_RunCinematic -71 +equ trap_CIN_DrawCinematic -72 +equ trap_CIN_SetExtents -73 +equ trap_R_RemapShader -74 +equ trap_LAN_ServerStatus -75 +equ trap_LAN_GetServerPing -76 +equ trap_LAN_ServerIsVisible -77 +equ trap_LAN_CompareServers -78 +equ trap_FS_Seek -79 +equ trap_SetPbClStatus -80 +equ trap_Parse_AddGlobalDefine -81 +equ trap_Parse_LoadSource -82 +equ trap_Parse_FreeSource -83 +equ trap_Parse_ReadToken -84 +equ trap_Parse_SourceFileAndLine -85 equ memset -101 diff --git a/src/ui/ui_syscalls.c b/src/ui/ui_syscalls.c index 545bcecc..528658e4 100644 --- a/src/ui/ui_syscalls.c +++ b/src/ui/ui_syscalls.c @@ -316,24 +316,24 @@ int trap_MemoryRemaining( void ) { return syscall( UI_MEMORY_REMAINING ); } -int trap_PC_AddGlobalDefine( char *define ) { - return syscall( UI_PC_ADD_GLOBAL_DEFINE, define ); +int trap_Parse_AddGlobalDefine( char *define ) { + return syscall( UI_PARSE_ADD_GLOBAL_DEFINE, define ); } -int trap_PC_LoadSource( const char *filename ) { - return syscall( UI_PC_LOAD_SOURCE, filename ); +int trap_Parse_LoadSource( const char *filename ) { + return syscall( UI_PARSE_LOAD_SOURCE, filename ); } -int trap_PC_FreeSource( int handle ) { - return syscall( UI_PC_FREE_SOURCE, handle ); +int trap_Parse_FreeSource( int handle ) { + return syscall( UI_PARSE_FREE_SOURCE, handle ); } -int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) { - return syscall( UI_PC_READ_TOKEN, handle, pc_token ); +int trap_Parse_ReadToken( int handle, pc_token_t *pc_token ) { + return syscall( UI_PARSE_READ_TOKEN, handle, pc_token ); } -int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) { - return syscall( UI_PC_SOURCE_FILE_AND_LINE, handle, filename, line ); +int trap_Parse_SourceFileAndLine( int handle, char *filename, int *line ) { + return syscall( UI_PARSE_SOURCE_FILE_AND_LINE, handle, filename, line ); } void trap_S_StopBackgroundTrack( void ) { |