/* common.m,
 *
 * Some useful routines, and also some common variables.
 */

#include <allegro.h>
#include <math.h>
#include <objc/Object.h>
#include <stdlib.h>
#include "common.h"


SebFile *base_sebum;
int game_flags;
char *raid_binary_directory;


/* Returns a random number between lower and upper (inclusive). */
inline int rnd(int lower, int upper)
{
    return (rand() % (upper - lower + 1)) + lower;
}

/* Makes the angle between +/-PI. */
inline void simplify_angle(double *theta)
{
    if (*theta < -M_PI)
	*theta += 2*M_PI;
    else if (*theta > M_PI)
	*theta -= 2*M_PI;
}
