- A_FreezeDeath() now removes fuzz effects.

- In mus2midi.cpp, added range checking to MUS_SYSEVENT and MUS_CTRLCHANGE,
  and masking for note-off keys, note-on velocities, and program changes.


SVN r2032 (trunk)
This commit is contained in:
Randy Heit 2009-12-19 04:54:04 +00:00
parent 51e158d7dc
commit d8a2387c39
4 changed files with 46 additions and 13 deletions

View file

@ -1,3 +1,8 @@
December 18, 2009
- A_FreezeDeath() now removes fuzz effects.
- In mus2midi.cpp, added range checking to MUS_SYSEVENT and MUS_CTRLCHANGE,
and masking for note-off keys, note-on velocities, and program changes.
December 18, 2009 (Changes by Graf Zahl)
- added all known maps requiring inverted sprite sorting to compatibility.txt.
- added compatibility option to invert sprite sorting. Apparently Doom.exe

View file

@ -163,6 +163,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath)
self->flags2 |= MF2_PUSHABLE|MF2_TELESTOMP|MF2_PASSMOBJ|MF2_SLIDE;
self->flags3 |= MF3_CRASHED;
self->height = self->GetDefault()->height;
// Remove fuzz effects from frozen actors.
if (self->RenderStyle.BlendOp >= STYLEOP_Fuzz && self->RenderStyle.BlendOp <= STYLEOP_FuzzOrRevSub)
{
self->RenderStyle = STYLE_Normal;
}
S_Sound (self, CHAN_BODY, "misc/freeze", 1, ATTN_NORM);
// [RH] Andy Baker's stealth monsters
@ -178,7 +184,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath)
self->player->poisoncount = 0;
self->player->bonuscount = 0;
}
else if (self->flags3&MF3_ISMONSTER && self->special)
else if (self->flags3 & MF3_ISMONSTER && self->special)
{ // Initiate monster death actions
LineSpecials [self->special] (NULL, self, false, self->args[0],
self->args[1], self->args[2], self->args[3], self->args[4]);

View file

@ -121,6 +121,7 @@ bool ProduceMIDI (const BYTE *musBuf, TArray<BYTE> &outFile)
BYTE chanUsed[16];
BYTE lastVel[16];
long trackLen;
bool no_op;
// Do some validation of the MUS file
if (MUSMagic != musHead->Magic)
@ -178,12 +179,13 @@ bool ProduceMIDI (const BYTE *musBuf, TArray<BYTE> &outFile)
midStatus = channel;
midArgs = 0; // Most events have two args (0 means 2, 1 means 1)
no_op = false;
switch (event & 0x70)
{
case MUS_NOTEOFF:
midStatus |= MIDI_NOTEOFF;
mid1 = t;
mid1 = t & 127;
mid2 = 64;
break;
@ -192,7 +194,7 @@ bool ProduceMIDI (const BYTE *musBuf, TArray<BYTE> &outFile)
mid1 = t & 127;
if (t & 128)
{
lastVel[channel] = musBuf[mus_p++];;
lastVel[channel] = musBuf[mus_p++] & 127;
}
mid2 = lastVel[channel];
break;
@ -204,9 +206,16 @@ bool ProduceMIDI (const BYTE *musBuf, TArray<BYTE> &outFile)
break;
case MUS_SYSEVENT:
if (t < 10 || t > 14)
{
no_op = true;
}
else
{
midStatus |= MIDI_CTRLCHANGE;
mid1 = CtrlTranslate[t];
mid2 = t == 12 ? LittleShort(musHead->NumChans) : 0;
mid2 = t == 12 /* Mono */ ? LittleShort(musHead->NumChans) : 0;
}
break;
case MUS_CTRLCHANGE:
@ -214,27 +223,39 @@ bool ProduceMIDI (const BYTE *musBuf, TArray<BYTE> &outFile)
{ // program change
midArgs = 1;
midStatus |= MIDI_PRGMCHANGE;
mid1 = musBuf[mus_p++];
mid1 = musBuf[mus_p++] & 127;
mid2 = 0; // Assign mid2 just to make GCC happy
}
else
else if (t > 0 && t < 10)
{
midStatus |= MIDI_CTRLCHANGE;
mid1 = CtrlTranslate[t];
mid2 = musBuf[mus_p++];
}
else
{
no_op = true;
}
break;
case MUS_SCOREEND:
midStatus = 0xff;
mid1 = 0x2f;
mid2 = 0x00;
midStatus = MIDI_META;
mid1 = MIDI_META_EOT;
mid2 = 0;
break;
default:
return false;
}
if (no_op)
{
// A system-specific event with no data is a no-op.
midStatus = MIDI_META;
mid1 = MIDI_META_SSPEC;
mid2 = 0;
}
WriteVarLen (outFile, deltaTime);
if (midStatus != status)

View file

@ -46,6 +46,7 @@
#define MIDI_META ((BYTE)0xFF) // Meta event begin
#define MIDI_META_TEMPO ((BYTE)0x51)
#define MIDI_META_EOT ((BYTE)0x2F) // End-of-track
#define MIDI_META_SSPEC ((BYTE)0x7F) // System-specific event
#define MIDI_NOTEOFF ((BYTE)0x80) // + note + velocity
#define MIDI_NOTEON ((BYTE)0x90) // + note + velocity