int __fastcall P_BlockLinesIterator(int x, int y, int (*func)(void))
{
  int v3; // edx@5
  int v4; // eax@6
  int result; // eax@7
  signed int v6; // eax@9
  int v7; // ebx@6
  int (*tmpfunc)(void); // [sp+0h] [bp-8h]@1

  tmpfunc = func;
  if ( x >= 0 && y >= 0 && x < bmapwidth && y < bmapheight )
  {
    v3 = 2 * *(_WORD *)(blockmap + 2 * (bmapwidth * y + x)) + blockmaplump;
    while ( 1 )
    {
      v6 = *(_WORD *)v3;
      if ( v6 == -1 )
        break;
      v7 = 62 * v6 + dword_A0230;
      dword_9FFC8 = 62 * v6 + dword_A0230;
      v4 = 62 * v6 + dword_A0230;
      if ( validcount != *(_DWORD *)(v7 + 54) )
      {
        *(_DWORD *)(v4 + 54) = validcount;
        result = tmpfunc();
        if ( !result )
          return result;
      }
      v3 += 2;
    }
  }
  return 1;
}

================================================================================

boolean
P_BlockLinesIterator
( int			x,
  int			y,
  boolean(*func)(line_t*) )
{
    int			offset;
    short*		list;
    line_t*		ld;
	
    if (x<0
	|| y<0
	|| x>=bmapwidth
	|| y>=bmapheight)
    {
	return true;
    }
    
    offset = y*bmapwidth+x;
	
    offset = *(blockmap+offset);

    for ( list = blockmaplump+offset ; *list != -1 ; list++)
    {
	ld = &lines[*list];

	if (ld->validcount == validcount)
	    continue; 	// line has already been checked

	ld->validcount = validcount;
		
	if ( !func(ld) )
	    return false;
    }
    return true;	// everything was checked
}