diff options
| author | epoch <epoch@hacking.allowed.org> | 2017-12-24 04:40:33 -0600 | 
|---|---|---|
| committer | epoch <epoch@hacking.allowed.org> | 2017-12-24 04:40:33 -0600 | 
| commit | b3cc9c8286aa30aadfd3c0d5dca936a4ab950003 (patch) | |
| tree | 3b009ea58ffebf0760dc252c29fb8b39c44e2090 /src | |
| parent | d248dadf6403e9ed9d0041d8606800c15aa6255a (diff) | |
| download | hackvr-b3cc9c8286aa30aadfd3c0d5dca936a4ab950003.tar.gz hackvr-b3cc9c8286aa30aadfd3c0d5dca936a4ab950003.zip | |
replaced cosl and sinl with cos and sin. increased line to 2048 to get gcc to shutup about truncation. got rid of annoying defines.
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphics_cs_x11.c | 30 | 
1 files changed, 13 insertions, 17 deletions
| diff --git a/src/graphics_cs_x11.c b/src/graphics_cs_x11.c index caf1093..595c524 100644 --- a/src/graphics_cs_x11.c +++ b/src/graphics_cs_x11.c @@ -1,5 +1,4 @@  #define _POSIX_C_SOURCE 200809L //for fileno and strdup -#define _BSD_SOURCE  #include <stdio.h>  #include <string.h>  #include <fcntl.h> @@ -13,8 +12,6 @@  #include <X11/cursorfont.h>  #include <X11/Xutil.h> //for size hints  #include <time.h> -#define __USE_GNU //for longer math constants -#include <math.h>  #include "config.h"  #include "common.h" @@ -209,7 +206,6 @@ void flipscreen() {  }  void set_aspect_ratio() { - long supplied_return;   XSizeHints *hints=XAllocSizeHints();   hints->min_aspect.x=AR_W*(gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1));   hints->min_aspect.y=AR_H; @@ -229,7 +225,7 @@ void set_demands_attention() {  }  void x11_keypress_handler(XKeyEvent *xkey,int x,int y) { -  char line[1024]; +  char line[2048];    char line2[1025];    int len;    radians tmprad; @@ -248,33 +244,33 @@ void x11_keypress_handler(XKeyEvent *xkey,int x,int y) {       case XK_Up:        tmprad=d2r((degrees){global.camera.r.y.d});//if the angle is 0...        tmprad2=d2r((degrees){global.camera.r.y.d}); -      tmpx=WALK_SPEED*sinl(tmprad.r);//cos(0)==1 -      tmpz=WALK_SPEED*cosl(tmprad2.r);//sin(0)==0 -      snprintf(line,sizeof(line)-1,"%s move %Lf 0 %Lf\n",global.user,tmpx,tmpz); +      tmpx=WALK_SPEED*sin(tmprad.r);//cos(0)==1 +      tmpz=WALK_SPEED*cos(tmprad2.r);//sin(0)==0 +      snprintf(line,sizeof(line)-1,"%s move %f 0 %f\n",global.user,tmpx,tmpz);        selfcommand(line);        break;       case XK_Down:        tmprad=d2r((degrees){global.camera.r.y.d+180});        tmprad2=d2r((degrees){global.camera.r.y.d+180}); -      tmpx=WALK_SPEED*sinl(tmprad.r); -      tmpz=WALK_SPEED*cosl(tmprad2.r); -      snprintf(line,sizeof(line)-1,"%s move %Lf 0 %Lf\n",global.user,tmpx,tmpz); +      tmpx=WALK_SPEED*sin(tmprad.r); +      tmpz=WALK_SPEED*cos(tmprad2.r); +      snprintf(line,sizeof(line)-1,"%s move %f 0 %f\n",global.user,tmpx,tmpz);        selfcommand(line);        break;       case XK_Left:        tmprad=d2r((degrees){global.camera.r.y.d+90});        tmprad2=d2r((degrees){global.camera.r.y.d+90}); -      tmpx=WALK_SPEED*sinl(tmprad.r); -      tmpz=WALK_SPEED*cosl(tmprad2.r); -      snprintf(line,sizeof(line)-1,"%s move %Lf 0 %Lf\n",global.user,tmpx,tmpz); +      tmpx=WALK_SPEED*sin(tmprad.r); +      tmpz=WALK_SPEED*cos(tmprad2.r); +      snprintf(line,sizeof(line)-1,"%s move %f 0 %f\n",global.user,tmpx,tmpz);        selfcommand(line);        break;       case XK_Right:        tmprad=d2r((degrees){global.camera.r.y.d+270});        tmprad2=d2r((degrees){global.camera.r.y.d+270}); -      tmpx=WALK_SPEED*sinl(tmprad.r); -      tmpz=WALK_SPEED*cosl(tmprad2.r); -      snprintf(line,sizeof(line)-1,"%s move %Lf 0 %Lf\n",global.user,tmpx,tmpz); +      tmpx=WALK_SPEED*sin(tmprad.r); +      tmpz=WALK_SPEED*cos(tmprad2.r); +      snprintf(line,sizeof(line)-1,"%s move %f 0 %f\n",global.user,tmpx,tmpz);        selfcommand(line);        break;       case XK_w: | 
