<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=postbody><FONT face=Arial size=2>Do you know how to add your 
own trap function ? <BR>I put my function in qcommon directory and I want to 
call it from the game directory (like for example the trap_FS_Write function). 
<BR>I do the same (definition/declaration) like the other trap functions but I 
suppose the problem is to find the correct id for the g_syscalls.asm.</FONT> 
</SPAN></DIV>
<DIV><SPAN class=postbody><SPAN class=postbody><FONT face=Arial><FONT 
size=2></FONT></FONT></SPAN></SPAN>&nbsp;</DIV>
<DIV><SPAN class=postbody><SPAN class=postbody><FONT face=Arial><FONT size=2>For 
example :</DIV>
<DIV><BR><BR><SPAN style="TEXT-DECORATION: underline">In qcommon/common.c 
</SPAN>: <BR><BR>void example_trap_function( void ) <BR>{ <BR>int i = 12345; // 
only for for debug <BR>} <BR><BR><BR><SPAN style="TEXT-DECORATION: underline">In 
qcommon/q_shared.h</SPAN>: <BR><BR>void example_trap_function( void ); 
<BR><BR><BR><SPAN style="TEXT-DECORATION: underline">In game/g_local.h</SPAN>: 
<BR><BR>void example_trap_function( void ); <BR><BR><BR><SPAN 
style="TEXT-DECORATION: underline">In game/gpublic.h</SPAN>: <BR><BR>in the 
gameImport_t enum adding the line : <BR><BR>EXAMPLE_TRAP_FUNCTION 
<BR><BR><BR><SPAN style="TEXT-DECORATION: underline">In 
game/g_syscalls.c</SPAN>: <BR><BR>void example_trap_function( void ) <BR>{ 
<BR>syscall( EXAMPLE_TRAP_FUNCTION ); <BR>} <BR><BR>You have to modify the 
game.q3asm for compiling g_syscalls.c (replace line <SPAN 
style="FONT-STYLE: italic">../g_syscalls</SPAN> with <SPAN 
style="FONT-STYLE: italic">g_syscalls</SPAN>) with ioquake3. <BR><BR><BR><SPAN 
style="TEXT-DECORATION: underline">In game/g_syscalls.asm</SPAN>: <BR><BR>adding 
this line at the end of the file : <BR><BR>equ trap_example_trap_function -584 
<BR><BR>Is it my problem ? <BR>How to know the number ? <BR><BR><BR><SPAN 
style="TEXT-DECORATION: underline">In game/g_main.c</SPAN>: <BR><BR>Use the 
example function in G_InitGame : <BR><BR>trap_example_trap_function( ); 
<BR><BR><BR>Compiling is ok <BR>After installing everything (bin and qvm) and 
starting the game it's ok. <BR>When the map is launching (G_InitGame function) I 
have this message : <BR><BR><SPAN style="FONT-STYLE: italic">bad game system 
trap -582</SPAN> (same result&nbsp;if I choose&nbsp;-583)<BR><BR>582 is the 
number for the trap_BotLibSourceFileAndLine in the g_syscalls.asm file. <BR>I 
add my line after it...</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank's</DIV>
<DIV>&nbsp;</DIV>
<DIV></FONT></FONT></SPAN></SPAN>&nbsp;</DIV></BODY></HTML>