void ZCombatQuestScreen::DrawPlayer(CCDrawContext* pDC, int index, ZCharacter* pCharacter) { CCFont *pFont = CCFontManager::Get("FONTa10b"); pDC->SetFont( pFont ); sColor color = sColor(0xFFFFFFFF); if (pCharacter->IsDie()) color = sColor(0xFF999999); else if (pCharacter == ZGetGame()->m_pMyCharacter) color = sColor(0xFFEEEE00); pDC->SetColor(color); char szMsg[128]; float x, y; x = 10.0f / 800.0f; y = (200.0f/600.0f) + ((20.0f / 600.0f) * index); int screenx = x * CCGetWorkspaceWidth(); int screeny = y * CCGetWorkspaceHeight(); int nKills = 0; ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pCharacter->GetModule(ZMID_QUESTSTATUS); if (pMod) { nKills = pMod->GetKills(); } sprintf(szMsg, "%d. %s / %d K.O.", index+1, pCharacter->GetProperty()->GetName(), nKills); pDC->Text(screenx, screeny, szMsg); /* // hp, ap bar const int BAR_HEIGHT = 3; const int BAR_WIDTH = 80; int bar_hp_width = (int)(BAR_WIDTH * ((float)pCharacter->GetHP() / pCharacter->GetProperty()->fMaxHP)); int bar_ap_width = (int)(BAR_WIDTH * ((float)pCharacter->GetAP() / pCharacter->GetProperty()->fMaxAP)); color = sColor(0xFFD6290B); int bar_y = screeny + pFont->GetHeight()+2; pDC->SetColor(color); pDC->FillRectangle(screenx, bar_y, bar_hp_width, BAR_HEIGHT); pDC->Rectangle(screenx, bar_y, BAR_WIDTH, BAR_HEIGHT); color = sColor(0xFF3AAF3A); pDC->SetColor(color); bar_y += (BAR_HEIGHT + 2); pDC->FillRectangle(screenx, bar_y, bar_ap_width, BAR_HEIGHT); pDC->Rectangle(screenx, bar_y, BAR_WIDTH, BAR_HEIGHT); */ }
void TimeReward_ChatOutput_RemainChance(int nRemainReward) { char szOutput[512]; char szRemain[64]; sprintf(szRemain, "%d", nRemainReward); ZTransMsg(szOutput,MSG_BONUS_REWARD_REMAIN,1,szRemain); ZChatOutput(sColor(ZCOLOR_CHAT_SYSTEM), szOutput); }
void TimeReward_ChatOutput_ResetChance(const char* szRewardResetDesc) { if (0 != strlen(szRewardResetDesc)) { // 'xxx 시점에 기회가 다시 충전된다'를 표시 //ZTransMsg(szOutput,MSG_BONUS_REWARD_RESET,1,szRewardResetDesc); ZChatOutput(sColor(ZCOLOR_CHAT_SYSTEM), szRewardResetDesc); } }
void ZCombatQuestScreen::OnDraw(CCDrawContext* pDC) { ///////////////////////////////////////////// list<ZCharacter*> SortedCharacterList; for(ZCharacterManager::iterator itor = ZGetGame()->m_CharacterManager.begin(); itor != ZGetGame()->m_CharacterManager.end(); ++itor) { ZCharacter* pCharacter = (*itor).second; if (!pCharacter->IsVisible()) continue; SortedCharacterList.push_back(pCharacter); } SortedCharacterList.sort(CompareQuestScreenCharacter); /* int cnt = 0; for (list<ZCharacter*>::iterator itor = SortedCharacterList.begin(); itor != SortedCharacterList.end(); ++itor) { DrawPlayer(pDC, cnt, (*itor)); cnt++; } */ if ( ZGetQuest()->IsRoundClear()) { // 운영자 hide는 제외 bool bEventHide = false; if (ZGetMyInfo()->IsAdminGrade()) { CCMatchObjCache* pCache = ZGetGameClient()->FindObjCache(ZGetMyUID()); if (pCache && pCache->CheckFlag(CCTD_PlayerFlags_AdminHide)) bEventHide = true; } DWORD dwSec; DWORD dwCurrTime = timeGetTime(); if ( ZGetQuest()->GetRemainedTime() < dwCurrTime) dwSec = 0; else dwSec = (ZGetQuest()->GetRemainedTime() - dwCurrTime) / 1000; char szSec[ 10]; sprintf( szSec, "%d", dwSec); char szMsg[ 128]; ZTransMsg( szMsg, MSG_GAME_NEXT_N_MIN_AFTER, 1, szSec); pDC->SetFont( CCFontManager::Get("FONTa10_O2Wht")); pDC->SetColor(sColor(0xFFFFFFFF)); if (!bEventHide) TextRelative(pDC,400.f/800.f,500.f/600.f, szMsg, true); } }
void HSBackport::doExclusiveEffect() { int percent = 100 - getBackportProgress(); // + backportFinishedReleaseFrames; // int nc = effectColorsMat->cols*effectColorsMat->channels(); // number of elements per line // get the address of row 0 // uchar* data = effectColorsMat.ptr<uchar>(0); int halfWidth = (int)floor(effectMat.cols / 2); // int rowSize = effectColorsMat.cols * effectColorsMat.channels(); for (int c = halfWidth; c > 0; c--) { for (int d = 0; d < 90; d++) { int colorAddressX = halfWidth - c + (int)floor((effectColorsMat.cols - halfWidth) / 100 * percent); if (colorAddressX >= effectColorsMat.cols) { colorAddressX = effectColorsMat.cols - 1; } int colorAddressY = d; // int colorAddressj = ((halfWidth - c + (int)floor((effectColorsMat.cols - halfWidth) / 100 * percent)) * effectColorsMat.channels()) + (rowSize * d); // Scalar sColor(data[colorAddressj], data[colorAddressj + 1], data[colorAddressj + 2], 255); Vec4b myColor = effectColorsMat.at<Vec4b>(colorAddressY, colorAddressX); Scalar sColor(myColor[0], myColor[1], myColor[2], 255); // cv::circle(effectMat, bCenterPoint, c*2, sColor, CV_FILLED, 8, 0); cv::ellipse(effectMat, bCenterPoint, Size(c, c), 0, d*4, (d+1)*4, sColor, CV_FILLED, 8, 0); } } int test = 1; // effectMat for (vector<CorsairLedPosition>::iterator it = allKeys.begin(); it != allKeys.end(); ++it) { cv::Rect testRect((int)it->left, (int)it->top, (int)it->width, (int)it->height); Mat4b testMat = Mat(effectMat, testRect); resize(testMat, testMat, cv::Size(1, 1), 0, 0, INTER_CUBIC); Vec4b color = testMat.at<Vec4b>(0, 0); LEDController::getInstance()->setKey(it->ledId, color[2], color[1], color[0]); testMat.release(); } // backportFinishedReleaseFrames++; }
CCBButtonLook::CCBButtonLook(void) : CCScalableLook() { for(int i=0; i<9; i++){ m_pUpBitmaps[i] = NULL; m_pDownBitmaps[i] = NULL; m_pOverBitmaps[i] = NULL; } for(int i=0; i<4; i++){ m_pFocusBitmaps[i] = NULL; } m_pFont = NULL; m_FontColor = sColor(DEFCOLOR_CCBUTTON_TEXT); m_FontDownColor = sColor(DEFCOLOR_LIGHT); m_FontDisableColor = sColor(DEFCOLOR_DISABLE); m_FontHighlightColor = sColor(DEFCOLOR_PEN_HIGHLIGHT); m_bStretch = true; m_bCustomLook = false; m_FontDownOffset = sPoint(0,0); }
uint32_t Walls::Wheel(byte Wheelpos) { int dvdr = 4; byte WheelPos = 255 - WheelPos; if (WheelPos < 64) { int b = WheelPos * dvdr; if (b < 192) { b = 192; } int r1 = 255 - WheelPos * dvdr; if (r1 > 127) { r1 = 127; } //Serial.println(b); return sColor(r1, 0, b); } else if (WheelPos < 128) { //Serial.println(0); return sColor(0, WheelPos * dvdr, 255 - WheelPos * dvdr); } else if (WheelPos < 192) { WheelPos = 255 - WheelPos; //Serial.println(0); return sColor(0, WheelPos * dvdr, 255 - WheelPos * dvdr); } else if (WheelPos < 256) { WheelPos = 255 - WheelPos; int b = WheelPos * dvdr; if (b < 192) { b = 192; } int r1 = 255 - WheelPos * dvdr; if (r1 > 127) { r1 = 127; } //Serial.println(b); return sColor(r1, 0, b); } }
CCBFrameLook::CCBFrameLook(void) : CCScalableLook() { m_szDefaultTitle[0]=0; m_TitlePosition = sPoint(14, 10); m_FontColor = sColor(255,255,255,255); m_bStretch = true; for(int i=0; i<FRAME_BITMAP_COUNT; i++) { m_pFrameBitmaps[i] = NULL; } for (int i=0; i<FRAME_BUTTON_BITMAP_COUNT; i++) { m_pCloseButtonBitmaps[i] = NULL; m_pMinimizeButtonBitmaps[i] = NULL; } m_iCustomLook = 0; }
void ZDuelTournamentRankingListBox::OnDraw( CCDrawContext* pDC ) { if (!m_pBmpRankingItemBg || !m_pBmpArrowUp || !m_pBmpArrowDown || !m_pBmpArrowBar) { _ASSERT(0); return; } const int nWidth = this->GetRect().w; const int nHeight = this->GetRect().h; const int nY_firstItem = nHeight * 0.17f; // 리스트 첫째 항목의 y위치 const int nItemHeight = (int)(nHeight / 7.f); char szTemp[128]; sRect rc; for (int i=0; i<NUM_DISPLAY_DUELTOURNAMENT_RANKING; ++i) { int y = (nY_firstItem + nItemHeight * i) - (nItemHeight * 0.04f); // 리스트아이템 배경이미지 pDC->SetBitmap(m_pBmpRankingItemBg); pDC->Draw(0, y, nWidth, nItemHeight); // 항목 내용 그리기 ZDUELTOURNAMENTRANKINGITEM* pRankItem = &m_rankingList[i]; if (pRankItem->bEmptyItem) continue; y = nY_firstItem + nItemHeight * i; pDC->SetColor(sColor(0xFFFFFFFF)); // 순위 if (pRankItem->nRank == -1) // 초기화 직후 순위정렬되지 않았을때 -1로 되어 있음 strcpy(szTemp, "--"); else sprintf(szTemp, "%d", pRankItem->nRank); rc.Set((int)(0.01f*nWidth), y, (int)(fabs(0.01f - 0.11f)*nWidth), nItemHeight); pDC->Text(rc, szTemp, CCD_RIGHT|CCD_VCENTER); // 순위등락 화살표 if (pRankItem->nFluctuation == 0) { pDC->SetBitmap(m_pBmpArrowBar); pDC->Draw((int)(0.13f*nWidth), y + (nItemHeight - m_pBmpArrowBar->GetHeight()) * 0.5f); } else { if (pRankItem->nFluctuation > 0) pDC->SetBitmap(m_pBmpArrowUp); else if (pRankItem->nFluctuation < 0) pDC->SetBitmap(m_pBmpArrowDown); pDC->Draw((int)(0.13f*nWidth), y + (nItemHeight - m_pBmpArrowBar->GetHeight()) * 0.5f); // 순위등락폭 pDC->SetColor(sColor(0xFFAAFF00)); sprintf(szTemp, "%d", abs(pRankItem->nFluctuation)); //pDC->Text((int)(0.04f*nWidth), y, szTemp); rc.Set((int)(0.16f*nWidth), y, (int)(fabs(0.16f - 0.26f)*nWidth), nItemHeight); pDC->Text(rc, szTemp, CCD_LEFT|CCD_VCENTER); pDC->SetColor(sColor(0xFFFFFFFF)); } // 토너먼트 등급 엠블렘 GetDuelTournamentGradeIconFileName(szTemp, pRankItem->nGrade); CCBitmap* pGradeIcon = CCBitmapManager::Get(szTemp); if (pGradeIcon) { //int height1px = int(600.f/CCGetWorkspaceHeight() + 0.5f); int margin = (nItemHeight * 0.05f + 0.5f); int size = nItemHeight-(margin*4); pDC->SetBitmap(pGradeIcon); rc.Set((int)(0.279f*nWidth), y+margin, size, size);//(int)(0.055f*nWidth), nItemHeight-3); pDC->Draw(rc); } // 이름 rc.Set((int)(0.34f*nWidth), y, (int)(fabs(0.34f - 0.55f)*nWidth), nItemHeight); pDC->Text(rc, pRankItem->szCharName, CCD_HCENTER|CCD_VCENTER); // 승패 sprintf(szTemp, "%d", pRankItem->nWins); rc.Set((int)(0.57f*nWidth), y, (int)(fabs(0.57f - 0.67f)*nWidth), nItemHeight); pDC->Text(rc, szTemp, CCD_RIGHT|CCD_VCENTER); rc.Set((int)(0.67f*nWidth), y, (int)(fabs(0.67f - 0.68f)*nWidth), nItemHeight); pDC->Text(rc, "/", CCD_HCENTER|CCD_VCENTER); sprintf(szTemp, "%d", pRankItem->nLosses); rc.Set((int)(0.68f*nWidth), y, (int)(fabs(0.68f - 0.78f)*nWidth), nItemHeight); pDC->Text(rc, szTemp, CCD_LEFT|CCD_VCENTER); // 우승수 sprintf(szTemp, "%d", pRankItem->nWinners); rc.Set((int)(0.8f*nWidth), y, (int)(fabs(0.8f - 0.91f)*nWidth), nItemHeight); pDC->Text(rc, szTemp, CCD_RIGHT|CCD_VCENTER); // 토너먼트 포인트 sprintf(szTemp, "%d", pRankItem->nPoint); rc.Set((int)(0.92f*nWidth), y, (int)(fabs(0.92f - 0.99f)*nWidth), nItemHeight); pDC->Text(rc, szTemp, CCD_RIGHT|CCD_VCENTER); // 내 랭킹 항목인 경우 하이라이트 이미지 덮어줌 if (i == m_nMyRankIndex) { CCBitmapR2 *pBitmap=(CCBitmapR2*)CCBitmapManager::Get("button_glow.png"); if(pBitmap) { DWORD defaultcolor = 0x333333; DWORD opacity=(DWORD)pDC->GetOpacity(); sRect rt(0, y, nWidth, nItemHeight); CCDrawEffect prevEffect = pDC->GetEffect(); pDC->SetEffect(CCDE_ADD); sColor prevColor = pDC->GetBitmapColor(); pDC->SetBitmapColor(sColor(defaultcolor)); unsigned char prevOpacity = pDC->GetOpacity(); pDC->SetOpacity(opacity); pDC->SetBitmap(pBitmap); pDC->Draw(rt.x,rt.y,rt.w,rt.h,0,0,64,32); pDC->SetBitmapColor(prevColor); pDC->SetEffect(prevEffect); pDC->SetOpacity(prevOpacity); } } } }
void CoronaRenderer::updateLight(std::shared_ptr<MayaObject> mobj) { std::shared_ptr<mtco_MayaObject> obj(std::static_pointer_cast<mtco_MayaObject>(mobj)); if (obj->lightShader != nullptr) { if (this->context.scene->hasLightShader(obj->lightShader)) this->context.scene->deleteLightShader(obj->lightShader); } if (obj->removed) return; if (MayaTo::getWorldPtr()->renderType == MayaTo::MayaToWorld::WorldRenderType::IPRRENDER) { obj->transformMatrices.clear(); obj->transformMatrices.push_back(obj->dagPath.inclusiveMatrix()); } MFnDependencyNode rGlNode(getRenderGlobalsNode()); MObject coronaGlobals = getRenderGlobalsNode(); std::shared_ptr<RenderGlobals> renderGlobals = MayaTo::getWorldPtr()->worldRenderGlobalsPtr; std::shared_ptr<MayaScene> mayaScene = MayaTo::getWorldPtr()->worldScenePtr; MObjectArray nodeList; MStatus stat; MFnDependencyNode glFn(getRenderGlobalsNode()); Corona::Rgb bgRgb = toCorona(getColorAttr("bgColor", glFn)); int bgType = getEnumInt("bgType", glFn); MayaObject *sunLight = nullptr; MFnDependencyNode depFn(obj->mobject); if (obj->mobject.hasFn(MFn::kPointLight)) { MColor col; getColor("color", depFn, col); float intensity = 1.0f; getFloat("intensity", depFn, intensity); int decay = 0; getEnum(MString("decayRate"), depFn, decay); MMatrix m = obj->transformMatrices[0] * renderGlobals->globalConversionMatrix; Corona::Pos LP(m[3][0], m[3][1], m[3][2]); PointLight *pl = new PointLight; pl->LP = LP; pl->distFactor = 1.0 / renderGlobals->scaleFactor; pl->lightColor = Corona::Rgb(col.r, col.g, col.b); pl->lightIntensity = intensity; getEnum(MString("decayRate"), depFn, pl->decayType); pl->lightRadius = getFloatAttr("lightRadius", depFn, 0.0) * renderGlobals->scaleFactor; pl->doShadows = getBoolAttr("useRayTraceShadows", depFn, true); col = getColorAttr("shadowColor", depFn); pl->shadowColor = Corona::Rgb(col.r, col.g, col.b); for (auto excludedObj : obj->excludedObjects) { pl->excludeList.nodes.push(excludedObj.get()); } this->context.scene->addLightShader(pl); obj->lightShader = pl; } if (obj->mobject.hasFn(MFn::kSpotLight)) { MVector lightDir(0, 0, -1); MColor col; getColor("color", depFn, col); float intensity = 1.0f; getFloat("intensity", depFn, intensity); MMatrix m = obj->transformMatrices[0] * renderGlobals->globalConversionMatrix; lightDir *= obj->transformMatrices[0] * renderGlobals->globalConversionMatrix; lightDir.normalize(); Corona::Pos LP(m[3][0], m[3][1], m[3][2]); SpotLight *sl = new SpotLight; sl->LP = LP; sl->lightColor = Corona::Rgb(col.r, col.g, col.b); sl->lightIntensity = intensity; sl->LD = Corona::Dir(lightDir.x, lightDir.y, lightDir.z); sl->angle = 45.0f; sl->distFactor = 1.0 / renderGlobals->scaleFactor; getEnum(MString("decayRate"), depFn, sl->decayType); getFloat("coneAngle", depFn, sl->angle); getFloat("penumbraAngle", depFn, sl->penumbraAngle); getFloat("dropoff", depFn, sl->dropoff); sl->lightRadius = getFloatAttr("lightRadius", depFn, 0.0) * renderGlobals->scaleFactor; sl->doShadows = getBoolAttr("useRayTraceShadows", depFn, true); col = getColorAttr("shadowColor", depFn); sl->shadowColor = Corona::Rgb(col.r, col.g, col.b); for (auto excludedObj : obj->excludedObjects) { sl->excludeList.nodes.push(excludedObj.get()); } Corona::AffineTm tm; setTransformationMatrix(sl->lightWorldInverseMatrix, m); ShadingNetwork network(obj->mobject); sl->lightColorMap = defineAttribute(MString("color"), depFn, network, oslRenderer); this->context.scene->addLightShader(sl); obj->lightShader = sl; } if (obj->mobject.hasFn(MFn::kDirectionalLight)) { if (getBoolAttr("mtco_useAsSun", depFn, false)) { if (sunLight != nullptr) { Logging::error(MString("A sun light is already defined, ignoring ") + obj->shortName); return; } sunLight = obj.get(); MVector lightDir(0, 0, 1); // default dir light dir lightDir *= obj->transformMatrices[0]; lightDir *= renderGlobals->globalConversionMatrix; lightDir.normalize(); MColor sunColor(1); MFnDependencyNode sunNode(obj->mobject); getColor("color", sunNode, sunColor); sunColor *= getFloatAttr("intensity", sunNode, 1.0f); //float colorMultiplier colorMultiplier = getFloatAttr("mtco_sun_multiplier", sunNode, 1.0f); const float intensityFactor = (1.f - cos(Corona::SUN_PROJECTED_HALF_ANGLE)) / (1.f - cos(getFloatAttr("sunSizeMulti", rGlNode, 1.0f) * Corona::SUN_PROJECTED_HALF_ANGLE)); sunColor *= intensityFactor * 1.0;// 2000000; Corona::Sun sun; Corona::ColorOrMap bgCoMap = this->context.scene->getBackground(); SkyMap *sky = dynamic_cast<SkyMap *>(bgCoMap.getMap()); Corona::Rgb avgColor(1, 1, 1); if (sky != nullptr) { avgColor = sky->sc(); } Corona::Rgb sColor(sunColor.r, sunColor.g, sunColor.b); sun.color = sColor * avgColor; sun.active = true; sun.dirTo = Corona::Dir(lightDir.x, lightDir.y, lightDir.z).getNormalized(); //sun.color = Corona::Rgb(sunColor.r,sunColor.g,sunColor.b); sun.visibleDirect = true; sun.visibleReflect = true; sun.visibleRefract = true; sun.sizeMultiplier = getFloatAttr("sunSizeMulti", rGlNode, 1.0); this->context.scene->getSun() = sun; if (sky != nullptr) { sky->initSky(); this->context.scene->setBackground(bgCoMap); avgColor = sky->sc(); this->context.scene->getSun().color = sColor * avgColor; } } else{ MVector lightDir(0, 0, -1); MVector lightDirTangent(1, 0, 0); MVector lightDirBiTangent(0, 1, 0); MColor col; getColor("color", depFn, col); float intensity = 1.0f; getFloat("intensity", depFn, intensity); MMatrix m = obj->transformMatrices[0] * renderGlobals->globalConversionMatrix; lightDir *= m; lightDirTangent *= m; lightDirBiTangent *= m; lightDir.normalize(); Corona::Pos LP(m[3][0], m[3][1], m[3][2]); DirectionalLight *dl = new DirectionalLight; dl->LP = LP; dl->lightColor = Corona::Rgb(col.r, col.g, col.b); dl->lightIntensity = intensity; dl->LD = Corona::Dir(lightDir.x, lightDir.y, lightDir.z); dl->LT = Corona::Dir(lightDirTangent.x, lightDirTangent.y, lightDirTangent.z); dl->LBT = Corona::Dir(lightDirBiTangent.x, lightDirBiTangent.y, lightDirBiTangent.z); dl->lightAngle = getFloatAttr("lightAngle", depFn, 0.0); dl->doShadows = getBoolAttr("useRayTraceShadows", depFn, true); col = getColorAttr("shadowColor", depFn); dl->shadowColor = Corona::Rgb(col.r, col.g, col.b); for (auto excludedObj : obj->excludedObjects) { dl->excludeList.nodes.push(excludedObj.get()); } this->context.scene->addLightShader(dl); obj->lightShader = dl; } } if (obj->mobject.hasFn(MFn::kAreaLight)) { MMatrix m = obj->transformMatrices[0] * renderGlobals->globalConversionMatrix; if ( obj->geom == nullptr) obj->geom = defineStdPlane(); obj->geom->deleteAllInstances(); Corona::AnimatedAffineTm atm; this->setAnimatedTransformationMatrix(atm, obj); obj->instance = obj->geom->addInstance(atm, nullptr, nullptr); if (getBoolAttr("mtco_envPortal", depFn, false)) { Corona::EnviroPortalMtlData data; Corona::SharedPtr<Corona::IMaterial> mat = data.createMaterial(); Corona::IMaterialSet ms = Corona::IMaterialSet(mat); obj->instance->addMaterial(ms); } else{ Corona::NativeMtlData data; MColor lightColor = getColorAttr("color", depFn); float intensity = getFloatAttr("intensity", depFn, 1.0f); lightColor *= intensity; Corona::ColorOrMap com; // experimental direct corona texture if (getBoolAttr("mtco_noOSL", depFn, false)) { MObject fileNode = getConnectedInNode(obj->mobject, "color"); if ((fileNode != MObject::kNullObj) && (fileNode.hasFn(MFn::kFileTexture))) { MFnDependencyNode fileDep(fileNode); mtco_MapLoader loader(fileNode); Corona::SharedPtr<Corona::Abstract::Map> texmap = loader.loadBitmap(""); com = Corona::ColorOrMap(bgRgb, texmap); } } else { com = defineAttribute(MString("color"), obj->mobject, oslRenderer); OSLMap *oslmap = (OSLMap *)com.getMap(); if (oslmap != nullptr) { oslmap->multiplier = intensity; } else{ Corona::Rgb col = com.getConstantColor() * intensity; com.setColor(col); } } data.emission.color = com; data.castsShadows = getBoolAttr("mtco_castShadows", depFn, false); for (auto excludedObj : obj->excludedObjects) { data.emission.excluded.nodes.push(excludedObj.get()); } data.emission.disableSampling = false; data.emission.useTwoSidedEmission = getBoolAttr("mtco_doubleSided", depFn, false); Corona::SharedPtr<Corona::IMaterial> mat = data.createMaterial(); Corona::IMaterialSet ms = Corona::IMaterialSet(mat); ms.visibility.direct = getBoolAttr("mtco_areaVisible", depFn, true); ms.visibility.reflect = getBoolAttr("mtco_visibleInReflection", depFn, true); ms.visibility.refract = getBoolAttr("mtco_visibleInRefraction", depFn, true); obj->instance->addMaterial(ms); } } }
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; }
void CCBFrameLook::OnDraw(CCFrame* pFrame, CCDrawContext* pDC) { sRect r = pFrame->GetInitialClientRect(); // 땜.. 장비창의 tooltip frame - // DrawBitmapFrame2 로 2장의 이미지를 사용해서 그림.. if(GetCustomLook()==3) { if(pFrame->GetVisible()==false) return; sRect rr = r; // 툴팁이라서 그리는 영역을 조금 보정.. rr.x -= 10; rr.y -= 10; rr.w += 20; rr.h += 20; // 지금은 툴팁 대용으로 쓰기때문에 cliprect 를 무시.. sRect cliprect = sRect(0,0,CCGetWorkspaceWidth(),CCGetWorkspaceHeight()); DrawBitmapFrame2(pDC,rr,cliprect,m_pFrameBitmaps); return; } sColor color = sColor(0xFF, 0xFF, 0xFF, pFrame->GetOpacity()); if( GetCustomLook() == 1 ) DrawBitmapFrameCustom1(pDC, r, m_pFrameBitmaps, m_bStretch); else if( GetCustomLook() == 2) DrawBitmapFrameCustom2(pDC, r, m_pFrameBitmaps, m_BGColor, m_bStretch ); else if( GetCustomLook() == 3 ) { pDC->SetColor( 128, 128, 128 ); //r = pFrame->GetRect(); pDC->Rectangle( r ); } else DrawBitmapFrame9(pDC, r, m_pFrameBitmaps, m_bStretch, GetScale()); if(pFrame->m_bTitleBar==true) { if (pFrame->GetCloseButton()->m_bVisible) { CCBitmap* pBitmap; if (pFrame->GetCloseButton()->IsButtonDown() == false) { pBitmap = m_pCloseButtonBitmaps[0]; } else { pBitmap = m_pCloseButtonBitmaps[1]; if (pBitmap == NULL) pBitmap = m_pCloseButtonBitmaps[0]; } if (pBitmap!=NULL) { int x, y; x = pFrame->GetCloseButton()->m_Rect.x; y = pFrame->GetCloseButton()->m_Rect.y; pDC->SetBitmap(pBitmap); pDC->Draw(x, y); } } if (pFrame->GetMinimizeButton()->m_bVisible) { CCBitmap* pBitmap; if (pFrame->GetMinimizeButton()->IsButtonDown() == false) { pBitmap = m_pMinimizeButtonBitmaps[0]; } else { pBitmap = m_pMinimizeButtonBitmaps[1]; if (pBitmap == NULL) pBitmap = m_pMinimizeButtonBitmaps[0]; } if (pBitmap!=NULL) { int x, y; x = pFrame->GetMinimizeButton()->m_Rect.x; y = pFrame->GetMinimizeButton()->m_Rect.y; pDC->SetBitmap(pBitmap); pDC->Draw(x, y); } } if(m_pFont!=NULL) pDC->SetFont(m_pFont); pDC->SetColor(sColor(0x0)); if( GetCustomLook() == 0 ) pDC->Text(r.x+16, r.y+12, pFrame->m_szName); /* pDC->Text(r.x+12, r.y+8, pFrame->m_szName); pDC->Text(r.x+16, r.y+8, pFrame->m_szName); pDC->Text(r.x+12, r.y+12, pFrame->m_szName); */ pDC->SetColor(m_FontColor); // 나중에 align고려해서 다시 수정해야 함 int y = int(m_TitlePosition.y*GetScale()); if(m_pFrameBitmaps[7]) { int au = (int)(GetScale() * m_pFrameBitmaps[7]->GetHeight()); y = (au - m_pFont->GetHeight())/2; } pDC->Text(int(r.x+m_TitlePosition.x*GetScale()), r.y+y, pFrame->m_szName); // pDC->Text(r.x+m_TitlePosition.x*GetScale(), r.y+m_TitlePosition.y*GetScale(), pFrame->m_szName); // pDC->Text(r.x+14, r.y+10, pFrame->m_szName); } }
/*********************************************************************** DrawPage : protected desc : 페이지를 그린다 arg : none ret : none ************************************************************************/ void ZMonsterBookInterface::DrawPage( void) { // 페이지 정보를 가져온다 ZMonsterBookPageItr itr = m_mapMonsterBookPage.find( m_nCurrentPageNum); ZMonsterBookPageInfo* pPageInfo; if ( itr != m_mapMonsterBookPage.end()) pPageInfo = (*itr).second; else pPageInfo = new ZMonsterBookPageInfo; // Get resource pointer ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); // 배경 이미지 로딩 if ( m_pBookBgImg != NULL) { delete m_pBookBgImg; m_pBookBgImg = NULL; } m_pBookBgImg = new CCBitmapR2; if ( m_nCurrentPageNum == 0) ((CCBitmapR2*)m_pBookBgImg)->Create( "monsterIllust.png", RGetDevice(), "interface/MonsterIllust/book_firstbg.jpg"); else ((CCBitmapR2*)m_pBookBgImg)->Create( "monsterIllust.png", RGetDevice(), "interface/MonsterIllust/book_bg.jpg"); if ( m_pBookBgImg) { // 읽어온 비트맵 이미지 포인터를 해당 위젯에 넘겨줘서 표시한다 CCPicture* pPicture = (CCPicture*)pResource->FindWidget( "MonsterBook_BookBG"); if ( pPicture) pPicture->SetBitmap( m_pBookBgImg->GetSourceBitmap()); } // 해당 몬스터의 일러스트 이미지를 업데이트 한다 if ( m_pIllustImg) { delete m_pIllustImg; m_pIllustImg = NULL; } CCPicture* pPicture = (CCPicture*)pResource->FindWidget( "MonsterBook_MonsterIllust"); if ( pPicture) pPicture->SetBitmap( NULL); m_pIllustImg = new CCBitmapR2; char szFileName[ 256]; sprintf( szFileName, "interface/MonsterIllust/monster_Illust%02d.jpg", pPageInfo->m_nID); ((CCBitmapR2*)m_pIllustImg)->Create( "monsterIllust.png", RGetDevice(), szFileName); if ( m_pIllustImg) { CCPicture* pPicture = (CCPicture*)pResource->FindWidget( "MonsterBook_MonsterIllust"); if ( pPicture) pPicture->SetBitmap( m_pIllustImg->GetSourceBitmap()); } // 해당 몬스터의 이름을 업데이트 한다 CCLabel* pLabel = (CCLabel*)pResource->FindWidget( "MonsterBook_MonsterName"); if (pLabel) { pLabel->SetText( m_nCurrentPageNum ? pPageInfo->m_strName.data() : ""); pLabel->Show( true); } // 해당 몬스터의 등급을 업데이트 한다 pLabel = (CCLabel*)pResource->FindWidget( "MonsterBook_MonsterGrade"); if ( pLabel) { char szGrade[ 64] = { 0, }; if ( m_nCurrentPageNum) { sprintf( szGrade, "%s : ", ZMsg(MSG_WORD_GRADE)); switch ( pPageInfo->m_nGrade) { case NPC_GRADE_REGULAR : strcat( szGrade, ZMsg(MSG_WORD_REGULAR)); break; case NPC_GRADE_LEGENDARY : strcat( szGrade, ZMsg(MSG_WORD_LEGENDARY)); break; case NPC_GRADE_BOSS : strcat( szGrade, ZMsg(MSG_WORD_BOSS)); break; case NPC_GRADE_ELITE : strcat( szGrade, ZMsg(MSG_WORD_ELITE)); break; case NPC_GRADE_VETERAN : strcat( szGrade, ZMsg(MSG_WORD_VETERAN)); break; } } pLabel->SetText( szGrade); pLabel->Show( true); } // 해당 몬스터의 설명을 업데이트 한다 CCTextArea* pTextArea = (CCTextArea*)pResource->FindWidget( "MonsterBook_MonsterDesc"); if ( pTextArea) { pTextArea->Clear(); pTextArea->AddText( m_nCurrentPageNum ? pPageInfo->m_strDesc.data() : "", sColor( 0xFF321E00)); pTextArea->Show(); } // 해당 몬스터의 HP를 업데이트 한다 pLabel = (CCLabel*)pResource->FindWidget( "MonsterBook_MonsterHP"); if ( pLabel) { char szHP[ 128] = { 0, }; if ( m_nCurrentPageNum) { strcpy( szHP, "HP : "); if ( pPageInfo->m_nHP > 200) strcat( szHP, ZMsg(MSG_WORD_VERYHARD)); else if ( pPageInfo->m_nHP > 120) strcat( szHP, ZMsg(MSG_WORD_HARD)); else if ( pPageInfo->m_nHP > 80) strcat( szHP, ZMsg(MSG_WORD_NORAML)); else if ( pPageInfo->m_nHP > 30) strcat( szHP, ZMsg(MSG_WORD_WEAK)); else strcat( szHP, ZMsg(MSG_WORD_VERYWEAK)); } pLabel->SetText( szHP); pLabel->Show( true); } // 해당 몬스터의 특수기를 업데이트 한다 pTextArea = (CCTextArea*)pResource->FindWidget( "MonsterBook_Attacks"); if ( pTextArea) { pTextArea->Clear(); for ( list<string>::iterator itrSkill = pPageInfo->m_Skill.begin(); itrSkill != pPageInfo->m_Skill.end(); itrSkill++) pTextArea->AddText( (*itrSkill).data(), sColor( 0xFF321E00)); } // 드롭 아이템 업데이트 list<ZDropItemInfo*>::iterator itrDropItem = pPageInfo->m_DropItem.begin(); for ( int i = 0; i < 10; i++) { char szWidgetName[ 50]; sprintf( szWidgetName, "MonsterBook_DropItem%d", i); CCPicture* pPicture = (CCPicture*)pResource->FindWidget( szWidgetName); if ( pPicture) { if ( itrDropItem != pPageInfo->m_DropItem.end()) { pPicture->AttachToolTip( (*itrDropItem)->m_strName.data()); pPicture->SetBitmap( (*itrDropItem)->m_pIcon); pPicture->Show( true); itrDropItem++; } else { pPicture->Show( false); } } } // 페이지 번호를 업데이트 한다 pLabel = (CCLabel*)pResource->FindWidget( "MonsterBook_PageNumber"); if ( pLabel) { char szPageNum[ 20] = { 0, }; if ( m_nCurrentPageNum) sprintf( szPageNum, "- %d -", m_nCurrentPageNum); pLabel->SetText( szPageNum); } // 달성률을 표시한다 pLabel = (CCLabel*)ZApplication::GetGameInterface()->GetIDLResource()->FindWidget( "MonsterBook_Complete"); if ( pLabel) { char szComplete[ 128] = { 0, }; if ( m_nCurrentPageNum == 0) sprintf( szComplete, "%s : %.1f%%", ZMsg(MSG_WORD_RATE), m_fCompleteRate); pLabel->SetText( szComplete); } // 이전 페이지 CCWidget* pWidget = pResource->FindWidget( "MonsterBook_PrevPageButton"); if ( pWidget) pWidget->Show( (m_nCurrentPageNum > 0) ? true : false); // 다음 페이지 pWidget = pResource->FindWidget( "MonsterBook_NextPageButton"); if ( pWidget) pWidget->Show( (m_nCurrentPageNum < m_nTotalPageNum) ? true : false); // 메모리 삭제 if ( itr == m_mapMonsterBookPage.end()) delete pPageInfo; }
void TimeReward_ChatOutput_NoChance(const char* szRewardName) { char szOutput[512]; ZTransMsg(szOutput,MSG_BONUS_REWARD_NOCHANCE,1,szRewardName); ZChatOutput(sColor(ZCOLOR_CHAT_SYSTEM), szOutput); }
void TimeReward_ChatOutput_RewardGet(const char* szRewardName, const char* szCharName, const char* szItemName) { char szOutput[512]; ZTransMsg(szOutput,MSG_BONUS_REWARD_GET,3,szRewardName,szCharName,szItemName); ZChatOutput(sColor(ZCOLOR_CHAT_SYSTEM), szOutput); }
void CCyclone::Update(CScreensaverCyclone* base) { int i; int temp; float between; float diff; int direction; float point[3]; float step; float blend; // update cyclone's path temp = gCycloneSettings.dComplexity + 2; if (m_xyzChange[temp][0] >= m_xyzChange[temp][1]) { m_oldxyz[temp][0] = m_xyz[temp][0]; m_oldxyz[temp][1] = m_xyz[temp][1]; m_oldxyz[temp][2] = m_xyz[temp][2]; m_targetxyz[temp][0] = rsRandf(float(WIDTH*2)) - float(WIDTH); m_targetxyz[temp][1] = float(HIGHT); m_targetxyz[temp][2] = rsRandf(float(WIDTH*2)) - float(WIDTH); m_xyzChange[temp][0] = 0.0f; m_xyzChange[temp][1] = rsRandf(150.0f / float(gCycloneSettings.dSpeed)) + 75.0f / float(gCycloneSettings.dSpeed); } temp = gCycloneSettings.dComplexity + 1; if (m_xyzChange[temp][0] >= m_xyzChange[temp][1]) { m_oldxyz[temp][0] = m_xyz[temp][0]; m_oldxyz[temp][1] = m_xyz[temp][1]; m_oldxyz[temp][2] = m_xyz[temp][2]; m_targetxyz[temp][0] = m_xyz[temp+1][0]; m_targetxyz[temp][1] = rsRandf(float(HIGHT / 3)) + float(HIGHT / 4); m_targetxyz[temp][2] = m_xyz[temp+1][2]; m_xyzChange[temp][0] = 0.0f; m_xyzChange[temp][1] = rsRandf(100.0f / float(gCycloneSettings.dSpeed)) + 75.0f / float(gCycloneSettings.dSpeed); } for (i = gCycloneSettings.dComplexity; i > 1; i--) { if (m_xyzChange[i][0] >= m_xyzChange[i][1]) { m_oldxyz[i][0] = m_xyz[i][0]; m_oldxyz[i][1] = m_xyz[i][1]; m_oldxyz[i][2] = m_xyz[i][2]; m_targetxyz[i][0] = m_targetxyz[i+1][0] + (m_targetxyz[i+1][0] - m_targetxyz[i+2][0]) / 2.0f + rsRandf(float(WIDTH / 2)) - float(WIDTH / 4); m_targetxyz[i][1] = (m_targetxyz[i+1][1] + m_targetxyz[i-1][1]) / 2.0f + rsRandf(float(HIGHT / 8)) - float(HIGHT / 16); m_targetxyz[i][2] = m_targetxyz[i+1][2] + (m_targetxyz[i+1][2] - m_targetxyz[i+2][2]) / 2.0f + rsRandf(float(WIDTH / 2)) - float(WIDTH / 4); if (m_targetxyz[i][1] > HIGHT) m_targetxyz[i][1] = HIGHT; if (m_targetxyz[i][1] < -HIGHT) m_targetxyz[i][1] = -HIGHT; m_xyzChange[i][0] = 0.0f; m_xyzChange[i][1] = rsRandf(75.0f / float(gCycloneSettings.dSpeed)) + 50.0f / float(gCycloneSettings.dSpeed); } } if (m_xyzChange[1][0] >= m_xyzChange[1][1]) { m_oldxyz[1][0] = m_xyz[1][0]; m_oldxyz[1][1] = m_xyz[1][1]; m_oldxyz[1][2] = m_xyz[1][2]; m_targetxyz[1][0] = m_targetxyz[2][0] + rsRandf(float(WIDTH / 2)) - float(WIDTH / 4); m_targetxyz[1][1] = -rsRandf(float(HIGHT / 2)) - float(HIGHT / 4); m_targetxyz[1][2] = m_targetxyz[2][2] + rsRandf(float(WIDTH / 2)) - float(WIDTH / 4); m_xyzChange[1][0] = 0.0f; m_xyzChange[1][1] = rsRandf(50.0f / float(gCycloneSettings.dSpeed)) + 30.0f / float(gCycloneSettings.dSpeed); } if (m_xyzChange[0][0] >= m_xyzChange[0][1]) { m_oldxyz[0][0] = m_xyz[0][0]; m_oldxyz[0][1] = m_xyz[0][1]; m_oldxyz[0][2] = m_xyz[0][2]; m_targetxyz[0][0] = m_xyz[1][0] + rsRandf(float(WIDTH / 8)) - float(WIDTH / 16); m_targetxyz[0][1] = float(-HIGHT); m_targetxyz[0][2] = m_xyz[1][2] + rsRandf(float(WIDTH / 8)) - float(WIDTH / 16); m_xyzChange[0][0] = 0.0f; m_xyzChange[0][1] = rsRandf(100.0f / float(gCycloneSettings.dSpeed)) + 75.0f / float(gCycloneSettings.dSpeed); } for (i = 0; i < (gCycloneSettings.dComplexity+3); i++) { between = m_xyzChange[i][0] / m_xyzChange[i][1] * (2 * M_PI); between = (1.0f - float(cos(between))) / 2.0f; m_xyz[i][0] = ((m_targetxyz[i][0] - m_oldxyz[i][0]) * between) + m_oldxyz[i][0]; m_xyz[i][1] = ((m_targetxyz[i][1] - m_oldxyz[i][1]) * between) + m_oldxyz[i][1]; m_xyz[i][2] = ((m_targetxyz[i][2] - m_oldxyz[i][2]) * between) + m_oldxyz[i][2]; m_xyzChange[i][0] += base->FrameTime(); } // Update cyclone's widths temp = gCycloneSettings.dComplexity + 2; if (m_widthChange[temp][0] >= m_widthChange[temp][1]) { m_oldWidth[temp] = m_width[temp]; m_targetWidth[temp] = rsRandf(225.0f) + 75.0f; m_widthChange[temp][0] = 0.0f; m_widthChange[temp][1] = rsRandf(50.0f / float(gCycloneSettings.dSpeed)) + 50.0f / float(gCycloneSettings.dSpeed); } temp = gCycloneSettings.dComplexity + 1; if (m_widthChange[temp][0] >= m_widthChange[temp][1]) { m_oldWidth[temp] = m_width[temp]; m_targetWidth[temp] = rsRandf(100.0f) + 15.0f; m_widthChange[temp][0] = 0.0f; m_widthChange[temp][1] = rsRandf(50.0f / float(gCycloneSettings.dSpeed)) + 50.0f / float(gCycloneSettings.dSpeed); } for (i = gCycloneSettings.dComplexity; i > 1; i--) { if (m_widthChange[i][0] >= m_widthChange[i][1]) { m_oldWidth[i] = m_width[i]; m_targetWidth[i] = rsRandf(50.0f) + 15.0f; m_widthChange[i][0] = 0.0f; m_widthChange[i][1] = rsRandf(50.0f / float(gCycloneSettings.dSpeed)) + 40.0f / float(gCycloneSettings.dSpeed); } } if (m_widthChange[1][0] >= m_widthChange[1][1]) { m_oldWidth[1] = m_width[1]; m_targetWidth[1] = rsRandf(40.0f) + 5.0f; m_widthChange[1][0] = 0.0f; m_widthChange[1][1] = rsRandf(50.0f / float(gCycloneSettings.dSpeed)) + 30.0f / float(gCycloneSettings.dSpeed); } if (m_widthChange[0][0] >= m_widthChange[0][1]) { m_oldWidth[0] = m_width[0]; m_targetWidth[0] = rsRandf(30.0f) + 5.0f; m_widthChange[0][0] = 0.0f; m_widthChange[0][1] = rsRandf(50.0f / float(gCycloneSettings.dSpeed)) + 20.0f / float(gCycloneSettings.dSpeed); } for (i = 0; i < (gCycloneSettings.dComplexity+3); i++) { between = m_widthChange[i][0] / m_widthChange[i][1]; m_width[i] = ((m_targetWidth[i] - m_oldWidth[i]) * between) + m_oldWidth[i]; m_widthChange[i][0] += base->FrameTime(); } // Update cyclones color if (m_hslChange[0] >= m_hslChange[1]) { m_oldhsl[0] = m_hsl[0]; m_oldhsl[1] = m_hsl[1]; m_oldhsl[2] = m_hsl[2]; m_targethsl[0] = rsRandf(1.0f); m_targethsl[1] = rsRandf(1.0f); m_targethsl[2] = rsRandf(1.0f) + 0.5f; if (m_targethsl[2] > 1.0f) m_targethsl[2] = 1.0f; m_hslChange[0] = 0.0f; m_hslChange[1] = rsRandf(30.0f) + 2.0f; } between = m_hslChange[0] / m_hslChange[1]; diff = m_targethsl[0] - m_oldhsl[0]; direction = 0; if ((m_targethsl[0] > m_oldhsl[0] && diff > 0.5f) || (m_targethsl[0] < m_oldhsl[0] && diff < -0.5f)) if (diff > 0.5f) direction = 1; hslTween(m_oldhsl[0], m_oldhsl[1], m_oldhsl[2], m_targethsl[0], m_targethsl[1], m_targethsl[2], between, direction, m_hsl[0], m_hsl[1], m_hsl[2]); m_hslChange[0] += base->FrameTime(); if (gCycloneSettings.dShowCurves) { unsigned int ptr = 0; sLight curves[std::max(gCycloneSettings.dComplexity+3, 50)]; base->m_lightingEnabled = 0; for (step=0.0; step<1.0; step+=0.02f) { point[0] = point[1] = point[2] = 0.0f; for (i = 0; i < (gCycloneSettings.dComplexity+3); i++) { blend = base->m_fact[gCycloneSettings.dComplexity+2] / (base->m_fact[i] * base->m_fact[gCycloneSettings.dComplexity+2-i]) * powf(step, float(i)) * powf((1.0f - step), float(gCycloneSettings.dComplexity+2-i)); point[0] += m_xyz[i][0] * blend; point[1] += m_xyz[i][1] * blend; point[2] += m_xyz[i][2] * blend; } curves[ptr ].color = sColor(0.0f, 1.0f, 0.0f); curves[ptr++].vertex = sPosition(point); } base->DrawEntry(GL_LINE_STRIP, curves, ptr); ptr = 0; for (i = 0; i < (gCycloneSettings.dComplexity+3); i++) { curves[ptr ].color = sColor(1.0f, 0.0f, 0.0f); curves[ptr++].vertex = sPosition(&m_xyz[i][0]); } base->DrawEntry(GL_LINE_STRIP, curves, ptr); base->m_lightingEnabled = 1; } }
void DrawBitmapFrame2(CCDrawContext* pDC, sRect& r, sRect& cr, CCBitmap* Bms[9]) { if(Bms[0]&&Bms[0]) { //자신의 영역을 둘러싸는 이미지를 그려준다.. // 9곳 회전해서 그리기.. // 1 2 3 // 4 5 6 // 7 8 9 Bms[0]->SetDrawMode(CCBM_Normal); Bms[1]->SetDrawMode(CCBM_Normal); sRect cliprect = pDC->GetClipRect();//잠시풀어준다.. pDC->SetColor(sColor(255,255,255,255)); // pDC->SetOpacity(255); // pDC->SetClipRect(0,0,CCGetWorkspaceWidth(),CCGetWorkspaceHeight()); pDC->SetClipRect( cr.x, cr.y, cr.w, cr.h ); // pDC->SetBitmapColor(color); pDC->SetBitmap( Bms[0] ); pDC->Draw(r.x, r.y, 16, 16); pDC->SetBitmap( Bms[1] ); pDC->Draw(r.x+16, r.y, r.w-32,16); Bms[0]->SetDrawMode(CCBM_FlipLR); pDC->SetBitmap( Bms[0] ); pDC->Draw(r.x+r.w-16, r.y, 16, 16); //그려야할사이즈가있다면~ 중간단계 if(r.h > 32) { Bms[1]->SetDrawMode(CCBM_RotL90); pDC->SetBitmap( Bms[1] ); pDC->Draw(r.x, r.y+16, 16, r.h-32); //중간색채우기 pDC->SetColor(sColor(0xffD9D9D9));//임시 pDC->FillRectangle(sRect(r.x+16,r.y+16,r.w-32,r.h-32)); Bms[1]->SetDrawMode(CCBM_RotR90); pDC->SetBitmap( Bms[1] ); pDC->Draw(r.x+r.w-16, r.y+16, 16, r.h-32); } // 아래부분~ Bms[0]->SetDrawMode(CCBM_FlipUD); pDC->SetBitmap( Bms[0] ); pDC->Draw(r.x, r.y+r.h-16, 16, 16); Bms[1]->SetDrawMode(CCBM_FlipUD); pDC->SetBitmap( Bms[1] ); pDC->Draw(r.x+16, r.y+r.h-16, r.w-32,16); Bms[0]->SetDrawMode(CCBM_FlipUD|CCBM_FlipLR); pDC->SetBitmap( Bms[0] ); pDC->Draw(r.x+r.w-16, r.y+r.h-16, 16, 16); Bms[0]->SetDrawMode(CCBM_Normal); Bms[1]->SetDrawMode(CCBM_Normal); // pDC->SetBitmapColor(sColor(255,255,255,255)); pDC->SetClipRect(cliprect); } }
void CParticle::Update(CScreensaverCyclone* base) { int i; float scale, temp; float newStep; float newSpinAngle; float cyWidth; float between; float dir[3]; float tiltAngle; float blend; m_lastxyz[0] = m_xyz[0]; m_lastxyz[1] = m_xyz[1]; m_lastxyz[2] = m_xyz[2]; if (m_step > 1.0f) Init(); m_xyz[0] = m_xyz[1] = m_xyz[2] = 0.0f; for (i = 0; i < (gCycloneSettings.dComplexity+3); i++) { blend = base->m_fact[gCycloneSettings.dComplexity+2] / (base->m_fact[i] * base->m_fact[gCycloneSettings.dComplexity+2-i]) * powf(m_step, float(i)) * powf((1.0f - m_step), float(gCycloneSettings.dComplexity+2-i)); m_xyz[0] += m_cy->m_xyz[i][0] * blend; m_xyz[1] += m_cy->m_xyz[i][1] * blend; m_xyz[2] += m_cy->m_xyz[i][2] * blend; } dir[0] = dir[1] = dir[2] = 0.0f; for (i = 0; i < (gCycloneSettings.dComplexity+3); i++) { blend = base->m_fact[gCycloneSettings.dComplexity+2] / (base->m_fact[i] * base->m_fact[gCycloneSettings.dComplexity+2-i]) * powf(m_step - 0.01f, float(i)) * powf((1.0f - (m_step - 0.01f)), float(gCycloneSettings.dComplexity+2-i)); dir[0] += m_cy->m_xyz[i][0] * blend; dir[1] += m_cy->m_xyz[i][1] * blend; dir[2] += m_cy->m_xyz[i][2] * blend; } dir[0] = m_xyz[0] - dir[0]; dir[1] = m_xyz[1] - dir[1]; dir[2] = m_xyz[2] - dir[2]; glm::vec3 up = {0.0f, 1.0f, 0.0f}; glm::vec3 ret = glm::normalize(glm::vec3(dir[0], dir[1], dir[2])); glm::vec3 crossVec = glm::cross(ret, up); tiltAngle = -acosf(glm::dot(ret, up)) * 180.0f / M_PI; i = int(m_step * (float(gCycloneSettings.dComplexity) + 2.0f)); if (i >= (gCycloneSettings.dComplexity + 2)) i = gCycloneSettings.dComplexity + 1; between = (m_step - (float(i) / float(gCycloneSettings.dComplexity + 2))) * float(gCycloneSettings.dComplexity + 2); cyWidth = m_cy->m_width[i] * (1.0f - between) + m_cy->m_width[i+1] * (between); newStep = (0.2f * base->FrameTime() * float(gCycloneSettings.dSpeed)) / (m_width * m_width * cyWidth); m_step += newStep; newSpinAngle = (1500.0f * base->FrameTime() * float(gCycloneSettings.dSpeed)) / (m_width * cyWidth); m_spinAngle += newSpinAngle; if (gCycloneSettings.dStretch) { scale = m_width * cyWidth * newSpinAngle * 0.02f; temp = cyWidth * 2.0f / float(gCycloneSettings.dSize); if (scale > temp) scale = temp; if (scale < 3.0f) scale = 3.0f; } glm::mat4 modelMat = base->m_modelMat; base->m_modelMat = glm::translate(glm::mat4(1.0f), glm::vec3(m_xyz[0], m_xyz[1], m_xyz[2])); base->m_modelMat = glm::rotate(base->m_modelMat, glm::radians(tiltAngle), crossVec); base->m_modelMat = glm::rotate(base->m_modelMat, glm::radians(m_spinAngle), glm::vec3(0.0f, 1.0f, 0.0f)); base->m_modelMat = glm::translate(base->m_modelMat, glm::vec3(m_width * cyWidth, 0.0f, 0.0f)); if (gCycloneSettings.dStretch) base->m_modelMat = glm::scale(base->m_modelMat, glm::vec3(1.0f, 1.0f, scale)); base->DrawSphere(sColor(m_r, m_g, m_b)); base->m_modelMat = modelMat; }
void CCWidget::OnDraw(CCDrawContext* pDC){ // Draw Nothing pDC->SetColor(sColor(196, 196, 196)); pDC->FillRectangle(GetInitialClientRect()); }