void parse_thrust_glows(species_info *species, bool no_create) { if (!no_create) { required_string("$ThrustGlows:"); generic_anim_init(&species->thruster_info.glow.normal, NULL); generic_anim_init(&species->thruster_info.glow.afterburn, NULL); } else if (!optional_string("$ThrustGlows:")) { return; } if (no_create) { if (optional_string("+Normal:")) stuff_string(species->thruster_info.glow.normal.filename, F_NAME, MAX_FILENAME_LEN); } else { required_string("+Normal:"); stuff_string(species->thruster_info.glow.normal.filename, F_NAME, MAX_FILENAME_LEN); } // if no glow is wanted then clear it if ( !VALID_FNAME(species->thruster_info.glow.normal.filename) ) generic_anim_init(&species->thruster_info.glow.normal, NULL); if (no_create) { if (optional_string("+Afterburn:")) stuff_string(species->thruster_info.glow.afterburn.filename, F_NAME, MAX_FILENAME_LEN); } else { required_string("+Afterburn:"); stuff_string(species->thruster_info.glow.afterburn.filename, F_NAME, MAX_FILENAME_LEN); } // if no glow is wanted then clear it if ( !VALID_FNAME(species->thruster_info.glow.afterburn.filename) ) generic_anim_init(&species->thruster_info.glow.afterburn, NULL); }
// ------------------------------------------------------------------------------------ // shockwave_load() // // Call to load a shockwave, or add it and then load it // int shockwave_load(char *s_name, bool shock_3D) { uint i; int s_index = -1; shockwave_info *si = NULL; Assert( s_name ); // make sure that this is, or should be, valid if ( !VALID_FNAME(s_name) ) return -1; for (i = 0; i < Shockwave_info.size(); i++) { if ( !stricmp(Shockwave_info[i].filename, s_name) ) { s_index = i; break; } } if (s_index < 0) { shockwave_info si_tmp; strcpy(si_tmp.filename, s_name); Shockwave_info.push_back( si_tmp ); s_index = (int)(Shockwave_info.size() - 1); } Assert( s_index >= 0 ); si = &Shockwave_info[s_index]; // make sure to only try loading the shockwave once if ( (si->bitmap_id >= 0) || (si->model_id >= 0) ) return s_index; if (shock_3D) { si->model_id = model_load( si->filename, 0, NULL ); if ( si->model_id < 0 ) { Error(LOCATION, "Unable to load 3D shockwave '%s'!\n", si->filename); return -1; } } else { si->bitmap_id = bm_load_animation( si->filename, &si->num_frames, &si->fps, 1 ); if ( si->bitmap_id < 0 ) { Error(LOCATION, "Unable to load 2D shockwave '%s'!\n", si->filename); return -1; } } return s_index; }
int generic_bitmap_load(generic_bitmap *gb) { if ( !VALID_FNAME(gb->filename) ) return -1; gb->bitmap_id = bm_load(gb->filename); if (gb->bitmap_id < 0) return -1; return 0; }
// Goober5000 // load a generic_anim // return 0 is successful, otherwise return -1 int generic_anim_load(generic_anim *ga) { int fps; if ( !VALID_FNAME(ga->filename) ) return -1; ga->first_frame = bm_load_animation(ga->filename, &ga->num_frames, &fps, &ga->keyframe, &ga->total_time); //mprintf(("generic_anim_load: %s - keyframe = %d\n", ga->filename, ga->keyframe)); if (ga->first_frame < 0) return -1; ga->done_playing = 0; ga->anim_time = 0.0f; return 0; }
int event_editor::save_message(int num) { char *ptr; int i, conflict = 0; CListBox *list; UpdateData(TRUE); if (num >= 0) { ptr = (char *) (LPCTSTR) m_message_name; for (i=0; i<Num_builtin_messages; i++){ if (!stricmp(m_message_name, Messages[i].name)) { conflict = 1; break; } } for (i=0; i<m_num_messages; i++){ if ((i != num) && (!stricmp(m_message_name, m_messages[i].name))) { conflict = 1; break; } } if (!conflict) { // update name if no conflicts, otherwise keep old name string_copy(m_messages[num].name, m_message_name, NAME_LENGTH - 1); list = (CListBox *) GetDlgItem(IDC_MESSAGE_LIST); list->DeleteString(num); list->InsertString(num, m_message_name); } string_copy(m_messages[num].message, m_message_text, MESSAGE_LENGTH - 1); lcl_fred_replace_stuff(m_messages[num].message, MESSAGE_LENGTH); if (m_messages[num].avi_info.name){ free(m_messages[num].avi_info.name); } ptr = (char *) (LPCTSTR) m_avi_filename; if ( !ptr || !VALID_FNAME(ptr) ) { m_messages[num].avi_info.name = NULL; } else { m_messages[num].avi_info.name = strdup(ptr); } if (m_messages[num].wave_info.name){ free(m_messages[num].wave_info.name); } ptr = (char *) (LPCTSTR) m_wave_filename; if ( !ptr || !VALID_FNAME(ptr) ) { m_messages[num].wave_info.name = NULL; } else { m_messages[num].wave_info.name = strdup(ptr); } // update the persona to the message. We subtract 1 for the "None" at the beginning of the combo // box list. m_messages[num].persona_index = m_persona - 1; if(m_message_team >= MAX_TVT_TEAMS){ m_messages[num].multi_team = -1; m_message_team = -1; } else { m_messages[num].multi_team = m_message_team; } // possible TODO: auto-update event tree references to this message if we renamed it. } return 0; }
void parse_thrust_anims(species_info *species, bool no_create) { if (!no_create) { required_string("$ThrustAnims:"); generic_anim_init(&species->thruster_info.flames.normal, NULL); generic_anim_init(&species->thruster_info.flames.afterburn, NULL); generic_bitmap_init(&species->thruster_secondary_glow_info.normal, NULL); generic_bitmap_init(&species->thruster_secondary_glow_info.afterburn, NULL); generic_bitmap_init(&species->thruster_tertiary_glow_info.normal, NULL); generic_bitmap_init(&species->thruster_tertiary_glow_info.afterburn, NULL); generic_bitmap_init(&species->thruster_distortion_info.normal, NULL); generic_bitmap_init(&species->thruster_distortion_info.afterburn, NULL); } else if (!optional_string("$ThrustAnims:")) { return; } // favor new style if (no_create) { if (optional_string("+Pri_Normal:") || optional_string("+Normal:")) stuff_string(species->thruster_info.flames.normal.filename, F_NAME, MAX_FILENAME_LEN); } else { if (!optional_string("+Pri_Normal:")) required_string("+Normal:"); stuff_string(species->thruster_info.flames.normal.filename, F_NAME, MAX_FILENAME_LEN); } // if no primary thruster anim is wanted then clear it if ( !VALID_FNAME(species->thruster_info.flames.normal.filename) ) generic_anim_init(&species->thruster_info.flames.normal, NULL); // and again if (no_create) { if (optional_string("+Pri_Afterburn:") || optional_string("+Afterburn:")) stuff_string(species->thruster_info.flames.afterburn.filename, F_NAME, MAX_FILENAME_LEN); } else { if (!optional_string("+Pri_Afterburn:")) required_string("+Afterburn:"); stuff_string(species->thruster_info.flames.afterburn.filename, F_NAME, MAX_FILENAME_LEN); } // if no primary thruster anim is wanted then clear it if ( !VALID_FNAME(species->thruster_info.flames.afterburn.filename) ) generic_anim_init(&species->thruster_info.flames.afterburn, NULL); // extra thruster stuff, bah if (optional_string("+Sec_Normal:")) stuff_string(species->thruster_secondary_glow_info.normal.filename, F_NAME, MAX_FILENAME_LEN); // etc. if (optional_string("+Sec_Afterburn:")) stuff_string(species->thruster_secondary_glow_info.afterburn.filename, F_NAME, MAX_FILENAME_LEN); // etc. if (optional_string("+Ter_Normal:")) stuff_string(species->thruster_tertiary_glow_info.normal.filename, F_NAME, MAX_FILENAME_LEN); // etc. if (optional_string("+Ter_Afterburn:")) stuff_string(species->thruster_tertiary_glow_info.afterburn.filename, F_NAME, MAX_FILENAME_LEN); // etc. if (optional_string("+Dist_Normal:")) stuff_string(species->thruster_distortion_info.normal.filename, F_NAME, MAX_FILENAME_LEN); // etc. if (optional_string("+Dist_Afterburn:")) stuff_string(species->thruster_distortion_info.afterburn.filename, F_NAME, MAX_FILENAME_LEN); }