Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

omicron.h File Reference

main header. More...

#include "forward.h"
#include "vector.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>
#include "extgl.h"
#include <GL/glu.h>

Go to the source code of this file.

Data Structures

class  engine_interface_c
 User supplied functions.

struct  gvar_s
 global stuff More...

struct  initvars_s
 Initialization variables struct. More...


Defines

#define SafeDelete(a)   { if (a) { delete a; a = NULL; }}
 safely delete a pointer, and set it to NULL

#define SafeArrayDelete(a)   { if (a) { delete [] a; a = NULL; }}
 safely delete an array pointer, and set it to NULL

#define StructElem(type, member)   (ulong)(((type*)(0))->member)
 get offset of the element in a struct or class

#define DBGSTAMP
 write a debugstamp

#define ASTSTAMP(ex)
 write an assertion

#define DebugReturn   { DBGSTAMP; return; };
 Writes a debugstamp and returns.

#define DebugReturnValue(a)   { DBGSTAMP; return a; };
 Writes a debugstamp and returns value a.

#define AssertReturn(ex)   { ASTSTAMP(ex); assertions++; return; };
 Writes a failed assertion and returns.

#define AssertReturnValue(ex, a)   { ASTSTAMP(ex); assertions++; return a; };
 Writes a failed assertion and returns a.

#define INVALID_INDEX   -1
 indicates an error for functions that return an index

#define PI   3.1415926535897932384626433832795f
 pi

#define PI2   6.2831853071795864769252867665590f
 pi * 2

#define SQRT2   1.4142135623730950488016887242097f
 sqrt(2)

#define SIN45   0.7071067811865475244008443621048f
 sin(45 deg)

#define DEG2RAD   0.0174532925199432957692369076848f
 degrees * DEG2RAD = radians

#define RAD2DEG   57.295779513082320876798154814105f
 radians * DEG2RAD = degrees

#define EQUAL_EPSILON   0.01f
 equality distance for vector elements

#define TRUE_STRING   "1yYtT"
 all characters interpreted as true

#define FALSE_STRING   "0nNfF"
 all characters interpreted as false

#define frand(a, b)   (((float)rand())/((float)RAND_MAX)*((b)-(a))+(a))
 get a random number between a and b

#define CLAMP(a, min, max)   ((a>max)?(max):(a<min?min:a))
 clamp a value to the interval min - max

#define GETFRACTION(pos, a, b)   ((pos-(a))/(b-(a)))
 get the fraction pos is between a and b


Typedefs

typedef initvars_s initvars_t
 Initialization variables struct.

typedef gvar_s gvar_t
 global stuff


Functions

void _log_printf (sshort level, char *fmt,...)
void _convert_file_path (char *path)
void _convert_pak_path (char *path)
char * _strtrm (char *string, char *trimchrs)
schar _sgn (float f)
float _interpolate_float_linear (float a, float b, float frac)
 Interpolate two floats linearly.

void _swap_long (ulong &l)

Variables

gvar_t gv
 global variables _main.cpp


Detailed Description

Definition in file omicron.h.


Define Documentation

#define AssertReturn1  
 

Value:

{ \
                    if (!(a)) AssertReturn(a);\
                };

Definition at line 170 of file omicron.h.

#define AssertReturn2 a,
 
 

Value:

{ \
                    if (!(a)) AssertReturn(a);\
                    if (!(b)) AssertReturn(b);\
                };

Definition at line 175 of file omicron.h.

#define AssertReturn3 a,
b,
 
 

Value:

{ \
                    if (!(a)) AssertReturn(a);\
                    if (!(b)) AssertReturn(b);\
                    if (!(c)) AssertReturn(c);\
                };

Definition at line 181 of file omicron.h.

#define AssertReturn4 a,
b,
c,
 
 

Value:

{ \
                    if (!(a)) AssertReturn(a);\
                    if (!(b)) AssertReturn(b);\
                    if (!(c)) AssertReturn(c);\
                    if (!(d)) AssertReturn(d);\
                };

Definition at line 188 of file omicron.h.

#define AssertReturnValue1 a,
 
 

Value:

{ \
                    if (!(a)) AssertReturnValue(a,v);\
                };

Definition at line 196 of file omicron.h.

