当前位置: 首页>>代码示例>>C++>>正文


C++ script_value_to_float函数代码示例

本文整理汇总了C++中script_value_to_float函数的典型用法代码示例。如果您正苦于以下问题:C++ script_value_to_float函数的具体用法?C++ script_value_to_float怎么用?C++ script_value_to_float使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了script_value_to_float函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: js_map_object_nearest_player_skip_self_func

JSValueRef js_map_object_nearest_player_skip_self_func(JSContextRef cx,JSObjectRef func,JSObjectRef j_obj,size_t argc,const JSValueRef argv[],JSValueRef *exception)
{
	int					min_dist,max_dist;
	float				ang,ang_sweep;
	d3pnt				pnt;
	obj_type			*obj;
	
	ang=-1;
	ang_sweep=360;

	if (!script_check_param_count(cx,func,argc,5,exception)) return(script_null_to_value(cx));

	script_value_to_point(cx,argv[0],&pnt);
	if (!script_is_value_null(cx,argv[1])) ang=script_value_to_float(cx,argv[1]);
	if (!script_is_value_null(cx,argv[2])) ang_sweep=script_value_to_float(cx,argv[2]);
	min_dist=script_value_to_int(cx,argv[3]);
	max_dist=script_value_to_int(cx,argv[4]);
	
		// find object

	obj=object_find_nearest(&pnt,NULL,-1,-1,ang,ang_sweep,min_dist,max_dist,TRUE,script_get_attached_object_uid(j_obj));
	if (obj==NULL) return(script_int_to_value(cx,-1));

	return(script_int_to_value(cx,obj->idx));
}
开发者ID:rzel,项目名称:dim3,代码行数:25,代码来源:script_map_object.c

示例2: js_map_object_nearest_skip_object_id_func

JSValueRef js_map_object_nearest_skip_object_id_func(JSContextRef cx,JSObjectRef func,JSObjectRef j_obj,size_t argc,const JSValueRef argv[],JSValueRef *exception)
{
	int					type,min_dist,max_dist;
	char				*name_ptr,name[name_str_len];
	float				ang,ang_sweep;
	d3pnt				pnt;
	obj_type			*obj;

	name_ptr=NULL;
	type=-1;
	ang=-1;
	ang_sweep=360;
	
	if (!script_check_param_count(cx,func,argc,8,exception)) return(script_null_to_value(cx));

	script_value_to_point(cx,argv[0],&pnt);
	if (!script_is_value_null(cx,argv[1])) {
		script_value_to_string(cx,argv[1],name,name_str_len);
		name_ptr=name;
	}
	if (!script_is_value_null(cx,argv[2])) type=script_value_to_int(cx,argv[2])-sd_object_type_player;
	if (!script_is_value_null(cx,argv[3])) ang=script_value_to_float(cx,argv[3]);
	if (!script_is_value_null(cx,argv[4])) ang_sweep=script_value_to_float(cx,argv[4]);
	min_dist=script_value_to_int(cx,argv[5]);
	max_dist=script_value_to_int(cx,argv[6]);
	
		// find object

	obj=object_find_nearest(&pnt,name_ptr,type,-1,ang,ang_sweep,min_dist,max_dist,FALSE,script_value_to_int(cx,argv[7]));
	if (obj==NULL) return(script_int_to_value(cx,-1));
	
	return(script_int_to_value(cx,obj->idx));
}
开发者ID:rzel,项目名称:dim3,代码行数:33,代码来源:script_map_object.c

示例3: js_map_object_nearest_team_func

