home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /***************************************************************************
- *
- * @(#) - BZ - Multiplayer tank game.
- *
- * $Id: bz.h,v 1.5 1993/08/11 19:45:22 adele Exp $
- *
- * Chris Fouts - Silicon Graphics, Inc.
- * October, 1991
- **************************************************************************/
-
- #if !defined(BZ_H)
- #include <sys/time.h>
- #include <time.h>
- #include <X11/X.h>
-
- #define BZ_H
- /*
- * Network stuff. NOTE: these values are chosen not to collide with known
- * multicast protocols and ports, but they might be wrong...
- */
- #define BZ_SERVICE "sgi-bznet"
- #define BZ_GROUP "224.0.1.2"
- #define BZ_MIN_TTL 1 /* TTL == 1, don't forward */
- #define BZ_DEFAULT_TTL 8
- #define BZ_MAX_TTL 32 /* don't go beyond site */
-
- #define MAIN_VIEW_MAP 0
- #define RADAR_VIEW_MAP 1
- #define BASE_VIEW_MAP 2
-
- #define FIELD_SIZE 1000.f
- #define OBJECT_SPACING 125
-
- #define RED_FLAG 0
- #define BLUE_FLAG 1
- #define N_FLAGS 2
- #define FLAG_HOME_PERIM 30.f
- #define FLAG_HOME_INSET 200.f
- #define RED_FLAG_HOME_X ( FIELD_SIZE - FLAG_HOME_PERIM - FLAG_HOME_INSET )
- #define RED_FLAG_HOME_Y ( FIELD_SIZE - FLAG_HOME_PERIM - FLAG_HOME_INSET )
- #define BLUE_FLAG_HOME_X ( -FIELD_SIZE + FLAG_HOME_PERIM + FLAG_HOME_INSET )
- #define BLUE_FLAG_HOME_Y ( -FIELD_SIZE + FLAG_HOME_PERIM + FLAG_HOME_INSET )
- #define FLAG_MINE_RADIUS 75.f
- #define FLAG_MINE_RADIUS_2 ( 75.f * 75.f )
-
- #define REG_MINE_RADIUS 15.f /* regular mine radius */
- #define DET_MINE_RADIUS 40.f /* detonated mine radius */
-
- #define FLAG_BONUS 500
-
- #define RED_FLAG_BIT 0x01
- #define BLUE_FLAG_BIT 0x02
- #define RESET_FLAG_BIT 0x04
-
- #define HAS_RED_FLAG(player) ((player).team_flag & RED_FLAG_BIT )
- #define HAS_BLUE_FLAG(player) ((player).team_flag & BLUE_FLAG_BIT )
- #define HAS_A_FLAG(player) ((player).team_flag & ( RED_FLAG_BIT | BLUE_FLAG_BIT ) )
- #define LOST_FLAG(player) ((player).team_flag & RESET_FLAG_BIT )
-
- #define DROP 3.25f
- #define CONES 0
- #define CUBES 12 /* allows 12 cones */
- #define TOTALOBSTS 24 /* allows 12 cubes */
- #define GM_DURATN 90
- #define RM_DURATN 75
- #define MEXPL_DURATION 10
- #define EXPDURATION 30
- #define GM_VEL 90.f /* guided missile velocity */
- #define RM_VEL 108.f /* normal missile velocity */
-
- #define CONE_COLLISION_INSET 0.8375f
-
- #define NORMAL_TRACK_RADIUS 150.f
- #define VIEW_ONLY_TRACK_RADIUS 225.f
-
- #define N_VIEWS 8
-
- #define DHEAD 10
- #define RAD2DEG 57.29578f /* factor to convert radians to degrees */
- #define DEG2RAD 0.0174533f /* factor to convert degrees to radians */
-
- #define NAME_CHECK_LIMIT 20 /* check for duplicate names first N frames */
-
- #define SELF 0
- #define ENEMY 1
- #define MISSILE 1
- #define MAXPLAYERS 40
- #define TOTALOBJS (TOTALOBSTS + 2 * (MAXPLAYERS) + N_FLAGS )
-
- #define BZACK 0x425a4102 /* BZ acknowledge = BZA 01 */
- #define BZBLUEMSG 0x425a4201 /* BZ BLUE Team msg = BZB 01 */
- #define BZCENSUS 0x425a4302 /* BZ census = BZC 02 */
- #define BZDROP 0x425a4400 /* BZ drop = BZD 00 */
- #define BZINVALIDATE 0x425a4900 /* BZ invalidate = BZI 00 */
- #define BZLOGO_00 0x425a4c00 /* BZ LOGO description 0 = BZL 00 */
- #define BZMSG 0x425a4d01 /* BZ msg = BZM 01 */
- #define BZ 0x425a5005 /* BZ player = BZP 05 */
- #define BZQUIT 0x425a5100 /* BZ quit = BZQ 00 */
- #define BZREDMSG 0x425a5201 /* BZ RED Team msg = BZR 01 */
- #define BZLIST 0x4c495354 /* BZ list = LIST */
- #define BZSTOP 0x53544f50 /* BZ stop = STOP */
-
- #define NAMELEN 12
-
- #define DEFAULT_FRAME_RATE 15
-
- #define POST_MSG_NUMBER 12
- #if !defined( NETDEBUGGER )
- #define POST_MSG_SIZE 50
- #else
- #define POST_MSG_SIZE 100
- #endif /* !defined( NETDEBUGGER ) */
- #define POST_MSG_DURATION 100
-
- #define MAIL_MSG_SIZE (POST_MSG_SIZE-1)
- #define SENDING_NO_MAIL 0
- #define SENDING_ALL_MAIL 1
- #define SENDING_TEAM_MAIL 2
-
- #define MAX_ACTIVITY 50
-
- #define QUITTING_STATUS -1
-
- #define ALIVE_STATUS 0
- #define MIN_DEAD_STATUS 1
- #define MAX_DEAD_STATUS 90
- #define MAILING_STATUS 10
-
- #define INTRO_SCREEN 0
- #define INTRO_PICK_SCREEN 1
- #define MAIN_SCREEN 2
-
- #define IS_ALIVE(player) ( (player).status <= ALIVE_STATUS )
- #define IS_DEAD(player) ( (player).status > ALIVE_STATUS )
-
- #define HIT_BY_MINE 0
- #define HIT_BY_MISSILE 1
-
- #define NEUTRAL_TEAM 0U
- #define RED_TEAM 1U
- #define BLUE_TEAM 2U
- #define N_TEAMS 3U
-
- #define N_TYPES 3 /* Number of tank types. */
-
- #define IS_STEALTH_TANK( player ) ( (player).tank_type == 2 )
-
- #define PRIVATE_GAME 0x08000
- #define NO_FLAG_GAME 0x04000
- #define FAST_GAME 0x02000
- #define GAME_KEY_MASK 0x01fff
-
- #ifndef DATA_DIR
- #define DATA_DIR "/usr/local/data/bz"
- #endif
-
- /*
- * Defs for solo version.
- */
- #define MAX_ENEMY 4
-
- typedef int BzId ;
-
-
- struct BzMember {
- BzId bz_id ;
- long id ;
- int score ;
- char tank_type ;
- char team ;
- char hit_type ;
- signed char status ;
- signed char msl_status ;
- unsigned char team_flag ;
- char name[NAMELEN];
- unsigned short key ;
- float x ;
- float y ;
- float head ;
- float msl_x ;
- float msl_y ;
- float msl_head ;
- long hit_by_id ;
- long killed_by_id ;
- } ;
-
-
- struct BzNotice {
- BzId bz_id ;
- long id ;
- char out_message[MAIL_MSG_SIZE] ;
- } ;
-
-
- struct BzAck {
- BzId bz_id ;
- long id ;
- long ack_id ;
- unsigned short key ;
- } ;
-
-
- struct BzCensus {
- BzId bz_id ;
- long id ;
- long n_players ;
- unsigned long chksum ;
- unsigned long chkxor ;
- long list[MAXPLAYERS] ;
- } ;
-
-
- #define LOGO_SIZE 500
-
- struct BzLogo {
- BzId bz_id ;
- long id ;
- unsigned char logo_info[LOGO_SIZE] ;
- } ;
-
- union BzPacket {
- BzId bz_id ;
- struct BzMember member ;
- struct BzNotice notice ;
- struct BzLogo logo ;
- struct BzAck ack ;
- struct BzCensus census ;
- } ;
-
- typedef void (*Color_Function)() ;
- typedef void (*Packet_Function)( void ) ;
-
- struct lineset {
- float v0[2] ;
- float v1[2] ;
- } ;
-
- #define COSINE(x) ( cosf( (float)(x) * DEG2RAD ) )
- #define SINE(x) ( sinf( (float)(x) * DEG2RAD ) )
-
- /* BEGIN PROTOTYPES bz.c */
- void act_on_input( void ) ;
- void add_player( int *number ) ;
- void blow_up_self( int killer ) ;
- void change_cursor( void ) ;
- void check_id( int n ) ;
- void check_name( void ) ;
- void check_quit_time( void ) ;
- int cmpfnc( const void *ep1, const void *ep2 ) ;
- void collide( void ) ;
- void copy_player( int k, struct BzMember *psrc ) ;
- void delete_player( int i, char *verb ) ;
- void draw_intro_screen( void ) ;
- void end_program( int status ) ;
- void file_in( void ) ;
- void file_name( char *name ) ;
- void file_out( void ) ;
- int find_player( long id ) ;
- float getangle( float x, float y ) ;
- float hypotn( float x, float y ) ;
- void indicate_map_order( Window w, int map ) ;
- void init_com( void ) ;
- void init_var( void ) ;
- int main( int argc, char **argv ) ;
- void main_view( void ) ;
- void move_after_hit( unsigned int tank_id, float xhit, float yhit,
- float velx, float vely ) ;
- void move_em( void ) ;
- void network_in( void ) ;
- void network_out( void ) ;
- void no_op( void ) ;
- void place_self( void ) ;
- char *print_version( void ) ;
- void process_bz_packet( struct BzMember *input ) ;
- void process_players( void ) ;
- int read_rest_of_file_packet( void *packet, int size ) ;
- void redraw_main_view( void ) ;
- void reset_viewing_order( void ) ;
- void send_out( void *buf, int size ) ;
- void send_out_message( void ) ;
- void send_quit_packet( void ) ;
- void send_to_file( void *buf, int size ) ;
- void send_to_network( char *buf, int size ) ;
- void set_quit_time( void ) ;
- void set_up_main_view( void ) ;
- void sort_view( int k ) ;
- float square( float x, float y ) ;
- void turn_and_go( float l, float r, float *heading, float *velx,
- float *vely ) ;
- void vertex2f( float x, float y ) ;
- /* END PROTOTYPES bz.c */
-
- #endif /* !defined(BZ_H) */
-