Use these
constants.h
#define AMBIENT 1 // PAT: 01-04-2020 pulseID
#define DIFFUSE 2 // PAT: 01-04-2020 pulseID
#define SPECULAR 4 // PAT: 01-04-2020 pulseID
#define EMISSIVE 8 // PAT: 01-04-2020 pulseID
mobj.h
} else if (instr(szBuffer, "#pulse_") == 1) { // PAT: 01-04-2020 pulseID
if (fscanf(pFile, "%f", &pMaterial->rPulseLevel)) {
switch (szBuffer[7]) {
case 'a': // pulse_ambient
pMaterial->pulseID |= AMBIENT;
break;
case 'd': // pulse_diffuse
pMaterial->pulseID |= DIFFUSE;
break;
case 's': // pulse_specular
pMaterial->pulseID |= SPECULAR;
break;
case 'e': // pulse_emissive
pMaterial->pulseID |= EMISSIVE;
break;
default:
fgets(szBuffer, sizeof(szBuffer), pFile);
break;
}
}
renders.h
void PulseLight(MobjMat* pMaterial, IN float rShine) { // PAT: 01-04-2020 pulseID
float ambient[4], diffuse[4], specular[4], emissive[4];
ambient[0] = pMaterial->ambient[0];
ambient[1] = pMaterial->ambient[1];
ambient[2] = pMaterial->ambient[2];
ambient[3] = pMaterial->ambient[3];
diffuse[0] = pMaterial->diffuse[0];
diffuse[1] = pMaterial->diffuse[1];
diffuse[2] = pMaterial->diffuse[2];
diffuse[3] = pMaterial->diffuse[3];
specular[0] = pMaterial->specular[0];
specular[1] = pMaterial->specular[1];
specular[2] = pMaterial->specular[2];
specular[3] = pMaterial->specular[3];
emissive[0] = pMaterial->emissive[0];
emissive[1] = pMaterial->emissive[1];
emissive[2] = pMaterial->emissive[2];
emissive[3] = pMaterial->emissive[3];
if (gB.channel) {
if ((pMaterial->pulseID) && (gP.bSyncAudio)) { // PAT: 01-04-2020 pulseID
DWORD nLevel = BASS_ChannelGetLevel(gB.channel);
float rPulse = (max(LOINT(nLevel), HIINT(nLevel)) / (20000.0f * pMaterial->rPulseLevel));
if (CheckStyle(pMaterial->pulseID, AMBIENT)) {
ambient[0] = rPulse;
ambient[1] = rPulse;
ambient[2] = rPulse;
}
if (CheckStyle(pMaterial->pulseID, DIFFUSE)) {
diffuse[0] = rPulse;
diffuse[1] = rPulse;
diffuse[2] = rPulse;
}
if (CheckStyle(pMaterial->pulseID, SPECULAR)) {
specular[0] = rPulse;
specular[1] = rPulse;
specular[2] = rPulse;
}
if (CheckStyle(pMaterial->pulseID, EMISSIVE)) {
emissive[0] = rPulse;
emissive[1] = rPulse;
emissive[2] = rPulse;
}
}
}
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, &ambient[0]);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse[0]);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &specular[0]);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, &emissive[0]);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, pMaterial->shininess * rShine);
}