UFO:Alien Invasion
Development => Coding => Topic started by: HaJo on August 11, 2006, 03:56:19 pm
-
I'm working on the (still missing) gameplay-tutorial, and it
would be nice to draw lines, arrows, circles etc. on the screen,
but I don't see how this can be done.
I can make a small picture with an arrow (like base/pics/cursor1.tga)
and position it somewhere, but I rather want lines between two points.
-
i've put some string to the gameplay tutorial a few revision ago.
currently there is only a way to draw a line - well a rectangle with height=1 (Resp. width=1)
-
currently there is only a way to draw a line - well a rectangle with height=1 (Resp. width=1)
Ok, that means only horizontal and vertical lines...
But I wonder how the lines in tactical missions are drawn,
i.e. for aiming and walking (when confirm is on).
-
Lines for aiming are drawn in
CL_TargetingStraight [cl_actor.c , line 1777]
Probably via CL_ParticleSpawn [cl_particle.c , line 535]
edit:
A quick check shows this is used in CL_TraceMove [cl_actor.c , line 854]
as well, so this is probably what you're looking for.
-
Lines for aiming are drawn .. in CL_TraceMove [cl_actor.c , line 854]
Is that usable in .ufo-files, and how ?
-
Well , i'v searched, and it doesnt look like this
function is binded to the script.
You'll have to bind it with a warpper function and
Cmd_AddCommand.
-
Well, what needs to be done ,more or less:
(by someone who can actually compile and run the game)
add to cl_view [i say cl_view since it looks an appropriate place.
but I'v known to be wrong]
/**
* @brief Function to draw a line on the battlescape
*
*/
static void CL_DrawParticle(void)
{
vec3_t start, end;
char *particleName;
/* only in 3d view */
if (!CL_OnBattlescape())
return;
/* check for bad usage*/
if ( Cmd_Argc() != 7 )
{
Com_Printf("Usage: drawline <particle_name> <from_x> <from_y> <from_z> <to_x> <to_y> <to_z>\n");
return;
}
/* first param is the particle name (should have a matching particle script)*/
particleName=Cmd_Argv( 1 );
/* next 3 vars are the start(from) position x, y, z*/
start[0]=atof(Cmd_Argv( 2 ));
start[1]=atof(Cmd_Argv( 3 ));
start[2]=atof(Cmd_Argv( 4 ));
/* next 3 vars are the end(to) position x, y, z*/
end[0]=atof(Cmd_Argv( 5 ));
end[1]=atof(Cmd_Argv( 6 ));
end[2]=atof(Cmd_Argv( 7 ));
/* plot the particle*/
CL_ParticleSpawn(particleName, 0, start, end, NULL);
}
Then ,in the same file ,in the function V_Init [line 791]
add the line:
Cmd_AddCommand("drawparticle", CL_DrawParticle, NULL);
Then, you'd be able to use it in the script with
cmd "drawparticle inRangeTracer 0.0 0.0 0.0 1.0 1.0 1.0"
to draw inRanger (green?) colored line from point 0,0,0 to point 1,1,1
Cant check its working though. You'll have to do it yourself, or
ask someone else.