📄 zone.cpp
字号:
{// sprintf( str2, "ActionType : SystemMessage\n\t Content : %s",// g_pStringPool->c_str( STRID_CANNOT_ENTER_PAY_ZONE ) ); sprintf( str2, "ActionType : SystemMessage\n\t Content : %d", STRID_CANNOT_ENTER_PAY_ZONE ); pTrigger->setCounterActions( str2 );// pTrigger->setCounterActions("ActionType : SystemMessage\n\t Content : 蜡丰粮捞扼辑 甸绢哎 荐 绝嚼聪促."); } else {// sprintf( str2, "ActionType : SystemMessage\n\t Content : %s", // g_pStringPool->c_str( STRID_CANNOT_ENTER ) ); sprintf( str2, "ActionType : SystemMessage\n\t Content : %d", STRID_CANNOT_ENTER ); pTrigger->setCounterActions( str2 );// pTrigger->setCounterActions("ActionType : SystemMessage\n\t Content : 瘤陛篮 哎 荐 绝嚼聪促."); } tm.addTrigger(pTrigger); // 鸥老俊促 器呕阑 嘿牢促. rTile.addPortal(pPortal); } } } //if (flag & 0x80) } // for } // for SMP.close(); ///* if (m_MonsterRegenPositions.size()==0) { printf("MonsterRegenPosition not exist: Width = %d, Height = %d\n", (int)m_Width, (int)m_Height); //Assert(m_MonsterRegenPositions.size()!=0); ZoneCoord_t outerMinX = m_Width/7; ZoneCoord_t outerMinY = m_Height/7; ZoneCoord_t outerMaxX = m_Width-outerMinX; ZoneCoord_t outerMaxY = m_Width-outerMinY; for (ZoneCoord_t y=outerMinY; y<outerMaxY; y++) { for (ZoneCoord_t x=outerMinX; x<outerMaxX; x++) { Tile& rTile = m_pTiles[x][y]; if (!rTile.hasPortal() && !rTile.isGroundBlocked() && !rTile.isAirBlocked() && !rTile.isUndergroundBlocked()) { m_MonsterRegenPositions.push_back( BPOINT( (BYTE)x, (BYTE)y ) ); } } } Assert(m_MonsterRegenPositions.size()!=0); } if ((isMasterLair() || m_ZoneID == 3002) && m_EmptyTilePositions.size()==0) { printf("MasterLair has No EmptyTilePosition\n"); Assert(m_EmptyTilePositions.size()!=0); } //*/ // Zone 沥焊甫 技泼茄促. m_ZoneType = pZoneInfo->getZoneType(); m_ZoneLevel = pZoneInfo->getZoneLevel(); // 皋葛府 且寸秦林绊... m_ppLevel = new (ZoneLevel_t*) [ m_Width ]; for (uint i = 0; i < m_Width; i++) m_ppLevel[i] = new ZoneLevel_t[m_Height]; // 粮 饭骇阑 叼弃飘 蔼栏肺 檬扁拳矫挪促. for (ZoneCoord_t x = 0; x < m_Width; x++) for (ZoneCoord_t y = 0; y < m_Height; y++) m_ppLevel[x][y] = m_ZoneLevel; // SSI 沥焊 颇老阑 楷促. string SSIFilename = g_pConfig->getProperty("HomePath") + "/data/" + pZoneInfo->getSSIFilename(); ifstream SSI(SSIFilename.c_str(), ios::in | ios::binary | ios::nocreate); if (!SSI) { strcpy(lwrFilename, SSIFilename.c_str()); strlwr( lwrFilename ); SSI.open(lwrFilename, ios::in | ios::binary | ios::nocreate); //cout << "second chk : " << lwrFilename.c_str() << endl; if (!SSI) { StringStream msg; msg << SSIFilename << " not exist or cannot open it"; throw FileNotExistException(msg.toString()); } } int size = 0; SSI.read(&size, szint); BYTE left, top, right, bottom, level; for (int i=0; i<size; i++) { SSI.read(&level, szBYTE); SSI.read(&left, szBYTE); SSI.read(&top, szBYTE); SSI.read(&right, szBYTE); SSI.read(&bottom, szBYTE); if (bOutput) { cout << "LEVEL:" << (int)level << ",(" << (int)left << "," << (int)top << "," << (int)right << "," << (int)bottom << ")" << endl; } Assert(left <= right); Assert(top <= bottom); for (int bx=left; bx<=right; bx++) for (int by=top; by<=bottom; by++) m_ppLevel[bx][by] = level; } SSI.close(); // 飘府芭靛 器呕阑 肺靛茄促. loadTriggeredPortal(); // 阁胶磐 肺靛窍绊.... m_pMonsterManager->load();//#ifdef __XMAS_EVENT_CODE__// printf("Begin Event Monster Loading\n");// m_pEventMonsterManager->load();// printf("Event Monster Loading Completed\n");//#endif // 付胶磐 饭绢牢 版快 // by sigi. 2002.9.2 if (pZoneInfo->isMasterLair()) { SAFE_DELETE(m_pMasterLairManager); m_pMasterLairManager = new MasterLairManager(this); } // 己牢 版快 // by sigi. 2003.1.24 if (isCastle()) { SAFE_DELETE(m_pWarScheduler); m_pWarScheduler = new WarScheduler(this); m_pWarScheduler->load(); printf("[%d] Castle : WarScheduler->load\n", (int)getZoneID()); } // 酒捞袍 肺靛茄促. loadItem();// if (isCastle())// {// CastleInfo* pCastleInfo = g_pCastleInfoManager->getCastleInfo( m_ZoneID );// m_pNPCManager->load( m_ZoneID, pCastleInfo->getRace() );// }// else// { // NPC 甫 肺爹茄促. m_pNPCManager->load( m_ZoneID );// } loadEffect(); // 霸矫魄阑 肺靛茄促. loadBulletinBoard( this ); // 胶橇扼捞飘 肮荐甫 檬扁拳茄促. initSpriteCount(); SAFE_DELETE(version); SAFE_DELETE(zonename); SAFE_DELETE(lwrFilename);} catch ( Throwable& t ){ cout << t.toString() << endl; Assert(false);} __END_DEBUG __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 粮 颇老俊辑 粮 沥焊甫 佬绢辑 肺爹茄促.//////////////////////////////////////////////////////////////////////////////void Zone::reload(bool bOutput) throw(Error){ __BEGIN_TRY __BEGIN_DEBUGtry { DWORD versionLen; char version[128]; WORD zoneID; WORD zoneGroupID; DWORD zonenameLen; char zonename[128]; BYTE zoneType; BYTE zoneLevel; DWORD descLen; char* pDesc = NULL; char lwrFilename[256]; ZoneInfo* pZoneInfo = g_pZoneInfoManager->getZoneInfo(m_ZoneID); Assert(pZoneInfo!=NULL); setPayPlay( pZoneInfo->isPayPlay() ); setPremiumZone( pZoneInfo->isPremiumZone() ); setPKZone( pZoneInfo->isPKZone() ); setNoPortalZone( pZoneInfo->isNoPortalZone() ); setMasterLair( pZoneInfo->isMasterLair() ); //filelog("zoneInfo.txt", "[%d] %d %d", (int)m_ZoneID, (int)isPayPlay(), (int)isPremiumZone()); // SMP 沥焊 颇老阑 楷促. string SMPFilename = g_pConfig->getProperty("HomePath") + "/data/" + pZoneInfo->getSMPFilename(); ifstream SMP(SMPFilename.c_str(), ios::in | ios::binary | ios::nocreate); if (!SMP) { strcpy( lwrFilename, SMPFilename.c_str()); strlwr( lwrFilename ); SMP.open(lwrFilename, ios::in | ios::binary | ios::nocreate); //cout << "second chk : " << lwrFilename << endl; if (!SMP) { StringStream msg; msg << SMPFilename << " not exist or cannot open it"; cerr << msg.toString() << endl; throw FileNotExistException(msg.toString()); } } // read zone version SMP.read(&versionLen,szDWORD); SMP.read(version,versionLen); version[versionLen] = 0; // read zone id SMP.read(&zoneID,szWORD); // read zone group id (no use) SMP.read(&zoneGroupID,szWORD); // read zone name SMP.read(&zonenameLen,szDWORD); if (zonenameLen > 0) { SMP.read(zonename,zonenameLen); zonename[zonenameLen] = 0; } // read zone type & level SMP.read(&zoneType,szBYTE); SMP.read(&zoneLevel,szBYTE); // read zone description SMP.read(&descLen,szDWORD); if (descLen > 0) { pDesc = new char[descLen+1]; SMP.read(pDesc,descLen); pDesc[descLen] = 0; SAFE_DELETE_ARRAY(pDesc); // add '_ARRAY' moved to here.. by sigi 2002.5.2 } // read zone width & height SMP.read(&m_Width, szWORD); SMP.read(&m_Height ,szWORD); Assert(m_Width <= maxZoneWidth); Assert(m_Height <= maxZoneHeight); uint i, x; if (m_pSectors==NULL) { // 冀磐甫 2瞒盔 硅凯肺 父甸绢 皋葛府甫 且寸茄促. m_SectorWidth = (int)ceil((float)m_Width/(float)SECTOR_SIZE); m_SectorHeight = (int)ceil((float)m_Height/(float)SECTOR_SIZE); m_pSectors = new (Sector*)[m_SectorWidth]; for (x=0; (int)x<m_SectorWidth; x++) { m_pSectors[x] = new Sector[m_SectorHeight]; } // 冀磐尝府 楷搬阑 茄促. VSRect srect(0, 0, m_SectorWidth-1, m_SectorHeight-1); for (int x=0; x<m_SectorWidth; x++) { for (int y=0; y<m_SectorHeight; y++) { for (uint d=0; d<9; d++) { int sectorx = x + dirMoveMask[d].x; int sectory = y + dirMoveMask[d].y; if (srect.ptInRect(sectorx, sectory)) { m_pSectors[x][y].setNearbySector(d, &m_pSectors[sectorx][sectory]); } } } } } // m_pTiles 啊 捞固 绝促搁... if (m_pTiles==NULL) { // 鸥老阑 2瞒盔硅凯肺 父甸绢 皋葛府甫 且寸茄促. m_pTiles = new Tile* [ m_Width ]; for (i = 0 ; i < m_Width ; i++) { m_pTiles[i] = new Tile [m_Height]; } // 阿阿狼 鸥老俊促啊 冀磐 器牢磐甫 技泼茄促. for (int x=0; x<m_Width; x++) { for (int y=0; y<m_Height; y++) { int sx = x/SECTOR_SIZE; int sy = y/SECTOR_SIZE; Assert(sx < m_SectorWidth && sy < m_SectorHeight); m_pTiles[x][y].setSector(&m_pSectors[sx][sy]); } } } // MonsterAI甫 困秦 粮狼 康开阑 备盒瘤绢初篮 荤阿屈阑 积己茄促. m_OuterRect.set(0, 0, m_Width-1, m_Height-1); if (m_Width > 64 && m_Height > 64) { m_InnerRect.set(15, 15, m_Width-15, m_Height-15); m_CoreRect.set(25, 25, m_Width-25, m_Height-25); } char str[80]; char str2[80]; // 促矫~ m_MonsterRegenPositions.clear(); m_EmptyTilePositions.clear(); for (ZoneCoord_t y=0; y<m_Height; y++) { for (ZoneCoord_t x=0; x<m_Width; x++) { BYTE flag = 0; SMP.read(&flag, szBYTE); // 鉴辑措肺 瘤窍, 瘤惑, 傍吝 喉废 if (flag & 0x01) m_pTiles[x][y].setBlocked(Creature::MOVE_MODE_BURROWING); if (flag & 0x02) m_pTiles[x][y].setBlocked(Creature::MOVE_MODE_WALKING); if (flag & 0x04) m_pTiles[x][y].setBlocked(Creature::MOVE_MODE_FLYING); // 酒公巴档 绝绰 版快.. // 各 积己阑 困茄 谅钎沥焊甫 父甸绢敌促. if (flag==0 && m_InnerRect.ptInRect( x, y )) { m_MonsterRegenPositions.push_back( BPOINT( (BYTE)x, (BYTE)y ) ); } // 付胶磐 饭绢牢 版快: block捞 窍唱扼档 救 等 镑阑 茫绰促. if ((flag & 0x07)!=0x07 && (isMasterLair() || m_ZoneID == 3002) ) { m_EmptyTilePositions.push_back( BPOINT( (BYTE)x, (BYTE)y ) ); } // 器呕 沥焊 if (flag & 0x80) { BYTE type; ZoneID_t targetZoneID; BYTE targetX, targetY; SMP.read(&type, szBYTE); PortalType_t portalType = PORTAL_NORMAL; bool bAddPortal = true; // 捞固 器呕捞 乐促搁 扁粮狼 器呕阑 瘤况霖促. if (m_pTiles[x][y].hasPortal()) { Portal* pPortal = m_pTiles[x][y].getPortal(); SAFE_DELETE(pPortal); m_pTiles[x][y].deletePortal(); } if (type == PORTAL_NORMAL) { SMP.read(&targetZoneID, szZoneID); SMP.read(&targetX, szBYTE); SMP.read(&targetY, szBYTE); // 器呕阑 积己秦 霖促. NormalPortal* pNormalPortal = new NormalPortal(); pNormalPortal->setObjectType(PORTAL_NORMAL); pNormalPortal->setZoneID(targetZoneID); pNormalPortal->setX(targetX); pNormalPortal->setY(targetY); getObjectRegistry().registerObject(pNormalPortal); m_pTiles[x][y].addPortal(pNormalPortal); if (bOutput) { cout << "Normal(" << (int)x << "," << (int)y << "," << (int)targetZoneID << "," << (int)targetX << "," << (int)targetY << ")" << endl; } } else if (type == PORTAL_SLAYER) { SMP.read(&targetZoneID, szZoneID); SMP.read(&targetX, szBYTE); SMP.read(&targetY, szBYTE); // 器呕阑 积己秦 霖促. NormalPortal* pNormalPortal = new NormalPortal(); pNormalPortal->setObjectType(PORTAL_SLAYER); pNormalPortal->setZoneID(targetZoneID); pNormalPortal->setX(targetX); pNormalPortal->setY(targetY);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -