project-navigation
Personal tools

Author Topic: Draw arrows etc. for tutorials  (Read 5626 times)

HaJo

  • Guest
Draw arrows etc. for tutorials
« 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.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Draw arrows etc. for tutorials
« Reply #1 on: August 11, 2006, 08:02:52 pm »
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)

HaJo

  • Guest
Draw arrows etc. for tutorials
« Reply #2 on: August 12, 2006, 01:09:22 am »
Quote from: "Mattn"
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).

Rani

  • Guest
Draw arrows etc. for tutorials
« Reply #3 on: September 06, 2006, 07:57:52 am »
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.

HaJo

  • Guest
Draw arrows etc. for tutorials
« Reply #4 on: September 06, 2006, 05:35:42 pm »
Quote from: "Rani"
Lines for aiming are drawn .. in CL_TraceMove [cl_actor.c , line 854]

Is that usable in .ufo-files, and how ?

Rani

  • Guest
Draw arrows etc. for tutorials
« Reply #5 on: September 06, 2006, 06:01:17 pm »
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.

Rani

  • Guest
Draw arrows etc. for tutorials
« Reply #6 on: September 07, 2006, 06:42:37 am »
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]

Code: [Select]

/**
 * @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:
Code: [Select]

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.