User panel stuff on forum
  3 posts on 1 page  1
Client Talk
2008-04-26, 21:25
Member
5 posts

Registered:
Aug 2006
I occasionally make my own custom locs, and I don't
like to deal with qizmo. I prefer to use ezquake's
inbuilt .loc editor.

I hope that this feature/tutorial will be helpful to
someone, as after you place a loc location, the .loc
will be represented by a small fireball. (30 mins)

Also, just to view the existing .locs on a map,
simply do: loc_view <seconds>, and all the
locs in the map will be represented by a small fireball
for the amount of time you specify.

You are welcome to use this code in the new ezquake, etc
All I ask is that you give me credit (5uper) and hopefully leave my comments intact
(note: my NA TF name is 5uper/ss, so that is why the comments say 5uper)

Here is the code for anyone who is interested
(built off ezquake 1754, will still port into ezq 1.8.3, etc)

open up teamplay.c and at the top add:
// 5uper: loc editor
void DrawLocs (vec3_t loc_location, int loc_time);


add this code right before TP_Init:
// 5uper: find all locs in map, and represent them as a particle
void LocateLocsToDraw_f (void)
{
locdata_t *node;
int loc_time = 0;

loc_time = atoi(Cmd_Argv(1));
Com_Printf ("displaying current locs for: %i seconds\n", loc_time);

for (node = locdata; node; node = node->next)
DrawLocs (node->coord, loc_time);
}


ok, in TP_Init, under Cmd_AddCommand ("loadloc", TP_LoadLocFile_f);

add:
// 5uper: command to view locs in map.
Cmd_AddCommand ("loc_view", LocateLocsToDraw_f);


now, in the middle of teamplay.c is the function:
void TP_AddLoc(char *locname)

under
TP_AddLocNode(location, locname);

add:
// 5uper: loc editor (view locs we just set)
DrawLocs (location, 1800); // 30 minutes should be more than enough time


ok, close teamplay.c.
now move to gl_rpart.c

at the very bottom of gl_rpart.c, add this function:

// 5uper: view loc files in a map, enhanced loc editing
void DrawLocs (vec3_t loc_location, int loc_time)
{
vec3_t end;
col_t color={255,142,62,0}; // look like fire

end[0] = end[1] = end[2] = 0; // no movement in any direction
AddParticle (p_fire, loc_location, 1, 25, loc_time, color, end);
}

Notice AddParticle. I had to create my own particle type to prevent
the particles from moving due to gravity without messing up the
original fire particle.


Ok, in typedef enum part_type_t at the top of gl_rpart.c,

above:
num_particletypes
add:
p_loc_particle,


Now, in QMB_InitParticles
under:
ADD_PARTICLE_TYPE(p_fire, pd_billboard, GL_SRC_ALPHA, GL_ONE, ptex_generic, 204, 0, -2.95, pm_die, 0);

add:
// 5uper: enhanced loc editing
ADD_PARTICLE_TYPE(p_loc_particle, pd_billboard, GL_SRC_ALPHA, GL_ONE, ptex_generic, 204, 0, 0, pm_die, 0);


Almost done.

In the function AddParticle, we need to add the p_loc_particle type.

Right after:
case p_fire:
VectorCopy(org, p->org);
for (j = 0; j < 3; j++)
p->vel[j] = ((rand() % 160) - 80) * (size / 25.0);
break;

add:
// 5uper: loc particle type for enhanced loc editing
case p_loc_particle:
VectorCopy(org, p->org);
for (j = 0; j < 3; j++)
p->vel[j] = 0;
break;


Done.

Now compile and start up any map you have a .loc for, and
type: loc_view 30

Here are screenshots of the loc_view command
http://img378.imageshack.us/img378/4326/ezquake054kq4.jpg
http://img169.imageshack.us/img169/3792/ezquake055fk5.jpg
http://img210.imageshack.us/img210/9082/ezquake056uj8.jpg

And here is a screenshot of a loc i just created using loc_add xxx
http://img137.imageshack.us/img137/2333/ezquake057tj4.jpg
2008-04-27, 21:59
Member
357 posts

Registered:
Mar 2006
This will draw a simple outlined polygon around the origin of the locs. Note though that these are in "proquake"'s loc format not QW so it might require some fudging.
void R_DrawLocs (void)
{
location_t *l;

for (l = locations;l;l = l->next_loc)
{
if ((r_drawlocs.value == 2) || (!(strcmp(l->name,cl.last_loc_name))))//highlight Current area
{
glPushMatrix();
glTranslatef(6.4f, 4.8f,-16.0f);
glColor4f(0,1,0,1);
glEnable(GL_LINE_SMOOTH);
glDisable (GL_DEPTH_TEST);

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, 0);

glBegin(GL_LINE_LOOP);
glLineWidth (2.0f);
glVertex3f(l->maxs[0], l->maxs[1], l->maxs[2]);
glVertex3f(l->mins[0], l->maxs[1], l->maxs[2]);
glVertex3f(l->mins[0], l->mins[1], l->maxs[2]);
glVertex3f(l->maxs[0], l->mins[1], l->maxs[2]);
glEnd();

glBegin(GL_LINE_LOOP);
glLineWidth (2.0f);
glVertex3f(l->maxs[0], l->maxs[1], l->mins[2]);
glVertex3f(l->mins[0], l->maxs[1], l->mins[2]);
glVertex3f(l->mins[0], l->mins[1], l->mins[2]);
glVertex3f(l->maxs[0], l->mins[1], l->mins[2]);
glEnd();

glBegin(GL_LINES);
glLineWidth (2.0f);
glVertex3f(l->maxs[0], l->maxs[1], l->maxs[2]);
glVertex3f(l->maxs[0], l->maxs[1], l->mins[2]);
glVertex3f(l->mins[0], l->maxs[1], l->maxs[2]);
glVertex3f(l->mins[0], l->maxs[1], l->mins[2]);
glVertex3f(l->mins[0], l->mins[1], l->maxs[2]);
glVertex3f(l->mins[0], l->mins[1], l->mins[2]);
glVertex3f(l->maxs[0], l->mins[1], l->maxs[2]);
glVertex3f(l->maxs[0], l->mins[1], l->mins[2]);
glEnd();

glPopMatrix();
glColor4f(1,1,1,1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
}
}
2008-04-27, 22:56
News Writer
493 posts

Registered:
Jan 2006
ss sputnik?

i've always wanted locs to fill the hue of a room, so you know the exact dimensions of a loc.
  3 posts on 1 page  1