camath.h

00001 #ifndef CAMATH_H
00002 #define CAMATH_H
00003 
00004 #include <math.h>
00005 #include <stdlib.h>
00006 #include <ClanLib/core.h>
00007 
00008 #define ARAD 57.29577951308232
00009 
00010 #define MAX(A,B) (A>=B ? A : B)
00011 #define MIN(A,B) (A<=B ? A : B)
00012 
00013 
00014 // Version dependent settings:
00015 
00016 #define CA_MAXTRACKS      64      // Max number of tracks
00017 #define CA_NUMCARTYPES     4      // Max number of car types
00018 
00019 #define CA_VERSION   "1.1.3"      // Trophy version
00020 
00021 #define CA_WIDTH         640      // Width of screen
00022 #define CA_HEIGHT        480      // Height      "
00023 
00024 #define CA_HELPHEIGHT     50      // Height of help-frame at the bottom
00025 
00026 #define CA_MAXMENUITEMS   10      // Max number of menu entries
00027 #define CA_MENUSPACE      12      // Space between menu texts
00028 #define CA_MENUWIDTH     360      // Menu width
00029 
00030 #define CA_MAXFOGBOMBS    10      // Max number of fog bombs
00031 #define CA_MAXDUSTCLOWDS  50      // Max number of dust clowds
00032 #define CA_NUMGOODYTYPES   5      // Number of different goodie items
00033 #define CA_NUMGOODIES      6      // Number of goodies of each type (max)
00034 #define CA_GOODYTIME     250      // Pace a goody all ... millisecs
00035 
00036 #define CA_MAXPLAYERS      6      // Max number of players in total
00037 
00038 #define CA_TURBOFACTOR     1.5    // Speed factor for turbo
00039 #define CA_SHOOTINGRANGE 200      // Shooting range in pixel
00040 #define CA_MAXHITPOINTS    5      // Max number of hit points for one screen and one player
00041 
00042 #define CA_MAXROUTEPOINTS 32      // Max number of route points for computer players
00043 
00044 #define CA_NUMLAPS         5      // Number of laps to do for each race
00045 
00046 #define CA_NUMSLOTS       10      // Number of slots for saving games.
00047 
00048 #define CA_FPR            72      // Number of frames used for one rotation of the sprite
00049 
00050 #define CA_PRIZE        3000      // Money for first player
00051 
00052 
00053 
00057 class CAMath {
00058 public:
00059     static bool   compFloat( float f1, float f2, float tol=0.001 );
00060     static float  corrAngle( float ang );
00061     static float  getAngle( float x1, float y1, float x2, float y2 );
00062     static float  getDistance( float x1, float y1, float x2, float y2 );
00063     static float  getAngleDiff( float a1, float a2 );
00064     static bool   getIntersection( int ax1, int ay1, int ax2, int ay2,
00065                                    int bx1, int by1, int bx2, int by2,
00066                                    int* ix, int* iy );
00067     static int    getRandomNumber( int min, int max );
00068     static void   timeToString( char* string, int time );
00069 };
00070 
00071 #endif
00072 
00073 // EOF

Generated on Tue Nov 28 06:48:28 2006 by  doxygen 1.5.0