Author: Dustin
Ridenbaugh
Make sure you have a compiler befor you try any of this. The last question I
want to have to awnser "What do you do after you have written the code".
Personally, I reccomend the LCC compiler. I used wordpad to edit the code, and
lcc to compile, and it works great.
Prelim thingy's
Open your g_local.h up and go to the end of the file where edict_s is.
Edit edict_s so that it looks like this. (Be careful, a lot of people acciedntly
will switch edict_s and edict_t)
That funny looking sprite?!?
Okay, someone may have noticed that this code does use a model, or I
mean sprite. You should have noticed is, unless your like me and just copy
everything straight from the .html file, and hope it works. Anyway, this is not
included in your pak file. However, you can make it using a hex editor. I would
highly recommend this for any experienced programer. !!!NAKED TEENAGE CHICKS!!!
That was to get the newbie's attention. DO NOT USE A HEX EDITOR IF YOU DON'T
HAVE A GOOD PROGRAMING BACKGROUND. Do not come whining to me because you
shuffeled your fat table :-)>. You need to edit it so that the size is 0,0.
Its there, but its just too small to see. I'll try to see if I can post it
somewhere.
I think thats all. If it don't work, well, too bad. Actully, if it doesn't
work, email me and I shall fix it ( :-(> 'sigh').
Dustin Ridenbaugh, The Gunslinger.
This site, and all content and graphics displayed on it,
Difficulty: It was harder to
edit the sprite
Hey guys. This is The Gunslinger. I've had a
couple request to put up tutorials here, so here goes. This first one is a
remake of the flashlight. I don't know about you guys, but when I put it in my
code, the dang thing didn't work!?! Then I tried splicing some of the other code
together, and after about an hour, something working came out. So theres the
history, and here we go. By the way, this is a rewritten version of the laser
sight (thanks Geza).
Now open up g_cmds.c and edit the very bottom of the
file and edit it to look like this :
// common data blocks
moveinfo_t moveinfo;
monsterinfo_t monsterinfo;
// Good sir, are you daft?
edict_t *flashlight;
};
void FL_think (edict_t *self);
void FL_make(edict_t *self);
This should
kill them
For $#!t's and giggles, lets create a new file, and call it p_light.c.
Make it look like this:
else if (Q_stricmp (cmd, "flashlight") == 0)
FL_make (ent);
else // anything that doesn't match a command will be a chat
Cmd_Say_f (ent, false, true);
}
Make'in purty
lights and colors
Well, the best way to accomplish the effect of funny lights and colors
in front of you is to get throughly plastered and high as Green Day , but Q2 is
kinda hard to play that way. This might be the next best. I don't know how
server friendly this is, but it works great none the less. The original
lasersight code used some "lss" thingy to find your sight edict_t. I didn't like
it(it wasn't purty) so I killed it. The code is pretty simple, and reminds me
alot of going back to ol' Quake1 and Team Fortress editing. That was fun stuff
wasn't it guys? Anyway...
// Flashlight patch, by Dustin Ridenbaugh, TheGunslinger@ecr.net
#include "g_local.h"
/*
8===============>
FL_make
make the dang thing
<===============8
*/
void FL_make(edict_t *self)
{
vec3_t start,forward,right,end;
if ( self->flashlight )
{
G_FreeEdict(self->flashlight);
self->flashlight = NULL;
return;
}
AngleVectors (self->client->v_angle, forward, right, NULL);
VectorSet(end,100 , 0, 0);
G_ProjectSource (self->s.origin, end, forward, right, start);
self->flashlight = G_Spawn ();
self->flashlight->owner = self;
self->flashlight->movetype = MOVETYPE_NOCLIP;
self->flashlight->solid = SOLID_NOT;
self->flashlight->classname = "flashlight";
self->flashlight->s.modelindex = gi.modelindex ("sprites/sight2.sp2"); // HEY KIDDYS NOTE THIS
self->flashlight->s.skinnum = 0;
self->flashlight->s.effects |= EF_HYPERBLASTER; // Other effects can be used here, such as flag1, but these look corney and
// dull. Try stuff and tell me if you find anything cool
self->flashlight->think = FL_think;
self->flashlight->nextthink = level.time + 0.1;
}
// Congratulations, and welcome to the middle of the file.
/*
8===============>
FL_make
make the dang thing
<===============8
*/
void FL_think (edict_t *self)
{
vec3_t start,end,endp,offset;
vec3_t forward,right,up;
trace_t tr;
AngleVectors (self->owner->client->v_angle, forward, right, up);
VectorSet(offset,24 , 6, self->owner->viewheight-7);
G_ProjectSource (self->owner->s.origin, offset, forward, right, start);
VectorMA(start,8192,forward,end);
tr = gi.trace (start,NULL,NULL, end,self->owner,CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_DEADMONSTER);
if (tr.fraction != 1)
{
VectorMA(tr.endpos,-4,forward,endp);
VectorCopy(endp,tr.endpos);
}
if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client))
{
if ((tr.ent->takedamage) && (tr.ent != self->owner))
{
self->s.skinnum = 1;
}
}
else
self->s.skinnum = 0;
vectoangles(tr.plane.normal,self->s.angles);
VectorCopy(tr.endpos,self->s.origin);
gi.linkentity (self);
self->nextthink = level.time + 0.1;
}
are
Šopyrighted to the Quake DeveLS team.
All rights received.
Got a suggestion? Comment? Question? Hate mail? Send it to us!
Oh yeah,
this site is best viewed in 16 Bit or higher, with the resolution on
800*600.
Thanks to Planet Quake for there great help
and support with hosting.
Best viewed with Netscape
4