[quake 3] add a trap function ?
Pierre Marti
pierremarti at free.fr
Fri Jun 29 11:14:13 EDT 2007
Hi,
Do you know how to add your own trap function ?
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).
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.
For example :
In qcommon/common.c :
void example_trap_function( void )
{
int i = 12345; // only for for debug
}
In qcommon/q_shared.h:
void example_trap_function( void );
In game/g_local.h:
void example_trap_function( void );
In game/gpublic.h:
in the gameImport_t enum adding the line :
EXAMPLE_TRAP_FUNCTION
In game/g_syscalls.c:
void example_trap_function( void )
{
syscall( EXAMPLE_TRAP_FUNCTION );
}
You have to modify the game.q3asm for compiling g_syscalls.c (replace line ../g_syscalls with g_syscalls) with ioquake3.
In game/g_syscalls.asm:
adding this line at the end of the file :
equ trap_example_trap_function -584
Is it my problem ?
How to know the number ?
In game/g_main.c:
Use the example function in G_InitGame :
trap_example_trap_function( );
Compiling is ok
After installing everything (bin and qvm) and starting the game it's ok.
When the map is launching (G_InitGame function) I have this message :
bad game system trap -582 (same result if I choose -583)
582 is the number for the trap_BotLibSourceFileAndLine in the g_syscalls.asm file.
I add my line after it...
Thank's
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/quake3/attachments/20070629/8584b826/attachment.htm>
More information about the quake3
mailing list