(20140701)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// Copyright (C) 2011 Valeriano Alfonso Rodriguez (Kableado)
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Util.h"
|
||||
|
||||
@@ -120,10 +122,9 @@ int Colision_CircleCircle(
|
||||
vec2_scale(cen_a,cir2,invrads);
|
||||
if(Intersec_RayUnitCircle(orig_a,vel_a,cen_a,t)){
|
||||
// Calculate n
|
||||
vec2_scale(temp,vel,*t);
|
||||
vec2_plus(temp,cir1,temp);
|
||||
vec2_minus(temp,cir2,temp);
|
||||
vec2_scale(n,temp,1.0f/rads);
|
||||
vec2_scaleadd(temp,cir1,vel,*t);
|
||||
vec2_minus(n,temp,cir2);
|
||||
vec2_scale(n,n,invrads);
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
@@ -188,7 +189,6 @@ int absmod(int v,int d){
|
||||
return(v%d);
|
||||
}
|
||||
}
|
||||
|
||||
float fabsmod(float v,int d){
|
||||
if(v<0){
|
||||
v+=d*((((int)(v/d))*(-1))+1);
|
||||
@@ -200,4 +200,29 @@ float fabsmod(float v,int d){
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// IsBigEndian
|
||||
//
|
||||
int IsBigEndian(){
|
||||
union{
|
||||
unsigned int i;
|
||||
char c[4];
|
||||
} bint={0x01020304};
|
||||
return bint.c[0]==1;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// EndsWith
|
||||
//
|
||||
int EndsWith(char *str, char *suffix){
|
||||
if (!str || !suffix)
|
||||
return 0;
|
||||
int lenStr = strlen(str);
|
||||
int lenSuffix = strlen(suffix);
|
||||
if (lenSuffix > lenStr)
|
||||
return 0;
|
||||
return strncmp(str+lenStr-lenSuffix, suffix, lenSuffix)==0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user