Implemented missing testprint functions for gvm/cgvm
Code cleanup
This commit is contained in:
parent
142e2645fb
commit
29e71ac6f8
|
@ -171,14 +171,7 @@ typedef enum {
|
|||
CG_GETCAMERAINFO,
|
||||
*/
|
||||
|
||||
CG_MEMSET = 100,
|
||||
CG_MEMCPY,
|
||||
CG_STRNCPY,
|
||||
CG_SIN,
|
||||
CG_COS,
|
||||
CG_ATAN2,
|
||||
CG_SQRT,
|
||||
CG_FLOOR,
|
||||
CG_FLOOR = 107,
|
||||
CG_CEIL,
|
||||
CG_TESTPRINTINT,
|
||||
CG_TESTPRINTFLOAT,
|
||||
|
|
|
@ -639,41 +639,47 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
|
|||
return 0;
|
||||
case CG_MEMORY_REMAINING:
|
||||
return Hunk_MemoryRemaining();
|
||||
case CG_KEY_ISDOWN:
|
||||
case CG_KEY_ISDOWN:
|
||||
return Key_IsDown( args[1] );
|
||||
case CG_KEY_GETCATCHER:
|
||||
case CG_KEY_GETCATCHER:
|
||||
return Key_GetCatcher();
|
||||
case CG_KEY_SETCATCHER:
|
||||
case CG_KEY_SETCATCHER:
|
||||
// Don't allow the cgame module to close the console
|
||||
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
|
||||
return 0;
|
||||
case CG_KEY_GETKEY:
|
||||
return 0;
|
||||
case CG_KEY_GETKEY:
|
||||
return Key_GetKey( VMA(1) );
|
||||
|
||||
case CG_MEMSET:
|
||||
// shared syscalls
|
||||
case TRAP_MEMSET:
|
||||
VM_CHECKBOUNDS( cgvm, args[1], args[3] );
|
||||
Com_Memset( VMA(1), args[2], args[3] );
|
||||
return args[1];
|
||||
case CG_MEMCPY:
|
||||
case TRAP_MEMCPY:
|
||||
VM_CHECKBOUNDS2( cgvm, args[1], args[2], args[3] );
|
||||
Com_Memcpy( VMA(1), VMA(2), args[3] );
|
||||
return args[1];
|
||||
case CG_STRNCPY:
|
||||
case TRAP_STRNCPY:
|
||||
VM_CHECKBOUNDS( cgvm, args[1], args[3] );
|
||||
strncpy( VMA(1), VMA(2), args[3] );
|
||||
return args[1];
|
||||
case CG_SIN:
|
||||
case TRAP_SIN:
|
||||
return FloatAsInt( sin( VMF(1) ) );
|
||||
case CG_COS:
|
||||
case TRAP_COS:
|
||||
return FloatAsInt( cos( VMF(1) ) );
|
||||
case CG_ATAN2:
|
||||
case TRAP_ATAN2:
|
||||
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
|
||||
case CG_SQRT:
|
||||
case TRAP_SQRT:
|
||||
return FloatAsInt( sqrt( VMF(1) ) );
|
||||
|
||||
case CG_FLOOR:
|
||||
return FloatAsInt( floor( VMF(1) ) );
|
||||
case CG_CEIL:
|
||||
return FloatAsInt( ceil( VMF(1) ) );
|
||||
case CG_TESTPRINTINT:
|
||||
return sprintf( VMA(1), "%i", args[2] );
|
||||
case CG_TESTPRINTFLOAT:
|
||||
return sprintf( VMA(1), "%f", VMF(2) );
|
||||
case CG_ACOS:
|
||||
return FloatAsInt( Q_acos( VMF(1) ) );
|
||||
|
||||
|
|
|
@ -1075,31 +1075,33 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
|
|||
re.RegisterFont( VMA(1), args[2], VMA(3));
|
||||
return 0;
|
||||
|
||||
case UI_MEMSET:
|
||||
// shared syscalls
|
||||
|
||||
case TRAP_MEMSET:
|
||||
VM_CHECKBOUNDS( uivm, args[1], args[3] );
|
||||
Com_Memset( VMA(1), args[2], args[3] );
|
||||
return args[1];
|
||||
|
||||
case UI_MEMCPY:
|
||||
case TRAP_MEMCPY:
|
||||
VM_CHECKBOUNDS2( uivm, args[1], args[2], args[3] );
|
||||
Com_Memcpy( VMA(1), VMA(2), args[3] );
|
||||
return args[1];
|
||||
|
||||
case UI_STRNCPY:
|
||||
case TRAP_STRNCPY:
|
||||
VM_CHECKBOUNDS( uivm, args[1], args[3] );
|
||||
strncpy( VMA(1), VMA(2), args[3] );
|
||||
return args[1];
|
||||
|
||||
case UI_SIN:
|
||||
case TRAP_SIN:
|
||||
return FloatAsInt( sin( VMF(1) ) );
|
||||
|
||||
case UI_COS:
|
||||
case TRAP_COS:
|
||||
return FloatAsInt( cos( VMF(1) ) );
|
||||
|
||||
case UI_ATAN2:
|
||||
case TRAP_ATAN2:
|
||||
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
|
||||
|
||||
case UI_SQRT:
|
||||
case TRAP_SQRT:
|
||||
return FloatAsInt( sqrt( VMF(1) ) );
|
||||
|
||||
case UI_FLOOR:
|
||||
|
|
|
@ -229,6 +229,14 @@ typedef enum {
|
|||
// 1.32
|
||||
G_FS_SEEK,
|
||||
|
||||
G_MATRIXMULTIPLY = 107,
|
||||
G_ANGLEVECTORS,
|
||||
G_PERPENDICULARVECTOR,
|
||||
G_FLOOR,
|
||||
G_CEIL,
|
||||
G_TESTPRINTINT,
|
||||
G_TESTPRINTFLOAT,
|
||||
|
||||
BOTLIB_SETUP = 200, // ( void );
|
||||
BOTLIB_SHUTDOWN, // ( void );
|
||||
BOTLIB_LIBVAR_SET,
|
||||
|
|
|
@ -354,14 +354,6 @@ typedef enum {
|
|||
TRAP_COS,
|
||||
TRAP_ATAN2,
|
||||
TRAP_SQRT,
|
||||
TRAP_MATRIXMULTIPLY,
|
||||
TRAP_ANGLEVECTORS,
|
||||
TRAP_PERPENDICULARVECTOR,
|
||||
TRAP_FLOOR,
|
||||
TRAP_CEIL,
|
||||
|
||||
TRAP_TESTPRINTINT,
|
||||
TRAP_TESTPRINTFLOAT
|
||||
} sharedTraps_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -883,6 +883,8 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) {
|
|||
case BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION:
|
||||
return botlib_export->ai.GeneticParentsAndChildSelection(args[1], VMA(2), VMA(3), VMA(4), VMA(5));
|
||||
|
||||
// shared syscalls
|
||||
|
||||
case TRAP_MEMSET:
|
||||
VM_CHECKBOUNDS( gvm, args[1], args[3] );
|
||||
Com_Memset( VMA(1), args[2], args[3] );
|
||||
|
@ -910,24 +912,30 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) {
|
|||
case TRAP_SQRT:
|
||||
return FloatAsInt( sqrt( VMF(1) ) );
|
||||
|
||||
case TRAP_MATRIXMULTIPLY:
|
||||
case G_MATRIXMULTIPLY:
|
||||
MatrixMultiply( VMA(1), VMA(2), VMA(3) );
|
||||
return 0;
|
||||
|
||||
case TRAP_ANGLEVECTORS:
|
||||
case G_ANGLEVECTORS:
|
||||
AngleVectors( VMA(1), VMA(2), VMA(3), VMA(4) );
|
||||
return 0;
|
||||
|
||||
case TRAP_PERPENDICULARVECTOR:
|
||||
case G_PERPENDICULARVECTOR:
|
||||
PerpendicularVector( VMA(1), VMA(2) );
|
||||
return 0;
|
||||
|
||||
case TRAP_FLOOR:
|
||||
case G_FLOOR:
|
||||
return FloatAsInt( floor( VMF(1) ) );
|
||||
|
||||
case TRAP_CEIL:
|
||||
case G_CEIL:
|
||||
return FloatAsInt( ceil( VMF(1) ) );
|
||||
|
||||
case G_TESTPRINTINT:
|
||||
return sprintf( VMA(1), "%i", args[2] );
|
||||
|
||||
case G_TESTPRINTFLOAT:
|
||||
return sprintf( VMA(1), "%f", VMF(2) );
|
||||
|
||||
case G_TRAP_GETVALUE:
|
||||
VM_CHECKBOUNDS( gvm, args[1], args[2] );
|
||||
return SV_GetValue( VMA(1), args[2], VMA(3) );
|
||||
|
|
|
@ -125,14 +125,7 @@ typedef enum {
|
|||
UI_FS_SEEK,
|
||||
UI_SET_PBCLSTATUS,
|
||||
|
||||
UI_MEMSET = 100,
|
||||
UI_MEMCPY,
|
||||
UI_STRNCPY,
|
||||
UI_SIN,
|
||||
UI_COS,
|
||||
UI_ATAN2,
|
||||
UI_SQRT,
|
||||
UI_FLOOR,
|
||||
UI_FLOOR = 107,
|
||||
UI_CEIL,
|
||||
|
||||
// engine extensions
|
||||
|
|
Loading…
Reference in New Issue