Forum

dland2 and h2ojump

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

dland2 and h2ojump

Postby Nahuel » Sat Nov 12, 2011 7:46 pm

Hello forum! when any entity falls and touch the ground or water or the engine plays h2ojump.wav dland2.wav by default. What is the best method for the engine play different sounds depending on the entities? I can easily add any wav in these situations. But in the case of the monsters I think it's complicated. Do you know any good way to carry this work out? Thanks in advance :)
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: dland2 and h2ojump

Postby qbism » Sun Nov 13, 2011 6:30 am

dland.wav is coded into the engine. Without an engine mod, maybe save a silent wav to this and do the sound in qc instead.

h2ojump on the other hand is played in client.qc, so do some conditional checks on self.whatever
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: dland2 and h2ojump

Postby Nahuel » Sun Nov 13, 2011 9:15 pm

Much thanks for the answer, is what I thought! Precisely because dland2 not called anywhere in qc.
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 492
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: dland2 and h2ojump

Postby qbism » Sun Nov 13, 2011 9:23 pm

Glad it helps. BTW here's the place in the engine:
Code: Select all
/*
=============
SV_Physics_Step

Monsters freefall when they don't have a ground entity, otherwise
all movement is done with discrete steps.

This is also used for objects that have become still on the ground, but
will fall if the floor is pulled out from under them.
=============
*/

void SV_Physics_Step (edict_t *ent)
{
    qboolean   hitsound;

// freefall if not onground
    if ( ! ((int)ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM) ) )
    {
        if (ent->v.velocity[2] < sv_gravity.value*-0.1)
            hitsound = true;
        else
            hitsound = false;

        SV_AddGravity (ent);
        SV_CheckVelocity (ent);
        SV_FlyMove (ent, host_frametime, NULL);
        SV_LinkEdict (ent, true);

        if ( (int)ent->v.flags & FL_ONGROUND )   // just hit ground
        {
            if (hitsound)
                SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
        }
    }

// regular thinking
    SV_RunThink (ent);

    SV_CheckWaterTransition (ent);
}
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest