home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char sccsid[] = "@(#)control_ship.c 1.1 92/05/28 SMI" ;
- /* from control_ship.c 1.3 90/07/23 SMI */
- #endif
-
- /*
- * Copyright (c) 1986 by Sun Microsystems, Inc.
- */
-
- /*
- * this file contains specific control stuff:
- *
- * control_ship()
- * read control inputs and act accordingly
- *
- */
-
-
- #include <stdio.h>
- #include <math.h>
- #include "graphics.h"
- #include "dstar.h"
- #include "object_types.h"
-
-
-
- extern int debug_level ;
-
-
-
-
- /****
- *
- * read control inputs, update ship's position/velocity/"up" vectors
- *
- ****/
-
-
- control_ship()
- {
- Pt3d new_delta ;
-
- /* read mouse input */
-
- if(!auto_pilot)
- {
- new_delta.x = VIEWSCALE*(Mouse_ax - .5) ;
- new_delta.y = VIEWSCALE*(Mouse_ay - .5) ;
-
- adjust_vector(Me,&new_delta) ;
-
- if(mouse_control)
- Me->Delta = new_delta ;
- else
- {
- Me->Delta.x = 0.0 ;
- Me->Delta.y = 0.0 ;
- }
-
- if(Middle_But)
- Me->flags |= LASER_FLAG ;
- else
- Me->flags &= ~LASER_FLAG ;
-
- if(Side_9)
- Me->Delta.z = -ROLL_RATE ;
- else if (Side_10)
- Me->Delta.z = ROLL_RATE ;
- else
- Me->Delta.z = 0.0 ;
- }
- else
- {
- auto_control(Me, AUTO_RANGE, MAX_TURN, MAX_SLEW) ;
- if(Middle_But)
- Me->flags |= LASER_FLAG ;
-
- if(Side_9)
- Me->Delta.z = -0.3 ;
- else if (Side_10)
- Me->Delta.z = 0.3 ;
- else
- Me->Delta.z = 0.0 ;
- }
-
- /* transform delta from ship coords to universal coords */
-
- adjust_vectors(Me) ;
- }
-