- Moved some files around for better organization
- Fixed compile errors in the other targets. - Added three test save files: one with a party not in a scenario, one with a party who has just entered Valley of Dying things, and one with the same party just after leaving town. - Added the new menu file for the game that I'm working on (not yet used) git-svn-id: http://openexile.googlecode.com/svn/trunk@53 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
60
osx/tools/mathutil.cpp
Normal file
60
osx/tools/mathutil.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* mathutil.cpp
|
||||
* BoE
|
||||
*
|
||||
* Created by Celtic Minstrel on 16/04/09.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mathutil.h"
|
||||
#include <math.h>
|
||||
|
||||
short get_ran (short times,short min,short max){
|
||||
long int store;
|
||||
short i, to_ret = 0;
|
||||
|
||||
if(max < min) max = min;
|
||||
|
||||
for (i = 1; i < times + 1; i++) {
|
||||
store = rand();
|
||||
to_ret += min + (store % (max - min + 1));//min + (((store + 32767) * (max - min + 1)) / 65536);
|
||||
}
|
||||
return to_ret;
|
||||
}
|
||||
|
||||
short s_pow(short x,short y){
|
||||
return (short) pow((double) x, (double) y);
|
||||
}
|
||||
|
||||
short s_sqrt(short val)
|
||||
{
|
||||
return (short) sqrt((double)(val));
|
||||
}
|
||||
|
||||
short max(short a,short b){
|
||||
if (a > b)
|
||||
return a;
|
||||
else return b;
|
||||
}
|
||||
|
||||
short min(short a,short b){
|
||||
if (a < b)
|
||||
return a;
|
||||
else return b;
|
||||
}
|
||||
|
||||
short minmax(short min,short max,short k){
|
||||
if (k < min)
|
||||
return min;
|
||||
if (k > max)
|
||||
return max;
|
||||
return k;
|
||||
}
|
||||
|
||||
short move_to_zero(short val){
|
||||
if (val < 0)
|
||||
return val + 1;
|
||||
if (val > 0)
|
||||
return val - 1;
|
||||
return val;
|
||||
}
|
||||
Reference in New Issue
Block a user