2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
16 * Game Loading editor functions
32 char game_filename[PATH_MAX] = "*.RL2";
34 extern void checkforext( char * f, char *ext );
36 void checkforgamext( char * f )
40 for (i=1; i<strlen(f); i++ )
42 if (f[i]=='.') return;
44 if ((f[i]==' '||f[i]==0) )
66 //these variables store the "permanant" player position, which overrides
67 //whatever the player's position happens to be when the game is saved
68 int Perm_player_segnum=-1; //-1 means position not set
69 vms_vector Perm_player_position;
70 vms_matrix Perm_player_orient;
72 //set the player's "permanant" position from the current position
73 int SetPlayerPosition()
75 Perm_player_position = ConsoleObject->pos;
76 Perm_player_orient = ConsoleObject->orient;
77 Perm_player_segnum = ConsoleObject->segnum;
79 editor_status("Player initial position set");
84 // returns 1 if successful
85 // returns 0 if unsuccessful
90 if (gamestate_not_restored) {
91 sprintf( Message, "Game State has not been restored...\nContinue?\n");
92 if (ui_messagebox( -2, -2, 2, Message, "NO", "Yes" )==1)
96 if (ui_get_filename( game_filename, "*.RL2", "SAVE GAME" )) {
98 vms_vector save_pos = ConsoleObject->pos;
99 vms_matrix save_orient = ConsoleObject->orient;
100 int save_segnum = ConsoleObject->segnum;
102 checkforgamext(game_filename);
104 if (Perm_player_segnum > Highest_segment_index)
105 Perm_player_segnum = -1;
107 if (Perm_player_segnum!=-1) {
108 if (get_seg_masks(&Perm_player_position, Perm_player_segnum, 0, __FILE__, __LINE__).centermask == 0)
110 ConsoleObject->pos = Perm_player_position;
111 obj_relink(OBJECT_NUMBER(ConsoleObject), Perm_player_segnum);
112 ConsoleObject->orient = Perm_player_orient;
115 Perm_player_segnum=-1; //position was bogus
117 saved_flag=save_level(game_filename);
118 if (Perm_player_segnum!=-1) {
119 int found_save_segnum;
121 if (save_segnum > Highest_segment_index)
124 ConsoleObject->pos = save_pos;
125 found_save_segnum = find_point_seg(&save_pos,save_segnum);
126 if (found_save_segnum == -1) {
127 compute_segment_center(&save_pos, &(Segments[save_segnum]));
128 found_save_segnum = save_segnum;
131 obj_relink(OBJECT_NUMBER(ConsoleObject), found_save_segnum);
132 ConsoleObject->orient = save_orient;
141 // returns 1 if successful
142 // returns 0 if unsuccessful
146 if (ui_get_filename( game_filename, "*.RL2", "LOAD GAME" ))
148 checkforgamext(game_filename);
149 if (load_level(game_filename))
151 Current_level_num = 0; //not a real level
152 gamestate_not_restored = 0;
153 Update_flags = UF_WORLD_CHANGED;
154 Perm_player_position = ConsoleObject->pos;
155 Perm_player_orient = ConsoleObject->orient;
156 Perm_player_segnum = ConsoleObject->segnum;
162 //called whenever a new mine is created, so new mine doesn't get name
163 //of last saved mine as default
166 strcpy(game_filename,"*.LVL");