-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QVM: Support for syscall extensions.
- Loading branch information
Showing
5 changed files
with
76 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "g_local.h" | ||
#include "g_syscalls.h" | ||
|
||
typedef union fi_s | ||
{ | ||
float _float; | ||
intptr_t _int; | ||
} fi_t; | ||
|
||
void trap_SetExtField_i(gedict_t *ed, const char *fieldname, int val) | ||
{ | ||
if (HAVEEXTENSION(G_SETEXTFIELD)) | ||
{ | ||
trap_SetExtField(ed, fieldname, val); | ||
} | ||
else | ||
{ | ||
G_bprint(PRINT_HIGH, "SetExtField(%s, %s, %d) not supported by server\n", ed->classname, fieldname, val); | ||
} | ||
} | ||
|
||
void trap_SetExtField_f(gedict_t *ed, const char *fieldname, float val) | ||
{ | ||
if (HAVEEXTENSION(G_SETEXTFIELD)) | ||
{ | ||
fi_t rc; | ||
rc._float = val; | ||
trap_SetExtField(ed, fieldname, rc._int); | ||
} | ||
else | ||
{ | ||
G_bprint(PRINT_HIGH, "SetExtField(%s, %s, %f) not supported by server\n", ed->classname, fieldname, val); | ||
} | ||
} | ||
|
||
int trap_GetExtField_i(gedict_t *ed, const char *fieldname) | ||
{ | ||
int ival = -1; | ||
if (HAVEEXTENSION(G_GETEXTFIELD)) | ||
{ | ||
ival = trap_GetExtField(ed, fieldname); | ||
} | ||
return ival; | ||
} | ||
|
||
float trap_GetExtField_f(gedict_t *ed, const char *fieldname) | ||
{ | ||
fi_t tmp; | ||
tmp._float = -1.0f; | ||
if (HAVEEXTENSION(G_GETEXTFIELD)) | ||
{ | ||
tmp._int = trap_GetExtField_f(ed, fieldname); | ||
} | ||
return tmp._float; | ||
} |