Go to the source code of this file.
Defines | |
| #define | _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) |
| #define | va_start(ap, v) ( ap = (va_list)&v + _INTSIZEOF(v) ) |
| #define | va_arg(ap, t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) |
| #define | va_end(ap) ( ap = (va_list)0 ) |
| #define | CHAR_BIT 8 |
| #define | SCHAR_MIN (-128) |
| #define | SCHAR_MAX 127 |
| #define | UCHAR_MAX 0xff |
| #define | SHRT_MIN (-32768) |
| #define | SHRT_MAX 32767 |
| #define | USHRT_MAX 0xffff |
| #define | INT_MIN (-2147483647 - 1) |
| #define | INT_MAX 2147483647 |
| #define | UINT_MAX 0xffffffff |
| #define | LONG_MIN (-2147483647L - 1) |
| #define | LONG_MAX 2147483647L |
| #define | ULONG_MAX 0xffffffffUL |
Typedefs | |
| typedef int | size_t |
| typedef char * | va_list |
| typedef int | cmp_t (const void *, const void *) |
Functions | |
| void | qsort (void *a, size_t n, size_t es, cmp_t *cmp) |
| void | srand (unsigned seed) |
| int | rand (void) |
| size_t | strlen (const char *string) |
| char * | strcat (char *strDestination, const char *strSource) |
| char * | strcpy (char *strDestination, const char *strSource) |
| int | strcmp (const char *string1, const char *string2) |
| char * | strchr (const char *string, int c) |
| char * | strstr (const char *string, const char *strCharSet) |
| char * | strncpy (char *strDest, const char *strSource, size_t count) |
| int | tolower (int c) |
| int | toupper (int c) |
| double | atof (const char *string) |
| double | _atof (const char **stringPtr) |
| int | atoi (const char *string) |
| int | _atoi (const char **stringPtr) |
| int | vsprintf (char *buffer, const char *fmt, va_list argptr) |
| int | sscanf (const char *buffer, const char *fmt,...) |
| void * | memmove (void *dest, const void *src, size_t count) |
| void * | memset (void *dest, int c, size_t count) |
| void * | memcpy (void *dest, const void *src, size_t count) |
| double | ceil (double x) |
| double | floor (double x) |
| double | sqrt (double x) |
| double | sin (double x) |
| double | cos (double x) |
| double | atan2 (double y, double x) |
| double | tan (double x) |
| int | abs (int n) |
| double | fabs (double x) |
| double | acos (double x) |
|
|
|
|
|
|
|
|
Definition at line 23 of file bg_lib.h. Referenced by Team_TouchEnemyFlag(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 12 of file bg_lib.h. Referenced by CG_Error(), CG_Printf(), Com_Error(), COM_ParseError(), COM_ParseWarning(), Com_Printf(), Com_sprintf(), Debug_NPCPrintf(), Debug_Printf(), G_DebugPrint(), G_Error(), G_LogPrintf(), G_Printf(), PC_SourceError(), PC_SourceWarning(), and va(). |
|
|
Definition at line 10 of file bg_lib.h. Referenced by CG_Error(), CG_Printf(), Com_Error(), COM_ParseError(), COM_ParseWarning(), Com_Printf(), Com_sprintf(), Debug_NPCPrintf(), Debug_Printf(), G_DebugPrint(), G_Error(), G_LogPrintf(), G_Printf(), PC_SourceError(), PC_SourceWarning(), and va(). |
|
|
|
|
|
|
|
|
Definition at line 8 of file bg_lib.h. Referenced by CG_Error(), CG_Printf(), Com_Error(), COM_ParseError(), COM_ParseWarning(), Com_Printf(), Com_sprintf(), Debug_NPCPrintf(), Debug_Printf(), G_DebugPrint(), G_Error(), G_LogPrintf(), G_Printf(), PC_SourceError(), PC_SourceWarning(), and va(). |
|
|
Definition at line 841 of file bg_lib.c.
00841 {
00842 const char *string;
00843 float sign;
00844 float value;
00845 int c = '0'; // bk001211 - uninitialized use possible
00846
00847 string = *stringPtr;
00848
00849 // skip whitespace
00850 while ( *string <= ' ' ) {
00851 if ( !*string ) {
00852 *stringPtr = string;
00853 return 0;
00854 }
00855 string++;
00856 }
00857
00858 // check sign
00859 switch ( *string ) {
00860 case '+':
00861 string++;
00862 sign = 1;
00863 break;
00864 case '-':
00865 string++;
00866 sign = -1;
00867 break;
00868 default:
00869 sign = 1;
00870 break;
00871 }
00872
00873 // read digits
00874 value = 0;
00875 if ( string[0] != '.' ) {
00876 do {
00877 c = *string++;
00878 if ( c < '0' || c > '9' ) {
00879 break;
00880 }
00881 c -= '0';
00882 value = value * 10 + c;
00883 } while ( 1 );
00884 }
00885
00886 // check for decimal point
00887 if ( c == '.' ) {
00888 double fraction;
00889
00890 fraction = 0.1;
00891 do {
00892 c = *string++;
00893 if ( c < '0' || c > '9' ) {
00894 break;
00895 }
00896 c -= '0';
00897 value += c * fraction;
00898 fraction *= 0.1;
00899 } while ( 1 );
00900
00901 }
00902
00903 // not handling 10e10 notation...
00904 *stringPtr = string;
00905
00906 return value * sign;
00907 }
|
|
|
|
|
|
Referenced by BotInputToUserCommand(), Menu_Transition3ItemByName(), Menu_TransitionItemByName(), PmoveSingle(), and Update(). |
|
|
Referenced by NormalToLatLong(), and Use_BinaryMover_Go(). |
|
||||||||||||
|
Referenced by CG_CalcFOVFromX(), CG_DrawRadar(), CG_DrawSkyBoxPortal(), Item_Model_Paint(), NormalToLatLong(), vectoangles(), and vectoyaw(). |
|
|
Definition at line 774 of file bg_lib.c. Referenced by BG_ParseAnimationFile(), BG_ParseField(), BG_SiegeParseClassFile(), BotUtilizePersonality(), CG_DrawSkyBoxPortal(), CG_NewParticleArea(), CG_ROFF_NotetrackCallback(), CG_TestModel_f(), Cmd_SetViewpos_f(), COM_ParseFloat(), Float_Parse(), G_BotConnect(), G_RunFrame(), G_SpawnFloat(), ItemParse_rectcvar(), LoadPathData(), NPC_UpdateAngles(), Parse1DMatrix(), Q3_GetFloat(), Q3_PlaySound(), Q3_Set(), Q3_SetParm(), Script_SetItemColorCvar(), Script_SetItemRectCvar(), Script_Transition3(), SP_misc_skyportal(), SP_terrain(), Svcmd_AddBot_f(), trap_Cvar_VariableValue(), UI_ParseAnimationFile(), UI_SaberBladeLengthForSaber(), UI_SaberBladeRadiusForSaber(), UI_SetSiegeObjectiveGraphicPos(), and WP_ResistForcePush().
00774 {
00775 float sign;
00776 float value;
00777 int c;
00778
00779
00780 // skip whitespace
00781 while ( *string <= ' ' ) {
00782 if ( !*string ) {
00783 return 0;
00784 }
00785 string++;
00786 }
00787
00788 // check sign
00789 switch ( *string ) {
00790 case '+':
00791 string++;
00792 sign = 1;
00793 break;
00794 case '-':
00795 string++;
00796 sign = -1;
00797 break;
00798 default:
00799 sign = 1;
00800 break;
00801 }
00802
00803 // read digits
00804 value = 0;
00805 c = string[0];
00806 if ( c != '.' ) {
00807 do {
00808 c = *string++;
00809 if ( c < '0' || c > '9' ) {
00810 break;
00811 }
00812 c -= '0';
00813 value = value * 10 + c;
00814 } while ( 1 );
00815 } else {
00816 string++;
00817 }
00818
00819 // check for decimal point
00820 if ( c == '.' ) {
00821 double fraction;
00822
00823 fraction = 0.1;
00824 do {
00825 c = *string++;
00826 if ( c < '0' || c > '9' ) {
00827 break;
00828 }
00829 c -= '0';
00830 value += c * fraction;
00831 fraction *= 0.1;
00832 } while ( 1 );
00833
00834 }
00835
00836 // not handling 10e10 notation...
00837
00838 return value * sign;
00839 }
|
|
|
|
|
|
|
||||||||||||||||
|
||||||||||||||||
|
Definition at line 287 of file bg_lib.c. References size_t. Referenced by ClearPlayerAlertEvents(), Item_TextField_HandleKey(), and RemoveOldestAlert().
00287 {
00288 int i;
00289
00290 if ( dest > src ) {
00291 for ( i = count-1 ; i >= 0 ; i-- ) {
00292 ((char *)dest)[i] = ((char *)src)[i];
00293 }
00294 } else {
00295 for ( i = 0 ; i < count ; i++ ) {
00296 ((char *)dest)[i] = ((char *)src)[i];
00297 }
00298 }
00299 return dest;
00300 }
|
|
||||||||||||||||
|
||||||||||||||||||||
|
Definition at line 105 of file bg_lib.c. References min, pm, size_t, swap, SWAPINIT, and vecswap. Referenced by CalculateRanks(), TeamplayInfoMessage(), and UI_ServersSort().
00106 {
00107 char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
00108 int d, r, swaptype, swap_cnt;
00109
00110 loop: SWAPINIT(a, es);
00111 swap_cnt = 0;
00112 if (n < 7) {
00113 for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
00114 for (pl = pm; pl > (char *)a && cmp(pl - es, pl) > 0;
00115 pl -= es)
00116 swap(pl, pl - es);
00117 return;
00118 }
00119 pm = (char *)a + (n / 2) * es;
00120 if (n > 7) {
00121 pl = a;
00122 pn = (char *)a + (n - 1) * es;
00123 if (n > 40) {
00124 d = (n / 8) * es;
00125 pl = med3(pl, pl + d, pl + 2 * d, cmp);
00126 pm = med3(pm - d, pm, pm + d, cmp);
00127 pn = med3(pn - 2 * d, pn - d, pn, cmp);
00128 }
00129 pm = med3(pl, pm, pn, cmp);
00130 }
00131 swap(a, pm);
00132 pa = pb = (char *)a + es;
00133
00134 pc = pd = (char *)a + (n - 1) * es;
00135 for (;;) {
00136 while (pb <= pc && (r = cmp(pb, a)) <= 0) {
00137 if (r == 0) {
00138 swap_cnt = 1;
00139 swap(pa, pb);
00140 pa += es;
00141 }
00142 pb += es;
00143 }
00144 while (pb <= pc && (r = cmp(pc, a)) >= 0) {
00145 if (r == 0) {
00146 swap_cnt = 1;
00147 swap(pc, pd);
00148 pd -= es;
00149 }
00150 pc -= es;
00151 }
00152 if (pb > pc)
00153 break;
00154 swap(pb, pc);
00155 swap_cnt = 1;
00156 pb += es;
00157 pc -= es;
00158 }
00159 if (swap_cnt == 0) { /* Switch to insertion sort */
00160 for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
00161 for (pl = pm; pl > (char *)a && cmp(pl - es, pl) > 0;
00162 pl -= es)
00163 swap(pl, pl - es);
00164 return;
00165 }
00166
00167 pn = (char *)a + n * es;
00168 r = min(pa - (char *)a, pb - pa);
00169 vecswap(a, pb - r, r);
00170 r = min(pd - pc, pn - pd - es);
00171 vecswap(pb, pn - r, r);
00172 if ((r = pb - pa) > es)
00173 qsort(a, r / es, es, cmp);
00174 if ((r = pd - pc) > es) {
00175 /* Iterate rather than recurse to save stack space */
00176 a = pn - r;
00177 n = r / es;
00178 goto loop;
00179 }
00180 /* qsort(pn - r, r / es, es, cmp);*/
00181 }
|
|
|
|
|
|
Definition at line 765 of file bg_lib.c. Referenced by G_InitGame().
00765 {
00766 randSeed = seed;
00767 }
|
|
||||||||||||||||
|
Referenced by BG_ParseField(), G_DebugPrint(), G_ReadSessionData(), G_SpawnVector(), Q3_GetVector(), and Q3_Set(). |
|
||||||||||||
|
||||||||||||
|
||||||||||||
|
||||||||||||
|
|
||||||||||||||||
|
Referenced by CG_ShaderStateChanged(), G_AddRandomBot(), G_LogWeaponOutput(), Item_Text_Wrapped_Paint(), Q3_SetParm(), Q_strncpyz(), and Text_PaintWithCursor(). |
|
||||||||||||
|
|
Referenced by CG_CalcFOVFromX(), CG_DrawSkyBoxPortal(), Item_Model_Paint(), and NPC_BSPointShoot(). |
|
|
Referenced by Q_strlwr(), and SanitizeString(). |
|
|
Referenced by Q_strupr(). |
|
||||||||||||||||