Voosh Mode!


Can we say railgun wars?

This could also be called Railgun Wars, since it involves only that one lovely weapon. This add-on will enable the server admin to convert the server to voosh mode.  While in voosh mode, everyone will spawn with a railgun and 500 slugs. No items at all will spawn and the railgun damage will be jacked up to make sure everyone dies with one shot.  This is definitely not for HPB's like myself :-)

Let's get started!
Add in the
blue code and remove any pink code.
First, open up g_local.h and add in this cvar right with all the others:

extern    cvar_t    *flood_waitdelay;
extern    cvar_t    *sv_maplist;
extern    cvar_t    *voosh;

Next do open up g_main.c and do almost the same thing:

cvar_t    *flood_waitdelay;
cvar_t    *sv_maplist;

cvar_t    *voosh;

Now open up g_save.c, we're going to add in the actual line that the server will use to change the voosh variable defined in g_local.h and g_main.c:

    skill = gi.cvar ("skill", "1", CVAR_LATCH);
    maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH);

   
voosh = gi.cvar ("vooshmode", "0", CVAR_LATCH);

When running a server, admins can turn on and off the voosh mode with the "vooshmode" variable.  Next open up g_items.c.   We're going to change the spawnitem function so when we're running voosh mode no items spawn.  Modify it like so:

/*
============
SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void SpawnItem (edict_t *ent, gitem_t *item)
{
    if (voosh->value)
        return;


    PrecacheItem (item);


    ...

This just checks against the voosh variable, and if it's on (has a value) it prevents ANY items from spawning.  Now open up p_client.c and go to the initclientpersistent function.  This next part makes players start with a railgun and some slugs when they spawn if the server is running voosh mode:

void InitClientPersistant (gclient_t *client)
{
    gitem_t        *item;

    memset (&client->pers, 0, sizeof(client->pers));

    item = FindItem("Blaster");
    client->pers.selected_item = ITEM_INDEX(item);
    client->pers.inventory[client->pers.selected_item] = 1;

   
if (voosh->value)
    {
        item = FindItem("Slugs");
        client->pers.selected_item = ITEM_INDEX(item);
        client->pers.inventory[client->pers.selected_item] = 500;

        item = FindItem("Railgun");
        client->pers.selected_item = ITEM_INDEX(item);
        client->pers.inventory[client->pers.selected_item] = 1;
    }

  
    client->pers.weapon = item;

    client->pers.health             = 100;
    client->pers.max_health        = 100;

    client->pers.max_bullets    = 200;
    client->pers.max_shells        = 100;
    client->pers.max_rockets    = 50;
    client->pers.max_grenades    = 50;
    client->pers.max_cells        = 200;

    client->pers.max_slugs        = 50;

    if (voosh->value)
        client->pers.max_slugs         = 500;
    else
        client->pers.max_slugs         = 50;

    client->pers.connected = true;
}

Lastly, we need to change the damage for the railgun in p_weapon.c so it has that nice splattering of gibs effect when you rail someone in voosh mode:

void weapon_railgun_fire (edict_t *ent)
{
    vec3_t        start;
    vec3_t        forward, right;
    vec3_t        offset;
    int             damage;
    int             kick;

    if (deathmatch->value)
    {    // normal damage is too extreme in dm
        damage = 100;
        kick = 200;
    }
    else
    {
        damage = 150;
        kick = 250;
    }

    if (voosh->value)
        damage = 250;


    if (is_quad)
    {
        damage *= 4;
        kick *= 4;
    }

    ...

That's it, we're done!
Remember, "vooshmode" is the variable for switching between normal and Voosh Mode servers. Have fun racking up the frags with one shot - one kill games!

Tutorial by Willi
Quake Style - Tutorials