35 #include "../../idlib/precompiled.h"
38 #include "../Game_local.h"
52 static int eventCallbackMemory = 0;
85 for( type = typelist; type !=
NULL; type = type->
next ) {
93 for ( insert = &typelist; *insert; insert = &(*insert)->
next ) {
95 if (
idStr::Cmp( classname, (*insert)->classname ) < 0 ) {
156 if ( ( !eventCallbacks || !eventCallbacks->
event ) &&
super ) {
174 set =
new bool[
num ];
175 memset( set, 0,
sizeof(
bool ) * num );
180 for( c =
this; c !=
NULL; c = c->
super ) {
256 CallSpawnFunc( type );
269 if ( func == cls->
Spawn ) {
276 ( this->*cls->
Spawn )();
287 #ifdef ID_DEBUG_UNINITIALIZED_MEMORY
288 unsigned long *ptr = ( (
unsigned long * )
this ) - 1;
290 assert( ( size & 3 ) == 0 );
292 for (
int i = 0;
i <
size;
i++ ) {
293 if ( ptr[
i] == 0xcdcdcdcd ) {
338 gameLocal.
Printf(
"%-24s %-24s %-6s %-6s\n",
"Classname",
"Superclass",
"Type",
"Subclasses" );
339 gameLocal.
Printf(
"----------------------------------------------------------------------\n" );
341 for( i = 0; i <
types.
Num(); i++ ) {
389 for( c = typelist; c !=
NULL; c = c->
next ) {
411 for( c = typelist; c !=
NULL; c = c->
next, num++ ) {
429 for( c = typelist; c !=
NULL; c = c->
next ) {
443 #ifdef ID_DEBUG_MEMORY
447 void * idClass::operator
new(
size_t s ) {
456 #ifdef ID_DEBUG_UNINITIALIZED_MEMORY
457 unsigned long *ptr = (
unsigned long *)p;
459 assert( ( size & 3 ) == 0 );
461 for (
int i = 1;
i <
size;
i++ ) {
469 void * idClass::operator
new(
size_t s,
int,
int,
char *,
int ) {
478 #ifdef ID_DEBUG_UNINITIALIZED_MEMORY
479 unsigned long *ptr = (
unsigned long *)p;
481 assert( ( size & 3 ) == 0 );
483 for (
int i = 1;
i <
size;
i++ ) {
491 #ifdef ID_DEBUG_MEMORY
492 #define new ID_DEBUG_NEW
500 void idClass::operator
delete(
void *ptr ) {
504 p = ( (
int * )ptr ) - 1;
511 void idClass::operator
delete(
void *ptr,
int,
int,
char *,
int ) {
515 p = ( (
int * )ptr ) - 1;
539 for( c = typelist; c !=
NULL; c = c->
next ) {
548 while( min <= max ) {
549 mid = ( min +
max ) / 2;
554 }
else if ( order > 0 ) {
574 for( c = typelist; c !=
NULL; c = c->
next ) {
579 }
else if ( ( typeNum >= 0 ) && ( typeNum <
types.
Num() ) ) {
652 va_start( args, numargs );
656 event->Schedule(
this, c, time );
703 return PostEventArgs( ev, time, 4, &arg1, &arg2, &arg3, &arg4 );
712 return PostEventArgs( ev, time, 5, &arg1, &arg2, &arg3, &arg4, &arg5 );
721 return PostEventArgs( ev, time, 6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6 );
730 return PostEventArgs( ev, time, 7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7 );
739 return PostEventArgs( ev, time, 8, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8 );
811 return PostEventArgs( ev,
SEC2MS( time ), 7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7 );
820 return PostEventArgs( ev,
SEC2MS( time ), 8, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8 );
844 va_start( args, numargs );
922 return ProcessEventArgs( ev, 7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7 );
931 return ProcessEventArgs( ev, 8, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8 );
950 if (
IsType( idEntity::Type ) ) {
952 ts.PushState( ent->timeGroup );
1003 ( this->*( eventCallback_1_t )callback )( data[ 0 ] );
1008 ( this->*( eventCallback_2_t )callback )( data[ 0 ], data[ 1 ] );
1013 ( this->*( eventCallback_3_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ] );
1018 ( this->*( eventCallback_4_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ] );
1023 ( this->*( eventCallback_5_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ] );
1028 ( this->*( eventCallback_6_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] );
1033 ( this->*( eventCallback_7_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ] );
1038 ( this->*( eventCallback_8_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ] );
idHierarchy< idTypeInfo > node
static void DisplayInfo_f(const idCmdArgs &args)
idEventFunc< idClass > * eventCallbacks
bool PostEventSec(const idEventDef *ev, float time)
assert(prefInfo.fullscreenBtn)
int Cmp(const char *text) const
static idTypeInfo * GetType(int num)
void Printf(const char *fmt,...) const id_attribute((format(printf
static void ListClasses_f(const idCmdArgs &args)
void SetNum(int newnum, bool resize=true)
void FindUninitializedMemory(void)
const idEventDef EV_Activate("activate","e")
void(idClass::* classSpawnFunc_t)(void)
bool IsType(const idTypeInfo &c) const
static idClass * CreateInstance(const char *name)
bool ProcessEvent(const idEventDef *ev)
static idList< idTypeInfo * > typenums
void SetGranularity(int newgranularity)
void SetOwner(type *object)
GLuint GLuint GLsizei GLenum type
const char * GetClassname(void) const
void ParentTo(idHierarchy &node)
const idEventDef EV_SafeRemove("remove", NULL)
idTypeInfo(const char *classname, const char *superclass, idEventFunc< idClass > *eventCallbacks, idClass *(*CreateInstance)(void), void(idClass::*Spawn)(void), void(idClass::*Save)(idSaveGame *savefile) const, void(idClass::*Restore)(idRestoreGame *savefile))
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
static int NumEventCommands(void)
#define EVENT(event, function)
#define ABSTRACT_DECLARATION(nameofsuperclass, nameofclass)
void(idClass::* Restore)(idRestoreGame *savefile)
classSpawnFunc_t CallSpawnFunc(idTypeInfo *cls)
GLuint GLuint GLuint GLuint arg1
void void void Warning(const char *fmt,...) const id_attribute((format(printf
void(idClass::* Save)(idSaveGame *savefile) const
const char * GetSuperclass(void) const
idCVar g_debugTriggers("g_debugTriggers","0", CVAR_GAME|CVAR_BOOL,"")
eventCallback_t * eventMap
bool ProcessEventArgs(const idEventDef *ev, int numargs,...)
const char * GetName(void) const
GLdouble GLdouble GLint GLint order
const char * GetTypeVariableName(const char *typeName, int offset)
void(idClass::* Spawn)(void)
static idList< idTypeInfo * > types
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
static void Shutdown(void)
GLsizei GLsizei GLenum GLenum const GLvoid * data
static idTypeInfo * GetClass(const char *name)
void CancelEvents(const idEventDef *ev)
void Event_SafeRemove(void)
int GetEventNum(void) const
type * GetNext(void) const
void(idClass::* eventCallback_t)(void)
gameState_t GameState(void) const
unsigned int GetFormatspecIndex(void) const
static int BitsForInteger(int i)
int GetNumArgs(void) const
bool PostEventArgs(const idEventDef *ev, int time, int numargs,...)
const char * GetName(void) const
bool ProcessEventArgPtr(const idEventDef *ev, int *data)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
const idEventDef EV_Remove("<immediateremove>", NULL)
void * Mem_Alloc(const int size)
static void CopyArgs(const idEventDef *evdef, int numargs, va_list args, int data[D_EVENT_MAXARGS])
static idEvent * Alloc(const idEventDef *evdef, int numargs, va_list args)
bool PostEventMS(const idEventDef *ev, int time)
static void CancelEvents(const idClass *obj, const idEventDef *evdef=NULL)
idClass *(* CreateInstance)(void)