//распечатать результат выполнен¤ команды командной строки (посмивольно) void PrintCMDResult(char ps, int pos) { int max; max=getmaxx(menu[1])-2; if(pos==1) { ClearPanel(2); } if(pos<=max&&pos>=1) { wmove(menu[1],1,pos); wprintw(menu[1],"%c",ps); } else { if(pos>max&&pos<=2*max) { wmove(menu[1],2,pos-max); wprintw(menu[1],"%c",ps); } else { if(pos>2*max&&pos<=3*max) { wmove(menu[1],3,pos-2*max); wprintw(menu[1],"%c",ps); } } } box(menu[1],0,0); wmove(menu[1],0,getmaxx(menu[1])/2-8); wprintw(menu[1],"Information"); curs_set(0); wrefresh(menu[1]); }
void Overlay::Init(D3D9Base::LPDIRECT3DDEVICE9 Device) { if(g_Globals.UsingOverlay) { _Device = Device; FreeMemory(); HDC hDC = GetDC( NULL ); int nLogPixelsY = GetDeviceCaps(hDC, LOGPIXELSY); ReleaseDC( NULL, hDC ); int FontHeight = -9 * nLogPixelsY / 72; //get the appropriate height of the font HRESULT hr = D3DXCreateFont( Device, FontHeight, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &_Font); Assert(SUCCEEDED(hr), "D3DXCreateFont failed"); for(UINT PanelIndex = 0; PanelIndex < ConsolePanelCount; PanelIndex++) { ClearPanel(PanelIndex); } hr = D3DXCreateSprite(Device, &_Sprite); Assert(SUCCEEDED(hr), "D3DXCreateSprite failed"); WriteLine("Console Start", RGBColor::Yellow, 0); } }
//сообщение об ошибке void ErrorMsg(char *str) { ClearPanel(2); wattron(menu[1],COLOR_PAIR(3)| A_BOLD); wmove(menu[1],1,1); wprintw(menu[1],"Error!"); wmove(menu[1],2,1); wprintw(menu[1],str); wattroff(menu[1],COLOR_PAIR(3)| A_BOLD); wattron(menu[1],COLOR_PAIR(0)| A_BOLD); curs_set(0); wrefresh(menu[1]); }
//восстановление параметров окон void RestoreState(void) { cbreak(); keypad(menu[1],1); keypad(menu[0],1); noecho(); SelectDir(0,1,0); SelectDir(1,1,0); ClearPanel(2); curs_set(0); wrefresh(mng[0]); wrefresh(mng[1]); wrefresh(menu[0]); wrefresh(menu[1]); wrefresh(cmd); }
void __cdecl CheckRportal() { int v0; // ecx int v1; // eax int v2; // esi int v3; // edx int v4; // ebx int v5; // [esp+0h] [ebp-4h] v5 = 0; if ( nummissiles > 0 ) { v0 = cursmx; v1 = cursmy; do { v2 = missileactive[v5]; if ( missile[v2]._mitype == MIS_RPORTAL ) { if ( (v3 = missile[v2]._mix, v4 = v3 - 1, v0 == v3 - 1) && v1 == missile[v2]._miy || v0 == v3 && v1 == missile[v2]._miy - 1 || v0 == v4 && v1 == missile[v2]._miy - 1 || v0 == v3 - 2 && (v1 == missile[v2]._miy - 1 || v0 == v3 - 2 && v1 == missile[v2]._miy - 2) || v0 == v4 && v1 == missile[v2]._miy - 2 || v0 == v3 && v1 == missile[v2]._miy ) { trigflag[3] = 1; ClearPanel(); strcpy(infostr, "Portal to"); if ( setlevel ) strcpy(tempstr, "level 15"); else strcpy(tempstr, "The Unholy Altar"); AddPanelString(tempstr, 1); v0 = missile[v2]._mix; v1 = missile[v2]._miy; cursmx = missile[v2]._mix; cursmy = v1; } } ++v5; } while ( v5 < nummissiles ); } }
//циклический ввод и отправка сообщений void MessageType(void) { int ch,x,y,i=0;//,j=1; char message[getmaxx(mpanel[2])-1]; while((ch=wgetch(mpanel[2]))!=KEY_F(5)&&end==0) { wrefresh(mpanel[2]); //обработка enter if(ch==10) { GetMessage(message); ClearPanel(2); wmove(mpanel[2],1,1); i=0; ClientSendMsg(message); } else if(ch==KEY_BACKSPACE) { getyx(mpanel[2],y,x); if(x!=1) { wmove(mpanel[2],y,x-1); wdelch(mpanel[2]); box(mpanel[2],0,0); wmove(mpanel[2],0,getmaxx(mpanel[2])/2-13); wprintw(mpanel[2]," Type your message, %ld ",(long)getpid()); wmove(mpanel[2],1,getmaxx(mpanel[2])-2); wprintw(mpanel[2]," "); wmove(mpanel[2],y,x-1); i--; } } else { //не даем печатать за границу if(i>=getmaxx(mpanel[2])-2) { continue; } wprintw(mpanel[2],"%c",ch); i++; } } }
void __cdecl CheckTown() { int v0; // ecx int v1; // eax int v2; // esi int v3; // edx int v4; // ebx int v5; // [esp+0h] [ebp-4h] v5 = 0; if ( nummissiles > 0 ) { v0 = cursmx; v1 = cursmy; do { v2 = missileactive[v5]; if ( missile[v2]._mitype == MIS_TOWN ) { if ( (v3 = missile[v2]._mix, v4 = v3 - 1, v0 == v3 - 1) && v1 == missile[v2]._miy || v0 == v3 && v1 == missile[v2]._miy - 1 || v0 == v4 && v1 == missile[v2]._miy - 1 || v0 == v3 - 2 && (v1 == missile[v2]._miy - 1 || v0 == v3 - 2 && v1 == missile[v2]._miy - 2) || v0 == v4 && v1 == missile[v2]._miy - 2 || v0 == v3 && v1 == missile[v2]._miy ) { trigflag[3] = 1; ClearPanel(); strcpy(infostr, "Town Portal"); sprintf(tempstr, "from %s", plr[missile[v2]._misource]._pName); AddPanelString(tempstr, 1); v0 = missile[v2]._mix; v1 = missile[v2]._miy; cursmx = missile[v2]._mix; cursmy = v1; } } ++v5; } while ( v5 < nummissiles ); } }
//активаци¤ командной строки void ActivateCMD(void) { int ch,i=0,x,y; char command[getmaxx(cmd)]; ClearPanel(3); wmove(cmd,1,1); curs_set(1); keypad(cmd,1); while((ch=wgetch(cmd))!=10&&i<getmaxx(cmd)) { wrefresh(cmd); if(ch==KEY_BACKSPACE) { getyx(cmd,y,x); if(x!=1) { wmove(cmd,y,x-1); wdelch(cmd); //после удалени¤ символа нужно поправить рамку box(cmd,0,0); wmove(cmd,0,2); wprintw(cmd,"Command line"); wmove(cmd,1,getmaxx(cmd)-2); wprintw(cmd," "); wmove(cmd,y,x-1); i--; } } else { wprintw(cmd,"%c",ch); command[i]=ch; i++; } } ExecuteCMD(command); curs_set(0); wrefresh(cmd); }
void __cdecl CheckTrigForce() { int v0; // eax int v1; // eax trigflag[3] = 0; if ( MouseY <= 351 ) { if ( setlevel ) { switch ( setlvlnum ) { case SL_SKELKING: v1 = ForceSKingTrig(); break; case SL_BONECHAMB: v1 = ForceSChambTrig(); break; case SL_POISONWATER: v1 = ForcePWaterTrig(); break; default: return; } goto LABEL_23; } if ( leveltype ) { switch ( leveltype ) { case DTYPE_CATHEDRAL: v0 = ForceL1Trig(); break; case DTYPE_CATACOMBS: v0 = ForceL2Trig(); break; case DTYPE_CAVES: v0 = ForceL3Trig(); break; case DTYPE_HELL: v0 = ForceL4Trig(); break; default: LABEL_14: if ( !leveltype ) goto LABEL_24; if ( trigflag[3] ) { LABEL_25: ClearPanel(); return; } v1 = ForceQuests(); LABEL_23: trigflag[3] = v1; LABEL_24: if ( !trigflag[3] ) return; goto LABEL_25; } } else { v0 = ForceTownTrig(); } trigflag[3] = v0; goto LABEL_14; } }
void AvatarEditor::RebuildEditView() { if (!avatar_widget_) return; // Activate/deactivate export button based on whether export currently supported QPushButton *button = avatar_widget_->findChild<QPushButton *>("but_export"); if (button) button->setEnabled(rexlogicmodule_->GetAvatarHandler()->AvatarExportSupported()); QWidget* mat_panel = avatar_widget_->findChild<QWidget *>("panel_materials"); QWidget* attachment_panel = avatar_widget_->findChild<QWidget *>("panel_attachments"); if (!mat_panel || !attachment_panel) return; Scene::EntityPtr entity = rexlogicmodule_->GetAvatarHandler()->GetUserAvatar(); if (!entity) return; EC_AvatarAppearance* appearance = entity->GetComponent<EC_AvatarAppearance>().get(); if (!appearance) return; int width = 308-10; int tab_width = 302-10; int itemheight = 20; // Materials ClearPanel(mat_panel); const AvatarMaterialVector& materials = appearance->GetMaterials(); mat_panel->resize(width, itemheight * (materials.size() + 1)); for (uint y = 0; y < materials.size(); ++y) { QPushButton* button = new QPushButton("Change", mat_panel); button->setObjectName(QString::fromStdString(ToString<int>(y))); // Material index button->resize(50, 20); button->move(width - 50, y*itemheight); button->show(); QObject::connect(button, SIGNAL(clicked()), this, SLOT(ChangeTexture())); // If there's a texture name, use it, because it is probably more understandable than material name std::string texname = materials[y].asset_.name_; if (materials[y].textures_.size()) texname = materials[y].textures_[0].name_; QLabel* label = new QLabel(QString::fromStdString(texname), mat_panel); label->resize(200,20); label->move(0, y*itemheight); label->show(); } // Attachments ClearPanel(attachment_panel); const AvatarAttachmentVector& attachments = appearance->GetAttachments(); attachment_panel->resize(width, itemheight * (attachments.size() + 1)); for (uint y = 0; y < attachments.size(); ++y) { QPushButton* button = new QPushButton("Remove", attachment_panel); button->setObjectName(QString::fromStdString(ToString<int>(y))); // Attachment index button->resize(50, 20); button->move(width - 50, y*itemheight); button->show(); QObject::connect(button, SIGNAL(clicked()), this, SLOT(RemoveAttachment())); std::string attachment_name = attachments[y].name_; // Strip away .xml from the attachment name for slightly nicer display std::size_t pos = attachment_name.find(".xml"); if (pos != std::string::npos) attachment_name = attachment_name.substr(0, pos); QLabel* label = new QLabel(QString::fromStdString(attachment_name), attachment_panel); label->resize(200,20); label->move(0, y*itemheight); label->show(); } // Modifiers QTabWidget* tabs = avatar_widget_->findChild<QTabWidget *>("tab_appearance"); if (!tabs) return; for (;;) { QWidget* tab = tabs->widget(0); if (!tab) break; tabs->removeTab(0); delete tab; } const MasterModifierVector& master_modifiers = appearance->GetMasterModifiers(); // If no master modifiers, show the individual morph/bone controls if (!master_modifiers.size()) { QWidget* morph_panel = GetOrCreateTabScrollArea(tabs, "Morphs"); QWidget* bone_panel = GetOrCreateTabScrollArea(tabs, "Bones"); if (!morph_panel || !bone_panel) return; const BoneModifierSetVector& bone_modifiers = appearance->GetBoneModifiers(); const MorphModifierVector& morph_modifiers = appearance->GetMorphModifiers(); morph_panel->resize(tab_width, itemheight * (morph_modifiers.size() + 1)); bone_panel->resize(tab_width, itemheight * (bone_modifiers.size() + 1)); for (uint i = 0; i < bone_modifiers.size(); ++i) { QScrollBar* slider = new QScrollBar(Qt::Horizontal, bone_panel); slider->setObjectName(QString::fromStdString(bone_modifiers[i].name_)); slider->setMinimum(0); slider->setMaximum(100); slider->setPageStep(10); slider->setValue(bone_modifiers[i].value_ * 100.0f); slider->resize(150, 20); slider->move(tab_width - 150, i * itemheight); slider->show(); QObject::connect(slider, SIGNAL(valueChanged(int)), this, SLOT(BoneModifierValueChanged(int))); QLabel* label = new QLabel(QString::fromStdString(bone_modifiers[i].name_), bone_panel); label->resize(100,20); label->move(0, i * itemheight); label->show(); } for (uint i = 0; i < morph_modifiers.size(); ++i) { QScrollBar* slider = new QScrollBar(Qt::Horizontal, morph_panel); slider->setObjectName(QString::fromStdString(morph_modifiers[i].name_)); slider->setMinimum(0); slider->setMaximum(100); slider->setPageStep(10); slider->setValue(morph_modifiers[i].value_ * 100.0f); slider->resize(150, 20); slider->move(tab_width - 150, i * itemheight); slider->show(); QObject::connect(slider, SIGNAL(valueChanged(int)), this, SLOT(MorphModifierValueChanged(int))); QLabel* label = new QLabel(QString::fromStdString(morph_modifiers[i].name_), morph_panel); label->resize(100,20); label->move(0, i * itemheight); label->show(); } }
void Overlay::RenderConsole() { const UINT ConsoleStartOffset = 3; const UINT ConsoleXSeparation = 210; const UINT ConsoleYSeparation = 13; if(Pressed(GetAsyncKeyState(KEY_F2))) { g_Globals.UsingNullPixelShader = !g_Globals.UsingNullPixelShader; } if(g_Globals.UsingOverlay) { if(Pressed(GetAsyncKeyState(KEY_DELETE))) { for(UINT PanelIndex = 0; PanelIndex < ConsolePanelCount; PanelIndex++) { ClearPanel(PanelIndex); } ClearMeshes(); } D3D9Base::LPDIRECT3DDEVICE9 Device = NULL; _Font->GetDevice(&Device); D3D9Base::LPDIRECT3DSURFACE9 BackBufferSurface = NULL; Device->GetBackBuffer(0, 0, D3D9Base::D3DBACKBUFFER_TYPE_MONO, &BackBufferSurface); D3DSURFACE_DESC BackBufferDesc; BackBufferSurface->GetDesc(&BackBufferDesc); D3DVIEWPORT9 Viewport; Viewport.X = 0; Viewport.Y = 0; Viewport.Width = BackBufferDesc.Width; Viewport.Height = BackBufferDesc.Height; Viewport.MinZ = 0.0f; Viewport.MaxZ = 1.0f; Device->SetViewport(&Viewport); BackBufferSurface->Release(); Device->Release(); _Sprite->Begin( D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE ); for(UINT PanelIndex = 0; PanelIndex < ConsolePanelCount; PanelIndex++) { ConsolePanel &CurPanel = _Panels[PanelIndex]; UINT LineIndex = CurPanel.CurHeadPtr, YPos = ConsoleStartOffset; UINT XPos = ConsoleStartOffset + ConsoleXSeparation * PanelIndex; bool FlipLineOrder = false; if(PanelIndex == ConsolePanelCount - 1) { FlipLineOrder = true; //YPos = ConsoleStartOffset + ConsoleYSeparation * CurPanel.Lines.Length(); YPos = ConsoleStartOffset + ConsoleYSeparation; XPos = ConsoleStartOffset; } if(PanelIndex == ConsolePanelCount - 2) { XPos += 75; } bool Done = false; while(!Done) { // TODO: add sprite support UINT ModifiedLineIndex = LineIndex; if(FlipLineOrder) { //ModifiedLineIndex = CurPanel.Lines.Length() - 1 - LineIndex; } const ConsoleLine &CurLine = CurPanel.Lines[ModifiedLineIndex]; const String &CurText = CurLine.Text; if(CurText.Length() > 0) { RECT Rect; SetRect( &Rect, int(XPos), int(YPos), 0, 0 ); //RGBColor Color = RGBColor::Black; //_Font->DrawText(_Sprite, CurText.CString(), CurText.Length(), &Rect, DT_NOCLIP, D3D9Base::D3DXCOLOR(Color.r / 255.0f, Color.g / 255.0f, Color.b / 255.0f, 1.0f )); //Rect.left -= 1; //Rect.top -= 1; RGBColor Color = CurLine.Color; _Font->DrawText(_Sprite, CurText.CString(), CurText.Length(), &Rect, DT_NOCLIP, D3D9Base::D3DXCOLOR(Color.r / 255.0f, Color.g / 255.0f, Color.b / 255.0f, Color.a / 255.0f )); } LineIndex = Math::Mod(LineIndex + 1, CurPanel.Lines.Length()); YPos += ConsoleYSeparation; if(LineIndex == Math::Mod(int(CurPanel.CurHeadPtr), CurPanel.Lines.Length())) { Done = true; } } } _Sprite->End(); } }