Debian Codegraph @

tools/quake3/q3data/oldstuff.c

raw symbols SCIP
1 /*
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #if 0
23
24 /*
25 ** ReindexTriangle
26 **
27 ** Given a triangle_t, find which indices match into the associated
28 ** surface's base triangles.
29 */
30 static void ReindexTriangle( int surfno, triangle_t *pTri, int indices[3] ){
31 int t, i;
32 md3SurfaceData_t *pSurfData = &g_data.surfData[surfno];
33 int matches[3][3];
34 int numMatches = 0;
35
36
37 indices[0] = -1;
38 indices[1] = -1;
39 indices[2] = -1;
40
41 for ( i = 0; i < 3; i++ )
42 {
43 numMatches = 0;
44
45 matches[i][0] = -1;
46 matches[i][1] = -1;
47 matches[i][2] = -1;
48
49 for ( t = 0; t < pSurfData->header.numVerts; t++ )
50 {
51 if ( !VectorCompare( pTri->verts[i], pSurfData->baseVertexes[t].xyz ) ) {
52 continue;
53 }
54
55 /*
56 if ( !VectorCompare( pTri->normals[i], pSurfData->baseVertexes[t].normal ) )
57 continue;
58 if ( pTri->texcoords[i][0] != pSurfData->baseVertexes[t].st[0] )
59 continue;
60 if ( pTri->texcoords[i][1] != pSurfData->baseVertexes[t].st[1] )
61 continue;
62 */
63
64 matches[i][numMatches++] = t;
65 }
66
67 if ( indices[i] == -1 ) {
68 // Error( "Could not ReindexTriangle, vertex not found" );
69 }
70 }
71
72 #if 0
73 for ( t = 0; t < psets[i].numtriangles; t++ )
74 {
75 int b;
76
77 bTri = &g_data.surfData[i].baseTriangles[t];
78
79 for ( j = 0 ; j < 3 ; j++ )
80 {
81 bVert = &bTri->v[j];
82
83 // get the xyz index
84 for ( k = 0; k < g_data.surfData[i].header.numVerts; k++ )
85 {
86 if ( ( g_data.surfData[i].baseVertexes[k].st[0] == bVert->st[0] ) &&
87 ( g_data.surfData[i].baseVertexes[k].st[1] == bVert->st[1] ) &&
88 ( VectorCompare( bVert->xyz, g_data.surfData[i].baseVertexes[k].xyz ) ) &&
89 ( VectorCompare( bVert->normal, g_data.surfData[i].baseVertexes[k].normal ) ) ) {
90 break; // this vertex is already in the base vertex list
91 }
92 }
93
94 if ( k == g_data.surfData[i].header.numVerts ) { // new index
95 g_data.surfData[i].baseVertexes[g_data.surfData[i].header.numVerts] = *bVert;
96 g_data.surfData[i].header.numVerts++;
97 }
98
99 bVert->index = k;
100 }
101 }
102 #endif
103 }
104
105 const char *FindFrameFile( const char *frame ){
106 int time1;
107 char file1[1024];
108 static char retname[1024];
109 char base[32];
110 char suffix[32];
111 const char *s;
112
113 if ( strstr( frame, "." ) ) {
114 return frame; // already in dot format
115
116 }
117 // split 'run1' into 'run' and '1'
118 s = frame + strlen( frame ) - 1;
119
120 while ( s != frame && *s >= '0' && *s <= '9' )
121 s--;
122
123 strcpy( suffix, s + 1 );
124 strcpy( base, frame );
125 base[s - frame + 1] = 0;
126
127 // check for 'run1.tri'
128 sprintf( file1, "%s/%s%s.tri", g_cddir, base, suffix );
129 time1 = FileTime( file1 );
130 if ( time1 != -1 ) {
131 sprintf( retname, "%s%s.tri", base, suffix );
132 return retname;
133 }
134
135 // check for 'run.1'
136 sprintf( file1, "%s/%s.%s",g_cddir, base, suffix );
137 time1 = FileTime( file1 );
138 if ( time1 != -1 ) {
139 sprintf( retname, "%s.%s", base, suffix );
140 return retname;
141 }
142
143 Error( "frame %s could not be found",frame );
144 return NULL;
145 }
146
147 #endif