#include "../game/q_shared.h"
#include "l_libvar.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
#include "../game/botlib.h"
#include "../game/be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_aas_def.h"
Include dependency graph for be_aas_optimize.c:

Go to the source code of this file.
Data Structures | |
| struct | optimized_s |
Typedefs | |
| typedef optimized_s | optimized_t |
Functions | |
| int | AAS_KeepEdge (aas_edge_t *edge) |
| int | AAS_KeepFace (aas_face_t *face) |
| void | AAS_Optimize (void) |
| void | AAS_OptimizeAlloc (optimized_t *optimized) |
| void | AAS_OptimizeArea (optimized_t *optimized, int areanum) |
| int | AAS_OptimizeEdge (optimized_t *optimized, int edgenum) |
| int | AAS_OptimizeFace (optimized_t *optimized, int facenum) |
| void | AAS_OptimizeStore (optimized_t *optimized) |
|
|
Referenced by AAS_Optimize(), AAS_OptimizeAlloc(), AAS_OptimizeArea(), AAS_OptimizeEdge(), AAS_OptimizeFace(), and AAS_OptimizeStore(). |
|
|
Definition at line 78 of file be_aas_optimize.c. References aas_edge_t. Referenced by AAS_OptimizeEdge(). 00079 {
00080 return 1;
00081 } //end of the function AAS_KeepFace
|
|
|
Definition at line 133 of file be_aas_optimize.c. References aas_face_t, and aas_face_s::faceflags. Referenced by AAS_OptimizeFace(). 00134 {
00135 if (!(face->faceflags & FACE_LADDER)) return 0;
00136 else return 1;
00137 } //end of the function AAS_KeepFace
|
|
|
Definition at line 280 of file be_aas_optimize.c. References AAS_OptimizeAlloc(), AAS_OptimizeArea(), AAS_OptimizeStore(), aasworld, abs(), botimport, aas_reachability_s::edgenum, optimized_s::edgeoptimizeindex, aas_reachability_s::facenum, optimized_s::faceoptimizeindex, i, aas_s::numareas, optimized_t, PRT_MESSAGE, aas_s::reachability, aas_s::reachabilitysize, sign, and aas_reachability_s::traveltype. Referenced by AAS_ContinueInit(), and main(). 00281 {
00282 int i, sign;
00283 optimized_t optimized;
00284
00285 AAS_OptimizeAlloc(&optimized);
00286 for (i = 1; i < aasworld.numareas; i++)
00287 {
00288 AAS_OptimizeArea(&optimized, i);
00289 } //end for
00290 //reset the reachability face pointers
00291 for (i = 0; i < aasworld.reachabilitysize; i++)
00292 {
00293 //NOTE: for TRAVEL_ELEVATOR the facenum is the model number of
00294 // the elevator
00295 if ((aasworld.reachability[i].traveltype & TRAVELTYPE_MASK) == TRAVEL_ELEVATOR) continue;
00296 //NOTE: for TRAVEL_JUMPPAD the facenum is the Z velocity and the edgenum is the hor velocity
00297 if ((aasworld.reachability[i].traveltype & TRAVELTYPE_MASK) == TRAVEL_JUMPPAD) continue;
00298 //NOTE: for TRAVEL_FUNCBOB the facenum and edgenum contain other coded information
00299 if ((aasworld.reachability[i].traveltype & TRAVELTYPE_MASK) == TRAVEL_FUNCBOB) continue;
00300 //
00301 sign = aasworld.reachability[i].facenum;
00302 aasworld.reachability[i].facenum = optimized.faceoptimizeindex[abs(aasworld.reachability[i].facenum)];
00303 if (sign < 0) aasworld.reachability[i].facenum = -aasworld.reachability[i].facenum;
00304 sign = aasworld.reachability[i].edgenum;
00305 aasworld.reachability[i].edgenum = optimized.edgeoptimizeindex[abs(aasworld.reachability[i].edgenum)];
00306 if (sign < 0) aasworld.reachability[i].edgenum = -aasworld.reachability[i].edgenum;
00307 } //end for
00308 //store the optimized AAS data into aasworld
00309 AAS_OptimizeStore(&optimized);
00310 //print some nice stuff :)
00311 botimport.Print(PRT_MESSAGE, "AAS data optimized.\n");
00312 } //end of the function AAS_Optimize
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 189 of file be_aas_optimize.c. References aas_area_t, AAS_OptimizeFace(), aasworld, optimized_s::areas, aas_s::areas, Com_Memcpy(), optimized_s::faceindex, aas_s::faceindex, optimized_s::faceindexsize, aas_area_s::firstface, i, aas_area_s::numfaces, and optimized_t. Referenced by AAS_Optimize(). 00190 {
00191 int i, facenum, optfacenum;
00192 aas_area_t *area, *optarea;
00193
00194 area = &aasworld.areas[areanum];
00195 optarea = &optimized->areas[areanum];
00196 Com_Memcpy(optarea, area, sizeof(aas_area_t));
00197
00198 optarea->numfaces = 0;
00199 optarea->firstface = optimized->faceindexsize;
00200 for (i = 0; i < area->numfaces; i++)
00201 {
00202 facenum = aasworld.faceindex[area->firstface + i];
00203 optfacenum = AAS_OptimizeFace(optimized, facenum);
00204 if (optfacenum)
00205 {
00206 optimized->faceindex[optarea->firstface + optarea->numfaces] = optfacenum;
00207 optarea->numfaces++;
00208 optimized->faceindexsize++;
00209 } //end if
00210 } //end for
00211 } //end of the function AAS_OptimizeArea
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 88 of file be_aas_optimize.c. References aas_edge_t, AAS_KeepEdge(), aasworld, abs(), optimized_s::edgeoptimizeindex, optimized_s::edges, aas_s::edges, i, optimized_s::numedges, optimized_s::numvertexes, optimized_t, aas_edge_s::v, VectorCopy, optimized_s::vertexes, aas_s::vertexes, and optimized_s::vertexoptimizeindex. Referenced by AAS_OptimizeFace(). 00089 {
00090 int i, optedgenum;
00091 aas_edge_t *edge, *optedge;
00092
00093 edge = &aasworld.edges[abs(edgenum)];
00094 if (!AAS_KeepEdge(edge)) return 0;
00095
00096 optedgenum = optimized->edgeoptimizeindex[abs(edgenum)];
00097 if (optedgenum)
00098 {
00099 //keep the edge reversed sign
00100 if (edgenum > 0) return optedgenum;
00101 else return -optedgenum;
00102 } //end if
00103
00104 optedge = &optimized->edges[optimized->numedges];
00105
00106 for (i = 0; i < 2; i++)
00107 {
00108 if (optimized->vertexoptimizeindex[edge->v[i]])
00109 {
00110 optedge->v[i] = optimized->vertexoptimizeindex[edge->v[i]];
00111 } //end if
00112 else
00113 {
00114 VectorCopy(aasworld.vertexes[edge->v[i]], optimized->vertexes[optimized->numvertexes]);
00115 optedge->v[i] = optimized->numvertexes;
00116 optimized->vertexoptimizeindex[edge->v[i]] = optimized->numvertexes;
00117 optimized->numvertexes++;
00118 } //end else
00119 } //end for
00120 optimized->edgeoptimizeindex[abs(edgenum)] = optimized->numedges;
00121 optedgenum = optimized->numedges;
00122 optimized->numedges++;
00123 //keep the edge reversed sign
00124 if (edgenum > 0) return optedgenum;
00125 else return -optedgenum;
00126 } //end of the function AAS_OptimizeEdge
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 144 of file be_aas_optimize.c. References aas_face_t, AAS_KeepFace(), AAS_OptimizeEdge(), aasworld, abs(), Com_Memcpy(), optimized_s::edgeindex, aas_s::edgeindex, optimized_s::edgeindexsize, optimized_s::faceoptimizeindex, optimized_s::faces, aas_s::faces, aas_face_s::firstedge, i, aas_face_s::numedges, optimized_s::numfaces, and optimized_t. Referenced by AAS_OptimizeArea(). 00145 {
00146 int i, edgenum, optedgenum, optfacenum;
00147 aas_face_t *face, *optface;
00148
00149 face = &aasworld.faces[abs(facenum)];
00150 if (!AAS_KeepFace(face)) return 0;
00151
00152 optfacenum = optimized->faceoptimizeindex[abs(facenum)];
00153 if (optfacenum)
00154 {
00155 //keep the face side sign
00156 if (facenum > 0) return optfacenum;
00157 else return -optfacenum;
00158 } //end if
00159
00160 optface = &optimized->faces[optimized->numfaces];
00161 Com_Memcpy(optface, face, sizeof(aas_face_t));
00162
00163 optface->numedges = 0;
00164 optface->firstedge = optimized->edgeindexsize;
00165 for (i = 0; i < face->numedges; i++)
00166 {
00167 edgenum = aasworld.edgeindex[face->firstedge + i];
00168 optedgenum = AAS_OptimizeEdge(optimized, edgenum);
00169 if (optedgenum)
00170 {
00171 optimized->edgeindex[optface->firstedge + optface->numedges] = optedgenum;
00172 optface->numedges++;
00173 optimized->edgeindexsize++;
00174 } //end if
00175 } //end for
00176 optimized->faceoptimizeindex[abs(facenum)] = optimized->numfaces;
00177 optfacenum = optimized->numfaces;
00178 optimized->numfaces++;
00179 //keep the face side sign
00180 if (facenum > 0) return optfacenum;
00181 else return -optfacenum;
00182 } //end of the function AAS_OptimizeFace
|
Here is the call graph for this function:

|
Here is the call graph for this function:

1.3.9.1