#define AssertReturnValue2 a,
b,
 
 

Value:

{ \
                    if (!(a)) AssertReturnValue(a,v);\
                    if (!(b)) AssertReturnValue(b,v);\
                };

Definition at line 201 of file omicron.h.

#define AssertReturnValue3 a,
b,
c,
 
 

Value:

{ \
                    if (!(a)) AssertReturnValue(a,v);\
                    if (!(b)) AssertReturnValue(b,v);\
                    if (!(c)) AssertReturnValue(c,v);\
                };

Definition at line 207 of file omicron.h.

#define AssertReturnValue4 a,
b,
c,
d,
 
 

Value:

{ \
                    if (!(a)) AssertReturnValue(a,v);\
                    if (!(b)) AssertReturnValue(b,v);\
                    if (!(c)) AssertReturnValue(c,v);\
                    if (!(d)) AssertReturnValue(d,v);\
                };

Definition at line 214 of file omicron.h.

#define ASTSTAMP ex   
 

Value:

_log_printf(MSG_DEBUG, "* ASSERTION ******************");               \
    _log_printf(MSG_DEBUG, "Assertion '" #ex "' failed in"                  \
                           "%s - at or near line %u", __FILE__, __LINE__);
Writes the failed assertion ex into the log file and the current position.

Definition at line 149 of file omicron.h.

#define DBGSTAMP
 

Value:

_log_printf(MSG_DEBUG, "* DEBUG **********************");               \
    _log_printf(MSG_DEBUG, "%s - at or near line %u", __FILE__, __LINE__);
Writes the current Position into the log file.

Definition at line 140 of file omicron.h.


Typedef Documentation

typedef struct gvar_s gvar_t
 

Global variable type Keeps all global variables (or better: it should [TODO] :) There is a global variable of this type called gv. Use it to access this information.

typedef struct initvars_s initvars_t
 

In this struct all initialization stuff is stored.


Function Documentation

void _convert_file_path char *    path
 

Convert a path for a file on disk Converts all '/' in a string into an '\' when running under windows. And '\' into '/' under *nixen.

Parameters:
path  path name to convert

Definition at line 73 of file o_shared.cpp.

Referenced by file_manager_c::load_pak().

void _convert_pak_path char *    path
 

Convert a path for a file in a pak Converts '\' into '/' as used in pak files.

Parameters:
path  path name to convert

Definition at line 88 of file o_shared.cpp.

float _interpolate_float_linear float    a,
float    b,
float    frac
 

Parameters:
a  First float
b  Second float
frac  Fraction of difference between floats

Definition at line 209 of file o_shared.cpp.

Referenced by vec3_c::linear(), vec2_c::linear(), and vec4_c::linear().

void _log_printf sshort    level,
char *    fmt,
...   
 

Writes to the log file Writes a line into the log file. Syntax is the same as for printf.

Parameters:
level  Message level
fmt  The format string.
See also:
printf

Definition at line 91 of file o_logging.cpp.

Referenced by net_manager_c::cl_sendmessage(), file_manager_c::close_paks(), file_manager_c::file_manager_c(), file_manager_c::load(), file_manager_c::load_from_disk(), file_manager_c::load_from_pak(), file_manager_c::load_pak(), sound_manager_c::load_wav(), net_client_c::receive_message(), net_client_c::send_message(), shader_load(), net_manager_c::start_listen(), net_manager_c::stop_listen(), and file_manager_c::unload_pak().

schar _sgn float    f
 

Get the sign of a float Returns -1 if negative, 0 if zero and 1 if positive

Definition at line 224 of file o_shared.cpp.

Referenced by brushface_c::cut(), and plane_pointside().

char* _strtrm char *    string,
char *    trimchrs
 

Trim a string Removes any char from beginning and end of a string that is given in trimchrs. Returns a pointer to the first char that was not trimmed.

Parameters:
string  string to trim
trimchrs  chars to remove from either side

Definition at line 143 of file o_shared.cpp.

Referenced by gui_c::load().

void _swap_long ulong &    l
 

Swap a long Swaps the hi and lo word of a long.

Definition at line 236 of file o_shared.cpp.


Generated on Wed Dec 18 15:48:48 2002 for omicron engine by doxygen1.2.18