From cb53bc8afe6f03a78afc35dfc7aad77d3eb476b9 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Tue, 27 Nov 2018 23:05:33 +0000
Subject: [PATCH] remove redundant wadfile loop within wadfile loop for
 ANIMDEFS code

---
 src/p_spec.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/p_spec.c b/src/p_spec.c
index 54407dd98..50b8aec9d 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -279,15 +279,12 @@ void P_InitPicAnims(void)
 				Z_Free(animatedLump);
 			}
 
-			for (w = numwadfiles-1; w >= 0; w--)
+			// Find ANIMDEFS lump in the WAD
+			animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0);
+			while (animdefsLumpNum != INT16_MAX)
 			{
-				// Find ANIMDEFS lump in the WAD
-				animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0);
-				while (animdefsLumpNum != INT16_MAX)
-				{
-					P_ParseANIMDEFSLump(w, animdefsLumpNum);
-					animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", (UINT16)w, animdefsLumpNum + 1);
-				}
+				P_ParseANIMDEFSLump(w, animdefsLumpNum);
+				animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", (UINT16)w, animdefsLumpNum + 1);
 			}
 		}
 		// Define the last one