@@ -297,7 +297,7 @@ struct vel spawn(void)
297297 rnd = (double )rand () / RAND_MAX ;
298298 initPos .holecount = (rnd * (HOLE_FREQ - HOLE_FIRST_DELAY ));
299299 rnd = (double )rand () / RAND_MAX ;
300- initPos .dir = rnd * (2 * PI );
300+ initPos .dir = rnd * (2 * M_PI );
301301 if (initPos .dir < 0 )
302302 initPos .dir *= -1 ;
303303
@@ -357,7 +357,7 @@ void drespawn(struct player *p)
357357 p -> alive = true;
358358 p -> posx = (WINDOW_W / 2 ) + (p -> active == 1 ? -120 : 120 );
359359 p -> posy = WINDOW_H / 2 ;
360- p -> dir = p -> active == 1 ? 0 : PI ;
360+ p -> dir = p -> active == 1 ? 0 : M_PI ;
361361
362362 p -> initposx = p -> posx ;
363363 p -> initposy = p -> posy ;
@@ -756,13 +756,13 @@ int logicGame(void)
756756 * be turned on */
757757 /*
758758 refreshGameScreen();
759- int checkx = p->posx + 40 * cos(p->dir + PI /2);
760- int checky = p->posy + 40 * sin(p->dir + PI /2);
759+ int checkx = p->posx + 40 * cos(p->dir + M_PI /2);
760+ int checky = p->posy + 40 * sin(p->dir + M_PI /2);
761761 SDL_Rect a = {checkx, checky, 4, 4};
762762 SDL_FillRect(screen, &a, SDL_MapRGB(screen->format,
763763 0x55, 0x77, 0x99));
764- checkx = p->posx + 40 * cos(p->dir - PI /2);
765- checky = p->posy + 40 * sin(p->dir - PI /2);
764+ checkx = p->posx + 40 * cos(p->dir - M_PI /2);
765+ checky = p->posy + 40 * sin(p->dir - M_PI /2);
766766 SDL_Rect b = {checkx, checky, 4, 4};
767767 SDL_FillRect(screen, &b, SDL_MapRGB(screen->format,
768768 0x55, 0x77, 0x99));
@@ -776,13 +776,13 @@ int logicGame(void)
776776 SDL_Rect e = {checkx, checky, 4, 4};
777777 SDL_FillRect(screen, &e, SDL_MapRGB(screen->format,
778778 0xFF, 0x30, 0x30));
779- checkx = p->posx + 60 * cos(p->dir + PI /4);
780- checky = p->posy + 60 * sin(p->dir + PI /4);
779+ checkx = p->posx + 60 * cos(p->dir + M_PI /4);
780+ checky = p->posy + 60 * sin(p->dir + M_PI /4);
781781 SDL_Rect f = {checkx, checky, 4, 4};
782782 SDL_FillRect(screen, &f, SDL_MapRGB(screen->format,
783783 0x66, 0x66, 0x66));
784- checkx = p->posx + 60 * cos(p->dir - PI /4);
785- checky = p->posy + 60 * sin(p->dir - PI /4);
784+ checkx = p->posx + 60 * cos(p->dir - M_PI /4);
785+ checky = p->posy + 60 * sin(p->dir - M_PI /4);
786786 SDL_Rect g = {checkx, checky, 4, 4};
787787 SDL_FillRect(screen, &g, SDL_MapRGB(screen->format,
788788 0x66, 0x66, 0x66));
@@ -792,9 +792,9 @@ int logicGame(void)
792792 hitmap , WINDOW_W , WINDOW_H );
793793 if (activeTron ) {
794794 if (c == 'l' )
795- p -> dir -= PI / 2 ;
795+ p -> dir -= M_PI / 2 ;
796796 else if (c == 'r' )
797- p -> dir += PI / 2 ;
797+ p -> dir += M_PI / 2 ;
798798 } else {
799799 if (c == 'l' )
800800 p -> dir -= 0.0022 * delta * p -> speed ;
@@ -806,10 +806,10 @@ int logicGame(void)
806806 /* Screw smooth angles, TRON MODE from here on! */
807807 if (keyDown [p -> lkey ]) {
808808 keyDown [p -> lkey ] = 0 ;
809- p -> dir -= PI / 2 ;
809+ p -> dir -= M_PI / 2 ;
810810 } else if (keyDown [p -> rkey ]) {
811811 keyDown [p -> rkey ] = 0 ;
812- p -> dir += PI / 2 ;
812+ p -> dir += M_PI / 2 ;
813813 }
814814 } else {
815815 if (keyDown [p -> lkey ])
@@ -895,7 +895,7 @@ void displayGameStart(void)
895895 struct player * p = & players [i ];
896896 SDL_Rect offset = {(int )p -> posx - 8 , (int )p -> posy - 8 ,
897897 0 , 0 };
898- int diri = (int )((p -> dir ) * (32.0 / (2.0 * PI )));
898+ int diri = (int )((p -> dir ) * (32.0 / (2.0 * M_PI )));
899899 SDL_BlitSurface (p -> arrow , & arrowClip [diri ], screen ,
900900 & offset );
901901 } else {
@@ -1172,9 +1172,9 @@ int wepSharpturn(struct player *p, bool on)
11721172 playSound (SOUND_SHARPTURN , sound );
11731173
11741174 if (keyDown [p -> rkey ])
1175- p -> dir += PI / 2 ;
1175+ p -> dir += M_PI / 2 ;
11761176 else
1177- p -> dir -= PI / 2 ;
1177+ p -> dir -= M_PI / 2 ;
11781178 }
11791179
11801180 p -> inv_self = INV_TIME ;
@@ -1249,11 +1249,11 @@ int wepMole(struct player *p, bool on)
12491249
12501250 p -> posx = p -> initposx ;
12511251 p -> posy = p -> initposy ;
1252- p -> dir = p -> initdir + PI ;
1252+ p -> dir = p -> initdir + M_PI ;
12531253
12541254 p -> initposx = oldposx ;
12551255 p -> initposy = oldposy ;
1256- p -> initdir = olddir + PI ;
1256+ p -> initdir = olddir + M_PI ;
12571257
12581258 p -> inv_self = DURATION_MOLE ;
12591259 p -> inv_others = DURATION_MOLE ;
@@ -1708,9 +1708,9 @@ void displayWepMenu(void)
17081708 if (p -> weapon == i ) {
17091709 int diri ;
17101710 if (j >= MAX_PLAYERS / 2 ) {
1711- diri = (int )((3.0 * PI / 2.0 ) * (32.0 / (2.0 * PI )));
1711+ diri = (int )((3.0 * M_PI / 2.0 ) * (32.0 / (2.0 * M_PI )));
17121712 } else {
1713- diri = (int )((PI / 2.0 ) * (32.0 / (2.0 * PI )));
1713+ diri = (int )((M_PI / 2.0 ) * (32.0 / (2.0 * M_PI )));
17141714 }
17151715 SDL_BlitSurface (p -> arrow , & arrowClip [diri ], screen ,
17161716 & offset );
0 commit comments