mirror of https://github.com/ioquake/ioq3.git
Fix stack underflow: currently for each call
it pops always the same fixed number of arguments related to instruction array size leading to underflow most of the time since it s mostly less.
This commit is contained in:
parent
39e2113c73
commit
de2971541b
|
@ -389,7 +389,7 @@ void CL_ShutdownCGame( void ) {
|
||||||
if ( !cgvm ) {
|
if ( !cgvm ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VM_Call( cgvm, CG_SHUTDOWN );
|
VM_Call( cgvm, CG_SHUTDOWN, 0 );
|
||||||
VM_Free( cgvm );
|
VM_Free( cgvm );
|
||||||
cgvm = NULL;
|
cgvm = NULL;
|
||||||
}
|
}
|
||||||
|
@ -742,7 +742,7 @@ void CL_InitCGame( void ) {
|
||||||
// init for this gamestate
|
// init for this gamestate
|
||||||
// use the lastExecutedServerCommand instead of the serverCommandSequence
|
// use the lastExecutedServerCommand instead of the serverCommandSequence
|
||||||
// otherwise server commands sent just before a gamestate are dropped
|
// otherwise server commands sent just before a gamestate are dropped
|
||||||
VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );
|
VM_Call( cgvm, CG_INIT, 3, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );
|
||||||
|
|
||||||
// reset any CVAR_CHEAT cvars registered by cgame
|
// reset any CVAR_CHEAT cvars registered by cgame
|
||||||
if ( !clc.demoplaying && !cl_connectedToCheatServer )
|
if ( !clc.demoplaying && !cl_connectedToCheatServer )
|
||||||
|
@ -782,7 +782,7 @@ qboolean CL_GameCommand( void ) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VM_Call( cgvm, CG_CONSOLE_COMMAND );
|
return VM_Call( cgvm, CG_CONSOLE_COMMAND, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ CL_CGameRendering
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
void CL_CGameRendering( stereoFrame_t stereo ) {
|
void CL_CGameRendering( stereoFrame_t stereo ) {
|
||||||
VM_Call( cgvm, CG_DRAW_ACTIVE_FRAME, cl.serverTime, stereo, clc.demoplaying );
|
VM_Call( cgvm, CG_DRAW_ACTIVE_FRAME, 3, cl.serverTime, stereo, clc.demoplaying );
|
||||||
VM_Debug( 0 );
|
VM_Debug( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1455,7 +1455,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
|
||||||
if (cinTable[currentHandle].alterGameState) {
|
if (cinTable[currentHandle].alterGameState) {
|
||||||
// close the menu
|
// close the menu
|
||||||
if ( uivm ) {
|
if ( uivm ) {
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NONE );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, 1, UIMENU_NONE );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cinTable[currentHandle].playonwalls = cl_inGameVideo->integer;
|
cinTable[currentHandle].playonwalls = cl_inGameVideo->integer;
|
||||||
|
|
|
@ -126,7 +126,7 @@ Con_MessageMode3_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_MessageMode3_f (void) {
|
void Con_MessageMode3_f (void) {
|
||||||
chat_playerNum = VM_Call( cgvm, CG_CROSSHAIR_PLAYER );
|
chat_playerNum = VM_Call( cgvm, CG_CROSSHAIR_PLAYER, 0 );
|
||||||
if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
|
if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
|
||||||
chat_playerNum = -1;
|
chat_playerNum = -1;
|
||||||
return;
|
return;
|
||||||
|
@ -143,7 +143,7 @@ Con_MessageMode4_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_MessageMode4_f (void) {
|
void Con_MessageMode4_f (void) {
|
||||||
chat_playerNum = VM_Call( cgvm, CG_LAST_ATTACKER );
|
chat_playerNum = VM_Call( cgvm, CG_LAST_ATTACKER, 0 );
|
||||||
if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
|
if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
|
||||||
chat_playerNum = -1;
|
chat_playerNum = -1;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -361,9 +361,9 @@ CL_MouseEvent
|
||||||
*/
|
*/
|
||||||
void CL_MouseEvent( int dx, int dy, int time ) {
|
void CL_MouseEvent( int dx, int dy, int time ) {
|
||||||
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
||||||
VM_Call( uivm, UI_MOUSE_EVENT, dx, dy );
|
VM_Call( uivm, UI_MOUSE_EVENT, 2, dx, dy );
|
||||||
} else if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
|
} else if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
|
||||||
VM_Call (cgvm, CG_MOUSE_EVENT, dx, dy);
|
VM_Call (cgvm, CG_MOUSE_EVENT, 2, dx, dy);
|
||||||
} else {
|
} else {
|
||||||
cl.mouseDx[cl.mouseIndex] += dx;
|
cl.mouseDx[cl.mouseIndex] += dx;
|
||||||
cl.mouseDy[cl.mouseIndex] += dy;
|
cl.mouseDy[cl.mouseIndex] += dy;
|
||||||
|
|
|
@ -1282,23 +1282,23 @@ void CL_KeyDownEvent( int key, unsigned time )
|
||||||
// escape always gets out of CGAME stuff
|
// escape always gets out of CGAME stuff
|
||||||
if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
|
if (Key_GetCatcher( ) & KEYCATCH_CGAME) {
|
||||||
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CGAME );
|
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CGAME );
|
||||||
VM_Call (cgvm, CG_EVENT_HANDLING, CGAME_EVENT_NONE);
|
VM_Call (cgvm, CG_EVENT_HANDLING, 1, CGAME_EVENT_NONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !( Key_GetCatcher( ) & KEYCATCH_UI ) ) {
|
if ( !( Key_GetCatcher( ) & KEYCATCH_UI ) ) {
|
||||||
if ( clc.state == CA_ACTIVE && !clc.demoplaying ) {
|
if ( clc.state == CA_ACTIVE && !clc.demoplaying ) {
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, 1, UIMENU_INGAME );
|
||||||
}
|
}
|
||||||
else if ( clc.state != CA_DISCONNECTED ) {
|
else if ( clc.state != CA_DISCONNECTED ) {
|
||||||
CL_Disconnect_f();
|
CL_Disconnect_f();
|
||||||
S_StopAllSounds();
|
S_StopAllSounds();
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, 1, UIMENU_MAIN );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_Call( uivm, UI_KEY_EVENT, key, qtrue );
|
VM_Call( uivm, UI_KEY_EVENT, 2, key, qtrue );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1310,11 +1310,11 @@ void CL_KeyDownEvent( int key, unsigned time )
|
||||||
Console_Key( key );
|
Console_Key( key );
|
||||||
} else if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_UI ) {
|
||||||
if ( uivm ) {
|
if ( uivm ) {
|
||||||
VM_Call( uivm, UI_KEY_EVENT, key, qtrue );
|
VM_Call( uivm, UI_KEY_EVENT, 2, key, qtrue );
|
||||||
}
|
}
|
||||||
} else if ( Key_GetCatcher( ) & KEYCATCH_CGAME ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_CGAME ) {
|
||||||
if ( cgvm ) {
|
if ( cgvm ) {
|
||||||
VM_Call( cgvm, CG_KEY_EVENT, key, qtrue );
|
VM_Call( cgvm, CG_KEY_EVENT, 2, key, qtrue );
|
||||||
}
|
}
|
||||||
} else if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE ) {
|
||||||
Message_Key( key );
|
Message_Key( key );
|
||||||
|
@ -1353,9 +1353,9 @@ void CL_KeyUpEvent( int key, unsigned time )
|
||||||
CL_ParseBinding( key, qfalse, time );
|
CL_ParseBinding( key, qfalse, time );
|
||||||
|
|
||||||
if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) {
|
||||||
VM_Call( uivm, UI_KEY_EVENT, key, qfalse );
|
VM_Call( uivm, UI_KEY_EVENT, 2, key, qfalse );
|
||||||
} else if ( Key_GetCatcher( ) & KEYCATCH_CGAME && cgvm ) {
|
} else if ( Key_GetCatcher( ) & KEYCATCH_CGAME && cgvm ) {
|
||||||
VM_Call( cgvm, CG_KEY_EVENT, key, qfalse );
|
VM_Call( cgvm, CG_KEY_EVENT, 2, key, qfalse );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,7 +1394,7 @@ void CL_CharEvent( int key ) {
|
||||||
}
|
}
|
||||||
else if ( Key_GetCatcher( ) & KEYCATCH_UI )
|
else if ( Key_GetCatcher( ) & KEYCATCH_UI )
|
||||||
{
|
{
|
||||||
VM_Call( uivm, UI_KEY_EVENT, key | K_CHAR_FLAG, qtrue );
|
VM_Call( uivm, UI_KEY_EVENT, 2, key | K_CHAR_FLAG, qtrue );
|
||||||
}
|
}
|
||||||
else if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE )
|
else if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE )
|
||||||
{
|
{
|
||||||
|
|
|
@ -359,12 +359,12 @@ void CL_VoipParseTargets(void)
|
||||||
{
|
{
|
||||||
if(!Q_stricmpn(target, "attacker", 8))
|
if(!Q_stricmpn(target, "attacker", 8))
|
||||||
{
|
{
|
||||||
val = VM_Call(cgvm, CG_LAST_ATTACKER);
|
val = VM_Call(cgvm, CG_LAST_ATTACKER, 0);
|
||||||
target += 8;
|
target += 8;
|
||||||
}
|
}
|
||||||
else if(!Q_stricmpn(target, "crosshair", 9))
|
else if(!Q_stricmpn(target, "crosshair", 9))
|
||||||
{
|
{
|
||||||
val = VM_Call(cgvm, CG_CROSSHAIR_PLAYER);
|
val = VM_Call(cgvm, CG_CROSSHAIR_PLAYER, 0);
|
||||||
target += 9;
|
target += 9;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1429,7 +1429,7 @@ void CL_Disconnect( qboolean showMainMenu ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( uivm && showMainMenu ) {
|
if ( uivm && showMainMenu ) {
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NONE );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, 1, UIMENU_NONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
SCR_StopCinematic ();
|
SCR_StopCinematic ();
|
||||||
|
@ -2956,12 +2956,12 @@ void CL_Frame ( int msec ) {
|
||||||
if ( cls.cddialog ) {
|
if ( cls.cddialog ) {
|
||||||
// bring up the cd error dialog if needed
|
// bring up the cd error dialog if needed
|
||||||
cls.cddialog = qfalse;
|
cls.cddialog = qfalse;
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NEED_CD );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, 1, UIMENU_NEED_CD );
|
||||||
} else if ( clc.state == CA_DISCONNECTED && !( Key_GetCatcher( ) & KEYCATCH_UI )
|
} else if ( clc.state == CA_DISCONNECTED && !( Key_GetCatcher( ) & KEYCATCH_UI )
|
||||||
&& !com_sv_running->integer && uivm ) {
|
&& !com_sv_running->integer && uivm ) {
|
||||||
// if disconnected, bring up the menu
|
// if disconnected, bring up the menu
|
||||||
S_StopAllSounds();
|
S_StopAllSounds();
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, 1, UIMENU_MAIN );
|
||||||
}
|
}
|
||||||
|
|
||||||
// if recording an avi, lock to a fixed fps
|
// if recording an avi, lock to a fixed fps
|
||||||
|
|
|
@ -477,7 +477,7 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
|
||||||
|
|
||||||
re.BeginFrame( stereoFrame );
|
re.BeginFrame( stereoFrame );
|
||||||
|
|
||||||
uiFullscreen = (uivm && VM_Call( uivm, UI_IS_FULLSCREEN ));
|
uiFullscreen = (uivm && VM_Call( uivm, UI_IS_FULLSCREEN, 0 ));
|
||||||
|
|
||||||
// wide aspect ratio screens need to have the sides cleared
|
// wide aspect ratio screens need to have the sides cleared
|
||||||
// unless they are displaying game renderings
|
// unless they are displaying game renderings
|
||||||
|
@ -502,15 +502,15 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
|
||||||
case CA_DISCONNECTED:
|
case CA_DISCONNECTED:
|
||||||
// force menu up
|
// force menu up
|
||||||
S_StopAllSounds();
|
S_StopAllSounds();
|
||||||
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
|
VM_Call( uivm, UI_SET_ACTIVE_MENU, 1, UIMENU_MAIN );
|
||||||
break;
|
break;
|
||||||
case CA_CONNECTING:
|
case CA_CONNECTING:
|
||||||
case CA_CHALLENGING:
|
case CA_CHALLENGING:
|
||||||
case CA_CONNECTED:
|
case CA_CONNECTED:
|
||||||
// connecting clients will only show the connection dialog
|
// connecting clients will only show the connection dialog
|
||||||
// refresh to update the time
|
// refresh to update the time
|
||||||
VM_Call( uivm, UI_REFRESH, cls.realtime );
|
VM_Call( uivm, UI_REFRESH, 1, cls.realtime );
|
||||||
VM_Call( uivm, UI_DRAW_CONNECT_SCREEN, qfalse );
|
VM_Call( uivm, UI_DRAW_CONNECT_SCREEN, 1, qfalse );
|
||||||
break;
|
break;
|
||||||
case CA_LOADING:
|
case CA_LOADING:
|
||||||
case CA_PRIMED:
|
case CA_PRIMED:
|
||||||
|
@ -520,8 +520,8 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
|
||||||
// also draw the connection information, so it doesn't
|
// also draw the connection information, so it doesn't
|
||||||
// flash away too briefly on local or lan games
|
// flash away too briefly on local or lan games
|
||||||
// refresh to update the time
|
// refresh to update the time
|
||||||
VM_Call( uivm, UI_REFRESH, cls.realtime );
|
VM_Call( uivm, UI_REFRESH, 1, cls.realtime );
|
||||||
VM_Call( uivm, UI_DRAW_CONNECT_SCREEN, qtrue );
|
VM_Call( uivm, UI_DRAW_CONNECT_SCREEN, 1, qtrue );
|
||||||
break;
|
break;
|
||||||
case CA_ACTIVE:
|
case CA_ACTIVE:
|
||||||
// always supply STEREO_CENTER as vieworg offset is now done by the engine.
|
// always supply STEREO_CENTER as vieworg offset is now done by the engine.
|
||||||
|
@ -536,7 +536,7 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
|
||||||
|
|
||||||
// the menu draws next
|
// the menu draws next
|
||||||
if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) {
|
if ( Key_GetCatcher( ) & KEYCATCH_UI && uivm ) {
|
||||||
VM_Call( uivm, UI_REFRESH, cls.realtime );
|
VM_Call( uivm, UI_REFRESH, 1, cls.realtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
// console draws next
|
// console draws next
|
||||||
|
|
|
@ -1091,7 +1091,7 @@ void CL_ShutdownUI( void ) {
|
||||||
if ( !uivm ) {
|
if ( !uivm ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VM_Call( uivm, UI_SHUTDOWN );
|
VM_Call( uivm, UI_SHUTDOWN, 0 );
|
||||||
VM_Free( uivm );
|
VM_Free( uivm );
|
||||||
uivm = NULL;
|
uivm = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1122,11 +1122,11 @@ void CL_InitUI( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
v = VM_Call( uivm, UI_GETAPIVERSION );
|
v = VM_Call( uivm, UI_GETAPIVERSION, 0 );
|
||||||
if (v == UI_OLD_API_VERSION) {
|
if (v == UI_OLD_API_VERSION) {
|
||||||
// Com_Printf(S_COLOR_YELLOW "WARNING: loading old Quake III Arena User Interface version %d\n", v );
|
// Com_Printf(S_COLOR_YELLOW "WARNING: loading old Quake III Arena User Interface version %d\n", v );
|
||||||
// init for this gamestate
|
// init for this gamestate
|
||||||
VM_Call( uivm, UI_INIT, (clc.state >= CA_AUTHORIZING && clc.state < CA_ACTIVE));
|
VM_Call( uivm, UI_INIT, 1, (clc.state >= CA_AUTHORIZING && clc.state < CA_ACTIVE));
|
||||||
}
|
}
|
||||||
else if (v != UI_API_VERSION) {
|
else if (v != UI_API_VERSION) {
|
||||||
// Free uivm now, so UI_SHUTDOWN doesn't get called later.
|
// Free uivm now, so UI_SHUTDOWN doesn't get called later.
|
||||||
|
@ -1138,14 +1138,14 @@ void CL_InitUI( void ) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// init for this gamestate
|
// init for this gamestate
|
||||||
VM_Call( uivm, UI_INIT, (clc.state >= CA_AUTHORIZING && clc.state < CA_ACTIVE) );
|
VM_Call( uivm, UI_INIT, 1, (clc.state >= CA_AUTHORIZING && clc.state < CA_ACTIVE) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef STANDALONE
|
#ifndef STANDALONE
|
||||||
qboolean UI_usesUniqueCDKey( void ) {
|
qboolean UI_usesUniqueCDKey( void ) {
|
||||||
if (uivm) {
|
if (uivm) {
|
||||||
return (VM_Call( uivm, UI_HASUNIQUECDKEY) == qtrue);
|
return (VM_Call( uivm, UI_HASUNIQUECDKEY, 0) == qtrue);
|
||||||
} else {
|
} else {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
@ -1164,5 +1164,5 @@ qboolean UI_GameCommand( void ) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VM_Call( uivm, UI_CONSOLE_COMMAND, cls.realtime );
|
return VM_Call( uivm, UI_CONSOLE_COMMAND, 1, cls.realtime );
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,7 @@ void VM_Forced_Unload_Start(void);
|
||||||
void VM_Forced_Unload_Done(void);
|
void VM_Forced_Unload_Done(void);
|
||||||
vm_t *VM_Restart(vm_t *vm, qboolean unpure);
|
vm_t *VM_Restart(vm_t *vm, qboolean unpure);
|
||||||
|
|
||||||
intptr_t QDECL VM_Call( vm_t *vm, int callNum, ... );
|
intptr_t QDECL VM_Call( vm_t *vm, int callNum, int n, ... );
|
||||||
|
|
||||||
void VM_Debug( int level );
|
void VM_Debug( int level );
|
||||||
|
|
||||||
|
|
|
@ -804,11 +804,11 @@ locals from sp
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
|
|
||||||
intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... )
|
intptr_t QDECL VM_Call( vm_t *vm, int callnum, int n, ... )
|
||||||
{
|
{
|
||||||
vm_t *oldVM;
|
vm_t *oldVM;
|
||||||
intptr_t r;
|
intptr_t r;
|
||||||
int i;
|
int i, cnt = n;
|
||||||
|
|
||||||
if(!vm || !vm->name[0])
|
if(!vm || !vm->name[0])
|
||||||
Com_Error(ERR_FATAL, "VM_Call with NULL vm");
|
Com_Error(ERR_FATAL, "VM_Call with NULL vm");
|
||||||
|
@ -827,8 +827,8 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... )
|
||||||
//rcg010207 - see dissertation at top of VM_DllSyscall() in this file.
|
//rcg010207 - see dissertation at top of VM_DllSyscall() in this file.
|
||||||
int args[MAX_VMMAIN_ARGS-1];
|
int args[MAX_VMMAIN_ARGS-1];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, callnum);
|
va_start(ap, n);
|
||||||
for (i = 0; i < ARRAY_LEN(args); i++) {
|
for (i = 0; i < ARRAY_LEN(args) && cnt-- > 0; i++) {
|
||||||
args[i] = va_arg(ap, int);
|
args[i] = va_arg(ap, int);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
@ -845,6 +845,7 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... )
|
||||||
#endif
|
#endif
|
||||||
r = VM_CallInterpreted( vm, (int*)&callnum );
|
r = VM_CallInterpreted( vm, (int*)&callnum );
|
||||||
#else
|
#else
|
||||||
|
cnt = n;
|
||||||
struct {
|
struct {
|
||||||
int callnum;
|
int callnum;
|
||||||
int args[MAX_VMMAIN_ARGS-1];
|
int args[MAX_VMMAIN_ARGS-1];
|
||||||
|
@ -852,8 +853,8 @@ intptr_t QDECL VM_Call( vm_t *vm, int callnum, ... )
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
a.callnum = callnum;
|
a.callnum = callnum;
|
||||||
va_start(ap, callnum);
|
va_start(ap, n);
|
||||||
for (i = 0; i < ARRAY_LEN(a.args); i++) {
|
for (i = 0; i < ARRAY_LEN(a.args) && cnt-- > 0; i++) {
|
||||||
a.args[i] = va_arg(ap, int);
|
a.args[i] = va_arg(ap, int);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
|
@ -435,7 +435,7 @@ void SV_BotFrame( int time ) {
|
||||||
if (!bot_enable) return;
|
if (!bot_enable) return;
|
||||||
//NOTE: maybe the game is already shutdown
|
//NOTE: maybe the game is already shutdown
|
||||||
if (!gvm) return;
|
if (!gvm) return;
|
||||||
VM_Call( gvm, BOTAI_START_FRAME, time );
|
VM_Call( gvm, BOTAI_START_FRAME, 1, time );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -302,7 +302,7 @@ static void SV_MapRestart_f( void ) {
|
||||||
// run a few frames to allow everything to settle
|
// run a few frames to allow everything to settle
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
VM_Call (gvm, GAME_RUN_FRAME, 1, sv.time);
|
||||||
sv.time += 100;
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ static void SV_MapRestart_f( void ) {
|
||||||
SV_AddServerCommand( client, "map_restart\n" );
|
SV_AddServerCommand( client, "map_restart\n" );
|
||||||
|
|
||||||
// connect the client again, without the firstTime flag
|
// connect the client again, without the firstTime flag
|
||||||
denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, i, qfalse, isBot ) );
|
denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, 3, i, qfalse, isBot ) );
|
||||||
if ( denied ) {
|
if ( denied ) {
|
||||||
// this generally shouldn't happen, because the client
|
// this generally shouldn't happen, because the client
|
||||||
// was connected before the level change
|
// was connected before the level change
|
||||||
|
@ -350,7 +350,7 @@ static void SV_MapRestart_f( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// run another frame to allow things to look at all the players
|
// run another frame to allow things to look at all the players
|
||||||
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
VM_Call (gvm, GAME_RUN_FRAME, 1, sv.time);
|
||||||
sv.time += 100;
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
}
|
}
|
||||||
|
|
|
@ -558,7 +558,7 @@ gotnewcl:
|
||||||
Q_strncpyz( newcl->userinfo, userinfo, sizeof(newcl->userinfo) );
|
Q_strncpyz( newcl->userinfo, userinfo, sizeof(newcl->userinfo) );
|
||||||
|
|
||||||
// get the game a chance to reject this connection or modify the userinfo
|
// get the game a chance to reject this connection or modify the userinfo
|
||||||
denied = VM_Call( gvm, GAME_CLIENT_CONNECT, clientNum, qtrue, qfalse ); // firstTime = qtrue
|
denied = VM_Call( gvm, GAME_CLIENT_CONNECT, 3, clientNum, qtrue, qfalse ); // firstTime = qtrue
|
||||||
if ( denied ) {
|
if ( denied ) {
|
||||||
// we can't just use VM_ArgPtr, because that is only valid inside a VM_Call
|
// we can't just use VM_ArgPtr, because that is only valid inside a VM_Call
|
||||||
char *str = VM_ExplicitArgPtr( gvm, denied );
|
char *str = VM_ExplicitArgPtr( gvm, denied );
|
||||||
|
@ -664,7 +664,7 @@ void SV_DropClient( client_t *drop, const char *reason ) {
|
||||||
|
|
||||||
// call the prog function for removing a client
|
// call the prog function for removing a client
|
||||||
// this will remove the body, among other things
|
// this will remove the body, among other things
|
||||||
VM_Call( gvm, GAME_CLIENT_DISCONNECT, drop - svs.clients );
|
VM_Call( gvm, GAME_CLIENT_DISCONNECT, 1, drop - svs.clients );
|
||||||
|
|
||||||
// add the disconnect command
|
// add the disconnect command
|
||||||
SV_SendServerCommand( drop, "disconnect \"%s\"", reason);
|
SV_SendServerCommand( drop, "disconnect \"%s\"", reason);
|
||||||
|
@ -803,7 +803,7 @@ void SV_ClientEnterWorld( client_t *client, usercmd_t *cmd ) {
|
||||||
memset(&client->lastUsercmd, '\0', sizeof(client->lastUsercmd));
|
memset(&client->lastUsercmd, '\0', sizeof(client->lastUsercmd));
|
||||||
|
|
||||||
// call the game begin function
|
// call the game begin function
|
||||||
VM_Call( gvm, GAME_CLIENT_BEGIN, client - svs.clients );
|
VM_Call( gvm, GAME_CLIENT_BEGIN, 1, client - svs.clients );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1492,7 +1492,7 @@ static void SV_UpdateUserinfo_f( client_t *cl ) {
|
||||||
|
|
||||||
SV_UserinfoChanged( cl );
|
SV_UserinfoChanged( cl );
|
||||||
// call prog code to allow overrides
|
// call prog code to allow overrides
|
||||||
VM_Call( gvm, GAME_CLIENT_USERINFO_CHANGED, cl - svs.clients );
|
VM_Call( gvm, GAME_CLIENT_USERINFO_CHANGED, 1, cl - svs.clients );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1576,7 +1576,7 @@ void SV_ExecuteClientCommand( client_t *cl, const char *s, qboolean clientOK ) {
|
||||||
// pass unknown strings to the game
|
// pass unknown strings to the game
|
||||||
if (!u->name && sv.state == SS_GAME && (cl->state == CS_ACTIVE || cl->state == CS_PRIMED)) {
|
if (!u->name && sv.state == SS_GAME && (cl->state == CS_ACTIVE || cl->state == CS_PRIMED)) {
|
||||||
Cmd_Args_Sanitize();
|
Cmd_Args_Sanitize();
|
||||||
VM_Call( gvm, GAME_CLIENT_COMMAND, cl - svs.clients );
|
VM_Call( gvm, GAME_CLIENT_COMMAND, 1, cl - svs.clients );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!bProcessed)
|
else if (!bProcessed)
|
||||||
|
@ -1656,7 +1656,7 @@ void SV_ClientThink (client_t *cl, usercmd_t *cmd) {
|
||||||
return; // may have been kicked during the last usercmd
|
return; // may have been kicked during the last usercmd
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_Call( gvm, GAME_CLIENT_THINK, cl - svs.clients );
|
VM_Call( gvm, GAME_CLIENT_THINK, 1, cl - svs.clients );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -860,7 +860,7 @@ void SV_ShutdownGameProgs( void ) {
|
||||||
if ( !gvm ) {
|
if ( !gvm ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VM_Call( gvm, GAME_SHUTDOWN, qfalse );
|
VM_Call( gvm, GAME_SHUTDOWN, 1, qfalse );
|
||||||
VM_Free( gvm );
|
VM_Free( gvm );
|
||||||
gvm = NULL;
|
gvm = NULL;
|
||||||
}
|
}
|
||||||
|
@ -888,7 +888,7 @@ static void SV_InitGameVM( qboolean restart ) {
|
||||||
|
|
||||||
// use the current msec count for a random seed
|
// use the current msec count for a random seed
|
||||||
// init for this gamestate
|
// init for this gamestate
|
||||||
VM_Call (gvm, GAME_INIT, sv.time, Com_Milliseconds(), restart);
|
VM_Call (gvm, GAME_INIT, 3, sv.time, Com_Milliseconds(), restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -904,7 +904,7 @@ void SV_RestartGameProgs( void ) {
|
||||||
if ( !gvm ) {
|
if ( !gvm ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VM_Call( gvm, GAME_SHUTDOWN, qtrue );
|
VM_Call( gvm, GAME_SHUTDOWN, 1, qtrue );
|
||||||
|
|
||||||
// do a restart instead of a free
|
// do a restart instead of a free
|
||||||
gvm = VM_Restart(gvm, qtrue);
|
gvm = VM_Restart(gvm, qtrue);
|
||||||
|
@ -958,6 +958,6 @@ qboolean SV_GameCommand( void ) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
return VM_Call( gvm, GAME_CONSOLE_COMMAND );
|
return VM_Call( gvm, GAME_CONSOLE_COMMAND, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,7 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
|
||||||
// run a few frames to allow everything to settle
|
// run a few frames to allow everything to settle
|
||||||
for (i = 0;i < 3; i++)
|
for (i = 0;i < 3; i++)
|
||||||
{
|
{
|
||||||
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
VM_Call (gvm, GAME_RUN_FRAME, 1, sv.time);
|
||||||
SV_BotFrame (sv.time);
|
SV_BotFrame (sv.time);
|
||||||
sv.time += 100;
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
|
@ -523,7 +523,7 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect the client again
|
// connect the client again
|
||||||
denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, i, qfalse, isBot ) ); // firstTime = qfalse
|
denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, 3, i, qfalse, isBot ) ); // firstTime = qfalse
|
||||||
if ( denied ) {
|
if ( denied ) {
|
||||||
// this generally shouldn't happen, because the client
|
// this generally shouldn't happen, because the client
|
||||||
// was connected before the level change
|
// was connected before the level change
|
||||||
|
@ -547,14 +547,14 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
|
||||||
client->deltaMessage = -1;
|
client->deltaMessage = -1;
|
||||||
client->lastSnapshotTime = 0; // generate a snapshot immediately
|
client->lastSnapshotTime = 0; // generate a snapshot immediately
|
||||||
|
|
||||||
VM_Call( gvm, GAME_CLIENT_BEGIN, i );
|
VM_Call( gvm, GAME_CLIENT_BEGIN, 1, i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// run another frame to allow things to look at all the players
|
// run another frame to allow things to look at all the players
|
||||||
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
VM_Call (gvm, GAME_RUN_FRAME, 1, sv.time);
|
||||||
SV_BotFrame (sv.time);
|
SV_BotFrame (sv.time);
|
||||||
sv.time += 100;
|
sv.time += 100;
|
||||||
svs.time += 100;
|
svs.time += 100;
|
||||||
|
|
|
@ -1140,7 +1140,7 @@ void SV_Frame( int msec ) {
|
||||||
sv.time += frameMsec;
|
sv.time += frameMsec;
|
||||||
|
|
||||||
// let everything in the world think and move
|
// let everything in the world think and move
|
||||||
VM_Call (gvm, GAME_RUN_FRAME, sv.time);
|
VM_Call (gvm, GAME_RUN_FRAME, 1, sv.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( com_speeds->integer ) {
|
if ( com_speeds->integer ) {
|
||||||
|
|
Loading…
Reference in New Issue