diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 8c0bf027aa..872bb43cb3 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ March 18, 2009 (Changes by Graf Zahl) +- Fixed: S_StopSound may not assume that after stopping a sound channel + its link to the next item in the list is still valid. +- Fixed typo in src/CMakeLists.txt. +- Fixed: Armor only worked for players. - Fixed: P_FindFloorCeiling may not call P_PointInSector if called from P_SpawnMapThing. It must use the values the actor has been initialized to by LinkToWorldForMapThing. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1647f41a8d..245b85cce0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,7 @@ foreach( majver ${MAJOR_VERSIONS} ) set( FMOD_LOCAL_INC_DIRS ${FMOD_LOCAL_INC_DIRS} "${dir}/api/inc" ) set( FMOD_LOCAL_LIB_DIRS ${FMOD_LOCAL_LIB_DIRS} "${dir}/api/lib" ) endforeach( dir ${FMOD_DIR_VERSIONS} ) -endforeach( majver ${MAJER_VERSIONS} ) +endforeach( majver ${MAJOR_VERSIONS} ) if( WIN32 ) if( X64 ) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 876d5c5f1a..5adcbdbbb3 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1155,6 +1155,18 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage } else { + // Armor for monsters. + if (!(flags & DMG_NO_ARMOR) && target->Inventory != NULL) + { + int newdam = damage; + target->Inventory->AbsorbDamage (damage, mod, newdam); + damage = newdam; + if (damage <= 0) + { + return; + } + } + target->health -= damage; } diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 157a029923..edbac9858f 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1369,13 +1369,16 @@ bool S_CheckSoundLimit(sfxinfo_t *sfx, const FVector3 &pos, int near_limit, floa void S_StopSound (int channel) { - for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) + FSoundChan *chan = Channels; + while (chan != NULL) { + FSoundChan *next = chan->NextChan; if (chan->SourceType == SOURCE_None && (chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE))) { S_StopChannel(chan); } + chan = next; } } @@ -1389,14 +1392,17 @@ void S_StopSound (int channel) void S_StopSound (AActor *actor, int channel) { - for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) + FSoundChan *chan = Channels; + while (chan != NULL) { + FSoundChan *next = chan->NextChan; if (chan->SourceType == SOURCE_Actor && chan->Actor == actor && (chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE))) { S_StopChannel(chan); } + chan = next; } } @@ -1410,14 +1416,17 @@ void S_StopSound (AActor *actor, int channel) void S_StopSound (const sector_t *sec, int channel) { - for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) + FSoundChan *chan = Channels; + while (chan != NULL) { + FSoundChan *next = chan->NextChan; if (chan->SourceType == SOURCE_Sector && chan->Sector == sec && (chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE))) { S_StopChannel(chan); } + chan = next; } } @@ -1431,14 +1440,17 @@ void S_StopSound (const sector_t *sec, int channel) void S_StopSound (const FPolyObj *poly, int channel) { - for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) + FSoundChan *chan = Channels; + while (chan != NULL) { + FSoundChan *next = chan->NextChan; if (chan->SourceType == SOURCE_Polyobj && chan->Poly == poly && (chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE))) { S_StopChannel(chan); } + chan = next; } } @@ -1475,8 +1487,10 @@ void S_RelinkSound (AActor *from, AActor *to) if (from == NULL) return; - for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) + FSoundChan *chan = Channels; + while (chan != NULL) { + FSoundChan *next = chan->NextChan; if (chan->SourceType == SOURCE_Actor && chan->Actor == from) { if (to != NULL) @@ -1496,6 +1510,7 @@ void S_RelinkSound (AActor *from, AActor *to) S_StopChannel(chan); } } + chan = next; } }