]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/splines/splines.cpp
[q3map2] Unwind script stack in case of script loading error.
[xonotic/netradiant.git] / libs / splines / splines.cpp
index b9b7c0c90e4907514e497ed252f2356a8bcdc3f4..e35d82b7e8b80d3b1ad4665203a93999a7645497 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1999-2007 id Software, Inc. and contributors.
+   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
    For a list of contributors, see the accompanying CONTRIBUTORS file.
 
    This file is part of GtkRadiant.
@@ -43,7 +43,7 @@ float Q_fabs( float f ) {
 //             Certainly better ways to do this, but this lets
 //             me get underway quickly with ents that need spline
 //             targets.
-#define MAX_CAMERAS 64
+const int MAX_CAMERAS = 64;
 
 idCameraDef camera[MAX_CAMERAS];
 
@@ -96,17 +96,17 @@ idCameraDef *g_splineList = &splineList;
 idVec3 idSplineList::zero( 0,0,0 );
 
 void glLabeledPoint( idVec3 &color, idVec3 &point, float size, const char *label ) {
-       qglColor3fv( color );
-       qglPointSize( size );
-       qglBegin( GL_POINTS );
-       qglVertex3fv( point );
-       qglEnd();
+       glColor3fv( color );
+       glPointSize( size );
+       glBegin( GL_POINTS );
+       glVertex3fv( point );
+       glEnd();
        idVec3 v = point;
        v.x += 1;
        v.y += 1;
        v.z += 1;
-       qglRasterPos3fv( v );
-       qglCallLists( strlen( label ), GL_UNSIGNED_BYTE, label );
+       glRasterPos3fv( v );
+       glCallLists( strlen( label ), GL_UNSIGNED_BYTE, label );
 }
 
 
@@ -119,30 +119,30 @@ void glBox( idVec3 &color, idVec3 &point, float size ) {
        maxs[0] += size;
        maxs[1] -= size;
        maxs[2] += size;
-       qglColor3fv( color );
-       qglBegin( GL_LINE_LOOP );
-       qglVertex3f( mins[0],mins[1],mins[2] );
-       qglVertex3f( maxs[0],mins[1],mins[2] );
-       qglVertex3f( maxs[0],maxs[1],mins[2] );
-       qglVertex3f( mins[0],maxs[1],mins[2] );
-       qglEnd();
-       qglBegin( GL_LINE_LOOP );
-       qglVertex3f( mins[0],mins[1],maxs[2] );
-       qglVertex3f( maxs[0],mins[1],maxs[2] );
-       qglVertex3f( maxs[0],maxs[1],maxs[2] );
-       qglVertex3f( mins[0],maxs[1],maxs[2] );
-       qglEnd();
-
-       qglBegin( GL_LINES );
-       qglVertex3f( mins[0],mins[1],mins[2] );
-       qglVertex3f( mins[0],mins[1],maxs[2] );
-       qglVertex3f( mins[0],maxs[1],maxs[2] );
-       qglVertex3f( mins[0],maxs[1],mins[2] );
-       qglVertex3f( maxs[0],mins[1],mins[2] );
-       qglVertex3f( maxs[0],mins[1],maxs[2] );
-       qglVertex3f( maxs[0],maxs[1],maxs[2] );
-       qglVertex3f( maxs[0],maxs[1],mins[2] );
-       qglEnd();
+       glColor3fv( color );
+       glBegin( GL_LINE_LOOP );
+       glVertex3f( mins[0],mins[1],mins[2] );
+       glVertex3f( maxs[0],mins[1],mins[2] );
+       glVertex3f( maxs[0],maxs[1],mins[2] );
+       glVertex3f( mins[0],maxs[1],mins[2] );
+       glEnd();
+       glBegin( GL_LINE_LOOP );
+       glVertex3f( mins[0],mins[1],maxs[2] );
+       glVertex3f( maxs[0],mins[1],maxs[2] );
+       glVertex3f( maxs[0],maxs[1],maxs[2] );
+       glVertex3f( mins[0],maxs[1],maxs[2] );
+       glEnd();
+
+       glBegin( GL_LINES );
+       glVertex3f( mins[0],mins[1],mins[2] );
+       glVertex3f( mins[0],mins[1],maxs[2] );
+       glVertex3f( mins[0],maxs[1],maxs[2] );
+       glVertex3f( mins[0],maxs[1],mins[2] );
+       glVertex3f( maxs[0],mins[1],mins[2] );
+       glVertex3f( maxs[0],mins[1],maxs[2] );
+       glVertex3f( maxs[0],maxs[1],maxs[2] );
+       glVertex3f( maxs[0],maxs[1],mins[2] );
+       glEnd();
 
 }
 
@@ -256,14 +256,14 @@ void idSplineList::draw( bool editMode ) {
        }
 
 
-       qglColor3fv( controlColor );
-       qglPointSize( 5 );
+       glColor3fv( controlColor );
+       glPointSize( 5 );
 
-       qglBegin( GL_POINTS );
+       glBegin( GL_POINTS );
        for ( i = 0; i < controlPoints.Num(); i++ ) {
-               qglVertex3fv( *controlPoints[i] );
+               glVertex3fv( *controlPoints[i] );
        }
-       qglEnd();
+       glEnd();
 
        if ( editMode ) {
                for ( i = 0; i < controlPoints.Num(); i++ ) {
@@ -272,22 +272,22 @@ void idSplineList::draw( bool editMode ) {
        }
 
        //Draw the curve
-       qglColor3fv( pathColor );
-       qglBegin( GL_LINE_STRIP );
+       glColor3fv( pathColor );
+       glBegin( GL_LINE_STRIP );
        int count = splinePoints.Num();
        for ( i = 0; i < count; i++ ) {
-               qglVertex3fv( *splinePoints[i] );
+               glVertex3fv( *splinePoints[i] );
        }
-       qglEnd();
+       glEnd();
 
        if ( editMode ) {
-               qglColor3fv( segmentColor );
-               qglPointSize( 3 );
-               qglBegin( GL_POINTS );
+               glColor3fv( segmentColor );
+               glPointSize( 3 );
+               glBegin( GL_POINTS );
                for ( i = 0; i < count; i++ ) {
-                       qglVertex3fv( *splinePoints[i] );
+                       glVertex3fv( *splinePoints[i] );
                }
-               qglEnd();
+               glEnd();
        }
        if ( count > 0 ) {
                //assert(activeSegment >=0 && activeSegment < count);
@@ -638,8 +638,8 @@ bool idCameraDef::waitEvent( int index ) {
 }
 
 
-#define NUM_CCELERATION_SEGS 10
-#define CELL_AMT 5
+const int NUM_CCELERATION_SEGS = 10;
+const int CELL_AMT = 5;
 
 void idCameraDef::buildCamera() {
        int i;
@@ -653,6 +653,7 @@ void idCameraDef::buildCamera() {
        for ( i = 0; i < events.Num(); i++ ) {
                events[i]->setTriggered( false );
                switch ( events[i]->getType() ) {
+               default: break;
                case idCameraEvent::EVENT_TARGET: {
                        targets.Append( i );
                        break;
@@ -1166,7 +1167,7 @@ void idFixedPosition::parse( const char *( *text )  ) {
                        Com_UngetToken();
                        idStr key = Com_ParseOnLine( text );
 
-                       const char *token = Com_Parse( text );
+                       Com_Parse( text );
                        if ( Q_stricmp( key.c_str(), "pos" ) == 0 ) {
                                Com_UngetToken();
                                Com_Parse1DMatrix( text, 3, pos );
@@ -1175,7 +1176,7 @@ void idFixedPosition::parse( const char *( *text )  ) {
                                Com_UngetToken();
                                idCameraPosition::parseToken( key.c_str(), text );
                        }
-                       token = Com_Parse( text );
+                       Com_Parse( text );
 
                } while ( 1 );
 
@@ -1212,7 +1213,7 @@ void idInterpolatedPosition::parse( const char *( *text )  ) {
                        Com_UngetToken();
                        idStr key = Com_ParseOnLine( text );
 
-                       const char *token = Com_Parse( text );
+                       Com_Parse( text );
                        if ( Q_stricmp( key.c_str(), "startPos" ) == 0 ) {
                                Com_UngetToken();
                                Com_Parse1DMatrix( text, 3, startPos );
@@ -1225,7 +1226,7 @@ void idInterpolatedPosition::parse( const char *( *text )  ) {
                                Com_UngetToken();
                                idCameraPosition::parseToken( key.c_str(), text );
                        }
-                       token = Com_Parse( text );
+                       Com_Parse( text );
 
                } while ( 1 );
 
@@ -1263,7 +1264,7 @@ void idSplinePosition::parse( const char *( *text )  ) {
                        Com_UngetToken();
                        idStr key = Com_ParseOnLine( text );
 
-                       const char *token = Com_Parse( text );
+                       Com_Parse( text );
                        if ( Q_stricmp( key.c_str(), "target" ) == 0 ) {
                                target.parse( text );
                        }
@@ -1271,7 +1272,7 @@ void idSplinePosition::parse( const char *( *text )  ) {
                                Com_UngetToken();
                                idCameraPosition::parseToken( key.c_str(), text );
                        }
-                       token = Com_Parse( text );
+                       Com_Parse( text );
 
                } while ( 1 );