=================
VM_vectoangles
-vector vectoangles(vector)
+vector vectoangles(vector[, vector])
=================
*/
void VM_vectoangles (void)
{
- float *value1;
- float forward;
- float yaw, pitch;
-
- VM_SAFEPARMCOUNT(1,VM_vectoangles);
-
- value1 = PRVM_G_VECTOR(OFS_PARM0);
-
- if (value1[1] == 0 && value1[0] == 0)
- {
- yaw = 0;
- if (value1[2] > 0)
- pitch = 90;
- else
- pitch = 270;
- }
- else
- {
- // LordHavoc: optimized a bit
- if (value1[0])
- {
- yaw = (atan2(value1[1], value1[0]) * 180 / M_PI);
- if (yaw < 0)
- yaw += 360;
- }
- else if (value1[1] > 0)
- yaw = 90;
- else
- yaw = 270;
+ VM_SAFEPARMCOUNTRANGE(1, 2,VM_vectoangles);
- forward = sqrt(value1[0]*value1[0] + value1[1]*value1[1]);
- pitch = (atan2(value1[2], forward) * 180 / M_PI);
- if (pitch < 0)
- pitch += 360;
- }
-
- PRVM_G_FLOAT(OFS_RETURN+0) = pitch;
- PRVM_G_FLOAT(OFS_RETURN+1) = yaw;
- PRVM_G_FLOAT(OFS_RETURN+2) = 0;
+ AnglesFromVectors(PRVM_G_VECTOR(OFS_RETURN), PRVM_G_VECTOR(OFS_PARM0), prog->argc >= 2 ? PRVM_G_VECTOR(OFS_PARM1) : NULL, true);
}
/*
string = PRVM_G_STRING(OFS_PARM0);
colors = (int)PRVM_G_FLOAT(OFS_PARM1);
- PRVM_G_FLOAT(OFS_RETURN) = DrawQ_String_Font(0, 0, string, 0, 1, 1, 0, 0, 0, 0, 0, NULL, !colors, getdrawfont()); // 1x1 characters, don't actually draw
+ PRVM_G_FLOAT(OFS_RETURN) = DrawQ_TextWidth_Font(string, 0, !colors, getdrawfont()); // 1x1 characters, don't actually draw
}
/*
=========
name = PRVM_G_STRING( OFS_PARM0 );
VM_CheckEmptyString( name );
key = (unsigned int) PRVM_G_FLOAT( OFS_PARM1 );
- switch( (unsigned int) PRVM_G_FLOAT( OFS_PARM3 ) ) {
+ switch( (unsigned int) PRVM_G_FLOAT( OFS_PARM2 ) ) {
case 0:
eventtype = CLG_BET_DOWN;
break;
}
CL_Gecko_Event_CursorMove( instance, x, y );
}
+
+
+/*
+========================
+VM_gecko_resize
+
+void gecko_resize( string name, float w, float h )
+========================
+*/
+void VM_gecko_resize( void ) {
+ const char *name;
+ float w, h;
+ clgecko_t *instance;
+
+ VM_SAFEPARMCOUNT( 3, VM_gecko_movemouse );
+
+ name = PRVM_G_STRING( OFS_PARM0 );
+ VM_CheckEmptyString( name );
+ w = PRVM_G_FLOAT( OFS_PARM1 );
+ h = PRVM_G_FLOAT( OFS_PARM2 );
+
+ instance = CL_Gecko_FindBrowser( name );
+ if( !instance ) {
+ return;
+ }
+ CL_Gecko_Resize( instance, w, h );
+}
+
+
+/*
+========================
+VM_gecko_get_texture_extent
+
+vector gecko_get_texture_extent( string name )
+========================
+*/
+void VM_gecko_get_texture_extent( void ) {
+ const char *name;
+ clgecko_t *instance;
+
+ VM_SAFEPARMCOUNT( 1, VM_gecko_movemouse );
+
+ name = PRVM_G_STRING( OFS_PARM0 );
+ VM_CheckEmptyString( name );
+
+ PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
+ instance = CL_Gecko_FindBrowser( name );
+ if( !instance ) {
+ PRVM_G_VECTOR(OFS_RETURN)[0] = 0;
+ PRVM_G_VECTOR(OFS_RETURN)[1] = 0;
+ return;
+ }
+ CL_Gecko_GetTextureExtent( instance,
+ PRVM_G_VECTOR(OFS_RETURN), PRVM_G_VECTOR(OFS_RETURN)+1 );
+}
+
+
#endif
/*