コード例 #1
0
ファイル: server_run.c プロジェクト: prophile/dim3
void run_objects_slice(int tick)
{
	int				n,mesh_idx;
	d3pnt			old_pnt;
	obj_type		*obj;

	obj=server.objs;

	for (n=0;n!=server.count.obj;n++) {

		if ((!obj->scenery.on) && (!obj->hidden)) {
		
				// remember current position if not suspended
				// so we can check for mesh changes
				
			if (!obj->suspend) {
				old_pnt.x=obj->pnt.x;
				old_pnt.y=obj->pnt.y;
				old_pnt.z=obj->pnt.z;
			}

				// run objects

			if (obj->remote.on) {
				remote_predict_move(obj);
			}
			else {
				run_object_single(obj,tick);
			}

				// trigger any mesh changes if not suspended
			
			if (!obj->suspend) {
			
				if ((old_pnt.x!=obj->pnt.x) || (old_pnt.y!=obj->pnt.y) || (old_pnt.z!=obj->pnt.z)) {
				
					mesh_idx=map_mesh_find(&map,&obj->pnt);
					if (obj->mesh.cur_mesh_idx!=mesh_idx) {
						mesh_triggers(obj,obj->mesh.cur_mesh_idx,mesh_idx);
						obj->mesh.cur_mesh_idx=mesh_idx;
					}
					
				}
			}
		}
		
		obj++;
	}
}
コード例 #2
0
ファイル: effects.c プロジェクト: rzel/dim3
int effect_spawn(int effecttype,d3pnt *pt,int life_tick)
{
	int				n,idx;
	effect_type		*effect;
	
		// can't spawn 0 time effects
		
	if (life_tick<=0) {
		console_add_error("Can't spawn effects with no life time");
		return(-1);
	}
	
		// any more effect spots?
		// this is a silent error, as it's not fatal
		// and not script-based

	idx=-1;

	for (n=0;n!=max_effect_list;n++) {
		effect=server.effect_list.effects[n];
		if (!effect->on) {
			idx=n;
			break;
		}
	}
		
	if (idx==-1) return(-1);
	
		// create effect
	
	effect=server.effect_list.effects[idx];
	effect->on=TRUE;
	
	effect->effecttype=effecttype;
	
	memmove(&effect->pnt,pt,sizeof(d3pnt));

	effect->mesh_idx=map_mesh_find(&map,pt);

	effect->start_tick=game_time_get();
	effect->life_tick=life_tick;

	effect->rtl_mesh_id=-1;

	return(idx);
}