(Parser.Decrypt): less cryptic.

This commit is contained in:
morkt 2014-08-01 20:38:36 +04:00
parent 959dec52f2
commit e2773d437e

View File

@ -209,14 +209,15 @@ namespace GameRes.Formats
public uint Decrypt (byte value) public uint Decrypt (byte value)
{ {
int pos = s_crypt_table.Length - 0x14; int pos = 4;
if (m_version >= 0x100) if (m_version >= 0x100)
{ {
pos -= 4;
if (m_version >= 0x12c && m_version < 0x196) if (m_version >= 0x12c && m_version < 0x196)
pos += 10; pos = 10;
else
pos = 0;
} }
pos = Array.FindIndex (s_crypt_table, pos, x => x == value); pos = Array.IndexOf (s_crypt_table, value, pos);
if (-1 == pos) if (-1 == pos)
return value; return value;
if (0 != (pos & 1)) if (0 != (pos & 1))