mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 11:00:38 +02:00
TypeInfoGen will now autobind doom scripts.
This commit is contained in:
@@ -227,13 +227,37 @@ void idTypeInfo::Shutdown() {
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
const idEventDef EV_Remove("<immediateremove>", NULL);
|
||||
const idEventDef EV_SafeRemove("remove", NULL);
|
||||
const idEventDef EV_Remove( "<immediateremove>", NULL );
|
||||
const idEventDef EV_SafeRemove( "remove", NULL );
|
||||
|
||||
ABSTRACT_DECLARATION(NULL, idClass)
|
||||
EVENT(EV_Remove, idClass::Event_Remove)
|
||||
EVENT(EV_SafeRemove, idClass::Event_SafeRemove)
|
||||
END_CLASS
|
||||
idTypeInfo idClass::Type(
|
||||
"idClass",
|
||||
"NULL",
|
||||
( idEventFunc<idClass>* )idClass::eventCallbacks,
|
||||
idClass::CreateInstance,
|
||||
( void ( idClass::* )( void ) )&idClass::Spawn,
|
||||
( void ( idClass::* )( idSaveGame* ) const )&idClass::Save,
|
||||
( void ( idClass::* )( idRestoreGame* ) )&idClass::Restore
|
||||
);
|
||||
|
||||
idClass* idClass::CreateInstance( void ) {
|
||||
gameLocal.Error( "Cannot instanciate abstract class %s.", "idClass" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
idTypeInfo& idClass::GetClassType( void ) {
|
||||
return idClass::Type;
|
||||
}
|
||||
|
||||
idTypeInfo* idClass::GetType( void ) const {
|
||||
return &( idClass::Type );
|
||||
}
|
||||
|
||||
idEventFunc<idClass> idClass::eventCallbacks[] = {
|
||||
EVENT( EV_Remove, idClass::Event_Remove )
|
||||
EVENT( EV_SafeRemove, idClass::Event_SafeRemove )
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
// alphabetical order
|
||||
idList<idTypeInfo*> idClass::types;
|
||||
@@ -936,6 +960,34 @@ bool idClass::ProcessEvent(const idEventDef* ev, idEventArg arg1, idEventArg arg
|
||||
return ProcessEventArgs(ev, 8, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idClass::FindEventDef
|
||||
================
|
||||
*/
|
||||
const idEventDef* idClass::FindEventDef(const char* name, const char* formatspec) const {
|
||||
const idTypeInfo* type;
|
||||
|
||||
for (type = GetType(); type != NULL; type = type->super) {
|
||||
if (type->eventCallbacks == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; type->eventCallbacks[i].event != NULL; i++) {
|
||||
const idEventDef* event = type->eventCallbacks[i].event;
|
||||
if (strcmp(event->GetName(), name) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (formatspec != NULL && strcmp(event->GetArgFormat(), formatspec) != 0) {
|
||||
continue;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idClass::ProcessEventArgPtr
|
||||
@@ -949,7 +1001,7 @@ bool idClass::ProcessEventArgPtr(const idEventDef* ev, intptr_t* data) {
|
||||
assert(ev);
|
||||
assert(idEvent::initialized);
|
||||
|
||||
if (g_debugTriggers.GetBool() && (ev == &EV_Activate) && IsType(idEntity::Type)) {
|
||||
if (g_debugTriggers.GetBool() && (strcmp(ev->GetName(), "activate") == 0) && IsType(idEntity::Type)) {
|
||||
const idEntity* ent = *reinterpret_cast<idEntity**>(data);
|
||||
gameLocal.Printf("%d: '%s' activated by '%s'\n", gameLocal.framenum, static_cast<idEntity*>(this)->GetName(), ent ? ent->GetName() : "NULL");
|
||||
}
|
||||
@@ -1069,4 +1121,4 @@ idClass::Event_SafeRemove
|
||||
void idClass::Event_SafeRemove(void) {
|
||||
// Forces the remove to be done at a safe time
|
||||
PostEventMS(&EV_Remove, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user