JSValueRef js_map_object_nearest_team_func(JSContextRef cx,JSObjectRef func,JSObjectRef j_obj,size_t argc,const JSValueRef argv[],JSValueRef *exception)
{
	int					min_dist,max_dist,team_idx;
	float				ang,ang_sweep;
	d3pnt				pnt;
	obj_type			*obj;

	ang=-1;
	ang_sweep=360;

	if (!script_check_param_count(cx,func,argc,6,exception)) return(script_null_to_value(cx));

	script_value_to_point(cx,argv[0],&pnt);
	team_idx=script_value_to_int(cx,argv[1])-sd_team_none;
	if (!script_is_value_null(cx,argv[2])) ang=script_value_to_float(cx,argv[2]);
	if (!script_is_value_null(cx,argv[3])) ang_sweep=script_value_to_float(cx,argv[3]);
	min_dist=script_value_to_int(cx,argv[4]);
	max_dist=script_value_to_int(cx,argv[5]);
	
		// find object

	obj=object_find_nearest(&pnt,NULL,-1,team_idx,ang,ang_sweep,min_dist,max_dist,FALSE,-1);
	if (obj==NULL) return(script_int_to_value(cx,-1));

	return(script_int_to_value(cx,obj->idx));
}
开发者ID:rzel,项目名称:dim3,代码行数:26,代码来源:script_map_object.c

示例4: js_multiplayer_bot_get_from_min_max_func

JSBool js_multiplayer_bot_get_from_min_max_func(JSContext *cx,JSObject *j_obj,uintN argc,jsval *argv,jsval *rval)
{
	float			skill,min,max;

	min=script_value_to_float(argv[0]);
	max=script_value_to_float(argv[1]);
	
	skill=(float)setup.network.bot.skill;

	*rval=script_float_to_value(min+(((max-min)*skill)/4.0f));
	
	return(JS_TRUE);
}
开发者ID:prophile,项目名称:dim3,代码行数:13,代码来源:script_multiplayer_bot.c

示例5: js_proj_action_bounce_func

JSValueRef js_proj_action_bounce_func(JSContextRef cx,JSObjectRef func,JSObjectRef j_obj,size_t argc,const JSValueRef argv[],JSValueRef *exception)
{
    float				min_ymove,reduce;
	proj_type			*proj;

	if (!script_check_param_count(cx,func,argc,2,exception)) return(script_null_to_value(cx));
	
	proj=proj_get_attach(j_obj);
	if (proj==NULL) return(script_null_to_value(cx));
    
    min_ymove=script_value_to_float(cx,argv[0]);
	reduce=script_value_to_float(cx,argv[1]);
	
	projectile_bounce(proj,min_ymove,reduce,FALSE);
    
	return(script_null_to_value(cx));
}
开发者ID:rzel,项目名称:dim3,代码行数:17,代码来源:script_proj_action.c

示例6: js_proj_action_seek_func

JSValueRef js_proj_action_seek_func(JSContextRef cx,JSObjectRef func,JSObjectRef j_obj,size_t argc,const JSValueRef argv[],JSValueRef *exception)
{
	proj_type			*proj;
	obj_type			*to_obj;

	if (!script_check_param_count(cx,func,argc,3,exception)) return(script_null_to_value(cx));
	
	proj=proj_get_attach(j_obj);
	if (proj==NULL) return(script_null_to_value(cx));
		
	to_obj=script_find_obj_from_uid_arg(cx,argv[0],exception);
	if (to_obj==NULL) return(script_null_to_value(cx));
	
	projectile_seek(proj,to_obj,script_value_to_float(cx,argv[1]),script_value_to_float(cx,argv[2]));
	
	return(script_null_to_value(cx));
}
开发者ID:rzel,项目名称:dim3,代码行数:17,代码来源:script_proj_action.c

示例7: js_obj_thrust_set_maxSpeed

JSBool js_obj_thrust_set_maxSpeed(JSContext *cx,JSObject *j_obj,jsval id,jsval *vp)
{
    obj_type		*obj;

    obj=object_find_uid(js.attach.thing_uid);
    obj->thrust.max_speed=script_value_to_float(*vp);

    return(JS_TRUE);
}
开发者ID:prophile,项目名称:dim3,代码行数:9,代码来源:script_obj_object_thrust.c

示例8: js_obj_forward_speed_set_decelerationAir

