// Load it from diskif (sfx->name[0] == '#') Com_sprintf(name, sizeof(name), "%s", &sfx->name[1]);else Com_sprintf(name, sizeof(name), "sound/%s", sfx->name);if (!S_OpenAL_LoadWAV(name, &data, &info)){ Com_DPrintf ("WARNING: couldn't find sound '%s'\n", name); return false; //S_CreateDefaultSound(&data, &info);}
// Declarations at beginning of methodfor new local variableschar *slash1;char *slash2;char temp2[MAX_QPATH];// begin patch code...if(sfx->name[0] == '#') { // gets the slashes, and does some bug checking slash1 = strchr(name, '/'); if(!slash1) { Com_Printf("WARNING: Could not find 1st '/'! Sound name: %s\n", LOG_CLIENT, name); return false; } else if(name[(int)(slash1-name)+1] == 0) { Com_Printf("WARNING: Zero byte encountered after 1st '/'! Sound name: %s\n", LOG_CLIENT, name); return false; } slash2 = strchr(slash1+1, '/'); if(!slash2) { Com_Printf("WARNING: Could not find 2nd '/'! Sound name: %s\n", LOG_CLIENT, name); return false; } else if(name[(int)(slash2-name)+1] == 0) { Com_Printf("WARNING: Zero byte encountered after 2nd '/'! Sound name: %s\n", LOG_CLIENT, name); return false; } // save the data strcpy(temp2, slash2+1); // expand to "players" directory... Com_sprintf(name, sizeof(name), "players/male/%s", temp2); // try loading that if (!S_OpenAL_LoadWAV(name, &data, &info)) return false; }else return false;// end patch