2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #include "../../idlib/precompiled.h"
34 #define MAX_POINTFILE 8192
35 static idVec3 s_pointvecs[MAX_POINTFILE];
36 static int s_num_points, s_check_point;
38 void Pointfile_Delete (void)
42 strcpy (name, currentmap);
43 StripExtension (name);
44 strcat (name, ".lin");
49 // advance camera to next point
50 void Pointfile_Next (void)
54 if (s_check_point >= s_num_points-2)
56 Sys_Status ("End of pointfile", 0);
60 VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetCamera()->Camera().origin);
61 VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetXYWnd()->GetOrigin());
62 VectorSubtract (s_pointvecs[s_check_point+1], g_pParentWnd->GetCamera()->Camera().origin, dir);
64 g_pParentWnd->GetCamera()->Camera().angles[1] = atan2 (dir[1], dir[0])*180/3.14159;
65 g_pParentWnd->GetCamera()->Camera().angles[0] = asin (dir[2])*180/3.14159;
67 Sys_UpdateWindows (W_ALL);
70 // advance camera to previous point
71 void Pointfile_Prev (void)
75 if ( s_check_point == 0)
77 Sys_Status ("Start of pointfile", 0);
81 VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetCamera()->Camera().origin);
82 VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetXYWnd()->GetOrigin());
83 VectorSubtract (s_pointvecs[s_check_point+1], g_pParentWnd->GetCamera()->Camera().origin, dir);
85 g_pParentWnd->GetCamera()->Camera().angles[1] = atan2 (dir[1], dir[0])*180/3.14159;
86 g_pParentWnd->GetCamera()->Camera().angles[0] = asin (dir[2])*180/3.14159;
88 Sys_UpdateWindows (W_ALL);
91 void WINAPI Pointfile_Check (void)
97 strcpy (name, currentmap);
98 StripExtension (name);
99 strcat (name, ".lin");
101 f = fopen (name, "r");
105 common->Printf ("Reading pointfile %s\n", name);
107 if (!g_qeglobals.d_pointfile_display_list)
108 g_qeglobals.d_pointfile_display_list = qglGenLists(1);
111 qglNewList (g_qeglobals.d_pointfile_display_list, GL_COMPILE);
112 qglColor3f (1, 0, 0);
113 qglDisable(GL_TEXTURE_2D);
114 qglDisable(GL_TEXTURE_1D);
116 qglBegin(GL_LINE_STRIP);
119 if (fscanf (f, "%f %f %f\n", &v[0], &v[1], &v[2]) != 3)
121 if (s_num_points < MAX_POINTFILE)
123 VectorCopy (v, s_pointvecs[s_num_points]);
126 qglVertex3fv( v.ToFloatPtr() );
137 void Pointfile_Draw( void )
141 qglColor3f( 1.0F, 0.0F, 0.0F );
142 qglDisable(GL_TEXTURE_2D);
143 qglDisable(GL_TEXTURE_1D);
145 qglBegin(GL_LINE_STRIP);
146 for ( i = 0; i < s_num_points; i++ )
148 qglVertex3fv( s_pointvecs[i].ToFloatPtr() );
154 void Pointfile_Clear (void)
156 if (!g_qeglobals.d_pointfile_display_list)
159 qglDeleteLists (g_qeglobals.d_pointfile_display_list, 1);
160 g_qeglobals.d_pointfile_display_list = 0;
161 Sys_UpdateWindows (W_ALL);