void SetModeParams() { #ifdef _DEBUG g_ModeParams.bFullScreen = false; #else g_ModeParams.bFullScreen = ZGetConfiguration()->GetVideo()->bFullScreen; #endif g_ModeParams.nWidth = ZGetConfiguration()->GetVideo()->nWidth; g_ModeParams.nHeight = ZGetConfiguration()->GetVideo()->nHeight; ZGetConfiguration()->GetVideo()->nColorBits == 32 ? g_ModeParams.PixelFormat = D3DFMT_X8R8G8B8 : g_ModeParams.PixelFormat = D3DFMT_R5G6B5 ; }
void ZGetInterfaceSkinPathSubLanguage(char* pOutPath, const char* szSkinName) { // 대체 언어용 UI이미지는 interface/###/skinname 의 폴더에 넣도록 한다 // 예) interface/default, interface/lodable의 독일어용 경로는 interface/grm/default, interface/grm/lodable이 된다 const char* szLanguage = ZGetConfiguration()->GetSelectedLanguage(); sprintf(pOutPath, "%s%s/%s/", PATH_INTERFACE, szLanguage, szSkinName); }
void ResetAppResource() { OnDestroy(0); ZGetConfiguration()->Destroy(); ZGetConfiguration()->Load(); SetModeParams(); if( !ZApplication::GetInstance()->InitLocale() ) CCLog("In changing language... InitLocale error !!!\n"); ZGetConfiguration()->Load_StringResDependent(); OnCreate(0); OnRestore(0); }
bool ZGameOnJPAuthInfo::ParseVersion() { ZLocatorList* pLocatorList = ZGetConfiguration()->GetLocatorList(); if ( pLocatorList == NULL) return false; // Launch mode char szTestLaunch[ 64]; GetPrivateProfileString( "SERVER", "TESTLAUNCH", "FALSE", szTestLaunch, 64, VERSION_CONFIG_FILENAME ); if ( stricmp( szTestLaunch, "TRUE") == 0) m_bAlpha = true; #ifdef _DEBUG if ( m_bAlpha == true) cclog( "%s : Launch mode = Alpha\n", __FUNCTION__); else cclog( "%s : Launch mode = Real\n", __FUNCTION__); #else if ( m_bAlpha == true) cclog( "Alpha launch mode\n"); #endif // Server list int nCount = 0; nCount = GetPrivateProfileInt( "SERVER", "COUNT", 0, VERSION_CONFIG_FILENAME); if ( nCount == 0) { cclog( "ERROR : The count of locator is ZERO.\n"); ASSERT( 0); return false; } #ifdef _DEBUG cclog( "%s : Server count = %d\n", __FUNCTION__, nCount); #endif for ( int i = 0; i < nCount; i++) { char szKeyName[ 64]; sprintf( szKeyName, "IP%d", i + 1); char szIP[ 64]; GetPrivateProfileString( "SERVER", szKeyName, "", szIP, 64, VERSION_CONFIG_FILENAME ); pLocatorList->AddIP( szIP); #ifdef _DEBUG cclog( "%s : Server IP = %s\n", __FUNCTION__, szIP); #endif } return true; }
RRESULT OnDestroy(void *pParam) { cclog("Destroy gunz\n"); g_App.OnDestroy(); SAFE_DELETE(g_pDefFont); g_Core.Finalize(); cclog("interface finalize.\n"); SAFE_DELETE(g_pInput); g_DInput.Destroy(); cclog("game input destroy.\n"); // RGetShaderMgr()->Release(); ZGetConfiguration()->Destroy(); cclog("game gonfiguration destroy.\n"); delete g_pDC; struct _finddata_t c_file; intptr_t hFile; char szFileName[256]; #define FONT_DIR "Font/" #define FONT_EXT "ttf" if( (hFile = _findfirst(FONT_DIR"*."FONT_EXT, &c_file )) != -1L ){ do{ strcpy(szFileName, FONT_DIR); strcat(szFileName, c_file.name); RemoveFontResource(szFileName); }while( _findnext( hFile, &c_file ) == 0 ); _findclose(hFile); } CCFontManager::Destroy(); CCBitmapManager::Destroy(); CCBitmapManager::DestroyAniBitmap(); cclog("Bitmap manager destroy Animation bitmap.\n"); // ZBasicInfoItem::Release(); // ZGetStencilLight()->Destroy(); // LightSource::Release(); RBspObject::DestroyShadeMap(); RDestroyLenzFlare(); RAnimationFileMgr::GetInstance()->Destroy(); ZStringResManager::ResetInstance(); cclog("destroy gunz finish.\n"); return R_OK; }
void ZApplication::OnRestore() { if(m_pGameInterface) m_pGameInterface->OnRestore(); if( ZGetConfiguration()->GetVideo()->bShader ) { RMesh::mHardwareAccellated = true; if( !RGetShaderMgr()->SetEnable() ) { RGetShaderMgr()->SetDisable(); } } }
bool ZApplication::InitLocale() { ZGetLocale()->Init( GetCountryID(ZGetConfiguration()->GetLocale()->strCountry.c_str())); char szPath[MAX_PATH] = "system/"; // 유저가 다른 언어를 선택했는지 확인 if (!ZGetConfiguration()->IsUsingDefaultLanguage()) { const char* szSelectedLanguage = ZGetConfiguration()->GetSelectedLanguage(); // 디폴트 언어가 아니라면 언어를 새로 설정한다 ZGetLocale()->SetLanguage( GetLanguageID(szSelectedLanguage) ); // 스트링을 로딩할 경로를 선택된 언어에 맞추어 수정 strcat(szPath, szSelectedLanguage); strcat(szPath, "/"); } ZGetStringResManager()->Init(szPath, ZGetLocale()->GetLanguage(), GetFileSystem()); return true; }
void TextOutKeymap(int skey,int x,int y) { static char szTemp[256] = ""; ZCONFIG_KEYBOARD* pKey = ZGetConfiguration()->GetKeyboard(); int nScanCode = pKey->ActionKeys[ skey ].nVirtualKey; char pStr[128]; ZGetInput()->GetInputKeyName(nScanCode,pStr,sizeof(pStr)); int nLen = (int)strlen(pStr); if(nLen>5) { pStr[4]='.'; pStr[5]='.'; pStr[6]=0; nLen = 5; } if(nLen) { nLen/=2; } sprintf(szTemp,"%s",pStr); g_pDC->Text( x-nLen*7, y, szTemp); }
bool ZGameInput::OnEvent(MEvent* pEvent) { int sel = 0; if ((ZGetGameInterface()->GetState() != GUNZ_GAME)) return false; if ( ZGetGameInterface()->GetGame() == NULL ) return false; MWidget* pMenuWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("CombatMenuFrame"); if ((pMenuWidget) && (pMenuWidget->IsVisible())) return false; MWidget* pChatWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("CombatChatInput"); if ((pChatWidget) && (pChatWidget->IsVisible())) return false; MWidget* p112ConfirmWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("112Confirm"); if (p112ConfirmWidget->IsVisible()) return false; #ifndef _PUBLISH if (m_pInstance) { if (m_pInstance->OnDebugEvent(pEvent) == true) return true; } #endif ZMyCharacter* pMyCharacter = ZGetGameInterface()->GetGame()->m_pMyCharacter; if ((!pMyCharacter) || (!pMyCharacter->GetInitialized())) return false; //////////////////////////////////////////////////////////////////////////// switch(pEvent->nMessage){ case MWM_HOTKEY: { int nKey = pEvent->nKey; ZHOTKEY *hk=ZGetConfiguration()->GetHotkey(nKey); //if(ProcessLowLevelCommand(hk->command.c_str())==false) char buffer[256]; strcpy(buffer,hk->command.c_str()); ZApplication::GetGameInterface()->GetChat()->Input(buffer); // ConsoleInputEvent(hk->command.c_str()); }break; case MWM_LBUTTONDOWN: { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); if ( ZGetCombatInterface()->IsShowResult()) { if ( ((ZGetCombatInterface()->m_nReservedOutTime - timeGetTime()) / 1000) < 13) { if(ZGetGameClient()->IsLadderGame() || ZGetGameClient()->IsDuelTournamentGame()) ZChangeGameState(GUNZ_LOBBY); else ZChangeGameState(GUNZ_STAGE); return true; } } if (pCombatInterface->IsChat()) { pCombatInterface->EnableInputChat(false); } if (pCombatInterface->GetObserver()->IsVisible()) { pCombatInterface->GetObserver()->ChangeToNextTarget(); return true; } /* if ((pMyCharacter) && (pMyCharacter->IsDie())) //// 실서비스에서 스폰안되는 버그유발. 원인불명(_PUBLISH누락) 영구봉쇄. { // 혼자테스트할때 되살아나기 if(g_pGame->m_CharacterManager.size()==1) { #ifndef _PUBLISH ZGetGameInterface()->RespawnMyCharacter(); return true; #endif } }*/ if (ZGetGameInterface()->IsCursorEnable()) return false; } return true; case MWM_RBUTTONDOWN: { if (ZGetGameInterface()->GetCombatInterface()->IsChat()) { ZGetGameInterface()->GetCombatInterface()->EnableInputChat(false); } ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); if (pCombatInterface->GetObserver()->IsVisible()) { pCombatInterface->GetObserver()->NextLookMode(); } } return true; case MWM_MBUTTONDOWN: if (ZGetGameInterface()->GetCombatInterface()->IsChat()) { ZGetGameInterface()->GetCombatInterface()->EnableInputChat(false); } return true; case MWM_ACTIONRELEASED: { switch(pEvent->nKey){ case ZACTION_FORWARD: case ZACTION_BACK: case ZACTION_LEFT: case ZACTION_RIGHT: if (m_pInstance) m_pInstance->m_ActionKeyHistory.push_back(ZACTIONKEYITEM(ZGetGame()->GetTime(),false,pEvent->nKey)); return true; case ZACTION_DEFENCE: { if(ZGetGame()->m_pMyCharacter) ZGetGame()->m_pMyCharacter->m_statusFlags.Ref().m_bGuardKey = false; } return true; } }break; case MWM_ACTIONPRESSED: if ( !ZGetGame()->IsReservedSuicide()) // 자살 예정인 경우 대쉬를 할수없게 막는다 { switch(pEvent->nKey){ case ZACTION_FORWARD: case ZACTION_BACK: case ZACTION_LEFT: case ZACTION_RIGHT: case ZACTION_JUMP: if (m_pInstance) m_pInstance->m_ActionKeyHistory.push_back(ZACTIONKEYITEM(ZGetGame()->GetTime(),true,pEvent->nKey)); return true; case ZACTION_MELEE_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_MELEE); } return true; case ZACTION_PRIMARY_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_PRIMARY); } return true; case ZACTION_SECONDARY_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_SECONDARY); } return true; case ZACTION_ITEM1: case ZACTION_ITEM2: { int nIndex = pEvent->nKey - ZACTION_ITEM1 + ZCWT_CUSTOM1; if ( !ZGetGame()->IsReplay()) { ZGetGameInterface()->ChangeWeapon(ZChangeWeaponType(nIndex)); } } return true; case ZACTION_COMMUNITYITEM1: mlog("Community Item1 Selected!\n"); return true; case ZACTION_COMMUNITYITEM2: mlog("Community Item2 Selected!\n"); return true; case ZACTION_PREV_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_PREV); } return true; case ZACTION_NEXT_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_NEXT); } return true; case ZACTION_RELOAD: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->Reload(); } return true; case ZACTION_DEFENCE: { if ( ZGetGame()->m_pMyCharacter && !ZGetGame()->IsReplay()) ZGetGame()->m_pMyCharacter->m_statusFlags.Ref().m_bGuardKey = true; } return true; case ZACTION_TAUNT: // 틸다키 case ZACTION_BOW: case ZACTION_WAVE: case ZACTION_LAUGH: case ZACTION_CRY: case ZACTION_DANCE: { if ( ZGetGame()->IsReplay()) break; if ( MEvent::GetShiftState()) break; if(ZGetGameInterface()->GetCombatInterface()->GetObserverMode()) break; ZC_SPMOTION_TYPE mtype; if(pEvent->nKey == ZACTION_TAUNT) mtype = ZC_SPMOTION_TAUNT; else if(pEvent->nKey == ZACTION_BOW ) mtype = ZC_SPMOTION_BOW; else if(pEvent->nKey == ZACTION_WAVE ) mtype = ZC_SPMOTION_WAVE; else if(pEvent->nKey == ZACTION_LAUGH) mtype = ZC_SPMOTION_LAUGH; else if(pEvent->nKey == ZACTION_CRY ) mtype = ZC_SPMOTION_CRY; else if(pEvent->nKey == ZACTION_DANCE) mtype = ZC_SPMOTION_DANCE; else return true; if(ZGetGame()) ZGetGame()->PostSpMotion( mtype ); // ZPostSpMotion(mtype); } return true; case ZACTION_RECORD: { if ( ZGetGame() && !ZGetGame()->IsReplay()) ZGetGame()->ToggleRecording(); } return true; case ZACTION_MOVING_PICTURE: { // 동영상 캡쳐...2008.10.02 if (ZGetGameInterface()->GetBandiCapturer() != NULL) ZGetGameInterface()->GetBandiCapturer()->ToggleStart(); } return true; case ZACTION_TOGGLE_CHAT: { if(ZGetCombatInterface()->IsShowUI()) { // UI토글이 켜져 있을때만 채팅토글을 처리해준다. if (ZGetGame()) { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); ZGetSoundEngine()->PlaySound("if_error"); pCombatInterface->ShowChatOutput(!ZGetConfiguration()->GetViewGameChat()); } } } return true; case ZACTION_USE_WEAPON: case ZACTION_USE_WEAPON2: { return true; } case ZACTION_SENSITIVITY_INC: case ZACTION_SENSITIVITY_DEC: { int nPrev = ZGetConfiguration()->GetMouseSensitivityInInt(); float senstivity = Z_MOUSE_SENSITIVITY; if (pEvent->nKey == ZACTION_SENSITIVITY_INC) senstivity += 0.01f; else senstivity -= 0.01f; ZGetConfiguration()->SetMouseSensitivityInFloat(senstivity); int nNew = ZGetConfiguration()->GetMouseSensitivityInInt(); ZGetConfiguration()->ReserveSave(); ZChatOutputMouseSensitivityChanged(nPrev, nNew); return true; } } // switch } break; case MWM_KEYDOWN: { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); switch (pEvent->nKey) { case VK_F1: case VK_F2: case VK_F3: case VK_F4: case VK_F5: case VK_F6: case VK_F7: case VK_F8: if( pEvent->nKey == VK_F1 ) sel = 0; else if( pEvent->nKey == VK_F2 ) sel = 1; else if( pEvent->nKey == VK_F3 ) sel = 2; else if( pEvent->nKey == VK_F4 ) sel = 3; else if( pEvent->nKey == VK_F5 ) sel = 4; else if( pEvent->nKey == VK_F6 ) sel = 5; else if( pEvent->nKey == VK_F7 ) sel = 6; else if( pEvent->nKey == VK_F8 ) sel = 7; if(ZGetConfiguration()) { char* str = ZGetConfiguration()->GetMacro()->GetString( sel ); if(str) { if(ZApplication::GetGameInterface()) if(ZApplication::GetGameInterface()->GetChat()) ZApplication::GetGameInterface()->GetChat()->Input(str); } } return true; case VK_F9: if (ZIsLaunchDevelop()) { ZApplication::GetGameInterface()->GetScreenDebugger()->SwitchDebugInfo(); } else { // 애들이 어떻게 알고서 쓰길래 막음... -_-; // if (pEvent->bCtrl) // ZApplication::GetGameInterface()->GetScreenDebugger()->SwitchDebugInfo(); } return true; case VK_RETURN: case VK_OEM_2: { if (!ShowCombatInputChat()) return false; } return true; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'Y': case 'N': if (pCombatInterface->GetObserver()->IsVisible()) pCombatInterface->GetObserver()->OnKeyEvent(pEvent->bCtrl, pEvent->nKey); if (ZGetGameClient()->CanVote() || ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->GetShowTargetList() ) { ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->VoteInput(pEvent->nKey); } break; case VK_ESCAPE: // 메뉴를 부르거나 kick player를 취소한다 if (ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->GetShowTargetList()) { ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->CancelVote(); } else { ZGetGameInterface()->ShowMenu(!ZGetGameInterface()->IsMenuVisible()); ZGetGameInterface()->Show112Dialog(false); } return true; case 'M' : if ( ZGetGame()->IsReplay() && pCombatInterface->GetObserver()->IsVisible()) { if(ZGetGameInterface()->GetCamera()->GetLookMode()==ZCAMERA_FREELOOK) ZGetGameInterface()->GetCamera()->SetLookMode(ZCAMERA_MINIMAP); else ZGetGameInterface()->GetCamera()->SetLookMode(ZCAMERA_FREELOOK); } break; case 'T' : if(ZGetGame()->m_pMyCharacter->GetTeamID()==MMT_SPECTATOR && ZGetGame()->GetMatch()->IsTeamPlay() && pCombatInterface->GetObserver()->IsVisible()) { ZObserver *pObserver = pCombatInterface->GetObserver(); pObserver->SetType(pObserver->GetType()==ZOM_BLUE ? ZOM_RED : ZOM_BLUE); pObserver->ChangeToNextTarget(); } case 'H': if ( ZGetGame()->IsReplay() && pCombatInterface->GetObserver()->IsVisible()) { if ( ZGetGame()->IsShowReplayInfo()) ZGetGame()->ShowReplayInfo( false); else ZGetGame()->ShowReplayInfo( true); } break; case 'J': { #ifdef _CMD_PROFILE if ((pEvent->bCtrl) && (ZIsLaunchDevelop())) { #ifndef _PUBLISH ZGetGameClient()->m_CommandProfiler.Analysis(); #endif } #endif } break; #ifdef _DEBUG case 'K': { rvector pos = ZGetGame()->m_pMyCharacter->GetPosition(); pos.x+=1; ZGetGame()->m_pMyCharacter->SetPosition(pos); } break; case 'L': { rvector pos = ZGetGame()->m_pMyCharacter->GetPosition(); pos.x-=1; ZGetGame()->m_pMyCharacter->SetPosition(pos); } break; //case 'J': // { // ZGetGame()->m_pMyCharacter->GetPosition().z = ZGetGame()->m_pMyCharacter->GetPosition().z+1; // } // break; //case 'M': // { // ZGetGame()->m_pMyCharacter->GetPosition().z = ZGetGame()->m_pMyCharacter->GetPosition().z-1; // } // break; case 'U': { rvector pos = ZGetGame()->m_pMyCharacter->GetPosition(); pos.x = -3809; pos.y = -1330; pos.z = 100; ZGetGame()->m_pMyCharacter->SetPosition(pos); //ZGetGame()->m_pMyCharacter->GetPosition().x = -3809; //ZGetGame()->m_pMyCharacter->GetPosition().y = -1337.5; //ZGetGame()->m_pMyCharacter->GetPosition().z = 461; } break; #endif } } break; case MWM_CHAR: { ZMatch* pMatch = ZGetGame()->GetMatch(); if (pMatch->IsTeamPlay()) { switch(pEvent->nKey) { case '\'': case '\"': { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); pCombatInterface->EnableInputChat(true, true); } return true; }; } // for deutsch, spanish keyboard if (pEvent->nKey == '/') { if (!ShowCombatInputChat()) return false; } } break; case MWM_SYSKEYDOWN: { // alt+a ~ z(65~90) if(pEvent->nKey==90){ // Alt+'Z' // 모든 UI 감추기... by kammir 20081020 ZGetCombatInterface()->SetIsShowUI(!ZGetCombatInterface()->IsShowUI()); if (ZGetGame()) { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); ZGetSoundEngine()->PlaySound("if_error"); pCombatInterface->ShowChatOutput(ZGetCombatInterface()->IsShowUI()); } } } break; case MWM_MOUSEWHEEL: { if ( ZGetGame()->IsReplay()) break; int nDelta = pEvent->nDelta; if ( (ZGetMyInfo()->IsAdminGrade() && ZGetCombatInterface()->GetObserver()->IsVisible()) || (ZGetGameInterface()->GetScreenDebugger()->IsVisible()) || (!ZGetGameInterface()->m_bViewUI)) { ZCamera* pCamera = ZGetGameInterface()->GetCamera(); pCamera->m_fDist+=-(float)nDelta; pCamera->m_fDist=max(CAMERA_DIST_MIN,pCamera->m_fDist); pCamera->m_fDist=min(CAMERA_DIST_MAX,pCamera->m_fDist); break; } // if (nDelta > 0) ZGetGameInterface()->ChangeWeapon(ZCWT_PREV); // else if (nDelta < 0) ZGetGameInterface()->ChangeWeapon(ZCWT_NEXT); }break; case MWM_MOUSEMOVE: { if(ZGetGameInterface()->IsCursorEnable()==false) { return true; } } break; } // switch (message) return false; }
bool ZGameClient::OnCommand(CCCommand* pCommand) { bool ret; ret = CCMatchClient::OnCommand(pCommand); #ifdef _LOG_ENABLE_CLIENT_COMMAND_ char buf[256]; sprintf(buf,"[ID:%d]: %s\n", pCommand->GetID(), pCommand->GetDescription()); OutputDebugString(buf); #endif switch(pCommand->GetID()){ case MC_NET_ONDISCONNECT: { } break; case MC_NET_ONERROR: { } break; case ZC_CHANGESKIN: { char szSkinName[256]; pCommand->GetParameter(szSkinName, 0, MPT_STR, sizeof(szSkinName) ); if(ZApplication::GetGameInterface()->ChangeInterfaceSkin(szSkinName)) { CCClient::OutputMessage(CCZMOM_LOCALREPLY, "Change Skin To %s", szSkinName); } else { CCClient::OutputMessage(CCZMOM_LOCALREPLY, "Change Skin Failed"); } } break; case MC_ADMIN_TERMINAL: { #ifndef _PUBLISH char szText[65535]; szText[0] = 0; CCUID uidChar; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(szText, 1, MPT_STR, sizeof(szText) ); OutputToConsole(szText); #endif } break; case MC_NET_CHECKPING: { CCUID uid; if (pCommand->GetParameter(&uid, 0, MPT_UID)==false) break; CCCommand* pNew = new CCCommand(m_CommandManager.GetCommandDescByID(MC_NET_PING), uid, m_This); pNew->AddParameter(new CCCommandParameterUInt(timeGetTime())); Post(pNew); return true; } case MC_NET_PING: { unsigned int nTimeStamp; if (pCommand->GetParameter(&nTimeStamp, 0, MPT_UINT)==false) break; CCCommand* pNew = new CCCommand(m_CommandManager.GetCommandDescByID(MC_NET_PONG), pCommand->m_Sender, m_This); pNew->AddParameter(new CCCommandParameterUInt(nTimeStamp)); Post(pNew); return true; } case MC_NET_PONG: { int nTimeStamp; pCommand->GetParameter(&nTimeStamp, 0, MPT_UINT); CCClient::OutputMessage(CCZMOM_LOCALREPLY, "Ping from (%u:%u) = %d", pCommand->GetSenderUID().High, pCommand->GetSenderUID().Low, timeGetTime()-nTimeStamp); } break; case MC_UDP_PONG: { unsigned int nIp, nTimeStamp; pCommand->GetParameter(&nIp, 0, MPT_UINT); pCommand->GetParameter(&nTimeStamp, 1, MPT_UINT); ZApplication::GetGameInterface()->SetAgentPing(nIp, nTimeStamp); } break; case MC_HSHIELD_PING: { /* unsigned int nTimeStamp; if(pCommand->GetParameter(&nTimeStamp, 0, MPT_UINT) == false) break; CCCommandParameter* pParam = pCommand->GetParameter(1); if(pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = CCGetBlobArrayCount(pBlob); unsigned char* pReqMsg = (unsigned char*)CCGetBlobArrayElement(pBlob, 0); DWORD dwRet = _AhnHS_MakeAckMsg(pReqMsg, ZGetMyInfo()->GetSystemInfo()->pbyAckMsg); if(dwRet != ERROR_SUCCESS) cclog("Making Ack Msg Failed. (Error code = %x)\n", dwRet); CCCommand* pNew = new CCCommand(m_CommandManager.GetCommandDescByID(MC_HSHIELD_PONG), pCommand->m_Sender, m_This); pNew->AddParameter(new CCCommandParameterUInt(nTimeStamp)); void* pBlob2 = CCMakeBlobArray(sizeof(unsigned char), SIZEOF_ACKMSG); unsigned char* pCmdBlock = (unsigned char*)CCGetBlobArrayElement(pBlob2, 0); CopyMemory(pCmdBlock, ZGetMyInfo()->GetSystemInfo()->pbyAckMsg, SIZEOF_ACKMSG); pNew->AddParameter(new CCCmdParamBlob(pBlob2, CCGetBlobArraySize(pBlob2))); // CCEraseBlobArray(pBlob); CCEraseBlobArray(pBlob2); Post(pNew); */ return true; } break; case ZC_CON_CONNECT: { char szBuf[256]; sprintf(szBuf, "Net.Connect %s:%d", ZGetConfiguration()->GetServerIP(), ZGetConfiguration()->GetServerPort()); ConsoleInputEvent(szBuf); SetServerAddr(ZGetConfiguration()->GetServerIP(), ZGetConfiguration()->GetServerPort()); } break; case ZC_CON_DISCONNECT: { ConsoleInputEvent("Net.Disconnect"); } break; case ZC_CON_CLEAR: { if (ZGetConsole()) ZGetConsole()->ClearMessage(); } break; case ZC_CON_HIDE: { if (ZGetConsole()) ZGetConsole()->Show(false); } break; case ZC_CON_SIZE: { if (ZGetConsole()) { int iConWidth, iConHeight; pCommand->GetParameter(&iConWidth, 0, MPT_INT); pCommand->GetParameter(&iConHeight, 1, MPT_INT); if ((iConWidth > 30) && (iConHeight > 30)) { sPoint point = ZGetConsole()->GetPosition(); ZGetConsole()->SetBounds(point.x, point.y, iConWidth, iConHeight); } } } break; case MC_CLOCK_SYNCHRONIZE: { unsigned long int nGlobalClock; pCommand->GetParameter(&nGlobalClock, 0, MPT_UINT); unsigned long int nLocalClock = GetClockCount(); if (nGlobalClock > nLocalClock) m_bIsBigGlobalClock = true; else m_bIsBigGlobalClock = false; m_nClockDistance = ZGetClockDistance(nGlobalClock, nLocalClock); } break; #ifdef _DEBUG case ZC_TEST_SETCLIENT1: { char szBuf[256]; sprintf(szBuf, "peer.setport 10000"); ConsoleInputEvent(szBuf); sprintf(szBuf, "peer.addpeer 127.0.0.1 10001"); ConsoleInputEvent(szBuf); CCClient::OutputMessage(CCZMOM_LOCALREPLY, "Done SetClient1"); } break; case ZC_TEST_SETCLIENT2: { char szBuf[256]; sprintf(szBuf, "peer.setport 10001"); ConsoleInputEvent(szBuf); sprintf(szBuf, "peer.addpeer 127.0.0.1 10000"); ConsoleInputEvent(szBuf); CCClient::OutputMessage(CCZMOM_LOCALREPLY, "Done SetClient2"); } break; case ZC_TEST_SETCLIENTALL: { char szMyIP[256]; pCommand->GetParameter(szMyIP, 0, MPT_STR, sizeof(szMyIP) ); char szBuf[256]; char szIPs[][256] = { "192.168.0.100", "192.168.0.111", "192.168.0.10", "192.168.0.11", "192.168.0.16", "192.168.0.20", "192.168.0.25", "192.168.0.30", "192.168.0.32", "192.168.0.200", "192.168.0.15", "192.168.0.17"}; sprintf(szBuf, "peer.setport 10000"); ConsoleInputEvent(szBuf); for (int i = 0; i < 12; i++) { if (!strcmp(szMyIP, szIPs[i])) continue; sprintf(szBuf, "peer.addpeer %s 10000", szIPs[i]); ConsoleInputEvent(szBuf); } CCClient::OutputMessage(CCZMOM_LOCALREPLY, "Done SetClient All"); } break; #endif #ifndef _PUBLISH case ZC_TEST_BIRD1: { OnBirdTest(); } break; #endif case MC_MATCH_NOTIFY: { unsigned int nMsgID = 0; if (pCommand->GetParameter(&nMsgID, 0, MPT_UINT) == false) break; OnMatchNotify(nMsgID); } break; case MC_MATCH_BRIDGEPEER_ACK: { CCUID uidChar; int nCode; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&nCode, 1, MPT_INT); OnBridgePeerACK(uidChar, nCode); } break; case MC_MATCH_STAGE_RESPONSE_FORCED_ENTRY: // 난입 { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); if (nResult == MOK) { OnForcedEntryToGame(); } else { ZApplication::GetGameInterface()->ShowMessage("난입할 수 없습니다."); } } break; case MC_MATCH_STAGE_JOIN: { CCUID uidChar, uidStage; unsigned int nRoomNo=0; char szStageName[256]=""; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nRoomNo, 2, MPT_UINT); pCommand->GetParameter(szStageName, 3, MPT_STR, sizeof(szStageName) ); OnStageJoin(uidChar, uidStage, nRoomNo, szStageName); } break; case MC_MATCH_STAGE_LEAVE: { CCUID uidChar, uidStage; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); OnStageLeave(uidChar, uidStage); } break; case MC_MATCH_STAGE_START: { CCUID uidChar, uidStage; int nCountdown; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nCountdown, 2, MPT_INT); OnStageStart(uidChar, uidStage, nCountdown); } break; case MC_MATCH_STAGE_LAUNCH: { CCUID uidStage; char szMapName[_MAX_DIR]; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName) ); OnStageLaunch(uidStage, szMapName); } break; case MC_MATCH_STAGE_RELAY_LAUNCH : { CCUID uidStage; bool bIsIgnore; char szMapName[_MAX_DIR]; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName) ); pCommand->GetParameter(&bIsIgnore, 2, MPT_BOOL); if( !bIsIgnore ) OnStageLaunch(uidStage, szMapName); else { m_bForcedEntry = true; ZApplication::GetGameInterface()->SerializeStageInterface(); } } break; case MC_MATCH_STAGE_FINISH_GAME: { bool bIsRelayMapUnFinish; CCUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(&bIsRelayMapUnFinish, 1, MPT_BOOL); OnStageFinishGame(uidStage, bIsRelayMapUnFinish); } break; case MC_MATCH_STAGE_MAP: { CCUID uidStage; char szMapName[_MAX_DIR]; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName) ); OnStageMap(uidStage, szMapName); } break; case MC_MATCH_STAGE_RELAY_MAP_INFO_UPDATE: { CCUID uidStage; int nRelayMapType = 0; int nRelayMapRepeatCount = 0; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(&nRelayMapType, 1, MPT_INT ); pCommand->GetParameter(&nRelayMapRepeatCount, 2, MPT_INT ); CCCommandParameter* pParam = pCommand->GetParameter(3); if (pParam->GetType() != MPT_BLOB) break; void* pRelayMapListBlob = pParam->GetPointer(); if( NULL == pRelayMapListBlob ) break; OnStageRelayMapListUpdate(nRelayMapType, nRelayMapRepeatCount, pRelayMapListBlob); } break; case MC_MATCH_STAGE_RELAY_MAP_ELEMENT_UPDATE: { CCUID uidStage; int nRelayMapType = 0; int nRelayMapRepeatCount = 0; pCommand->GetParameter(&uidStage, 0, MPT_UID ); pCommand->GetParameter(&nRelayMapType, 1, MPT_INT ); pCommand->GetParameter(&nRelayMapRepeatCount, 2, MPT_INT ); OnStageRelayMapElementUpdate(nRelayMapType, nRelayMapRepeatCount); } break; case MC_MATCH_STAGE_TEAM: { CCUID uidChar, uidStage; unsigned int nTeam; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nTeam, 2, MPT_UINT); OnStageTeam(uidChar, uidStage, nTeam); } break; case MC_MATCH_STAGE_PLAYER_STATE: { CCUID uidChar, uidStage; int nObjectStageState; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nObjectStageState, 2, MPT_INT); OnStagePlayerState(uidChar, uidStage, CCMatchObjectStageState(nObjectStageState)); } break; case MC_MATCH_STAGE_MASTER: { CCUID uidChar, uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(&uidChar, 1, MPT_UID); OnStageMaster(uidStage, uidChar); } break; case MC_MATCH_STAGE_CHAT: { CCUID uidStage, uidChar; static char szChat[512]; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(szChat, 2, MPT_STR, sizeof(szChat) ); //check Chatting Message..jintriple3 줄 바꿈 문자 필터링 CheckMsgAboutChat(szChat); OnStageChat(uidChar, uidStage, szChat); } break; case MC_MATCH_STAGE_LIST: { char nPrevStageCount, nNextStageCount; pCommand->GetParameter(&nPrevStageCount, 0, MPT_CHAR); pCommand->GetParameter(&nNextStageCount, 1, MPT_CHAR); CCCommandParameter* pParam = pCommand->GetParameter(2); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = CCGetBlobArrayCount(pBlob); OnStageList((int)nPrevStageCount, (int)nNextStageCount, pBlob, nCount); } break; case MC_MATCH_CHANNEL_RESPONSE_PLAYER_LIST: { unsigned char nTotalPlayerCount, nPage; pCommand->GetParameter(&nTotalPlayerCount, 0, MPT_UCHAR); pCommand->GetParameter(&nPage, 1, MPT_UCHAR); CCCommandParameter* pParam = pCommand->GetParameter(2); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = CCGetBlobArrayCount(pBlob); OnChannelPlayerList((int)nTotalPlayerCount, (int)nPage, pBlob, nCount); } break; case MC_MATCH_CHANNEL_RESPONSE_ALL_PLAYER_LIST: { CCUID uidChannel; pCommand->GetParameter(&uidChannel, 0, MPT_UID); CCCommandParameter* pParam = pCommand->GetParameter(1); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = CCGetBlobArrayCount(pBlob); OnChannelAllPlayerList(uidChannel, pBlob, nCount); } break; case MC_MATCH_RESPONSE_FRIENDLIST: { CCCommandParameter* pParam = pCommand->GetParameter(0); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = CCGetBlobArrayCount(pBlob); OnResponseFriendList(pBlob, nCount); } break; case MC_MATCH_RESPONSE_STAGESETTING: { CCUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); CCCommandParameter* pStageParam = pCommand->GetParameter(1); if(pStageParam->GetType()!=MPT_BLOB) break; void* pStageBlob = pStageParam->GetPointer(); int nStageCount = CCGetBlobArrayCount(pStageBlob); CCCommandParameter* pCharParam = pCommand->GetParameter(2); if(pCharParam->GetType()!=MPT_BLOB) break; void* pCharBlob = pCharParam->GetPointer(); int nCharCount = CCGetBlobArrayCount(pCharBlob); int nStageState; pCommand->GetParameter(&nStageState, 3, MPT_INT); CCUID uidMaster; pCommand->GetParameter(&uidMaster, 4, MPT_UID); OnResponseStageSetting(uidStage, pStageBlob, nStageCount, pCharBlob, nCharCount, STAGE_STATE(nStageState), uidMaster); ChangeQuestStage(); } break; case MC_MATCH_RESPONSE_PEER_RELAY: { CCUID uidPeer; if (pCommand->GetParameter(&uidPeer, 0, MPT_UID) == false) break; OnResponsePeerRelay(uidPeer); } break; case MC_MATCH_LOADING_COMPLETE: { CCUID uidChar; int nPercent; if (pCommand->GetParameter(&uidChar, 0, MPT_UID) == false) break; if (pCommand->GetParameter(&nPercent, 1, MPT_INT) == false) break; OnLoadingComplete(uidChar, nPercent); } break; case MC_MATCH_ANNOUNCE: { unsigned int nType; char szMsg[256]; pCommand->GetParameter(&nType, 0, MPT_UINT); pCommand->GetParameter(szMsg, 1, MPT_STR, sizeof(szMsg) ); OnAnnounce(nType, szMsg); } break; case MC_MATCH_CHANNEL_RESPONSE_JOIN: { CCUID uidChannel; int nChannelType; char szChannelName[256]; bool bEnableInterface; pCommand->GetParameter(&uidChannel, 0, MPT_UID); pCommand->GetParameter(&nChannelType, 1, MPT_INT); pCommand->GetParameter(szChannelName, 2, MPT_STR, sizeof(szChannelName) ); pCommand->GetParameter(&bEnableInterface, 3, MPT_BOOL); const char* szChannelNameTranslated = ZGetStringResManager()->GetStringFromXml(szChannelName); OnChannelResponseJoin(uidChannel, (CCCHANNEL_TYPE)nChannelType, szChannelNameTranslated, bEnableInterface); } break; case MC_MATCH_CHANNEL_CHAT: { CCUID uidChannel, uidChar; char szChat[512]; char szName[256]; int nGrade; pCommand->GetParameter(&uidChannel, 0, MPT_UID); pCommand->GetParameter(szName, 1, MPT_STR, sizeof(szName) ); pCommand->GetParameter(szChat, 2, MPT_STR, sizeof(szChat) ); pCommand->GetParameter(&nGrade,3, MPT_INT); //jintriple3 줄 바꿈 문자 필터링 //check chatting Message CheckMsgAboutChat(szChat); OnChannelChat(uidChannel, szName, szChat, nGrade); } break; case MC_MATCH_CHANNEL_LIST: { CCCommandParameter* pParam = pCommand->GetParameter(0); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = CCGetBlobArrayCount(pBlob); OnChannelList(pBlob, nCount); } break; case MC_MATCH_CHANNEL_RESPONSE_RULE: { CCUID uidChannel; pCommand->GetParameter(&uidChannel, 0, MPT_UID); char szRuleName[128]; pCommand->GetParameter(szRuleName, 1, MPT_STR, sizeof(szRuleName) ); OnChannelResponseRule(uidChannel, szRuleName); } break; case MC_MATCH_RESPONSE_RECOMMANDED_CHANNEL: { CCUID uidChannel; pCommand->GetParameter(&uidChannel, 0, MPT_UID); OnResponseRecommandedChannel(uidChannel); } break; case MC_ADMIN_ANNOUNCE: { char szChat[512]; unsigned long int nMsgType = 0; pCommand->GetParameter(szChat, 1, MPT_STR, sizeof(szChat) ); pCommand->GetParameter(&nMsgType, 2, MPT_UINT); OnAdminAnnounce(ZGetStringResManager()->GetStringFromXml(szChat), ZAdminAnnounceType(nMsgType)); } break; case MC_MATCH_GAME_LEVEL_UP: { CCUID uidChar; pCommand->GetParameter(&uidChar, 0, MPT_UID); OnGameLevelUp(uidChar); } break; case MC_MATCH_GAME_LEVEL_DOWN: { CCUID uidChar; pCommand->GetParameter(&uidChar, 0, MPT_UID); OnGameLevelDown(uidChar); } break; case MC_MATCH_RESPONSE_GAME_INFO: { CCUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); CCCommandParameter* pParam = pCommand->GetParameter(1); if(pParam->GetType()!=MPT_BLOB) break; void* pGameInfoBlob = pParam->GetPointer(); pParam = pCommand->GetParameter(2); if(pParam->GetType()!=MPT_BLOB) break; void* pRuleInfoBlob = pParam->GetPointer(); pParam = pCommand->GetParameter(3); if(pParam->GetType()!=MPT_BLOB) break; void* pPlayerInfoBlob = pParam->GetPointer(); OnResponseGameInfo(uidStage, pGameInfoBlob, pRuleInfoBlob, pPlayerInfoBlob); } break; case MC_MATCH_OBTAIN_WORLDITEM: { CCUID uidPlayer; int nIteCCUID; pCommand->GetParameter(&uidPlayer, 0, MPT_UID); pCommand->GetParameter(&nIteCCUID, 1, MPT_INT); OnObtainWorldItem(uidPlayer, nIteCCUID); } break; case MC_MATCH_SPAWN_WORLDITEM: { CCCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType()!=MPT_BLOB) break; void* pSpawnInfoBlob = pParam->GetPointer(); OnSpawnWorldItem(pSpawnInfoBlob); } break; case MC_MATCH_REMOVE_WORLDITEM: { int nIteCCUID; pCommand->GetParameter(&nIteCCUID, 0, MPT_INT); OnRemoveWorldItem(nIteCCUID); } break; case MC_MATCH_USER_WHISPER: { char szSenderName[128]=""; char szTargetName[128]=""; char szMessage[1024]=""; pCommand->GetParameter(szSenderName, 0, MPT_STR, sizeof(szSenderName) ); pCommand->GetParameter(szTargetName, 1, MPT_STR, sizeof(szTargetName) ); pCommand->GetParameter(szMessage, 2, MPT_STR, sizeof(szMessage) ); //jintriple3 줄 바꿈 문자 필터링 //check chatting Message CheckMsgAboutChat(szMessage); OnUserWhisper(szSenderName, szTargetName, szMessage); } break; case MC_MATCH_CHATROOM_JOIN: { char szPlayerName[128]=""; char szChatRoomName[128]=""; pCommand->GetParameter(szPlayerName, 0, MPT_STR, sizeof(szPlayerName) ); pCommand->GetParameter(szChatRoomName, 1, MPT_STR, sizeof(szChatRoomName) ); OnChatRoomJoin(szPlayerName, szChatRoomName); } break; case MC_MATCH_CHATROOM_LEAVE: { char szPlayerName[128]=""; char szChatRoomName[128]=""; pCommand->GetParameter(szPlayerName, 0, MPT_STR, sizeof(szPlayerName) ); pCommand->GetParameter(szChatRoomName, 1, MPT_STR, sizeof(szChatRoomName) ); OnChatRoomLeave(szPlayerName, szChatRoomName); } break; case MC_MATCH_CHATROOM_SELECT_WRITE: { char szChatRoomName[128]=""; pCommand->GetParameter(szChatRoomName, 0, MPT_STR, sizeof(szChatRoomName) ); OnChatRoomSelectWrite(szChatRoomName); } break; case MC_MATCH_CHATROOM_INVITE: { char szSenderName[64]=""; char szTargetName[64]=""; char szRoomName[128]=""; pCommand->GetParameter(szSenderName, 0, MPT_STR, sizeof(szSenderName) ); pCommand->GetParameter(szTargetName, 1, MPT_STR, sizeof(szTargetName) ); pCommand->GetParameter(szRoomName, 2, MPT_STR, sizeof(szRoomName) ); OnChatRoomInvite(szSenderName, szRoomName); } break; case MC_MATCH_CHATROOM_CHAT: { char szChatRoomName[128]=""; char szPlayerName[128]=""; char szChat[128]=""; pCommand->GetParameter(szChatRoomName, 0, MPT_STR, sizeof(szChatRoomName) ); pCommand->GetParameter(szPlayerName, 1, MPT_STR, sizeof(szPlayerName) ); pCommand->GetParameter(szChat, 2, MPT_STR, sizeof(szChat) ); //jintriple3 줄 바꿈 문자 필터링 //check chatting Message CheckMsgAboutChat(szChat); OnChatRoomChat(szChatRoomName, szPlayerName, szChat); } break; case ZC_REPORT_119: { OnLocalReport119(); } break; case ZC_MESSAGE: { int iMessageID; pCommand->GetParameter(&iMessageID, 0, MPT_INT); ZGetGameInterface()->ShowMessage(iMessageID); }break; case MC_TEST_PEERTEST_PING: { CCUID uidSender = pCommand->GetSenderUID(); char szLog[128]; sprintf(szLog, "PEERTEST_PING: from (%d%d)", uidSender.High, uidSender.Low); ZChatOutput(szLog, ZChat::CMT_SYSTEM); } break; case MC_TEST_PEERTEST_PONG: { } break; // 클랜관련 case MC_MATCH_CLAN_RESPONSE_CREATE_CLAN: { int nResult, nRequestID; pCommand->GetParameter(&nResult, 0, MPT_INT); pCommand->GetParameter(&nRequestID, 1, MPT_INT); OnResponseCreateClan(nResult, nRequestID); } break; case MC_MATCH_CLAN_RESPONSE_AGREED_CREATE_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnResponseAgreedCreateClan(nResult); } break; case MC_MATCH_CLAN_ASK_SPONSOR_AGREEMENT: { int nRequestID; char szClanName[256]; CCUID uidMasterObject; char szMasterName[256]; pCommand->GetParameter(&nRequestID, 0, MPT_INT); pCommand->GetParameter(szClanName, 1, MPT_STR, sizeof(szClanName) ); pCommand->GetParameter(&uidMasterObject, 2, MPT_UID); pCommand->GetParameter(szMasterName, 3, MPT_STR, sizeof(szMasterName) ); OnClanAskSponsorAgreement(nRequestID, szClanName, uidMasterObject, szMasterName); } break; case MC_MATCH_CLAN_ANSWER_SPONSOR_AGREEMENT: { CCUID uidClanMaster; int nRequestID; bool bAnswer; char szCharName[256]; pCommand->GetParameter(&nRequestID, 0, MPT_INT); pCommand->GetParameter(&uidClanMaster, 1, MPT_UID); pCommand->GetParameter(szCharName, 2, MPT_STR, sizeof(szCharName) ); pCommand->GetParameter(&bAnswer, 3, MPT_BOOL); OnClanAnswerSponsorAgreement(nRequestID, uidClanMaster, szCharName, bAnswer); } break; case MC_MATCH_CLAN_RESPONSE_CLOSE_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseCloseClan(nResult); } break; case MC_MATCH_CLAN_RESPONSE_JOIN_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseJoinClan(nResult); } break; case MC_MATCH_CLAN_ASK_JOIN_AGREEMENT: { char szClanName[256], szClanAdmin[256]; CCUID uidClanAdmin; pCommand->GetParameter(szClanName, 0, MPT_STR, sizeof(szClanName) ); pCommand->GetParameter(&uidClanAdmin, 1, MPT_UID); pCommand->GetParameter(szClanAdmin, 2, MPT_STR, sizeof(szClanAdmin) ); OnClanAskJoinAgreement(szClanName, uidClanAdmin, szClanAdmin); } break; case MC_MATCH_CLAN_ANSWER_JOIN_AGREEMENT: { CCUID uidClanAdmin; bool bAnswer; char szJoiner[256]; pCommand->GetParameter(&uidClanAdmin, 0, MPT_UID); pCommand->GetParameter(szJoiner, 1, MPT_STR, sizeof(szJoiner) ); pCommand->GetParameter(&bAnswer, 2, MPT_BOOL); OnClanAnswerJoinAgreement(uidClanAdmin, szJoiner, bAnswer); } break; case MC_MATCH_CLAN_RESPONSE_AGREED_JOIN_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseAgreedJoinClan(nResult); } break; case MC_MATCH_CLAN_UPDATE_CHAR_CLANINFO: { CCCommandParameter* pParam = pCommand->GetParameter(0); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanUpdateCharClanInfo(pBlob); } break; case MC_MATCH_CLAN_RESPONSE_LEAVE_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseLeaveClan(nResult); } break; case MC_MATCH_CLAN_MASTER_RESPONSE_CHANGE_GRADE: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseChangeGrade(nResult); } break; case MC_MATCH_CLAN_ADMIN_RESPONSE_EXPEL_MEMBER: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseExpelMember(nResult); } break; case MC_MATCH_CLAN_MSG: { char szSenderName[256]; char szMsg[512]; pCommand->GetParameter(szSenderName, 0, MPT_STR, sizeof(szSenderName) ); pCommand->GetParameter(szMsg, 1, MPT_STR, sizeof( szMsg) ); //jintriple3 줄 바꿈 문자 필터링 //check chatting Message CheckMsgAboutChat(szMsg); OnClanMsg(szSenderName, szMsg); } break; case MC_MATCH_CLAN_RESPONSE_MEMBER_LIST: { CCCommandParameter* pParam = pCommand->GetParameter(0); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanMemberList(pBlob); } break; case MC_MATCH_CLAN_RESPONSE_CLAN_INFO: { CCCommandParameter* pParam = pCommand->GetParameter(0); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanResponseClanInfo(pBlob); } break; case MC_MATCH_CLAN_RESPONSE_EMBLEMURL: { int nCLID=0; int nEmblemChecksum=0; char szURL[4096]=""; pCommand->GetParameter(&nCLID, 0, MPT_INT); pCommand->GetParameter(&nEmblemChecksum, 1, MPT_INT); pCommand->GetParameter(szURL, 2, MPT_STR, sizeof(szURL) ); OnClanResponseEmblemURL(nCLID, nEmblemChecksum, szURL); } break; case MC_MATCH_CLAN_LOCAL_EMBLEMREADY: { int nCLID=0; char szURL[4096]=""; pCommand->GetParameter(&nCLID, 0, MPT_INT); pCommand->GetParameter(szURL, 1, MPT_STR, sizeof(szURL) ); OnClanEmblemReady(nCLID, szURL); } break; case MC_MATCH_RESPONSE_RESULT: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); if (nResult != MOK) { ZApplication::GetGameInterface()->ShowErrorMessage( nResult ); } } break; case MC_MATCH_RESPONSE_CHARINFO_DETAIL: { CCCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnResponseCharInfoDetail(pBlob); } break; case MC_MATCH_RESPONSE_PROPOSAL: { int nResult, nProposalMode, nRequestID; pCommand->GetParameter(&nResult, 0, MPT_INT); pCommand->GetParameter(&nProposalMode, 1, MPT_INT); pCommand->GetParameter(&nRequestID, 2, MPT_INT); OnResponseProposal(nResult, CCMatchProposalMode(nProposalMode), nRequestID); } break; case MC_MATCH_ASK_AGREEMENT: { CCUID uidProposer; // char szProposerCharName[256]; int nProposalMode, nRequestID; pCommand->GetParameter(&uidProposer, 0, MPT_UID); // pCommand->GetParameter(szProposerCharName, 1, MPT_STR); CCCommandParameter* pParam = pCommand->GetParameter(1); void* pMemberNamesBlob = pParam->GetPointer(); pCommand->GetParameter(&nProposalMode, 2, MPT_INT); pCommand->GetParameter(&nRequestID, 3, MPT_INT); OnAskAgreement(uidProposer, pMemberNamesBlob, CCMatchProposalMode(nProposalMode), nRequestID); } break; case MC_MATCH_REPLY_AGREEMENT: { CCUID uidProposer, uidChar; char szReplierName[256]; int nProposalMode, nRequestID; bool bAgreement; pCommand->GetParameter(&uidProposer, 0, MPT_UID); pCommand->GetParameter(&uidChar, 1, MPT_UID); pCommand->GetParameter(szReplierName, 2, MPT_STR, sizeof(szReplierName) ); pCommand->GetParameter(&nProposalMode, 3, MPT_INT); pCommand->GetParameter(&nRequestID, 4, MPT_INT); pCommand->GetParameter(&bAgreement, 5, MPT_BOOL); OnReplyAgreement(uidProposer, uidChar, szReplierName, CCMatchProposalMode(nProposalMode), nRequestID, bAgreement); } break; // 레더 커맨드 case MC_MATCH_LADDER_SEARCH_RIVAL: // 검색 시작 { ZGetGameInterface()->OnArrangedTeamGameUI(true); }break; case MC_MATCH_LADDER_CANCEL_CHALLENGE: { ZGetGameInterface()->OnArrangedTeamGameUI(false); char szCharName[MATCHOBJECT_NAME_LENGTH]; pCommand->GetParameter(szCharName, 0, MPT_STR, sizeof(szCharName) ); if(szCharName[0]!=0) { char szOutput[256]; ZTransMsg(szOutput,MSG_LADDER_CANCEL,1,szCharName); ZChatOutput(sColor(ZCOLOR_CHAT_SYSTEM), szOutput); }else // 이름이 없으면 실패한경우다. { ZChatOutput(sColor(ZCOLOR_CHAT_SYSTEM), ZMsg(MSG_LADDER_FAILED) ); } }break; case MC_MATCH_LADDER_RESPONSE_CHALLENGE: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnLadderResponseChallenge(nResult); } break; case MC_MATCH_LADDER_PREPARE: { CCUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); int nTeam; pCommand->GetParameter(&nTeam, 1, MPT_INT); OnLadderPrepare(uidStage, nTeam); }break; case MC_MATCH_LADDER_LAUNCH: // 게임 시작 { CCUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); char szMapName[128]; pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName) ); OnLadderLaunch(uidStage, szMapName); }break; case MC_MATCH_CLAN_STANDBY_CLAN_LIST: { int nPrevStageCount, nNextStageCount; pCommand->GetParameter(&nPrevStageCount, 0, MPT_INT); pCommand->GetParameter(&nNextStageCount, 1, MPT_INT); CCCommandParameter* pParam = pCommand->GetParameter(2); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanStandbyClanList(nPrevStageCount, nNextStageCount, pBlob); } break; case MC_MATCH_CLAN_MEMBER_CONNECTED: { char szMember[256]; pCommand->GetParameter(szMember, 0, MPT_STR, sizeof(szMember) ); OnClanMemberConnected(szMember); } break; case MC_MATCH_NOTIFY_CALLVOTE: { char szDiscuss[128] = ""; char szArg[256] = ""; pCommand->GetParameter(szDiscuss, 0, MPT_STR, sizeof(szDiscuss) ); pCommand->GetParameter(szArg, 1, MPT_STR, sizeof(szArg) ); OnNotifyCallVote(szDiscuss, szArg); } break; case MC_MATCH_NOTIFY_VOTERESULT: { char szDiscuss[128]; int nResult = 0; pCommand->GetParameter(szDiscuss, 0, MPT_STR, sizeof(szDiscuss) ); pCommand->GetParameter(&nResult, 1, MPT_INT); OnNotifyVoteResult(szDiscuss, nResult); } break; case MC_MATCH_VOTE_RESPONSE: { int nMsgCode = 0; pCommand->GetParameter( &nMsgCode, 0, MPT_INT ); OnVoteAbort( nMsgCode ); } break; case MC_MATCH_BROADCAST_CLAN_RENEW_VICTORIES: { char szWinnerClanName[256], szLoserClanName[256]; int nVictories; pCommand->GetParameter(szWinnerClanName, 0, MPT_STR, sizeof(szWinnerClanName) ); pCommand->GetParameter(szLoserClanName, 1, MPT_STR, sizeof(szLoserClanName) ); pCommand->GetParameter(&nVictories, 2, MPT_INT); OnBroadcastClanRenewVictories(szWinnerClanName, szLoserClanName, nVictories); } break; case MC_MATCH_BROADCAST_CLAN_INTERRUPT_VICTORIES: { char szWinnerClanName[256], szLoserClanName[256]; int nVictories; pCommand->GetParameter(szWinnerClanName, 0, MPT_STR, sizeof(szWinnerClanName) ); pCommand->GetParameter(szLoserClanName, 1, MPT_STR, sizeof(szLoserClanName) ); pCommand->GetParameter(&nVictories, 2, MPT_INT); OnBroadcastClanInterruptVictories(szWinnerClanName, szLoserClanName, nVictories); } break; case MC_MATCH_BROADCAST_DUEL_RENEW_VICTORIES: { char szChannelName[256], szChampionName[256]; int nVictories, nRoomNo; pCommand->GetParameter(szChampionName, 0, MPT_STR, sizeof(szChampionName) ); pCommand->GetParameter(szChannelName, 1, MPT_STR, sizeof(szChannelName) ); pCommand->GetParameter(&nRoomNo, 2, MPT_INT); pCommand->GetParameter(&nVictories, 3, MPT_INT); OnBroadcastDuelRenewVictories(szChampionName, szChannelName, nRoomNo, nVictories); } break; case MC_MATCH_BROADCAST_DUEL_INTERRUPT_VICTORIES: { char szChampionName[256], szInterrupterName[256]; int nVictories; pCommand->GetParameter(szChampionName, 0, MPT_STR, sizeof(szChampionName) ); pCommand->GetParameter(szInterrupterName, 1, MPT_STR, sizeof(szInterrupterName) ); pCommand->GetParameter(&nVictories, 2, MPT_INT); OnBroadcastDuelInterruptVictories(szChampionName, szInterrupterName, nVictories); } break; case MC_MATCH_RESPONSE_STAGE_FOLLOW: { int nMsgID; pCommand->GetParameter( &nMsgID, 0, MPT_INT ); OnFollowResponse( nMsgID ); } break; case MC_MATCH_SCHEDULE_ANNOUNCE_SEND : { char cAnnounce[ 512 ] = {0}; pCommand->GetParameter( cAnnounce, 0, MPT_STR , sizeof(cAnnounce) ); ZChatOutput( cAnnounce ); } break; case MC_MATCH_EXPIRED_RENT_ITEM: { CCCommandParameter* pParam = pCommand->GetParameter(0); if(pParam->GetType()!=MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnExpiredRentItem(pBlob); } break; case MC_MATCH_FIND_HACKING: { } break; case MC_MATCH_REWARD_BATTLE_TIME: { CCUID uidOwner; char szRewardName[256], szRewardResetDesc[256]; int nRemainReward; unsigned int nItemId, nItemCnt; unsigned int nRentHourPeriod; pCommand->GetParameter(&uidOwner, 0, MPT_UID); pCommand->GetParameter(szRewardName, 1, MPT_STR, sizeof(szRewardName) ); pCommand->GetParameter(szRewardResetDesc, 2, MPT_STR, sizeof(szRewardResetDesc) ); pCommand->GetParameter(&nItemId, 3, MPT_UINT); pCommand->GetParameter(&nItemCnt, 4, MPT_UINT); pCommand->GetParameter(&nRentHourPeriod, 5, MPT_UINT); pCommand->GetParameter(&nRemainReward, 6, MPT_INT); const char* szCharName = "-"; const char* szItemName = "-"; if (ZGetCharacterManager()) { ZCharacter* pChar = ZGetCharacterManager()->Find(uidOwner); if (pChar) szCharName = pChar->GetUserName(); } CCMatchItemDesc* pItemDesc = CCGetMatchItemDescMgr()->GetItemDesc(nItemId); if (pItemDesc) szItemName = pItemDesc->m_pMItemName->Ref().m_szItemName; else { const ZGambleItemDefine* pGItemDef = ZGetGambleItemDefineMgr().GetGambleItemDefine(nItemId); if (pGItemDef) szItemName = pGItemDef->GetName().c_str(); } // 이 커맨드는 // 1. 보상을 실제로 받은 경우 // 2. 보상을 받을 수 있지만 기회가 남지 않아서 받을 수 없는 경우 // 두 경우 모두 전송받는다. 따라서 상황에 맞게 적절한 처리가 필요하다 bool bRewardReally = (nItemId != 0); bool bMyReward = (ZGetMyUID() == uidOwner); if (bRewardReally) { TimeReward_ShowCharEffect(uidOwner); // 캐릭터 머리 위에 이펙트 출력 TimeReward_ChatOutput_RewardGet(szRewardName, szCharName, szItemName); // '누가 무엇을 받았다' 출력 if (bMyReward) // 나 자신을 위한 커맨드라면 { if (nRemainReward >= 1) TimeReward_ChatOutput_RemainChance(nRemainReward); // 남은 기회를 출력 else if (nRemainReward == 0) TimeReward_ChatOutput_ResetChance(szRewardResetDesc); // 이번에 받은 것이 마지막 기회였다면 재충전 시각 공지 else if (nRemainReward == -1) int a=0;// 이 경우는 별도의 기회 제한이 없는 이벤트를 나타낸다, 특별히 기회에 대한 출력문을 보여주지 않는다 } } else // 조건은 충족했으나 남은 기회가 없어 받지 못한 경우 { if (bMyReward) { TimeReward_ChatOutput_NoChance(szRewardName); // 기회가 없어서 받지 못함을 알려주고 TimeReward_ChatOutput_ResetChance(szRewardResetDesc); // 재충전 시각을 공지 } } } break; // 듀얼 토너먼트 #ifdef _DUELTOURNAMENT case MC_MATCH_DUELTOURNAMENT_RESPONSE_JOINGAME: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); switch (nResult) { case MERR_DT_WRONG_CHANNEL: ZApplication::GetGameInterface()->ShowErrorMessage( nResult ); cclog("Error: Illegal request to join game, This isn't a duel tournament channel.\n"); break; case MERR_DT_CANNOT_CHALLENGE: ZApplication::GetGameInterface()->ShowErrorMessage( nResult ); cclog("Error: failed to challenge a duel tournament game.\n"); break; case MERR_DT_ALREADY_JOIN: ZApplication::GetGameInterface()->ShowErrorMessage( nResult ); cclog("Error: already trying to join a duel tournament game.\n"); break; } } break; case MC_MATCH_DUELTOURNAMENT_PREPARE_MATCH: { CCUID uidStage = CCUID(0,0); int nType; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(&nType, 1, MPT_INT); CCCommandParameter* pParam = pCommand->GetParameter(2); void* pBlobPlayerInfo = pParam->GetPointer(); OnDuelTournamentPrepare((CCDUELTOURNAMENTTYPE)nType, uidStage, pBlobPlayerInfo); } break; case MC_MATCH_DUELTOURNAMENT_LAUNCH_MATCH: { CCUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); char szMapName[128]; pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName) ); ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); CCWidget* pWidget = pResource->FindWidget("DuelTournamentWaitMatchDialog"); if(pWidget!=NULL) pWidget->Show(false); OnDuelTournamentLaunch(uidStage, szMapName); } break; case MC_MATCH_DUELTOURNAMENT_NOT_SERVICE_TIME: { int nOpenStartTime; int nOpenEndTime; pCommand->GetParameter(&nOpenStartTime, 0, MPT_INT); pCommand->GetParameter(&nOpenEndTime, 1, MPT_INT); // 듀얼토너먼트 신청이 서비스 시간에 따라 취소 되었음. ZApplication::GetGameInterface()->OnDuelTournamentGameUI(false); // 참가 신청 박스 닫아준다. const char *strFormat = ZErrStr( MERR_DT_NOT_SERVICE_TIME ); if(strFormat) { char text[1024]; sprintf(text, strFormat, nOpenStartTime, nOpenEndTime); ZApplication::GetGameInterface()->ShowErrorMessage(text, MERR_DT_NOT_SERVICE_TIME); } } break; case MC_MATCH_DUELTOURNAMENT_CHAR_INFO: { pCommand->GetParameter(&m_dtCharInfo.tournamentPoint, 0, MPT_INT); pCommand->GetParameter(&m_dtCharInfo.wins, 1, MPT_INT); pCommand->GetParameter(&m_dtCharInfo.losses, 2, MPT_INT); pCommand->GetParameter(&m_dtCharInfo.ranking, 3, MPT_INT); //pCommand->GetParameter(&rankingFructuation, 4, MPT_INT); pCommand->GetParameter(&m_dtCharInfo.winners, 5, MPT_INT); pCommand->GetParameter(&m_dtCharInfo.lastWeekGrade, 6, MPT_INT); ZGetGameInterface()->UpdateDuelTournamantMyCharInfoUI(); } break; case MC_MATCH_DUELTOURNAMENT_CHAR_INFO_PREVIOUS: { pCommand->GetParameter(&m_dtCharInfoPrev.tournamentPoint, 0, MPT_INT); pCommand->GetParameter(&m_dtCharInfoPrev.wins, 1, MPT_INT); pCommand->GetParameter(&m_dtCharInfoPrev.losses, 2, MPT_INT); pCommand->GetParameter(&m_dtCharInfoPrev.ranking, 3, MPT_INT); pCommand->GetParameter(&m_dtCharInfoPrev.winners, 4, MPT_INT); ZGetGameInterface()->UpdateDuelTournamantMyCharInfoPreviousUI(); } break; #endif //_DUELTOURNAMENT // Gamble 아이템 case MC_MATCH_RESPONSE_GAMBLE: { unsigned int nRecvItem; unsigned int nCnt; unsigned int nTime; pCommand->GetParameter(&nRecvItem, 0, MPT_UINT); pCommand->GetParameter(&nCnt, 1, MPT_UINT); pCommand->GetParameter(&nTime, 2, MPT_UINT); OnRecieveGambleItem( nRecvItem, nCnt, nTime); } break; case MC_QUEST_NPCLIST : { CCCommandParameter* pParam = pCommand->GetParameter( 0 ); if( MPT_BLOB != pParam->GetType() ) { break; } void* pBlobNPCList = pParam->GetPointer(); if( NULL == pBlobNPCList ) { return false; } int gameType; if (!pCommand->GetParameter(&gameType, 1, MPT_INT)) { ASSERT(0); return false; } OnQuestNPCList( pBlobNPCList, (CCMATCH_GAMETYPE)gameType ); } break; case MC_REQUEST_RESOURCE_CRC32 : { DWORD dwKey = 0; pCommand->GetParameter( &dwKey, 0, MPT_UINT ); DWORD dwCrc32, dwXor; ZGetGame()->MakeResourceCRC32(dwKey, dwCrc32, dwXor); ZPostResponseResourceCRC32( dwCrc32, dwXor ); } break; case MC_MATCH_ROUTE_UPDATE_STAGE_EQUIP_LOOK : { CCUID uidPlayer; int nParts; int nItemID; pCommand->GetParameter( &uidPlayer, 0, MPT_UID ); pCommand->GetParameter( &nParts, 1, MPT_INT ); pCommand->GetParameter( &nItemID, 2, MPT_INT ); OnResponseUpdateStageEquipLook( uidPlayer, nParts, nItemID ); } break; case MC_ADMIN_RESPONSE_KICK_PLAYER: { int nResult; pCommand->GetParameter( &nResult, 0, MPT_INT ); OnAdminResponseKickPlayer(nResult); } break; case MC_ADMIN_RESPONSE_BLOCK_PLAYER: { int nResult; pCommand->GetParameter( &nResult, 0, MPT_INT ); OnAdminResponseBlockPlayer(nResult); } break; case MC_ADMIN_RESPONSE_MUTE_PLAYER: { int nResult; pCommand->GetParameter( &nResult, 0, MPT_INT ); OnAdminResponseMutePlayer(nResult); } break; default: if (!ret) { // CCClient::OutputMessage(CCZMOM_LOCALREPLY, "Command(%s) handler not found", pCommand->m_pCommandDesc->GetName()); // return false; } break; } if (m_fnOnCommandCallback) ret = m_fnOnCommandCallback(pCommand); return ret; }
RRESULT OnCreate(void *pParam) { /* // Walk through in debug to trace all routes */ g_App.PreCheckArguments(); sprintf( cstrReleaseDate, "Version : %s", ZGetSVNRevision().c_str()); //Possibly cclog(cstrReleaseDate); cclog("\n"); g_DInput.Create(g_hWnd, FALSE, FALSE); g_pInput = new ZInput(&g_DInput); RSetGammaRamp(Z_VIDEO_GAMMA_VALUE); RSetRenderFlags(RRENDER_CLEAR_BACKBUFFER); ZGetInitialLoading()->Initialize( 1, 0, 0, RGetScreenWidth(), RGetScreenHeight(), 0, 0, 1024, 768 ); cclog("InitialLoading success.\n"); struct _finddata_t c_file; intptr_t hFile; char szFileName[256]; #define FONT_DIR "Font/" #define FONT_EXT "ttf" if( (hFile = _findfirst(FONT_DIR"*."FONT_EXT, &c_file )) != -1L ){ do{ strcpy(szFileName, FONT_DIR); strcat(szFileName, c_file.name); AddFontResource(szFileName); }while( _findnext( hFile, &c_file ) == 0 ); _findclose(hFile); } g_pDefFont = new CCFontR2; if( !g_pDefFont->Create("Default", Z_LOCALE_DEFAULT_FONT, DEFAULT_FONT_HEIGHT, 1.0f) ) { cclog("Fail to Create default font : CCFontR2 / main.cpp.. onCreate\n" ); g_pDefFont->Destroy(); SAFE_DELETE( g_pDefFont ); g_pDefFont = NULL; } g_pDC = new CCDrawContextR2(RGetDevice()); if( ZGetInitialLoading()->IsUseEnable() ) { ZGetInitialLoading()->AddBitmap( 0, "Interface/Default/LOADING/loading_adult.jpg" ); ZGetInitialLoading()->AddBitmapBar( "Interface/Default/LOADING/loading.bmp" ); ZGetInitialLoading()->SetText( g_pDefFont, 5, 5, cstrReleaseDate ); ZGetInitialLoading()->AddBitmapGrade( "Interface/Default/LOADING/loading_grade_fifteen.jpg" ); ZGetInitialLoading()->SetPercentage( 0.0f ); ZGetInitialLoading()->Draw( MODE_FADEIN, 0 , true ); } g_Core.Initialize(800, 600, g_pDC, g_pDefFont); Core::GetInstance()->SetHWND(RealSpace2::g_hWnd); cclog("interface Initialize success\n"); ZLoadingProgress appLoading("application"); if(!g_App.OnCreate(&appLoading)) { ZGetInitialLoading()->Release(); return R_ERROR_LOADING; } ZGetSoundEngine()->SetEffectVolume(Z_AUDIO_EFFECT_VOLUME); ZGetSoundEngine()->SetMusicVolume(Z_AUDIO_BGM_VOLUME); ZGetSoundEngine()->SetEffectMute(Z_AUDIO_EFFECT_MUTE); ZGetSoundEngine()->SetMusicMute(Z_AUDIO_BGM_MUTE); g_Core.SetWorkspaceSize(g_ModeParams.nWidth, g_ModeParams.nHeight); g_Core.GetMainFrame()->SetSize(g_ModeParams.nWidth, g_ModeParams.nHeight); ZGetOptionInterface()->Resize(g_ModeParams.nWidth, g_ModeParams.nHeight); // Default Key for(int i=0; i<ZACTION_COUNT; i++){ ZACTIONKEYDESCRIPTION& keyDesc = ZGetConfiguration()->GetKeyboard()->ActionKeys[i]; g_pInput->RegisterActionKey(i, keyDesc.nVirtualKey); if(keyDesc.nVirtualKeyAlt!=-1) g_pInput->RegisterActionKey(i, keyDesc.nVirtualKeyAlt); } g_App.SetInitialState(); // ParseParameter(g_szCmdLine); // ZGetFlashBangEffect()->SetDrawCopyScreen(true); static const char *szDone = "Done."; ZGetInitialLoading()->SetLoadingStr(szDone); if( ZGetInitialLoading()->IsUseEnable() ) { #ifndef _FASTDEBUG ZGetInitialLoading()->SetPercentage( 100.f ); ZGetInitialLoading()->Draw( MODE_FADEOUT, 0 ,true ); #endif ZGetInitialLoading()->Release(); } cclog("main : OnCreate() done\n"); SetFocus(g_hWnd); return R_OK; }
// STEP1 int WINAPI WinMain(HINSTANCE this_inst, HINSTANCE prev_inst, LPSTR cmdline, int cmdshow) { _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); InitLog(CCLOGSTYLE_DEBUGSTRING|CCLOGSTYLE_FILE); g_dwMainThreadID= GetCurrentThreadId(); char szModuleFileName[_MAX_DIR] = {0,}; GetModuleFileName(NULL, szModuleFileName, _MAX_DIR); PathRemoveFileSpec(szModuleFileName); SetCurrentDirectory(szModuleFileName); cclog("-------------------------------------------------------------\n"); cclog("Current working directory: %s\n", szModuleFileName); cclog("-------------------------------------------------------------\n"); srand( (unsigned)time( NULL )); cclog("GUNZ " STRFILEVER " launched. build ("__DATE__" "__TIME__") \n"); char szDateRun[128]=""; char szTimeRun[128]=""; _strdate( szDateRun ); _strtime( szTimeRun ); cclog("Log time (%s %s)\n", szDateRun, szTimeRun); CCSysInfoLog(); g_App.InitFileSystem(); ZGetConfiguration()->Load(); ZStringResManager::MakeInstance(); if( !ZApplication::GetInstance()->InitLocale() ) { CCLog("Locale Init error !!!\n"); return false; } DWORD ver_major = 0; DWORD ver_minor = 0; TCHAR ver_letter = ' '; if(CheckFont()==false) { CCLog("CheckFont() failed.\n"); return 0; } RSetFunction(RF_CREATE , OnCreate); RSetFunction(RF_RENDER , OnRender); RSetFunction(RF_UPDATE , OnUpdate); RSetFunction(RF_DESTROY , OnDestroy); RSetFunction(RF_INVALIDATE, OnInvalidate); RSetFunction(RF_RESTORE, OnRestore); RSetFunction(RF_ACTIVATE, OnActivate); RSetFunction(RF_DEACTIVATE, OnDeActivate); RSetFunction(RF_ERROR, OnError); SetModeParams(); // STEP2 cclog("Entering RMain()\n"); const int nRMainReturn = RMain(APPLICATION_NAME,this_inst,prev_inst,cmdline,cmdshow,&g_ModeParams,WndProc,IDI_ICON1); if( 0 != nRMainReturn ) return nRMainReturn; if( 0 != RInitD3D(&g_ModeParams) ) { MessageBox(g_hWnd, "fail to initialize DirectX", NULL, MB_OK); cclog( "error init RInitD3D\n" ); return 0; } cclog("Entering RRun()\n"); const int nRRunReturn = RRun(); ShowWindow(g_hWnd, SW_MINIMIZE); cclog("========================== DONE ===============================\n"); ZStringResManager::FreeInstance(); return 0;//nRRunReturn; }
void ZCharacterObject::Draw_SetLight(const rvector& vPosition) { // ±¤¿øÁ¤ÀÇ // 0¹ø - ambient : ij¸¯ÅÍÀÇ ±âº» ¹à±â // - diffuse : ¼ø°£ÀûÀÎ ±¤¿ø( ÃÑ·ù¸¦ ¹ß»çÇÒ¶§ Àû¿ë) // 1¹ø - ambient : »ç¿ë¾ÈÇÔ // - diffuse : ¸ÊÀÇ µðÇ»Áî ¶óÀÌÆ® // specular, emit ¼Ó¼ºÀº »ç¿ë¾ÈÇÔ #define CHARACTER_AMBIENT 0.0 D3DLIGHT9 Light; rvector pos; rvector char_pos = vPosition; char_pos.z += 180.f; memset( &Light, 0, sizeof( D3DLIGHT9 )); // ÃʱâÈ // 0¹ø ¶óÀÌÆ® begine Light.Type = D3DLIGHT_POINT; Light.Ambient.r = CHARACTER_AMBIENT; Light.Ambient.g = CHARACTER_AMBIENT; Light.Ambient.b = CHARACTER_AMBIENT; Light.Specular.r = 1.f; Light.Specular.g = 1.f; Light.Specular.b = 1.f; Light.Specular.a = 1.f; if( ZGetConfiguration()->GetVideo()->bDynamicLight && m_bDynamicLight ) { m_vLightColor.x -= 0.03f; m_vLightColor.y -= 0.03f; m_vLightColor.z -= 0.03f; max( m_vLightColor.x, 0.0f ); max( m_vLightColor.y, 0.0f ); max( m_vLightColor.z, 0.0f ); Light.Diffuse.r = m_vLightColor.x; Light.Diffuse.g = m_vLightColor.y; Light.Diffuse.b = m_vLightColor.z; Light.Range = g_CharLightList[m_iDLightType].fRange; float lastTime = m_fTime; m_fTime = timeGetTime(); float lap = m_fTime - lastTime; m_fLightLife -= lap; if( m_fLightLife <= 0.0f ) { m_bDynamicLight = false; m_fLightLife = 0; } } else { m_bDynamicLight = false; m_vLightColor.x = 0.0f; m_vLightColor.y = 0.0f; m_vLightColor.z = 0.0f; } if( IsDoubleGun() ) { if( m_bLeftShot ) GetWeaponTypePos( weapon_dummy_muzzle_flash, &pos ,true); else GetWeaponTypePos( weapon_dummy_muzzle_flash, &pos ); m_bLeftShot = !m_bLeftShot; } else { GetWeaponTypePos( weapon_dummy_muzzle_flash, &pos ); } Light.Position.x = pos.x ; Light.Position.y = pos.y ; Light.Position.z = pos.z ; Light.Attenuation1 = 0.05f; Light.Attenuation2 = 0.001f; if (IsNPC()) { Light.Ambient.r = 0.4f; Light.Ambient.g = 0.4f; Light.Ambient.b = 0.4f; Light.Range = 2000.0f; Light.Attenuation0 = 1.0f; Light.Attenuation1 = 0.0f; Light.Attenuation2 = 0.0f; } // RGetDevice()->SetLight( 0, &Light ); // RGetDevice()->LightEnable( 0, TRUE ); // if( RShaderMgr::mbUsingShader ) // { // RGetShaderMgr()->setLight( 0, &Light ); // RGetShaderMgr()->LightEnable( 0, TRUE ); // } m_pVMesh->SetLight(0,&Light,false); // 0¹ø ¶óÀÌÆ® end // 1¹ø ¶óÀÌÆ® begine ZeroMemory( &Light, sizeof(D3DLIGHT9) ); RLightList* pLightList = 0; RLIGHT* pLight = 0; RLIGHT* pSelectedLight = 0; rvector sunDir; float distance; float SelectedLightDistance = FLT_MAX; pLightList = ZGetGame()->GetWorld()->GetBsp()->GetSunLightList(); int nLight = (int)pLightList->size(); Light.Specular.r = 1.f; Light.Specular.g = 1.f; Light.Specular.b = 1.f; Light.Specular.a = 1.f; if( nLight > 0 ) { // Áß°£¿¡ ¸Ê ÇÈÅ·ÀÌ ¾ÈµÇ¸é.. // ÇØ°¡ ¿©·¯°³À̸é? °Å¸®·Î ¼±ÅÃ.. for( RLightList::iterator iter = pLightList->begin(); iter != pLightList->end(); ++iter ) { pLight = *iter; sunDir = pLight->sPosition - char_pos; distance = D3DXVec3LengthSq( &sunDir ); D3DXVec3Normalize( &sunDir, &sunDir ); RBSPPICKINFO info; if( ZGetGame()->GetWorld()->GetBsp()->Pick( char_pos, sunDir, &info,RM_FLAG_ADDITIVE ) ) { if( distance > D3DXVec3LengthSq(&( char_pos - info.PickPos )) ) { continue; } } if( distance < SelectedLightDistance ) { SelectedLightDistance = distance; pSelectedLight = pLight; } } Light.Type = D3DLIGHT_POINT; Light.Attenuation1 = 0.00001f; if( pSelectedLight != 0 ) { Light.Diffuse.r = pSelectedLight->Color.x * pSelectedLight->fIntensity * 0.15f; Light.Diffuse.g = pSelectedLight->Color.y * pSelectedLight->fIntensity * 0.15f; Light.Diffuse.b = pSelectedLight->Color.z * pSelectedLight->fIntensity * 0.15f; } } SelectedLightDistance = FLT_MAX ; if( pSelectedLight == 0 ) { pLightList = ZGetGame()->GetWorld()->GetBsp()->GetObjectLightList(); // ¿©±â ÃÖÀûÈ°¡ ÂÀ ÇÊ¿äÇÏ´Ù for( RLightList::iterator itor = pLightList->begin(); itor != pLightList->end(); itor++ ) { RLIGHT *pl = *itor; float fDist = Magnitude( pl->sPosition-char_pos ); if( SelectedLightDistance > fDist ) { SelectedLightDistance = fDist; pSelectedLight = pl; } } Light.Type = D3DLIGHT_POINT; Light.Attenuation1 = 0.0025f; if( pSelectedLight != 0 ) { Light.Diffuse.r = pSelectedLight->Color.x * pSelectedLight->fIntensity; Light.Diffuse.g = pSelectedLight->Color.y * pSelectedLight->fIntensity; Light.Diffuse.b = pSelectedLight->Color.z * pSelectedLight->fIntensity; } } if( pSelectedLight != NULL ) { Light.Position = pSelectedLight->sPosition; // Light.Diffuse.r = pSelectedLight->Color.x; // Light.Diffuse.g = pSelectedLight->Color.y; // Light.Diffuse.b = pSelectedLight->Color.z; Light.Range = pSelectedLight->fAttnEnd; m_pVMesh->SetLight(1,&Light,false); // RGetDevice()->SetLight( 1, &Light ); // RGetDevice()->LightEnable( 1, TRUE ); // if( RShaderMgr::mbUsingShader ) // { // RGetShaderMgr()->setLight( 1, &Light ); // RGetShaderMgr()->LightEnable( 1, TRUE ); // RGetShaderMgr()->setLight( 0x00cccccc ); // } } else { m_pVMesh->SetLight(1,NULL,false); // RGetDevice()->LightEnable( 1, FALSE ); // if( RShaderMgr::mbUsingShader ) // { // RGetShaderMgr()->LightEnable( 1, FALSE ); // } } // 1¹ø ¶óÀÌÆ® end RGetShaderMgr()->setAmbient( 0x00cccccc ); RGetDevice()->SetRenderState( D3DRS_LIGHTING, TRUE ); RGetDevice()->SetRenderState( D3DRS_AMBIENT, 0x00cccccc ); }
bool ZGameClient::OnCommand(MCommand* pCommand) { bool ret = MMatchClient::OnCommand(pCommand); switch (pCommand->GetID()) { case MC_MATCH_PING_LIST: { auto Param = pCommand->GetParameter(0); if (Param->GetType() != MPT_BLOB) break; void* Blob = Param->GetPointer(); int Count = MGetBlobArrayCount(Blob); for (int i = 0; i < Count; i++) { auto& Ping = *static_cast<MTD_PingInfo*>(MGetBlobArrayElement(Blob, i)); if (Ping.UID == GetPlayerUID()) { PingToServer = Ping.Ping; continue; } auto Peer = GetPeers()->Find(Ping.UID); if (Peer) Peer->UpdatePing(GetGlobalTimeMS(), Ping.Ping); auto Char = ZGetCharacterManager()->Find(Ping.UID); if (Char) Char->Ping = Ping.Ping; } } break; case MC_MATCH_RESPONSE_LOGIN_FAILED: { char szReason[4096]; if (!pCommand->GetParameter(szReason, 0, MPT_STR, sizeof(szReason))) break; ZGetGameInterface()->ShowErrorMessage(szReason); ZPostDisconnect(); } break; case MC_MATCH_RESPONSE_CREATE_ACCOUNT: { char szMessage[128]; if (!pCommand->GetParameter(szMessage, 0, MPT_STR, sizeof(szMessage))) break; ZGetGameInterface()->ShowErrorMessage(szMessage); } break; case MC_NET_ONDISCONNECT: break; case MC_NET_ONERROR: break; case ZC_CHANGESKIN: { char szSkinName[256]; pCommand->GetParameter(szSkinName, 0, MPT_STR, sizeof(szSkinName)); if (ZApplication::GetGameInterface()->ChangeInterfaceSkin(szSkinName)) { MClient::OutputMessage(MZMOM_LOCALREPLY, "Change Skin To %s", szSkinName); } else { MClient::OutputMessage(MZMOM_LOCALREPLY, "Change Skin Failed"); } } break; case MC_ADMIN_TERMINAL: { #ifndef _PUBLISH char szText[65535]; szText[0] = 0; MUID uidChar; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(szText, 1, MPT_STR, sizeof(szText)); OutputToConsole(szText); #endif } break; case MC_NET_CHECKPING: { MUID uid; if (pCommand->GetParameter(&uid, 0, MPT_UID) == false) break; MCommand* pNew = new MCommand(m_CommandManager.GetCommandDescByID(MC_NET_PING), uid, m_This); pNew->AddParameter(new MCommandParameterUInt(GetGlobalTimeMS())); Post(pNew); return true; } case MC_NET_PING: { unsigned int nTimeStamp; if (pCommand->GetParameter(&nTimeStamp, 0, MPT_UINT) == false) break; MCommand* pNew = new MCommand(m_CommandManager.GetCommandDescByID(MC_NET_PONG), pCommand->m_Sender, m_This); pNew->AddParameter(new MCommandParameterUInt(nTimeStamp)); Post(pNew); return true; } case MC_NET_PONG: { int nTimeStamp; pCommand->GetParameter(&nTimeStamp, 0, MPT_UINT); MClient::OutputMessage(MZMOM_LOCALREPLY, "Ping from (%u:%u) = %d", pCommand->GetSenderUID().High, pCommand->GetSenderUID().Low, GetGlobalTimeMS() - nTimeStamp); } break; case ZC_CON_CONNECT: { char szBuf[256]; sprintf_safe(szBuf, "Net.Connect %s:%d", ZGetConfiguration()->GetServerIP(), ZGetConfiguration()->GetServerPort()); ConsoleInputEvent(szBuf); SetServerAddr(ZGetConfiguration()->GetServerIP(), ZGetConfiguration()->GetServerPort()); } break; case ZC_CON_DISCONNECT: { ConsoleInputEvent("Net.Disconnect"); } break; case ZC_CON_CLEAR: { if (ZGetConsole()) ZGetConsole()->ClearMessage(); } break; case ZC_CON_HIDE: { if (ZGetConsole()) ZGetConsole()->Show(false); } break; case ZC_CON_SIZE: { if (ZGetConsole()) { int iConWidth, iConHeight; pCommand->GetParameter(&iConWidth, 0, MPT_INT); pCommand->GetParameter(&iConHeight, 1, MPT_INT); if ((iConWidth > 30) && (iConHeight > 30)) { MPOINT point = ZGetConsole()->GetPosition(); ZGetConsole()->SetBounds(point.x, point.y, iConWidth, iConHeight); } } } break; case MC_CLOCK_SYNCHRONIZE: { u32 nGlobalClock; pCommand->GetParameter(&nGlobalClock, 0, MPT_UINT); u32 nLocalClock = GetClockCount(); if (nGlobalClock > nLocalClock) m_bIsBigGlobalClock = true; else m_bIsBigGlobalClock = false; m_nClockDistance = ZGetClockDistance(nGlobalClock, nLocalClock); } break; case MC_MATCH_NOTIFY: { unsigned int nMsgID = 0; if (pCommand->GetParameter(&nMsgID, 0, MPT_UINT) == false) break; OnMatchNotify(nMsgID); } break; case MC_MATCH_BRIDGEPEER_ACK: { MUID uidChar; int nCode; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&nCode, 1, MPT_INT); OnBridgePeerACK(uidChar, nCode); } break; case MC_MATCH_STAGE_RESPONSE_FORCED_ENTRY: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); if (nResult == MOK) { OnForcedEntryToGame(); } else { ZApplication::GetGameInterface()->ShowMessage("Forced entry rejected"); } } break; case MC_MATCH_STAGE_JOIN: { MUID uidChar, uidStage; unsigned int nRoomNo = 0; char szStageName[256] = ""; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nRoomNo, 2, MPT_UINT); pCommand->GetParameter(szStageName, 3, MPT_STR, sizeof(szStageName)); OnStageJoin(uidChar, uidStage, nRoomNo, szStageName); } break; case MC_MATCH_STAGE_LEAVE: { MUID uidChar, uidStage; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); OnStageLeave(uidChar, uidStage); } break; case MC_MATCH_STAGE_START: { MUID uidChar, uidStage; int nCountdown; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nCountdown, 2, MPT_INT); OnStageStart(uidChar, uidStage, nCountdown); } break; case MC_MATCH_STAGE_LAUNCH: { MUID uidStage; char szMapName[_MAX_DIR]; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName)); OnStageLaunch(uidStage, szMapName); } break; case MC_MATCH_STAGE_FINISH_GAME: { MUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); OnStageFinishGame(uidStage); } break; case MC_MATCH_STAGE_MAP: { MUID uidStage; char szMapName[_MAX_DIR]; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName)); OnStageMap(uidStage, szMapName); } break; case MC_MATCH_STAGE_TEAM: { MUID uidChar, uidStage; unsigned int nTeam; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nTeam, 2, MPT_UINT); OnStageTeam(uidChar, uidStage, nTeam); } break; case MC_MATCH_STAGE_PLAYER_STATE: { MUID uidChar, uidStage; int nObjectStageState; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(&nObjectStageState, 2, MPT_INT); OnStagePlayerState(uidChar, uidStage, MMatchObjectStageState(nObjectStageState)); } break; case MC_MATCH_STAGE_MASTER: { MUID uidChar, uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); pCommand->GetParameter(&uidChar, 1, MPT_UID); OnStageMaster(uidStage, uidChar); } break; case MC_MATCH_STAGE_CHAT: { MUID uidStage, uidChar; static char szChat[512]; pCommand->GetParameter(&uidChar, 0, MPT_UID); pCommand->GetParameter(&uidStage, 1, MPT_UID); pCommand->GetParameter(szChat, 2, MPT_STR, sizeof(szChat)); OnStageChat(uidChar, uidStage, szChat); } break; case MC_MATCH_STAGE_LIST: { char nPrevStageCount, nNextStageCount; pCommand->GetParameter(&nPrevStageCount, 0, MPT_CHAR); pCommand->GetParameter(&nNextStageCount, 1, MPT_CHAR); MCommandParameter* pParam = pCommand->GetParameter(2); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = MGetBlobArrayCount(pBlob); OnStageList((int)nPrevStageCount, (int)nNextStageCount, pBlob, nCount); } break; case MC_MATCH_CHANNEL_RESPONSE_PLAYER_LIST: { unsigned char nTotalPlayerCount, nPage; pCommand->GetParameter(&nTotalPlayerCount, 0, MPT_UCHAR); pCommand->GetParameter(&nPage, 1, MPT_UCHAR); MCommandParameter* pParam = pCommand->GetParameter(2); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = MGetBlobArrayCount(pBlob); OnChannelPlayerList((int)nTotalPlayerCount, (int)nPage, pBlob, nCount); } break; case MC_MATCH_CHANNEL_RESPONSE_ALL_PLAYER_LIST: { MUID uidChannel; pCommand->GetParameter(&uidChannel, 0, MPT_UID); MCommandParameter* pParam = pCommand->GetParameter(1); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = MGetBlobArrayCount(pBlob); OnChannelAllPlayerList(uidChannel, pBlob, nCount); } break; case MC_MATCH_RESPONSE_FRIENDLIST: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = MGetBlobArrayCount(pBlob); OnResponseFriendList(pBlob, nCount); } break; case MC_MATCH_RESPONSE_STAGESETTING: { MUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); MCommandParameter* pStageParam = pCommand->GetParameter(1); if (pStageParam->GetType() != MPT_BLOB) break; void* pStageBlob = pStageParam->GetPointer(); int nStageCount = MGetBlobArrayCount(pStageBlob); MCommandParameter* pCharParam = pCommand->GetParameter(2); if (pCharParam->GetType() != MPT_BLOB) break; void* pCharBlob = pCharParam->GetPointer(); int nCharCount = MGetBlobArrayCount(pCharBlob); int nStageState; pCommand->GetParameter(&nStageState, 3, MPT_INT); MUID uidMaster; pCommand->GetParameter(&uidMaster, 4, MPT_UID); OnResponseStageSetting(uidStage, pStageBlob, nStageCount, pCharBlob, nCharCount, static_cast<STAGE_STATE>(nStageState), uidMaster); } break; case MC_MATCH_RESPONSE_PEER_RELAY: { MUID uidPeer; if (pCommand->GetParameter(&uidPeer, 0, MPT_UID) == false) break; OnResponsePeerRelay(uidPeer); } break; case MC_MATCH_LOADING_COMPLETE: { MUID uidChar; int nPercent; if (pCommand->GetParameter(&uidChar, 0, MPT_UID) == false) break; if (pCommand->GetParameter(&nPercent, 1, MPT_INT) == false) break; OnLoadingComplete(uidChar, nPercent); } break; case MC_MATCH_ANNOUNCE: { unsigned int nType; char szMsg[256]; pCommand->GetParameter(&nType, 0, MPT_UINT); pCommand->GetParameter(szMsg, 1, MPT_STR, sizeof(szMsg)); OnAnnounce(nType, szMsg); } break; case MC_MATCH_CHANNEL_RESPONSE_JOIN: { MUID uidChannel; int nChannelType; char szChannelName[256]; pCommand->GetParameter(&uidChannel, 0, MPT_UID); pCommand->GetParameter(&nChannelType, 1, MPT_INT); pCommand->GetParameter(szChannelName, 2, MPT_STR, sizeof(szChannelName)); OnChannelResponseJoin(uidChannel, (MCHANNEL_TYPE)nChannelType, szChannelName); } break; case MC_MATCH_CHANNEL_CHAT: { MUID uidChannel, uidChar; char szChat[512]; char szName[256]; int nGrade; pCommand->GetParameter(&uidChannel, 0, MPT_UID); pCommand->GetParameter(szName, 1, MPT_STR, sizeof(szName)); pCommand->GetParameter(szChat, 2, MPT_STR, sizeof(szChat)); pCommand->GetParameter(&nGrade, 3, MPT_INT); OnChannelChat(uidChannel, szName, szChat, nGrade); } break; case MC_MATCH_CHANNEL_LIST: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); int nCount = MGetBlobArrayCount(pBlob); OnChannelList(pBlob, nCount); } break; case MC_MATCH_CHANNEL_RESPONSE_RULE: { MUID uidChannel; pCommand->GetParameter(&uidChannel, 0, MPT_UID); char szRuleName[128]; pCommand->GetParameter(szRuleName, 1, MPT_STR, sizeof(szRuleName)); OnChannelResponseRule(uidChannel, szRuleName); } break; case MC_MATCH_RESPONSE_RECOMMANDED_CHANNEL: { MUID uidChannel; pCommand->GetParameter(&uidChannel, 0, MPT_UID); OnResponseRecommandedChannel(uidChannel); } break; case MC_ADMIN_ANNOUNCE: { char szChat[512]; u32 nMsgType = 0; pCommand->GetParameter(szChat, 1, MPT_STR, sizeof(szChat)); pCommand->GetParameter(&nMsgType, 2, MPT_UINT); OnAdminAnnounce(szChat, ZAdminAnnounceType(nMsgType)); } break; case MC_MATCH_GAME_LEVEL_UP: { MUID uidChar; pCommand->GetParameter(&uidChar, 0, MPT_UID); OnGameLevelUp(uidChar); } break; case MC_MATCH_GAME_LEVEL_DOWN: { MUID uidChar; pCommand->GetParameter(&uidChar, 0, MPT_UID); OnGameLevelDown(uidChar); } break; case MC_MATCH_RESPONSE_GAME_INFO: { MUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); MCommandParameter* pParam = pCommand->GetParameter(1); if (pParam->GetType() != MPT_BLOB) break; void* pGameInfoBlob = pParam->GetPointer(); pParam = pCommand->GetParameter(2); if (pParam->GetType() != MPT_BLOB) break; void* pRuleInfoBlob = pParam->GetPointer(); pParam = pCommand->GetParameter(3); if (pParam->GetType() != MPT_BLOB) break; void* pPlayerInfoBlob = pParam->GetPointer(); OnResponseGameInfo(uidStage, pGameInfoBlob, pRuleInfoBlob, pPlayerInfoBlob); } break; case MC_MATCH_OBTAIN_WORLDITEM: { MUID uidPlayer; int nItemUID; pCommand->GetParameter(&uidPlayer, 0, MPT_UID); pCommand->GetParameter(&nItemUID, 1, MPT_INT); OnObtainWorldItem(uidPlayer, nItemUID); } break; case MC_MATCH_SPAWN_WORLDITEM: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pSpawnInfoBlob = pParam->GetPointer(); OnSpawnWorldItem(pSpawnInfoBlob); } break; case MC_MATCH_REMOVE_WORLDITEM: { int nItemUID; pCommand->GetParameter(&nItemUID, 0, MPT_INT); OnRemoveWorldItem(nItemUID); } break; case MC_MATCH_USER_WHISPER: { char szSenderName[128] = ""; char szTargetName[128] = ""; char szMessage[1024] = ""; pCommand->GetParameter(szSenderName, 0, MPT_STR, sizeof(szSenderName)); pCommand->GetParameter(szTargetName, 1, MPT_STR, sizeof(szTargetName)); pCommand->GetParameter(szMessage, 2, MPT_STR, sizeof(szMessage)); OnUserWhisper(szSenderName, szTargetName, szMessage); } break; case MC_MATCH_CHATROOM_JOIN: { char szPlayerName[128] = ""; char szChatRoomName[128] = ""; pCommand->GetParameter(szPlayerName, 0, MPT_STR, sizeof(szPlayerName)); pCommand->GetParameter(szChatRoomName, 1, MPT_STR, sizeof(szChatRoomName)); OnChatRoomJoin(szPlayerName, szChatRoomName); } break; case MC_MATCH_CHATROOM_LEAVE: { char szPlayerName[128] = ""; char szChatRoomName[128] = ""; pCommand->GetParameter(szPlayerName, 0, MPT_STR, sizeof(szPlayerName)); pCommand->GetParameter(szChatRoomName, 1, MPT_STR, sizeof(szChatRoomName)); OnChatRoomLeave(szPlayerName, szChatRoomName); } break; case MC_MATCH_CHATROOM_SELECT_WRITE: { char szChatRoomName[128] = ""; pCommand->GetParameter(szChatRoomName, 0, MPT_STR, sizeof(szChatRoomName)); OnChatRoomSelectWrite(szChatRoomName); } break; case MC_MATCH_CHATROOM_INVITE: { char szSenderName[64] = ""; char szTargetName[64] = ""; char szRoomName[128] = ""; pCommand->GetParameter(szSenderName, 0, MPT_STR, sizeof(szSenderName)); pCommand->GetParameter(szTargetName, 1, MPT_STR, sizeof(szTargetName)); pCommand->GetParameter(szRoomName, 2, MPT_STR, sizeof(szRoomName)); OnChatRoomInvite(szSenderName, szRoomName); } break; case MC_MATCH_CHATROOM_CHAT: { char szChatRoomName[128] = ""; char szPlayerName[128] = ""; char szChat[128] = ""; pCommand->GetParameter(szChatRoomName, 0, MPT_STR, sizeof(szChatRoomName)); pCommand->GetParameter(szPlayerName, 1, MPT_STR, sizeof(szPlayerName)); pCommand->GetParameter(szChat, 2, MPT_STR, sizeof(szChat)); OnChatRoomChat(szChatRoomName, szPlayerName, szChat); } break; case ZC_REPORT_119: { OnLocalReport119(); } break; case ZC_MESSAGE: { int nMessageID; pCommand->GetParameter(&nMessageID, 0, MPT_INT); ZGetGameInterface()->ShowMessage(nMessageID); }break; case MC_TEST_PEERTEST_PING: { MUID uidSender = pCommand->GetSenderUID(); char szLog[128]; sprintf_safe(szLog, "PEERTEST_PING: from (%d%d)", uidSender.High, uidSender.Low); ZChatOutput(szLog, ZChat::CMT_SYSTEM); } break; case MC_TEST_PEERTEST_PONG: { } break; case MC_MATCH_CLAN_RESPONSE_CREATE_CLAN: { int nResult, nRequestID; pCommand->GetParameter(&nResult, 0, MPT_INT); pCommand->GetParameter(&nRequestID, 1, MPT_INT); OnResponseCreateClan(nResult, nRequestID); } break; case MC_MATCH_CLAN_RESPONSE_AGREED_CREATE_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnResponseAgreedCreateClan(nResult); } break; case MC_MATCH_CLAN_ASK_SPONSOR_AGREEMENT: { int nRequestID; char szClanName[256]; MUID uidMasterObject; char szMasterName[256]; pCommand->GetParameter(&nRequestID, 0, MPT_INT); pCommand->GetParameter(szClanName, 1, MPT_STR, sizeof(szClanName)); pCommand->GetParameter(&uidMasterObject, 2, MPT_UID); pCommand->GetParameter(szMasterName, 3, MPT_STR, sizeof(szMasterName)); OnClanAskSponsorAgreement(nRequestID, szClanName, uidMasterObject, szMasterName); } break; case MC_MATCH_CLAN_ANSWER_SPONSOR_AGREEMENT: { MUID uidClanMaster; int nRequestID; bool bAnswer; char szCharName[256]; pCommand->GetParameter(&nRequestID, 0, MPT_INT); pCommand->GetParameter(&uidClanMaster, 1, MPT_UID); pCommand->GetParameter(szCharName, 2, MPT_STR, sizeof(szCharName)); pCommand->GetParameter(&bAnswer, 3, MPT_BOOL); OnClanAnswerSponsorAgreement(nRequestID, uidClanMaster, szCharName, bAnswer); } break; case MC_MATCH_CLAN_RESPONSE_CLOSE_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseCloseClan(nResult); } break; case MC_MATCH_CLAN_RESPONSE_JOIN_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseJoinClan(nResult); } break; case MC_MATCH_CLAN_ASK_JOIN_AGREEMENT: { char szClanName[256], szClanAdmin[256]; MUID uidClanAdmin; pCommand->GetParameter(szClanName, 0, MPT_STR, sizeof(szClanName)); pCommand->GetParameter(&uidClanAdmin, 1, MPT_UID); pCommand->GetParameter(szClanAdmin, 2, MPT_STR, sizeof(szClanAdmin)); OnClanAskJoinAgreement(szClanName, uidClanAdmin, szClanAdmin); } break; case MC_MATCH_CLAN_ANSWER_JOIN_AGREEMENT: { MUID uidClanAdmin; bool bAnswer; char szJoiner[256]; pCommand->GetParameter(&uidClanAdmin, 0, MPT_UID); pCommand->GetParameter(szJoiner, 1, MPT_STR, sizeof(szJoiner)); pCommand->GetParameter(&bAnswer, 2, MPT_BOOL); OnClanAnswerJoinAgreement(uidClanAdmin, szJoiner, bAnswer); } break; case MC_MATCH_CLAN_RESPONSE_AGREED_JOIN_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseAgreedJoinClan(nResult); } break; case MC_MATCH_CLAN_UPDATE_CHAR_CLANINFO: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanUpdateCharClanInfo(pBlob); } break; case MC_MATCH_CLAN_RESPONSE_LEAVE_CLAN: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseLeaveClan(nResult); } break; case MC_MATCH_CLAN_MASTER_RESPONSE_CHANGE_GRADE: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseChangeGrade(nResult); } break; case MC_MATCH_CLAN_ADMIN_RESPONSE_EXPEL_MEMBER: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnClanResponseExpelMember(nResult); } break; case MC_MATCH_CLAN_MSG: { char szSenderName[256]; char szMsg[512]; pCommand->GetParameter(szSenderName, 0, MPT_STR, sizeof(szSenderName)); pCommand->GetParameter(szMsg, 1, MPT_STR, sizeof(szMsg)); OnClanMsg(szSenderName, szMsg); } break; case MC_MATCH_CLAN_RESPONSE_MEMBER_LIST: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanMemberList(pBlob); } break; case MC_MATCH_CLAN_RESPONSE_CLAN_INFO: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanResponseClanInfo(pBlob); } break; case MC_MATCH_CLAN_RESPONSE_EMBLEMURL: { int nCLID = 0; int nEmblemChecksum = 0; char szURL[4096] = ""; pCommand->GetParameter(&nCLID, 0, MPT_INT); pCommand->GetParameter(&nEmblemChecksum, 1, MPT_INT); pCommand->GetParameter(szURL, 2, MPT_STR, sizeof(szURL)); OnClanResponseEmblemURL(nCLID, nEmblemChecksum, szURL); } break; case MC_MATCH_CLAN_LOCAL_EMBLEMREADY: { int nCLID = 0; char szURL[4096] = ""; pCommand->GetParameter(&nCLID, 0, MPT_INT); pCommand->GetParameter(szURL, 1, MPT_STR, sizeof(szURL)); OnClanEmblemReady(nCLID, szURL); } break; case MC_MATCH_RESPONSE_RESULT: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); if (nResult != MOK) { ZApplication::GetGameInterface()->ShowErrorMessage(nResult); } } break; case MC_MATCH_RESPONSE_CHARINFO_DETAIL: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnResponseCharInfoDetail(pBlob); } break; case MC_MATCH_RESPONSE_PROPOSAL: { int nResult, nProposalMode, nRequestID; pCommand->GetParameter(&nResult, 0, MPT_INT); pCommand->GetParameter(&nProposalMode, 1, MPT_INT); pCommand->GetParameter(&nRequestID, 2, MPT_INT); OnResponseProposal(nResult, MMatchProposalMode(nProposalMode), nRequestID); } break; case MC_MATCH_ASK_AGREEMENT: { MUID uidProposer; int nProposalMode, nRequestID; pCommand->GetParameter(&uidProposer, 0, MPT_UID); MCommandParameter* pParam = pCommand->GetParameter(1); void* pMemberNamesBlob = pParam->GetPointer(); pCommand->GetParameter(&nProposalMode, 2, MPT_INT); pCommand->GetParameter(&nRequestID, 3, MPT_INT); OnAskAgreement(uidProposer, pMemberNamesBlob, MMatchProposalMode(nProposalMode), nRequestID); } break; case MC_MATCH_REPLY_AGREEMENT: { MUID uidProposer, uidChar; char szReplierName[256]; int nProposalMode, nRequestID; bool bAgreement; pCommand->GetParameter(&uidProposer, 0, MPT_UID); pCommand->GetParameter(&uidChar, 1, MPT_UID); pCommand->GetParameter(szReplierName, 2, MPT_STR, sizeof(szReplierName)); pCommand->GetParameter(&nProposalMode, 3, MPT_INT); pCommand->GetParameter(&nRequestID, 4, MPT_INT); pCommand->GetParameter(&bAgreement, 5, MPT_BOOL); OnReplyAgreement(uidProposer, uidChar, szReplierName, MMatchProposalMode(nProposalMode), nRequestID, bAgreement); } break; case MC_MATCH_LADDER_SEARCH_RIVAL: { ZGetGameInterface()->OnArrangedTeamGameUI(true); }break; case MC_MATCH_LADDER_CANCEL_CHALLENGE: { ZGetGameInterface()->OnArrangedTeamGameUI(false); char szCharName[MATCHOBJECT_NAME_LENGTH]; pCommand->GetParameter(szCharName, 0, MPT_STR, sizeof(szCharName)); if (szCharName[0] != 0) { char szOutput[256]; ZTransMsg(szOutput, MSG_LADDER_CANCEL, 1, szCharName); ZChatOutput(MCOLOR(ZCOLOR_CHAT_SYSTEM), szOutput); } else { ZChatOutput(MCOLOR(ZCOLOR_CHAT_SYSTEM), ZMsg(MSG_LADDER_FAILED)); } }break; case MC_MATCH_LADDER_RESPONSE_CHALLENGE: { int nResult; pCommand->GetParameter(&nResult, 0, MPT_INT); OnLadderResponseChallenge(nResult); } break; case MC_MATCH_LADDER_PREPARE: { MUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); int nTeam; pCommand->GetParameter(&nTeam, 1, MPT_INT); OnLadderPrepare(uidStage, nTeam); }break; case MC_MATCH_LADDER_LAUNCH: { MUID uidStage; pCommand->GetParameter(&uidStage, 0, MPT_UID); char szMapName[128]; pCommand->GetParameter(szMapName, 1, MPT_STR, sizeof(szMapName)); OnLadderLaunch(uidStage, szMapName); }break; case MC_MATCH_CLAN_STANDBY_CLAN_LIST: { int nPrevStageCount, nNextStageCount; pCommand->GetParameter(&nPrevStageCount, 0, MPT_INT); pCommand->GetParameter(&nNextStageCount, 1, MPT_INT); MCommandParameter* pParam = pCommand->GetParameter(2); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnClanStandbyClanList(nPrevStageCount, nNextStageCount, pBlob); } break; case MC_MATCH_CLAN_MEMBER_CONNECTED: { char szMember[256]; pCommand->GetParameter(szMember, 0, MPT_STR, sizeof(szMember)); OnClanMemberConnected(szMember); } break; case MC_MATCH_NOTIFY_CALLVOTE: { char szDiscuss[128] = ""; char szArg[256] = ""; pCommand->GetParameter(szDiscuss, 0, MPT_STR, sizeof(szDiscuss)); pCommand->GetParameter(szArg, 1, MPT_STR, sizeof(szArg)); OnNotifyCallVote(szDiscuss, szArg); } break; case MC_MATCH_NOTIFY_VOTERESULT: { char szDiscuss[128]; int nResult = 0; pCommand->GetParameter(szDiscuss, 0, MPT_STR, sizeof(szDiscuss)); pCommand->GetParameter(&nResult, 1, MPT_INT); OnNotifyVoteResult(szDiscuss, nResult); } break; case MC_MATCH_VOTE_RESPONSE: { int nMsgCode = 0; pCommand->GetParameter(&nMsgCode, 0, MPT_INT); OnVoteAbort(nMsgCode); } break; case MC_MATCH_BROADCAST_CLAN_RENEW_VICTORIES: { char szWinnerClanName[256], szLoserClanName[256]; int nVictories; pCommand->GetParameter(szWinnerClanName, 0, MPT_STR, sizeof(szWinnerClanName)); pCommand->GetParameter(szLoserClanName, 1, MPT_STR, sizeof(szLoserClanName)); pCommand->GetParameter(&nVictories, 2, MPT_INT); OnBroadcastClanRenewVictories(szWinnerClanName, szLoserClanName, nVictories); } break; case MC_MATCH_BROADCAST_CLAN_INTERRUPT_VICTORIES: { char szWinnerClanName[256], szLoserClanName[256]; int nVictories; pCommand->GetParameter(szWinnerClanName, 0, MPT_STR, sizeof(szWinnerClanName)); pCommand->GetParameter(szLoserClanName, 1, MPT_STR, sizeof(szLoserClanName)); pCommand->GetParameter(&nVictories, 2, MPT_INT); OnBroadcastClanInterruptVictories(szWinnerClanName, szLoserClanName, nVictories); } break; case MC_MATCH_BROADCAST_DUEL_RENEW_VICTORIES: { char szChannelName[256], szChampionName[256]; int nVictories, nRoomNo; pCommand->GetParameter(szChampionName, 0, MPT_STR, sizeof(szChampionName)); pCommand->GetParameter(szChannelName, 1, MPT_STR, sizeof(szChannelName)); pCommand->GetParameter(&nRoomNo, 2, MPT_INT); pCommand->GetParameter(&nVictories, 3, MPT_INT); OnBroadcastDuelRenewVictories(szChampionName, szChannelName, nRoomNo, nVictories); } break; case MC_MATCH_BROADCAST_DUEL_INTERRUPT_VICTORIES: { char szChampionName[256], szInterrupterName[256]; int nVictories; pCommand->GetParameter(szChampionName, 0, MPT_STR, sizeof(szChampionName)); pCommand->GetParameter(szInterrupterName, 1, MPT_STR, sizeof(szInterrupterName)); pCommand->GetParameter(&nVictories, 2, MPT_INT); OnBroadcastDuelInterruptVictories(szChampionName, szInterrupterName, nVictories); } break; case MC_MATCH_RESPONSE_STAGE_FOLLOW: { int nMsgID; pCommand->GetParameter(&nMsgID, 0, MPT_INT); OnFollowResponse(nMsgID); } break; case MC_MATCH_SCHEDULE_ANNOUNCE_SEND: { char cAnnounce[512] = { 0 }; pCommand->GetParameter(cAnnounce, 0, MPT_STR, sizeof(cAnnounce)); ZChatOutput(cAnnounce); } break; case MC_MATCH_EXPIRED_RENT_ITEM: { MCommandParameter* pParam = pCommand->GetParameter(0); if (pParam->GetType() != MPT_BLOB) break; void* pBlob = pParam->GetPointer(); OnExpiredRentItem(pBlob); } break; case MC_MATCH_FIND_HACKING: { } break; case MC_MATCH_ROUTE_UPDATE_STAGE_EQUIP_LOOK: { MUID uidPlayer; int nParts; int nItemID; pCommand->GetParameter(&uidPlayer, 0, MPT_UID); pCommand->GetParameter(&nParts, 1, MPT_INT); pCommand->GetParameter(&nItemID, 2, MPT_INT); OnResponseUpdateStageEquipLook(uidPlayer, nParts, nItemID); } break; default: if (!ret) { } break; } if (m_fnOnCommandCallback) ret = m_fnOnCommandCallback(pCommand); return ret; }
int ZConfiguration::GetMouseSensitivityInInt() { return (int(ZGetConfiguration()->GetMouse()->fSensitivity * MOUSE_SENSITIVITY_MAX)); }