void map_textures_read_texture(map_type *map,int txt_idx) { int n; char path[1024],name[256]; texture_type *texture; texture_frame_type *frame; // if in engine, then only load textures // directly hooked up to elements #ifdef D3_ENGINE if (!map_textures_read_texture_ok(map,txt_idx)) return; #endif // load textures texture=&map->textures[txt_idx]; // load texture frame=texture->frames; for (n=0;n!=max_texture_frame;n++) { if (frame->name[0]!=0x0) { // bitmap file_paths_data(&file_path_setup,path,"Bitmaps/Textures",frame->name,"png"); bitmap_open(&frame->bitmap,path,TRUE,texture->compress,texture->pixelated,FALSE,FALSE,FALSE); // bumpmap sprintf(name,"%s_n",frame->name); file_paths_data(&file_path_setup,path,"Bitmaps/Textures",name,"png"); // compresses messes up normals bitmap_open(&frame->bumpmap,path,TRUE,FALSE,texture->pixelated,FALSE,FALSE,texture->flip_normal); // specular map sprintf(name,"%s_s",frame->name); file_paths_data(&file_path_setup,path,"Bitmaps/Textures",name,"png"); bitmap_open(&frame->specularmap,path,TRUE,texture->compress,texture->pixelated,FALSE,FALSE,FALSE); // glow map sprintf(name,"%s_g",frame->name); file_paths_data(&file_path_setup,path,"Bitmaps/Textures",name,"png"); bitmap_open(&frame->glowmap,path,TRUE,texture->compress,texture->pixelated,FALSE,TRUE,FALSE); } frame++; } }
void cursor_initialize(void) { char path[1024]; file_paths_data(&setup.file_path_setup,path,"Bitmaps/UI_Elements","cursor","png"); bitmap_open(&cursor_bitmap,path,anisotropic_mode_none,mipmap_mode_none,FALSE,FALSE,FALSE); }
bool texture_edit_click_bitmap_open(char *bitmap_name) { char err_str[256],sub_path[1024],path[1024]; // get bitmap if (state.mode==app_mode_map) { strcpy(sub_path,"Bitmaps/Textures"); } else { sprintf(sub_path,"Models/%s/Textures",model.name); } if (!dialog_file_open_run("Open a Bitmap",sub_path,"png",NULL,bitmap_name)) return(FALSE); // check bitmap file_paths_data(&file_path_setup,path,sub_path,bitmap_name,"png"); if (!bitmap_check(path,err_str)) { os_dialog_alert("Texture Error",err_str); return(FALSE); } return(TRUE); }
void launch_map_script_editor(void) { char path[1024]; file_paths_data(&file_path_setup,path,"Scripts/Courses",map.info.name,"js"); if (!os_launch_process(path,TRUE)) { os_dialog_alert("Could not locate script file","No script file with this name exists."); } }
bool setup_xml_reset(void) { char path[1024]; // read directly from the default file_paths_data(&file_path_setup,path,"Settings","Setup","xml"); return(setup_xml_read_path(path)); }
void launch_spot_script_editor(spot_type *spot) { char path[1024]; if (spot->script[0]==0x0) return; file_paths_data(&file_path_setup,path,"Scripts/Objects",spot->script,"js"); if (!os_launch_process(path,TRUE)) { os_dialog_alert("Could not locate script file","No script file with this name exists."); } }
bool iface_write_settings_singleplayer(iface_type *iface,char *err_str) { int n; char path[1024]; bool ok; iface_sp_option_type *sp_option; // start new file xml_new_file(); // singleplayer xml_add_tagstart("Singleplayer"); xml_add_tagend(FALSE); // settings xml_add_tagstart("Settings"); xml_add_attribute_boolean("skill",iface->singleplayer.skill); xml_add_attribute_boolean("map_pick",iface->singleplayer.map_pick); xml_add_attribute_int("map_pick_ss_reveal_id",iface->singleplayer.map_pick_ss_reveal_id); xml_add_tagend(TRUE); // options xml_add_tagstart("Options"); xml_add_tagend(FALSE); sp_option=iface->singleplayer.option_list.options; for (n=0;n!=iface->singleplayer.option_list.noption;n++) { xml_add_tagstart("Option"); xml_add_attribute_text("name",sp_option->name); xml_add_attribute_text("description",sp_option->descript); xml_add_attribute_int("ss_reveal_id",sp_option->ss_reveal_id); xml_add_tagend(TRUE); sp_option++; } xml_add_tagclose("Options"); xml_add_tagclose("Singleplayer"); // write the xml file_paths_data(&file_path_setup,path,"Settings","Singleplayer","xml"); ok=xml_save_file(path,err_str); xml_close_file(); return(ok); }
void iface_read_settings_singleplayer(iface_type *iface) { int singleplayer_head_tag, settings_tag,options_head_tag,option_tag; char path[1024]; iface_sp_option_type *sp_option; // get xml file file_paths_data(&file_path_setup,path,"Settings","Singleplayer","xml"); if (!xml_open_file(path)) return; singleplayer_head_tag=xml_findrootchild("Singleplayer"); if (singleplayer_head_tag==-1) { xml_close_file(); return; } // settings settings_tag=xml_findfirstchild("Settings",singleplayer_head_tag); if (settings_tag!=-1) { iface->singleplayer.skill=xml_get_attribute_boolean(settings_tag,"skill"); iface->singleplayer.map_pick=xml_get_attribute_boolean(settings_tag,"map_pick"); iface->singleplayer.map_pick_ss_reveal_id=xml_get_attribute_int_default(settings_tag,"map_pick_ss_reveal_id",-1); } // options options_head_tag=xml_findfirstchild("Options",singleplayer_head_tag); if (options_head_tag!=-1) { iface->singleplayer.option_list.noption=0; option_tag=xml_findfirstchild("Option",options_head_tag); while (option_tag!=-1) { sp_option=&iface->singleplayer.option_list.options[iface->singleplayer.option_list.noption]; xml_get_attribute_text(option_tag,"name",sp_option->name,name_str_len); xml_get_attribute_text(option_tag,"description",sp_option->descript,64); sp_option->ss_reveal_id=xml_get_attribute_int_default(option_tag,"ss_reveal_id",-1); iface->singleplayer.option_list.noption++; if (iface->singleplayer.option_list.noption==max_net_option) break; option_tag=xml_findnextchild(option_tag); } } xml_close_file(); }
bool setup_xml_read(void) { char path[1024]; // check user specific setup XML file. If it exists, use that, // otherwise use default XML file if (!file_paths_documents_exist(&setup.file_path_setup,path,"Settings","Setup","xml")) { file_paths_data(&setup.file_path_setup,path,"Settings","Setup","xml"); } return(setup_xml_read_path(path)); }
bool map_open(map_type *map,char *name,bool in_engine) { if (!map_new(map,name)) return(FALSE); strcpy(map->info.name,name); file_paths_data(&maputility_settings.file_path_setup,map->info.load_path,"Maps",map->info.name,"xml"); if (!read_map_xml(map,in_engine)) return(FALSE); if (!map_textures_read(map,in_engine)) return(FALSE); map_find_random_spot_clear(map,NULL,NULL); return(TRUE); }
bool setup_xml_read(void) { char path[1024]; // check user specific setup XML file. If it exists, use that, // otherwise use default XML file if (!file_paths_app_data_exist(&file_path_setup,path,"Settings","Setup","xml")) { file_paths_data(&file_path_setup,path,"Settings","Setup","xml"); } if (!setup_xml_read_path(path)) return(FALSE); return(TRUE); }
void read_settings_action(void) { int n,actions_head_tag,action_tag,idx; char name[name_str_len],path[1024]; // default actions for (n=0;n!=ncontrol;n++) { strcpy(action_display[n].display_name,control_names_str[n]); action_display[n].show=TRUE; } // read in actions from setting files file_paths_data(&setup.file_path_setup,path,"Settings","Actions","xml"); if (!xml_open_file(path)) return; // decode the file actions_head_tag=xml_findrootchild("Actions"); if (actions_head_tag!=-1) { action_tag=xml_findfirstchild("Action",actions_head_tag); while (action_tag!=-1) { xml_get_attribute_text(action_tag,"name",name,name_str_len); idx=setup_find_control_for_name(name); if (idx!=-1) { xml_get_attribute_text(action_tag,"display",action_display[idx].display_name,name_str_len); action_display[idx].show=xml_get_attribute_boolean(action_tag,"show"); } action_tag=xml_findnextchild(action_tag); } } xml_close_file(); }
bool read_mesh_xml(model_type *model) { int version,model_head; char sub_path[1024],path[1024]; // load the model xml sprintf(sub_path,"Models/%s",model->name); file_paths_data(&modelutility_settings.file_path_setup,path,sub_path,"mesh","xml"); if (!xml_open_file(path)) return(FALSE); model_head=xml_findrootchild("Model"); if (model_head==-1) { xml_close_file(); return(FALSE); } // get the version version=xml_get_attribute_int_default(model_head,"version",1); // decode switch (version) { case 1: decode_mesh_v1_xml(model,model_head); break; case 2: decode_mesh_v2_xml(model,model_head); break; } xml_close_file(); return(TRUE); }
void iface_read_settings_halo(iface_type *iface) { int nhalo,halos_head_tag,halo_tag,tag; char path[1024]; iface_halo_type *halo; // read in interface from setting files file_paths_data(&file_path_setup,path,"Settings","Halos","xml"); if (!xml_open_file(path)) return; // get counts halos_head_tag=xml_findrootchild("Halos"); if (halos_head_tag==-1) { xml_close_file(); return; } nhalo=xml_countchildren(halos_head_tag); if (nhalo==0) { xml_close_file(); return; } // read the halos halo_tag=xml_findfirstchild("Halo",halos_head_tag); while (halo_tag!=-1) { // create a new halo if (iface->halo_list.nhalo>=max_iface_halo) { xml_close_file(); return; } halo=&iface->halo_list.halos[iface->halo_list.nhalo]; iface->halo_list.nhalo++; // read settings xml_get_attribute_text(halo_tag,"name",halo->name,name_str_len); tag=xml_findfirstchild("Image",halo_tag); if (tag!=-1) { xml_get_attribute_text(tag,"file",halo->bitmap_name,file_str_len); } halo->min_dist=3000; halo->max_dist=50000; halo->min_size=500; halo->max_size=200; halo->min_alpha=0.8f; halo->max_alpha=0.05f; halo->no_clip_object=FALSE; halo->no_clip_self=TRUE; tag=xml_findfirstchild("Distance",halo_tag); if (tag!=-1) { halo->min_dist=xml_get_attribute_int(tag,"min"); halo->max_dist=xml_get_attribute_int(tag,"max"); } tag=xml_findfirstchild("Size",halo_tag); if (tag!=-1) { halo->min_size=xml_get_attribute_int(tag,"min"); halo->max_size=xml_get_attribute_int(tag,"max"); } tag=xml_findfirstchild("Alpha",halo_tag); if (tag!=-1) { halo->min_alpha=xml_get_attribute_float(tag,"min"); halo->max_alpha=xml_get_attribute_float(tag,"max"); } tag=xml_findfirstchild("Option",halo_tag); if (tag!=-1) { halo->no_clip_object=xml_get_attribute_boolean(tag,"no_clip_object"); halo->no_clip_self=xml_get_attribute_boolean(tag,"no_clip_self"); } // move on to next halo halo_tag=xml_findnextchild(halo_tag); } xml_close_file(); }
bool iface_write_settings_halo(iface_type *iface,char *err_str) { int n; char path[1024]; bool ok; iface_halo_type *halo; // start new file xml_new_file(); xml_add_tagstart("Halos"); xml_add_tagend(FALSE); halo=iface->halo_list.halos; for (n=0;n!=iface->halo_list.nhalo;n++) { xml_add_tagstart("Halo"); xml_add_attribute_text("name",halo->name); xml_add_tagend(FALSE); xml_add_tagstart("Image"); xml_add_attribute_text("file",halo->bitmap_name); xml_add_tagend(TRUE); xml_add_tagstart("Distance"); xml_add_attribute_int("min",halo->min_dist); xml_add_attribute_int("max",halo->max_dist); xml_add_tagend(TRUE); xml_add_tagstart("Size"); xml_add_attribute_int("min",halo->min_size); xml_add_attribute_int("max",halo->max_size); xml_add_tagend(TRUE); xml_add_tagstart("Alpha"); xml_add_attribute_float("min",halo->min_alpha); xml_add_attribute_float("max",halo->max_alpha); xml_add_tagend(TRUE); xml_add_tagstart("Option"); xml_add_attribute_boolean("no_clip_object",halo->no_clip_object); xml_add_attribute_boolean("no_clip_self",halo->no_clip_self); xml_add_tagend(TRUE); xml_add_tagclose("Halo"); halo++; } xml_add_tagclose("Halos"); // write the xml file_paths_data(&file_path_setup,path,"Settings","Halos","xml"); ok=xml_save_file(path,err_str); xml_close_file(); return(ok); }
void read_settings_ring(void) { int nring,ring_head_tag,ring_tag,tag; char path[1024]; ring_type *ring; // no rings yet server.rings=NULL; server.count.ring=0; // read in rings from setting files file_paths_data(&setup.file_path_setup,path,"Settings","Rings","xml"); if (!xml_open_file(path)) return; // get counts ring_head_tag=xml_findrootchild("Rings"); if (ring_head_tag==-1) { xml_close_file(); return; } nring=xml_countchildren(ring_head_tag); if (nring==0) { xml_close_file(); return; } server.rings=(ring_type*)malloc(sizeof(ring_type)*nring); if (server.rings==NULL) { xml_close_file(); return; } // read in the rings ring_tag=xml_findfirstchild("Ring",ring_head_tag); while (ring_tag!=-1) { // create a new ring ring=&server.rings[server.count.ring]; xml_get_attribute_text(ring_tag,"name",ring->name,name_str_len); ring->life_msec=1000; ring->blend_add=FALSE; tag=xml_findfirstchild("Settings",ring_tag); if (tag!=-1) { ring->life_msec=xml_get_attribute_int(tag,"time"); ring->blend_add=xml_get_attribute_boolean(tag,"additive"); } ring->animate.image_count=1; ring->animate.image_per_row=1; ring->animate.msec=200; ring->animate.loop=TRUE; ring->animate.loop_back=FALSE; tag=xml_findfirstchild("Image",ring_tag); if (tag!=-1) { xml_get_attribute_text(tag,"file",ring->bitmap_name,file_str_len); ring->animate.image_count=xml_get_attribute_int(tag,"count"); ring->animate.image_per_row=(int)sqrt((float)ring->animate.image_count); ring->animate.msec=xml_get_attribute_int(tag,"time"); ring->animate.loop=xml_get_attribute_boolean(tag,"loop"); ring->animate.loop_back=xml_get_attribute_boolean(tag,"loop_back"); } tag=xml_findfirstchild("Outer",ring_tag); if (tag!=-1) { ring->start_outer_size=xml_get_attribute_int(tag,"start"); ring->end_outer_size=xml_get_attribute_int(tag,"end"); } tag=xml_findfirstchild("Inner",ring_tag); if (tag!=-1) { ring->start_inner_size=xml_get_attribute_int(tag,"start"); ring->end_inner_size=xml_get_attribute_int(tag,"end"); } tag=xml_findfirstchild("Rotate",ring_tag); if (tag!=-1) { ring->ang.x=xml_get_attribute_float(tag,"x"); ring->ang.y=xml_get_attribute_float(tag,"y"); ring->ang.z=xml_get_attribute_float(tag,"z"); ring->rot.x=xml_get_attribute_float_default(tag,"x_add",0.0f); ring->rot.y=xml_get_attribute_float_default(tag,"y_add",0.0f); ring->rot.z=xml_get_attribute_float_default(tag,"z_add",0.0f); ring->rot_accel.x=xml_get_attribute_float_default(tag,"x_accel",0.0f); ring->rot_accel.y=xml_get_attribute_float_default(tag,"y_accel",0.0f); ring->rot_accel.z=xml_get_attribute_float_default(tag,"z_accel",0.0f); } tag=xml_findfirstchild("Move",ring_tag); if (tag!=-1) { ring->vct.x=xml_get_attribute_float(tag,"x"); ring->vct.y=xml_get_attribute_float(tag,"y"); ring->vct.z=xml_get_attribute_float(tag,"z"); } ring->start_color.r=ring->start_color.g=ring->start_color.b=1.0f; ring->end_color.r=ring->end_color.g=ring->end_color.b=1.0f; ring->team_tint=FALSE; tag=xml_findfirstchild("Color",ring_tag); if (tag!=-1) { xml_get_attribute_color(tag,"start",&ring->start_color); xml_get_attribute_color(tag,"end",&ring->end_color); ring->team_tint=xml_get_attribute_boolean(tag,"team"); } tag=xml_findfirstchild("Alpha",ring_tag); if (tag!=-1) { ring->start_alpha=xml_get_attribute_float(tag,"start"); ring->end_alpha=xml_get_attribute_float(tag,"end"); } // move on to next ring server.count.ring++; ring_tag=xml_findnextchild(ring_tag); } xml_close_file(); }
bool iface_write_settings_ring(iface_type *iface,char *err_str) { int n; char path[1024]; bool ok; iface_ring_type *ring; // start new file xml_new_file(); xml_add_tagstart("Rings"); xml_add_tagend(FALSE); ring=iface->ring_list.rings; for (n=0;n!=iface->ring_list.nring;n++) { xml_add_tagstart("Ring"); xml_add_attribute_text("name",ring->name); xml_add_tagend(FALSE); xml_add_tagstart("Settings"); xml_add_attribute_int("time",ring->life_msec); xml_add_attribute_boolean("additive",ring->blend_add); xml_add_tagend(TRUE); xml_add_tagstart("Image"); xml_add_attribute_text("file",ring->bitmap_name); xml_add_attribute_int("count",ring->animate.image_count); xml_add_attribute_int("time",ring->animate.msec); xml_add_attribute_boolean("loop",ring->animate.loop); xml_add_attribute_boolean("loop_back",ring->animate.loop_back); xml_add_tagend(TRUE); xml_add_tagstart("Outer"); xml_add_attribute_int("start",ring->start_outer_size); xml_add_attribute_int("end",ring->end_outer_size); xml_add_tagend(TRUE); xml_add_tagstart("Inner"); xml_add_attribute_int("start",ring->start_inner_size); xml_add_attribute_int("end",ring->end_inner_size); xml_add_tagend(TRUE); xml_add_tagstart("Rotate"); xml_add_attribute_float("x",ring->ang.x); xml_add_attribute_float("y",ring->ang.y); xml_add_attribute_float("z",ring->ang.z); xml_add_attribute_float("x_add",ring->rot.x); xml_add_attribute_float("y_add",ring->rot.y); xml_add_attribute_float("z_add",ring->rot.z); xml_add_attribute_float("x_accel",ring->rot_accel.x); xml_add_attribute_float("y_accel",ring->rot_accel.y); xml_add_attribute_float("z_accel",ring->rot_accel.z); xml_add_tagend(TRUE); xml_add_tagstart("Move"); xml_add_attribute_float("x",ring->vct.x); xml_add_attribute_float("y",ring->vct.y); xml_add_attribute_float("z",ring->vct.z); xml_add_tagend(TRUE); xml_add_tagstart("Color"); xml_add_attribute_color("start",&ring->start_color); xml_add_attribute_color("end",&ring->end_color); xml_add_tagend(TRUE); xml_add_tagstart("Alpha"); xml_add_attribute_float("start",ring->start_alpha); xml_add_attribute_float("end",ring->end_alpha); xml_add_tagend(TRUE); xml_add_tagclose("Ring"); ring++; } xml_add_tagclose("Rings"); // write the xml file_paths_data(&file_path_setup,path,"Settings","Rings","xml"); ok=xml_save_file(path,err_str); xml_close_file(); return(ok); }
void script_load_user_defines(void) { int cnt,sz; char path[1024],tmp_name[64],tmp_value[64]; char *c,*data; FILE *file; struct stat sb; script_define_type *define; script_user_defines=NULL; // read defines file file_paths_data(&file_path_setup,path,"Scripts/Global","Defines","txt"); file=fopen(path,"rb"); if (file==NULL) return; stat(path,&sb); sz=sb.st_size; data=malloc(sz+1); if (data==NULL) return; fread(data,1,sz,file); fclose(file); data[sz]=0x0; // count returns cnt=0; c=data; while (TRUE) { if (script_load_user_defines_line(c,tmp_name,tmp_value)) cnt++; c=strchr(c,'\n'); if (c==NULL) break; c++; } // create defines script_user_defines=malloc((cnt+1)*sizeof(script_define_type)); if (script_user_defines==NULL) { free(data); return; } c=data; define=script_user_defines; while (TRUE) { if (script_load_user_defines_line(c,define->name,define->value_str)) { define->value_int=0; define++; } c=strchr(c,'\n'); if (c==NULL) break; c++; } define->value_int=-1; // free file free(data); }
bool read_pose_xml(model_type *model) { int n,k,t,npose,pose_idx,cnt, tag,model_head,bone_tag,poses_tag,pose_tag,constraint_bone_idx; char sub_path[1024],path[1024]; model_tag constraint_bone_tag; model_bone_move_type *bone_move; model_pose_type *pose; // load the pose xml sprintf(sub_path,"Models/%s",model->name); file_paths_data(&modelutility_settings.file_path_setup,path,sub_path,"pose","xml"); if (!xml_open_file(path)) return(FALSE); model_head=xml_findrootchild("Model"); if (model_head==-1) return(FALSE); // poses poses_tag=xml_findfirstchild("Poses",model_head); npose=xml_countchildren(poses_tag); pose_tag=xml_findfirstchild("Pose",poses_tag); for (n=0;n!=npose;n++) { // add new pose pose_idx=model_pose_add(model); if (pose_idx==-1) { xml_close_file(); return(FALSE); } pose=&model->poses[pose_idx]; // set pose data xml_get_attribute_text(pose_tag,"name",pose->name,64); bone_move=pose->bone_moves; for (k=0;k!=model->nbone;k++) { bone_move->rot.x=bone_move->rot.z=bone_move->rot.y=0.0f; bone_move->mov.x=bone_move->mov.z=bone_move->mov.y=1.0f; bone_move->acceleration=0; bone_move->skip_blended=FALSE; bone_move->constraint.bone_idx=-1; bone_move->constraint.offset.x=bone_move->constraint.offset.y=bone_move->constraint.offset.z=0; bone_move++; } bone_tag=xml_findfirstchild("Bones",pose_tag); cnt=xml_countchildren(bone_tag); tag=xml_findfirstchild("Bone",bone_tag); for (k=0;k!=cnt;k++) { t=model_find_bone(model,xml_get_attribute_model_tag(tag,"tag")); if (t!=-1) { bone_move=&pose->bone_moves[t]; xml_get_attribute_3_coord_float(tag,"rot",&bone_move->rot.x,&bone_move->rot.y,&bone_move->rot.z); xml_get_attribute_3_coord_float(tag,"move",&bone_move->mov.x,&bone_move->mov.y,&bone_move->mov.z); bone_move->acceleration=xml_get_attribute_float(tag,"acceleration"); bone_move->skip_blended=xml_get_attribute_boolean(tag,"skip_blended"); bone_move->constraint.bone_idx=-1; bone_move->constraint.offset.x=bone_move->constraint.offset.y=bone_move->constraint.offset.z=0; constraint_bone_tag=xml_get_attribute_model_tag(tag,"constraint_bone"); if (constraint_bone_tag!=model_null_tag) { constraint_bone_idx=model_find_bone(model,constraint_bone_tag); if (constraint_bone_idx!=-1) { bone_move->constraint.bone_idx=constraint_bone_idx; xml_get_attribute_3_coord_int(tag,"constraint_offset",&bone_move->constraint.offset.x,&bone_move->constraint.offset.y,&bone_move->constraint.offset.z); } } } tag=xml_findnextchild(tag); } pose_tag=xml_findnextchild(pose_tag); } xml_close_file(); return(TRUE); }
void view_images_load(void) { int n; char path[1024]; hud_bitmap_type *hud_bitmap; hud_radar_icon_type *icon; halo_type *halo; mark_type *mark; crosshair_type *crosshair; particle_type *particle; ring_type *ring; view.count.image=0; // hud bitmaps hud_bitmap=hud.bitmaps; for (n=0;n!=hud.count.bitmap;n++) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Interface",hud_bitmap->filename,"png"); hud_bitmap->image_idx=view_images_load_single(path,TRUE); hud_bitmap++; } // radar if (hud.radar.on) { // radar background file_paths_data(&setup.file_path_setup,path,"Bitmaps/Radar",hud.radar.background_bitmap_name,"png"); hud.radar.background_image_idx=view_images_load_single(path,TRUE); // radar icons icon=hud.radar.icons; for (n=0;n!=hud.radar.nicon;n++) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Radar",icon->bitmap_name,"png"); icon->image_idx=view_images_load_single(path,TRUE); icon++; } } // halos halo=server.halos; for (n=0;n!=server.count.halo;n++) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Halos",halo->bitmap_name,"png"); halo->image_idx=view_images_load_single(path,FALSE); halo++; } // marks mark=server.marks; for (n=0;n!=server.count.mark;n++) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Marks",mark->bitmap_name,"png"); mark->image_idx=view_images_load_single(path,FALSE); mark++; } // crosshairs crosshair=server.crosshairs; for (n=0;n!=server.count.crosshair;n++) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Crosshairs",crosshair->bitmap_name,"png"); crosshair->image_idx=view_images_load_single(path,TRUE); crosshair++; } // particles particle=server.particles; for (n=0;n!=server.count.particle;n++) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Particles",particle->bitmap_name,"png"); particle->image_idx=view_images_load_single(path,FALSE); particle++; } // rings ring=server.rings; for (n=0;n!=server.count.ring;n++) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Rings",ring->bitmap_name,"png"); ring->image_idx=view_images_load_single(path,FALSE); ring++; } // remote bitmaps if (net_setup.client.joined) { file_paths_data(&setup.file_path_setup,path,"Bitmaps/Network","slow","png"); remote_slow_image_idx=view_images_load_single(path,TRUE); file_paths_data(&setup.file_path_setup,path,"Bitmaps/Network","talk","png"); remote_talk_image_idx=view_images_load_single(path,TRUE); } }
void read_settings_crosshair(void) { int ncrosshair,crosshairs_head_tag,crosshair_tag,tag; char path[1024]; crosshair_type *crosshair; // no crosshairs yet server.crosshairs=NULL; server.count.crosshair=0; // read in crosshairs from setting files file_paths_data(&setup.file_path_setup,path,"Settings","Crosshairs","xml"); if (!xml_open_file(path)) return; // get counts crosshairs_head_tag=xml_findrootchild("Crosshairs"); if (crosshairs_head_tag==-1) { xml_close_file(); return; } ncrosshair=xml_countchildren(crosshairs_head_tag); if (ncrosshair==0) { xml_close_file(); return; } server.crosshairs=(crosshair_type*)malloc(sizeof(crosshair_type)*ncrosshair); if (server.crosshairs==NULL) { xml_close_file(); return; } // read the crosshairs crosshair_tag=xml_findfirstchild("Crosshair",crosshairs_head_tag); while (crosshair_tag!=-1) { // create a new crosshair crosshair=&server.crosshairs[server.count.crosshair]; xml_get_attribute_text(crosshair_tag,"name",crosshair->name,name_str_len); tag=xml_findfirstchild("Image",crosshair_tag); if (tag!=-1) { xml_get_attribute_text(tag,"file",crosshair->bitmap_name,file_str_len); } // move on to next crosshair server.count.crosshair++; crosshair_tag=xml_findnextchild(crosshair_tag); } xml_close_file(); }
int view_dim3rtl_create_material_from_texture(char *sub_path,texture_type *texture,texture_frame_type *frame) { int material_id,wid,high,png_wid,png_high; bool alpha_channel; char name[256],path[1024]; unsigned char *png_data; // create material, use original // bitmap for wid/high file_paths_data(&file_path_setup,path,sub_path,frame->name,"png"); png_data=png_utility_read(path,&wid,&high,&alpha_channel); if (png_data==NULL) return(-1); material_id=rtlMaterialAdd(wid,high,texture->rl_alpha_type,0); rtlMaterialAttachBufferData(material_id,RL_MATERIAL_TARGET_COLOR,(alpha_channel?RL_MATERIAL_FORMAT_32_RGBA:RL_MATERIAL_FORMAT_24_RGB),png_data); free(png_data); rtlMaterialSetRefractionFactor(material_id,texture->rl_refract_factor); // normal map sprintf(name,"%s_n",frame->name); file_paths_data(&file_path_setup,path,sub_path,name,"png"); png_data=png_utility_read(path,&png_wid,&png_high,&alpha_channel); if (png_data!=NULL) { if ((png_wid!=wid) || (png_high!=high)) { fprintf(stdout,"%s: Not correct size for material\n",path); } else { rtlMaterialAttachBufferData(material_id,RL_MATERIAL_TARGET_NORMAL,(alpha_channel?RL_MATERIAL_FORMAT_32_RGBA:RL_MATERIAL_FORMAT_24_RGB),png_data); } free(png_data); } // specular map sprintf(name,"%s_s",frame->name); file_paths_data(&file_path_setup,path,sub_path,name,"png"); png_data=png_utility_read(path,&png_wid,&png_high,&alpha_channel); if (png_data!=NULL) { if ((png_wid!=wid) || (png_high!=high)) { fprintf(stdout,"%s: Not correct size for material\n",path); } else { rtlMaterialAttachBufferData(material_id,RL_MATERIAL_TARGET_SPECULAR,(alpha_channel?RL_MATERIAL_FORMAT_32_RGBA:RL_MATERIAL_FORMAT_24_RGB),png_data); } free(png_data); } rtlMaterialSetShineFactor(material_id,texture->shine_factor); // glow map sprintf(name,"%s_g",frame->name); file_paths_data(&file_path_setup,path,sub_path,name,"png"); png_data=png_utility_read(path,&png_wid,&png_high,&alpha_channel); if (png_data!=NULL) { if ((png_wid!=wid) || (png_high!=high)) { fprintf(stdout,"%s: Not correct size for material\n",path); } else { rtlMaterialAttachBufferData(material_id,RL_MATERIAL_TARGET_GLOW,(alpha_channel?RL_MATERIAL_FORMAT_32_RGBA:RL_MATERIAL_FORMAT_24_RGB),png_data); } free(png_data); } rtlMaterialSetGlowFactor(material_id,texture->glow.min); // mipmaps rtlMaterialBuildMipMaps(material_id); return(material_id); }