Skip to content

Commit

Permalink
PR2: Add support for CSQCSEND via SendEntity.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson committed Feb 2, 2025
1 parent 22bf7ee commit 44fa0b2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/g_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ typedef enum
GAME_CLIENT_SAY, // ( int isTeamSay );
GAME_PAUSED_TIC, // ( int duration_msec ); // duration is in msecs
GAME_CLEAR_EDICT, // (self)

GAME_EDICT_CSQCSEND = 200, //entrypoint, called when using SendEntity
} gameExport_t;

typedef enum
Expand Down
4 changes: 4 additions & 0 deletions include/progs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,10 @@ typedef struct gedict_s
float healmax; // maximum health see triggers.c for defaults
float healtimer; // internal timer for tracking health replenishment interval
// }

// { csqc
func_t SendEntity;
// }
} gedict_t;

typedef enum
Expand Down
11 changes: 11 additions & 0 deletions src/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,17 @@ intptr_t VISIBILITY_VISIBLE vmMain(
// Don't ClearGlobals() as this will be called during spawn()
initialise_spawned_ent(PROG_TO_EDICT(g_globalvars.self));

return 0;

case GAME_EDICT_CSQCSEND:
self = PROG_TO_EDICT(g_globalvars.self);
other = PROG_TO_EDICT(g_globalvars.other);

if (self->SendEntity)
{
return ((int(*)(int))(self->SendEntity))(arg0);
}

return 0;
}

Expand Down

0 comments on commit 44fa0b2

Please sign in to comment.