Maps & WADs

A crude attempt at doing footsteps per surface. This particular try is keyed on sector tags. It would be better probably to key on floor flat name.

The main difficulty I found was to change the frequency of the stepping as the player speed changed.

I added suitable sound lumps and a corresponding SNDINFO:

FS_METAL    FS_METAL
FS_WOOD     FS_WOOD
FS_CONCR    FS_CONCR
FS_MUD      FS_MUD
FS_WTR      FS_WTR
                

And a fairly crude script that maps sector tags with a sound to play. The stub of the frequency routine is there too, but needs expanding to account for different player speeds, and possibly a starting and stopping pattern.

#include "zcommon.acs"

int footstepTypesCount = 6;
int footstepTypesDef[6][2]  = {{0,""},{1,"FS_WTR"},{2,"FS_MUD"},{3,"FS_CONCR"},{4,"FS_WOOD"},{5,"FS_METAL"}};

script 1 ENTER{
    Thing_ChangeTID(0, 1000 + PlayerNumber());
    ACS_Execute(2,0,0,0,0);
}

/*
detect footsteps:
also, see https://zdoom.org/wiki/GetActorVelY
*/
script 2 (void){
    int _delay = 15;
    while(TRUE){
        int x = GetActorVelX(0);
        int y = GetActorVelY(0);
        int z = GetActorVelZ(0);
        int speed = FixedSqrt(FixedMul(x, x) + FixedMul(y, y) + FixedMul(z, z));
        str _footstep = "";
        _footstep = isInFootstepSector();
        if(_footstep){
            if(speed > 3){
                PlaySound(1000,_footstep);
            }
        }
        delay(_delay);
    }
}

/*
return whether player is in marked sector
*/
function str isInFootstepSector(void){
    if(getActorVelX(0) || getActorVelY(0) || getActorVelZ(0)){
        for(int a=0; a < footstepTypesCount; a++){
            if(ThingCountSector (T_NONE, 1000, footstepTypesDef[a][0])){
                return(footstepTypesDef[a][1]);
            }
        }
    }
    return(FALSE);
}