QuakeC would be quite difficult to write 'Hello World' in, as it forces OO, has loads of required modules, and doesn't really have a standard output.

(If you really want a hello world, try adding
bprint("Hello World\n");
to PutClientInServer, in Client.qc. This will hello world everyone that joins the server).)


So, with no easy way to hello world, what are you supposed to do instead? Mess with the rocket launcher of course, which is done in weapons.qc 1

Popular choices for the hello world programmer include adding significant figures to the damg calculations, or missile.velocity lines. If you're feeling inventive, sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM); can also be messed with. Truly imaginative programmers will change setmodel (missile, "progs/missile.mdl"); to an entirely different model!

I actually saw a mod released on FTP.CDROM.COM thats sole features were 'I've replaced the rocket launcher with a fish launcher, and the grenade launcher with a doggy launcher. And they now do lots of damage'. Ph33r M@1 31337 5k177z!

The Shub-Niggurath launcher was quite amusing though.



1 - The relevant bits from weapons.qc
void() W_FireRocket =
{
local entity missile, mpuff;

self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;

sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);

self.punchangle_x = -2;

missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_FLYMISSILE;
missile.solid = SOLID_BBOX;
missile.classname = "missile";

// set missile speed

makevectors (self.v_angle);
missile.velocity = aim(self, 1000);

missile.velocity = missile.velocity * 1000;
missile.angles = vectoangles(missile.velocity);

// set missile duration
missile.nextthink = time + 5;
missile.think = SUB_Remove;
setmodel (missile, "progs/missile.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + v_forward*8 + '0 0 16');
};

void() T_MissileTouch =
{
local float damg;

if (other == self.owner)
return; // don't explode on owner

if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}

damg = 100 + random()*20;

if (other.health)
{
if (other.classname == "monster_shambler")
damg = damg * 0.5; // mostly immune
T_Damage (other, self, self.owner, damg );
}
// don't do radius damage to the other, because all the damage
// was done in the impact
T_RadiusDamage (self, self.owner, 120, other);

// sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
self.origin = self.origin - 8*normalize(self.velocity);

WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);

BecomeExplosion ();
};

The quakeC excerpt above is copyright id Software, and was released under the GPL, I think. It's definitely fair use though.

Log in or register to write something here or to contact authors.