void gObjViewportListCreate(short aIndex)
{
#if(ENABLE_OPTIMIZATION)
g_Optimization.ViewePortCPU(aIndex);
return;
#endif
int result,n;
LPOBJ lpObj;
int mapnum;
if(OBJMAX_RANGE(aIndex) == 0)
{
return;
}
lpObj = &gObj[aIndex];
if(lpObj->Connected < PLAYER_PLAYING)
{
return;
}
if(lpObj->RegenOk > 0)
{
return;
}
mapnum = lpObj->MapNumber;
gItemLoop2 = 0;
if(lpObj->Type == OBJ_USER)
{
MapClass * lpMap = &MapC[mapnum];
for(n = 0; n < MAX_MAPITEM; n++)
{
if(lpMap->m_cItem[n].live)
{
gItemLoop2++;
if(lpMap->m_cItem[n].m_State == 1 || lpMap->m_cItem[n].m_State == 2)
{
if(gObjCheckViewport(aIndex,lpMap->m_cItem[n].px,lpMap->m_cItem[n].py) == 1)
{
result = ViewportAdd(aIndex,n,5);
}
}
}
}
}
if(aIndex == 0)
{
gItemLoopMax = gItemLoop2;
gItemLoop = gItemLoop2;
gCurPaintPlayer = aIndex;
}
int a = 1;
LPOBJ lpTempObj;
if(lpObj->Type == OBJ_USER)
{
for(n = 0; n < OBJMAX; n++)
{
lpTempObj = &gObj[n];
if(lpTempObj->Connected == PLAYER_PLAYING && aIndex != n)
{
if(lpTempObj->m_State == 1 || lpTempObj->m_State == 2)
{
if(mapnum == lpTempObj->MapNumber)
{
if(gObjCheckViewport(aIndex,lpTempObj->X,lpTempObj->Y) == 1)
{
result = ViewportAdd(aIndex,n,lpTempObj->Type);
result = ViewportAdd2(n,aIndex,gObj[aIndex].Type);
}
}
}
}
}
}
else if(
lpObj->Type == OBJ_MONSTER
//#if(GS_CASTLE==1)
|| lpObj->Type == OBJ_NPC
//#endif
)
{
for(n = OBJ_MAXMONSTER; n < OBJMAX; n++)
{
lpTempObj = &gObj[n];
if(lpTempObj->Connected == PLAYER_PLAYING && aIndex != n)
{
if(lpTempObj->m_State == 1 || lpTempObj->m_State == 2)
{
if(mapnum == lpTempObj->MapNumber)
{
if(gObjCheckViewport(aIndex,lpTempObj->X,lpTempObj->Y) == 1)
{
result = ViewportAdd(aIndex,n,gObj[n].Type);
result = ViewportAdd2(n,aIndex,gObj[aIndex].Type);
}
}
}
}
}
}
}