]> icculus.org git repositories - divverent/netradiant.git/blob - tools/quake3/q3data/oldstuff.c
samplesize warning
[divverent/netradiant.git] / tools / quake3 / q3data / oldstuff.c
1 /*
2 Copyright (C) 1999-2006 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 {
32         int t, i;
33         md3SurfaceData_t *pSurfData = &g_data.surfData[surfno];
34         int matches[3][3];
35         int numMatches = 0;
36                 
37
38         indices[0] = -1;
39         indices[1] = -1;
40         indices[2] = -1;
41
42         for ( i = 0; i < 3; i++ )
43         {
44                 numMatches = 0;
45
46                 matches[i][0] = -1;
47                 matches[i][1] = -1;
48                 matches[i][2] = -1;
49
50                 for ( t = 0; t < pSurfData->header.numVerts; t++ )
51                 {
52                         if ( !VectorCompare( pTri->verts[i], pSurfData->baseVertexes[t].xyz ) )
53                                 continue;
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                 {
69 //                      Error( "Could not ReindexTriangle, vertex not found" );
70                 }
71         }
72
73 #if 0
74                 for ( t = 0; t < psets[i].numtriangles; t++ )
75                 {
76                         int b;
77
78                         bTri = &g_data.surfData[i].baseTriangles[t];
79
80                         for (j=0 ; j<3 ; j++)
81                         {
82                                 bVert = &bTri->v[j];
83
84                                 // get the xyz index
85                                 for ( k = 0; k < g_data.surfData[i].header.numVerts; k++ )
86                                 {
87                                         if ( ( g_data.surfData[i].baseVertexes[k].st[0] == bVert->st[0] ) &&
88                                                  ( g_data.surfData[i].baseVertexes[k].st[1] == bVert->st[1] ) &&
89                                                  ( VectorCompare (bVert->xyz, g_data.surfData[i].baseVertexes[k].xyz) ) &&
90                                                  ( VectorCompare (bVert->normal, g_data.surfData[i].baseVertexes[k].normal) ) )
91                                         {
92                                                 break;  // this vertex is already in the base vertex list
93                                         }
94                                 }
95
96                                 if (k == g_data.surfData[i].header.numVerts)    { // new index
97                                         g_data.surfData[i].baseVertexes[g_data.surfData[i].header.numVerts] = *bVert;
98                                         g_data.surfData[i].header.numVerts++;
99                                 }
100
101                                 bVert->index = k;
102                         }
103                 }
104 #endif
105 }
106
107 const char      *FindFrameFile (const char *frame)
108 {
109         int                     time1;
110         char    file1[1024];
111         static char     retname[1024];
112         char    base[32];
113         char    suffix[32];
114         const char      *s;
115
116         if (strstr (frame, "."))
117                 return frame;           // allready in dot format
118
119         // split 'run1' into 'run' and '1'
120         s = frame + strlen(frame)-1;
121
122         while (s != frame && *s >= '0' && *s <= '9')
123                 s--;
124
125         strcpy (suffix, s+1);
126         strcpy (base, frame);
127         base[s-frame+1] = 0;
128
129         // check for 'run1.tri'
130         sprintf (file1, "%s/%s%s.tri", g_cddir, base, suffix);
131         time1 = FileTime (file1);
132         if (time1 != -1)
133         {
134                 sprintf (retname, "%s%s.tri", base, suffix);
135                 return retname;
136         }
137
138         // check for 'run.1'
139         sprintf (file1, "%s/%s.%s",g_cddir, base, suffix);
140         time1 = FileTime (file1);
141         if (time1 != -1)
142         {
143                 sprintf (retname, "%s.%s", base, suffix);
144                 return retname;
145         }
146
147         Error ("frame %s could not be found",frame);
148         return NULL;
149 }
150
151 #endif