/*
Memonix, Viewizard Game Core ver 2.0
Copyright (c) 2001-2006 Michael Kurinnoy, Viewizard Games
All Rights Reserved.
Memonix game source codes available under "dual licensing" model.
The licensing options available are:
* Commercial Licensing. This is the appropriate option if you are creating proprietary
applications and you are not prepared to distribute and share the source code of your application.
Contact us for pricing at viewizard@viewizard.com
* Open Source Licensing. This is the appropriate option if you want to share the source code of
your application with everyone you distribute it to, and you also want to give them the right to share who uses it.
You should have received a copy of the GNU General Public License version 3 with this source codes. If not, see .
*/
#ifndef CoreMath_H
#define CoreMath_H
#include "../../Core.h"
// Get cosine
double vw_dcos(int Angle);
// Get sine
double vw_dsin(int Angle);
// быстрый sqrtf
float vw_sqrtf(float x);
// быстрое преобразование float в long
void vw_ftol(int *i, float f);
// быстрое преобразование double в int
int vw_dtoi(double d);
// приведение float к int (замена округлением)
int vw_roundf(float f);
// быстрое сравнение строк (по аналогии с strcmp)
int vw_strcmp(const char *a, const char *b);
// быстрое абсолютное значение float
#define vw_absf(x) (*((DWORD *)&(x))) &= 0x7FFFFFFF
// быстрое абсолютное значение double
#define vw_absd(x) (*(((DWORD *)&(x)) + 1)) &= 0x7FFFFFFF
// установка знака float
#define vw_SetSingf(to, sign) {*((DWORD *)&(to)) = ((*((DWORD *)&(to)))&0x7FFFFFFF) | ((DWORD(sign)) << 31); }
// rand
float vw_Rand();
float vw_RandNum(float Max);
int vw_iRandNum(int Max);
// RANDOM_NUM возвращает значение -1.0f - 1.0f, стремится к нулю (!)
#define vw_Randf0 ((vw_Rand()-vw_Rand())/RAND_MAX)
// RANDOM_NUM2 возвращает значение 0.0f - 1.0f
#define vw_Randf1 (vw_Rand()/RAND_MAX) //(fmodf(vw_Rand(),100.0f)/100.0f)
// Полезный макрос, гарантирует что в пределах
#define Clamp(x, min, max) x = (x