|
QuakeZone MOD Coding Tutorials
|
|
|
Introduction Code Notes Exercises |
|
| Introduction |
|
|
This tutorial is based on the chunder tutorial on the QDevels site (see Links page). For added realism, once a player's health drops below 50 he starts to chuck his guts up, the less health the more chunder. And while his health remains below 50 the screen reddens as a little reminder. This tutorial will only work if the Throwup tutorial on the QDevels site has
already been implemented.
|
| Code |
|
|
throwup.c Add the following lines to the end of procedure ThrowUpNow:
// cough up some gibs.
if (self->health < 25)
{
for (i = 0; i<3; i++)
{
ThrowVomit (self, mouth_pos, forward, right, self->velocity);
}
}
// every now and again, cough up MEGA vomit
if (self->health < 10)
{
for (i = 0; i<10; i++)
{
ThrowVomit (self, mouth_pos, forward, right, self->velocity);
}
}
p_client.c Add the following lines to the start of procedure ClientThink:
// PJT - throw up
if ((level.time > ent->client->next_chunder) && (ent->health<50) && (!ent->deadflag))
{
ThrowUpNow(ent);
ent->client->next_chunder = level.time + 5.0;
}
// PJT
g_local.h Add the folloiwng line to the end of structure gclient_s: float next_chunder; // PJT - next chunder when ill p_view.c To procedure SV_CalcBlend, add the following lines as indicated:
// PJT - screen red when damaged
if ((ent->health < 50) && (ent->health > 0))
SV_AddBlend (1.0, 0.0, 0.0, (50.0 - ent->health)/100.0, ent->client->ps.blend);
// PJT - end of insert
// add for powerups
if (ent->client->quad_framenum > level.framenum)
{
|
| Notes |
|
|
throwup.c
p_client.c
g_local.h
p_view.c
|
| Exercises |
|
|