Skip to content

Commit

Permalink
WiP: Temporarily expose getmodelindex/getsoundindex.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsvensson committed Nov 20, 2024
1 parent b0e74e8 commit 5a9f257
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engine/server/pr_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -4535,7 +4535,7 @@ static void QCBUILTIN PF_precache_sound (pubprogfuncs_t *prinst, struct globalva
else
G_INT(OFS_RETURN) = G_INT(OFS_PARM0); //returns the filename as a string.
}
static void QCBUILTIN PF_getsoundindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_getsoundindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
const char *s = PR_GetStringOfs(prinst, OFS_PARM0);
qboolean queryonly = (svprogfuncs->callargc >= 2)?G_FLOAT(OFS_PARM1):false;
Expand Down Expand Up @@ -4634,7 +4634,7 @@ static void QCBUILTIN PF_h2precache_puzzle_model (pubprogfuncs_t *prinst, struct
}
#endif

static void QCBUILTIN PF_getmodelindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_getmodelindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
const char *s = PR_GetStringOfs(prinst, OFS_PARM0);
qboolean queryonly = (svprogfuncs->callargc >= 2)?G_FLOAT(OFS_PARM1):false;
Expand Down
14 changes: 14 additions & 0 deletions engine/server/pr_q1qvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,8 @@ static qintptr_t QVM_uri_query (void *offset, quintptr_t mask, const qintptr_t *
void QCBUILTIN PF_sv_trailparticles(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_sv_pointparticles(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_sv_particleeffectnum(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getmodelindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_getsoundindex (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
static qintptr_t QVM_particleeffectnum (void *offset, quintptr_t mask, const qintptr_t *arg)
{
int i = WrapQCBuiltin(PF_sv_particleeffectnum, offset, mask, arg, "s");
Expand Down Expand Up @@ -2112,6 +2114,16 @@ static qintptr_t QVM_VisibleTo_FTE (void *offset, quintptr_t mask, const qintptr
return 0;
}

static qintptr_t QVM_getmodelindex (void *offset, quintptr_t mask, const qintptr_t *arg)
{
return WrapQCBuiltin(PF_getmodelindex, offset, mask, arg, "i");
}

static qintptr_t QVM_getsoundindex (void *offset, quintptr_t mask, const qintptr_t *arg)
{
return WrapQCBuiltin(PF_getsoundindex, offset, mask, arg, "i");
}

static qintptr_t QVM_Map_Extension (void *offset, quintptr_t mask, const qintptr_t *arg);

typedef qintptr_t (*traps_t) (void *offset, quintptr_t mask, const qintptr_t *arg);
Expand Down Expand Up @@ -2234,6 +2246,8 @@ struct
{"pointerstat", QVM_pointerstat}, //csqc extension
{"setsendneeded", QVM_SetSendNeeded}, //csqc extension
{"VisibleTo", QVM_VisibleTo_FTE}, //alternative to mvdsv's visclients hack. redundant now. FIXME: Remove.
{"getmodelindex", QVM_getmodelindex},
{"getsoundindex", QVM_getsoundindex},

//sql?
//model querying?
Expand Down

0 comments on commit 5a9f257

Please sign in to comment.