cyrri
Member
|
# Posted: 11 Oct 2006 04:22 - Edited by: cyrri
5 minutes after i posted, he queried me on IRC :)
the mod i am working on is WoP: www.worldofpadman.com
thanks to gg67's explanations i got it working meanwhile. for everyone else trying to link camtrace3d to his q3 mod, a quick'n dirty tutorial:
1) howto create the input files for camtrace3d?
no coding needed here. exec the etpro config, fly around, press 0 to write your position and view direction to *.epcp files.
in camtrace choose file->mod etpro, import position files, tweak, write the cfg's
2) how to handle the cfg's?
it's all about providing a handler function for the freecamsetpos command, but first create a new cvar "cg_cammode" with default value 0.
to each of these functions: CG_Draw2D(), CG_AddViewWeapon(), CG_DamageBlendBlob() add the line:
if (cg_cammode.integer == 1) return;
in CG_CalcViewValues() above the intermission stuff, add:
[code]
if(cg_cammode.integer == 1){
VectorCopy( freecampos, cg.refdef.vieworg );
VectorCopy( freecamangles, cg.refdefViewAngles);
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
return CG_CalcFov();
}
[/code]
freecampos and freecamangles are global vec3_t's, set by CG_FreeCamSetPos_f() in cg_consolecmds.c:
[code]
static void CG_FreeCamSetPos_f(void){
char buf[128];
if(trap_Argc() != 7){
CG_Printf("bad argument count %d, give me 7
", trap_Argc() );
return;
}
trap_Argv(1, buf, 128 );
freecampos[0] = atof(buf);
trap_Argv(2, buf, 128 );
freecampos[1] = atof(buf);
trap_Argv(3, buf, 128 );
freecampos[2] = atof(buf);
trap_Argv(4, buf, 128 );
freecamangles[0] = atof(buf);
trap_Argv(5, buf, 128 );
freecamangles[1] = atof(buf);
trap_Argv(6, buf, 128 );
freecamangles[2] = atof(buf);
}
[/code]
which handles freecamsetpos:
[code]
static consoleCommand_t commands[] = {
...
,{"freecamsetpos", CG_FreeCamSetPos_f}
}
[/code]
thats it. almost. if you start the game, set cg_cammode 1 and exec cam.cfg , a cbuf_insert overflow will occur. this can be handled either by splitting the cfg files into smaller ones or by increasing MAX_CMD_BUFFER in qcommon/cmd.c inside the engine.
edit: damn, no code tags :/
|