Yo lonso, to get a little overview:
G_AddEvent: https://github.com/id-Software/Quake...g_utils.c#L574
And PM_AddEvent: https://github.com/id-Software/Quake...bg_pmove.c#L58
Interesting flags:
PHP Code:
// TTimo
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=551
#define SVF_CLIENTMASK 0x00000002
#define SVF_BOT 0x00000008 // set if the entity is a bot
#define SVF_BROADCAST 0x00000020 // send to all connected clients
#define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
#define SVF_USE_CURRENT_ORIGIN 0x00000080 // entity->r.currentOrigin instead of entity->s.origin
// for link position (missiles and movers)
#define SVF_SINGLECLIENT 0x00000100 // only send to a single client (entityShared_t->singleClient)
#define SVF_NOSERVERINFO 0x00000200 // don't send CS_SERVERINFO updates to this client
// so that it can be updated for ping tools without
// lagging clients
#define SVF_CAPSULE 0x00000400 // use capsule for collision detection instead of bbox
#define SVF_NOTSINGLECLIENT 0x00000800 // send entity to everyone but one client
// (entityShared_t->singleClient)
Settable for:
PHP Code:
void PM_AddEvent( int newEvent ) {
BG_AddPredictableEventToPlayerstate( newEvent, 0, pm->ps );
}
void SendPendingPredictableEvents( playerState_t *ps ) {
gentity_t *t;
int event, seq;
int extEvent, number;
// if there are still events pending
if ( ps->entityEventSequence < ps->eventSequence ) {
// create a temporary entity for this event which is sent to everyone
// except the client who generated the event
seq = ps->entityEventSequence & (MAX_PS_EVENTS-1);
event = ps->events[ seq ] | ( ( ps->entityEventSequence & 3 ) << 8 );
// set external event to zero before calling BG_PlayerStateToEntityState
extEvent = ps->externalEvent;
ps->externalEvent = 0;
// create temporary entity for event
t = G_TempEntity( ps->origin, event );
number = t->s.number;
BG_PlayerStateToEntityState( ps, &t->s, qtrue );
t->s.number = number;
t->s.eType = ET_EVENTS + event;
t->s.eFlags |= EF_PLAYER_EVENT;
t->s.otherEntityNum = ps->clientNum;
// send to everyone except the client who generated the event
t->r.svFlags |= SVF_NOTSINGLECLIENT; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
t->r.singleClient = ps->clientNum;
// set back external event
ps->externalEvent = extEvent;
}
}
Those are kind the origins of the events, but that doesn't help much, since these functions are basically just "declaring" those events, so the engine makes them real later on by networking them to the clients.
The event funcs are called for all kinds of stuff, little overview from Quake 3... you can get the same for CoD2 with IDA, just right-click and "search xrefs" or something:
![Click image for larger version.
Name: g_addevent.png
Views: 34
Size: 83.5 KB
ID: 1377](https://killtube.org/attachment.php?s=55e2d885f6cb14d4a87d167f4208689a&attachmentid=1377&d=1510477566&thumb=1)
![Click image for larger version.
Name: pm_addevent.png
Views: 31
Size: 42.3 KB
ID: 1378](https://killtube.org/attachment.php?s=55e2d885f6cb14d4a87d167f4208689a&attachmentid=1378&d=1510477576&thumb=1)
All the CoD2 events: https://github.com/voron00/libcod/bl...tions.hpp#L275
The actual networking of those tempentities e.g. is done in the netcode, e.g. stuff like:
https://github.com/id-Software/Quake...napshot.c#L283
Lots of aids code to reverse engineer, but the code is speaking about zones etc... I would try to mess around with portals inside the map first, before hacking into the code. But I never used map portals so far, but it seems quite legit that the engine culls away the events which are in different "zones" (like... over 4 steps away). Never messed with that so far.
CodRadiant BSP Portal tutorial: https://www.youtube.com/watch?v=E_yE56jP2tY