/* * Portions of this file are copyright Rebirth contributors and licensed as * described in COPYING.txt. * Portions of this file are copyright Parallax Software and licensed * according to the Parallax license below. * See COPYING.txt for license details. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* * * Functions to change entire mines. * */ #include #include #include #include "dxxerror.h" #include "strutil.h" #include "inferno.h" #include "editor.h" #include "editor/esegment.h" #include "editor/medmisc.h" #include "ui.h" #include "texpage.h" // For texpage_goto_first #include "segment.h" #include "kdefs.h" #include "info.h" #include "game.h" #include "physfsx.h" #include "gameseq.h" #include "object.h" char mine_filename[PATH_MAX] = "*.MIN"; static char sit_filename[PATH_MAX] = "*.SIT"; #define MAX_NAME_LENGTH PATH_MAX // See if filename f contains an extent. If not, add extent ext. static void checkforext( char * f, const char *ext ) { int i; for (i=1; ipos.x,(unsigned int) ConsoleObject->pos.y,(unsigned int) ConsoleObject->pos.z); // Write player orientation. PHYSFSX_printf(SaveFile, "%8x %8x %8x\n",(unsigned int) ConsoleObject->orient.rvec.x,(unsigned int) ConsoleObject->orient.rvec.y,(unsigned int) ConsoleObject->orient.rvec.z); PHYSFSX_printf(SaveFile, "%8x %8x %8x\n",(unsigned int) ConsoleObject->orient.uvec.x,(unsigned int) ConsoleObject->orient.uvec.y,(unsigned int) ConsoleObject->orient.uvec.z); PHYSFSX_printf(SaveFile, "%8x %8x %8x\n",(unsigned int) ConsoleObject->orient.fvec.x,(unsigned int) ConsoleObject->orient.fvec.y,(unsigned int) ConsoleObject->orient.fvec.z); PHYSFSX_printf(SaveFile, "%i\n", ConsoleObject->segnum); return 1; } // ----------------------------------------------------------------------------- int SaveSituation(void) { if (ui_get_filename( sit_filename, "*.SIT", "Save Situation" )) { set_extension(sit_filename, "MIN"); if (med_save_mine(sit_filename)) { return 0; } set_extension(sit_filename, "SIT"); if (med_save_situation(sit_filename)) return 0; } return 1; } // ----------------------------------------------------------------------------- // Load a situation file which consists of x,y,z, orientation matrix, mine name. int LoadSituation(void) { if (SafetyCheck()) { if (ui_get_filename( sit_filename, "*.sit", "Load Situation" )) { checkforext(sit_filename, "SIT"); if (med_load_situation(sit_filename)) return 0; // set_view_target_from_segment(Cursegp); Update_flags = UF_WORLD_CHANGED; // SetPlayerFromCurseg(); med_compress_mine(); init_info = 1; mine_changed = 0; } } return 1; }