Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. void gObjViewportListCreate(short aIndex)
  2. {
  3. #if(ENABLE_OPTIMIZATION)
  4.     g_Optimization.ViewePortCPU(aIndex);
  5.     return;
  6. #endif
  7.  
  8.     int result,n;
  9.     LPOBJ lpObj;
  10.     int mapnum;
  11.  
  12.     if(OBJMAX_RANGE(aIndex) == 0)
  13.     {
  14.         return;
  15.     }
  16.  
  17.     lpObj = &gObj[aIndex];
  18.  
  19.     if(lpObj->Connected < PLAYER_PLAYING)
  20.     {
  21.         return;
  22.     }
  23.  
  24.     if(lpObj->RegenOk > 0)
  25.     {
  26.         return;
  27.     }
  28.  
  29.     mapnum = lpObj->MapNumber;
  30.     gItemLoop2 = 0;
  31.  
  32.     if(lpObj->Type == OBJ_USER)
  33.     {
  34.         MapClass * lpMap = &MapC[mapnum];
  35.  
  36.         for(n = 0; n < MAX_MAPITEM; n++)
  37.         {
  38.             if(lpMap->m_cItem[n].live)
  39.             {
  40.                 gItemLoop2++;
  41.  
  42.                 if(lpMap->m_cItem[n].m_State == 1 || lpMap->m_cItem[n].m_State == 2)
  43.                 {
  44.                     if(gObjCheckViewport(aIndex,lpMap->m_cItem[n].px,lpMap->m_cItem[n].py) == 1)
  45.                     {
  46.                         result = ViewportAdd(aIndex,n,5);
  47.                     }
  48.                 }
  49.             }
  50.         }
  51.     }
  52.  
  53.     if(aIndex == 0)
  54.     {
  55.         gItemLoopMax = gItemLoop2;
  56.         gItemLoop = gItemLoop2;
  57.         gCurPaintPlayer = aIndex;
  58.     }
  59.  
  60.     int a = 1;
  61.     LPOBJ lpTempObj;
  62.  
  63.     if(lpObj->Type == OBJ_USER)
  64.     {
  65.         for(n = 0; n < OBJMAX; n++)
  66.         {
  67.             lpTempObj = &gObj[n];
  68.  
  69.             if(lpTempObj->Connected == PLAYER_PLAYING && aIndex != n)
  70.             {
  71.                 if(lpTempObj->m_State == 1 || lpTempObj->m_State == 2)
  72.                 {
  73.                     if(mapnum == lpTempObj->MapNumber)
  74.                     {
  75.                         if(gObjCheckViewport(aIndex,lpTempObj->X,lpTempObj->Y) == 1)
  76.                         {
  77.                             result = ViewportAdd(aIndex,n,lpTempObj->Type);
  78.                             result = ViewportAdd2(n,aIndex,gObj[aIndex].Type);
  79.                         }
  80.                     }
  81.                 }
  82.             }
  83.         }
  84.     }
  85.     else if(
  86.         lpObj->Type == OBJ_MONSTER
  87. //#if(GS_CASTLE==1)
  88.         || lpObj->Type == OBJ_NPC
  89. //#endif
  90.         )
  91.     {
  92.         for(n = OBJ_MAXMONSTER; n < OBJMAX; n++)
  93.         {
  94.             lpTempObj = &gObj[n];
  95.  
  96.             if(lpTempObj->Connected == PLAYER_PLAYING && aIndex != n)
  97.             {
  98.                 if(lpTempObj->m_State == 1 || lpTempObj->m_State == 2)
  99.                 {
  100.                     if(mapnum == lpTempObj->MapNumber)
  101.                     {
  102.                         if(gObjCheckViewport(aIndex,lpTempObj->X,lpTempObj->Y) == 1)
  103.                         {
  104.                             result = ViewportAdd(aIndex,n,gObj[n].Type);
  105.                             result = ViewportAdd2(n,aIndex,gObj[aIndex].Type);
  106.                         }
  107.                     }
  108.                 }
  109.             }
  110.         }
  111.     }
  112. }