bool js_obj_forward_speed_set_decelerationAir(JSContextRef cx,JSObjectRef j_obj,JSStringRef name,JSValueRef vp,JSValueRef *exception)
{
	obj_type		*obj;
	
	obj=object_get_attach(j_obj);
	obj->forward_move.air_decelerate=fabsf(script_value_to_float(cx,vp));
	
	return(TRUE);
}
开发者ID:rzel,项目名称:dim3,代码行数:9,代码来源:script_obj_forward_speed.c

示例9: js_obj_vert_speed_set_flySlop

JSBool js_obj_vert_speed_set_flySlop(JSContext *cx,JSObject *j_obj,jsval id,jsval *vp)
{
	obj_type		*obj;
	
	obj=object_find_uid(js.attach.thing_uid);
	obj->vert_move.slop=fabsf(script_value_to_float(*vp));
	
	return(JS_TRUE);
}
开发者ID:prophile,项目名称:dim3,代码行数:9,代码来源:script_obj_vert_speed.c

示例10: js_obj_turn_speed_set_key

JSBool js_obj_turn_speed_set_key(JSContext *cx,JSObject *j_obj,jsval id,jsval *vp)
{
	obj_type		*obj;
	
	obj=object_find_uid(js.attach.thing_uid);
	obj->turn.key_speed=fabsf(script_value_to_float(*vp));
	
	return(JS_TRUE);
}
开发者ID:prophile,项目名称:dim3,代码行数:9,代码来源:script_obj_turn_speed.c

示例11: js_obj_health_set_fallDamageFactor

JSBool js_obj_health_set_fallDamageFactor(JSContext *cx,JSObject *j_obj,jsval id,jsval *vp)
{
	obj_type		*obj;
	
	obj=object_find_uid(js.attach.thing_uid);
	obj->fall.damage_factor=script_value_to_float(*vp);
	
	return(JS_TRUE);
}
开发者ID:prophile,项目名称:dim3,代码行数:9,代码来源:script_obj_health.c

示例12: js_weap_hand_angle_set_z

bool js_weap_hand_angle_set_z(JSContextRef cx,JSObjectRef j_obj,JSStringRef name,JSValueRef vp,JSValueRef *exception)
{
	weapon_type		*weap;
	
	weap=weapon_get_attach(j_obj);
	weap->hand.ang.z=script_value_to_float(cx,vp);

	return(TRUE);
}
开发者ID:rzel,项目名称:dim3,代码行数:9,代码来源:script_weap_hand_angle.c

示例13: js_proj_action_set_auto_bounceReduce

bool js_proj_action_set_auto_bounceReduce(JSContextRef cx,JSObjectRef j_obj,JSStringRef name,JSValueRef vp,JSValueRef *exception)
{
	proj_setup_type		*proj_setup;
	
	proj_setup=proj_setup_get_attach(j_obj);
	if (proj_setup!=NULL) proj_setup->action.bounce_reduce=script_value_to_float(cx,vp);

	return(TRUE);
}
开发者ID:rzel,项目名称:dim3,代码行数:9,代码来源:script_proj_action.c

示例14: js_weap_zoom_set_lookFactor

JSBool js_weap_zoom_set_lookFactor(JSContext *cx,JSObject *j_obj,jsval id,jsval *vp)
{
	weapon_type		*weap;
	
	weap=weapon_find_uid(js.attach.thing_uid);
	weap->zoom.look_factor=script_value_to_float(*vp);
	
	return(JS_TRUE);
}
开发者ID:prophile,项目名称:dim3,代码行数:9,代码来源:script_weap_zoom.c

示例15: js_weap_crosshair_pickup_color_set_blue

JSBool js_weap_crosshair_pickup_color_set_blue(JSContext *cx,JSObject *j_obj,jsval id,jsval *vp)
{
    weapon_type		*weap;

    weap=weapon_find_uid(js.attach.thing_uid);
    weap->crosshair.pickup_col.b=script_value_to_float(*vp);

    return(JS_TRUE);
}
开发者ID:prophile,项目名称:dim3,代码行数:9,代码来源:script_weap_crosshair_pickup_color.c


注:本文中的script_value_to_float函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。