// kind of helper function
static qboolean checkextension(const char *name)
{
- size_t len;
+ int len;
char *e, *start;
- len = strlen(name);
+ len = (int)strlen(name);
for (e = prog->extensionstring;*e;e++)
{
start = e;
while (*e && *e != ' ')
e++;
- if ((size_t)(e - start) == len && !strncasecmp(start, name, len))
+ if ((e - start) == len && !strncasecmp(start, name, len))
return true;
}
return false;
{
float *value1;
vec3_t newvalue;
- float new;
+ double f;
VM_SAFEPARMCOUNT(1,VM_normalize);
value1 = PRVM_G_VECTOR(OFS_PARM0);
- new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
- new = sqrt(new);
-
- if (new == 0)
- newvalue[0] = newvalue[1] = newvalue[2] = 0;
- else
+ f = VectorLength2(value1);
+ if (f)
{
- new = 1/new;
- newvalue[0] = value1[0] * new;
- newvalue[1] = value1[1] * new;
- newvalue[2] = value1[2] * new;
+ f = 1.0 / sqrt(f);
+ VectorScale(value1, f, newvalue);
}
+ else
+ VectorClear(newvalue);
VectorCopy (newvalue, PRVM_G_VECTOR(OFS_RETURN));
}
*/
void VM_vlen (void)
{
- float *value1;
- float new;
-
VM_SAFEPARMCOUNT(1,VM_vlen);
-
- value1 = PRVM_G_VECTOR(OFS_PARM0);
-
- new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
- new = sqrt(new);
-
- PRVM_G_FLOAT(OFS_RETURN) = new;
+ PRVM_G_FLOAT(OFS_RETURN) = VectorLength(PRVM_G_VECTOR(OFS_PARM0));
}
/*
//void(float fhandle, string s) fputs = #113; // writes a line of text to the end of the file
void VM_fputs(void)
{
- size_t stringlength;
+ int stringlength;
char string[VM_STRINGTEMP_LENGTH];
int filenum;
return;
}
VM_VarString(1, string, sizeof(string));
- if ((stringlength = strlen(string)))
+ if ((stringlength = (int)strlen(string)))
FS_Write(VM_FILES[filenum], string, stringlength);
if (developer.integer)
Con_Printf("fputs: %s: %s\n", PRVM_NAME, string);
void VM_loadfromfile(void)
{
const char *filename;
- qbyte *data;
+ char *data;
VM_SAFEPARMCOUNT(1,VM_loadfromfile);
}
// not conform with VM_fopen
- data = FS_LoadFile(filename, tempmempool, false);
+ data = (char *)FS_LoadFile(filename, tempmempool, false);
if (data == NULL)
PRVM_G_FLOAT(OFS_RETURN) = -1;
name = PRVM_G_STRING( OFS_PARM0 );
VM_CheckEmptyString( name );
- state = PRVM_G_FLOAT( OFS_PARM1 );
+ state = (clvideostate_t)PRVM_G_FLOAT( OFS_PARM1 );
video = CL_GetVideo( name );
if( video && state > CLVIDEO_UNUSED && state < CLVIDEO_STATECOUNT )