void AssignSound() { CString strBasePath = ValueForKey(g_qeglobals.d_project_entity, "basepath"); AddSlash(strBasePath); CString strPath = strBasePath; strPath += "sound\\"; CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Sound files (*.wav,*.mp3)|*.wav;*.mp3||", g_pParentWnd); dlgFile.m_ofn.lpstrInitialDir = strPath; if (dlgFile.DoModal() == IDOK) { SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)"noise"); CString str = dlgFile.GetPathName().GetBuffer(0); str.MakeLower(); strBasePath.MakeLower(); QE_ConvertDOSToUnixName(str.GetBuffer(0), str.GetBuffer(0)); QE_ConvertDOSToUnixName(strBasePath.GetBuffer(0), strBasePath.GetBuffer(0)); int n = str.Find(strBasePath); if (n == 0) { str = str.Right(str.GetLength() - strBasePath.GetLength()); } SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM)str.GetBuffer(0)); AddProp(); g_pParentWnd->GetXYWnd()->SetFocus(); } }
bool Node::RoutePureGreedy(Message &m, string &nextNode) { if(!IsProp(INPATH)) AddProp(INPATH); m.AddNodeToPath(Name); //Add Current node to path for tracking purposes only nextNode = GetClosestNeighborToNode(m.GetEndNode()); return !nextNode.empty(); }
void SeedBag::Use() { auto currentLandmark = GameState::Get().GetCurrentLandmark(); auto positionX = Player::Get().GetPositionX(); auto positionY = Player::Get().GetPositionY(); auto tile = currentLandmark->GetTile(positionX, positionY); if (tile.TileType != TileType::Tilled) { GameState::Get().AddLogMessage("The ground here is not tilled!"); return; } auto prop = currentLandmark->GetProp(positionX, positionY); if (prop != nullptr) { GameState::Get().AddLogMessage("There is already something here."); return; } if (this->NumberOfSeeds <= 0) { GameState::Get().AddLogMessage("There are no more seeds in this bag."); return; } this->NumberOfSeeds--; auto crop = PlantedCrop::Construct(Crop::FromCropType(this->CropType), CropGrowthType::Seedling); currentLandmark->AddProp(positionX, positionY, crop); auto cropName = Crop::FromCropType(this->CropType).Name; bool startsWithVowel = cropName.find_first_of("aAeEiIoOuU") == 0; GameState::Get().AddLogMessageFmt("You plant %s %s.", startsWithVowel ? "an" : "a", cropName.c_str()); }
void CEntityDlg::OnBnClickedButtonSkin() { CPreviewDlg *dlg = ShowSkinChooser( editEntity ); if( dlg->returnCode == IDOK ) { editKey.SetWindowText( "skin" ); editVal.SetWindowText( dlg->mediaName ); AddProp(); } }
void CEntityDlg::OnBnClickedEDown() { if( editEntity == NULL ) { return; } editKey.SetWindowText( AngleKey() ); editVal.SetWindowText( "-2" ); AddProp(); }
void CEntityDlg::OnBnClickedButtonSound() { CPreviewDlg *dlg = ShowSoundChooser(); if (dlg->returnCode == IDOK) { editKey.SetWindowText("s_shader"); editVal.SetWindowText(dlg->mediaName); AddProp(); } }
void CEntityDlg::OnBnClickedButtonParticle() { CPreviewDlg *dlg = ShowParticleChooser(); if (dlg->returnCode == IDOK) { editKey.SetWindowText("model"); editVal.SetWindowText(dlg->mediaName); AddProp(); } }
void CullPropsFromProxies( const int *pStartProps, int nStartProps, int *pOutProps, int nMaxOutProps ) { m_nOutProps = 0; m_pOutProps = pOutProps; m_nMaxOutProps = nMaxOutProps; m_nNewProxyProps = 0; Init(); // This list will have any newly available props written into it. Write a sentinel at the end. m_NewProxyProps[m_nNewProxyProps] = PROP_SENTINEL; int *pCurNewProxyProp = m_NewProxyProps; for ( int i=0; i < nStartProps; i++ ) { int iProp = pStartProps[i]; // Fill in the gaps with any properties that are newly enabled by the proxies. while ( *pCurNewProxyProp < iProp ) { AddProp( *pCurNewProxyProp ); ++pCurNewProxyProp; } // Now write this property's index if the proxies are allowing this property to be written. if ( IsPropProxyValid( iProp ) ) { AddProp( iProp ); // avoid that we add it twice. if ( *pCurNewProxyProp == iProp ) ++pCurNewProxyProp; } } // add any remaining new proxy props while ( *pCurNewProxyProp < PROP_SENTINEL ) { AddProp( *pCurNewProxyProp ); ++pCurNewProxyProp; } }
void CModel::AddAmmoProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry) { AddProp(point, model, objectentry); m_AmmoPropPoint = point; m_AmmoLoadedProp = m_Props.size() - 1; m_Props[m_AmmoLoadedProp].m_Hidden = true; // we only need to invalidate the selection box here if it is based on props and their visibilities if (!m_CustomSelectionShape) m_SelectionBoxValid = false; }
/* ========================= FieldWndProc Just to handle tab and enter... ========================= */ BOOL CALLBACK FieldWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_CHAR: if (LOWORD(wParam) == VK_TAB) return FALSE; if (LOWORD(wParam) == VK_RETURN) return FALSE; if (LOWORD(wParam) == VK_ESCAPE) { SetFocus (g_qeglobals.d_hwndCamera); return FALSE; } break; case WM_KEYDOWN: if (LOWORD(wParam) == VK_TAB) { if (hwnd == hwndEnt[EntKeyField]) { SendMessage (hwndEnt[EntValueField], WM_SETTEXT, 0, (long)""); SetFocus (hwndEnt[EntValueField]); } else SetFocus (hwndEnt[EntKeyField]); } if (LOWORD(wParam) == VK_RETURN) { if (hwnd == hwndEnt[EntKeyField]) { SendMessage (hwndEnt[EntValueField], WM_SETTEXT, 0, (long)""); SetFocus (hwndEnt[EntValueField]); } else { AddProp (); SetFocus (g_qeglobals.d_hwndCamera); } } break; // case WM_NCHITTEST: case WM_LBUTTONDOWN: SetFocus (hwnd); break; } return CallWindowProc (OldFieldWindowProc, hwnd, uMsg, wParam, lParam); }
bool Node::RoutePureRandom(Message &m, string &nextNode) { nextNode = ""; if(!IsProp(INPATH)) AddProp(INPATH); m.AddNodeToPath(Name); //Add Current node to path for tracking purposes only string neighbor; if(Neighbors.size() > 1) { //srand((uint)time(NULL)); auto it = Neighbors.begin(); std::advance(it, rand() % Neighbors.size()); neighbor = it->first; } else if(Neighbors.size() == 1) neighbor = Neighbors.begin()->first; return !nextNode.empty(); }
void CEntityDlg::OnBnClickedButtonCurve() { CCurveDlg dlg; if ( dlg.DoModal() == IDOK ) { if ( editEntity ) { idStr str = "curve_" + dlg.strCurveType; editKey.SetWindowText( str ); idVec3 org = editEntity->origin; str = "3 ( "; str += org.ToString(); org.x += 64; str += " "; str += org.ToString(); org.y += 64; str += " "; str += org.ToString(); str += " )"; editVal.SetWindowText( str ); AddProp(); Entity_SetCurveData( editEntity ); } } }
SceneryObject* SceneryZone::ReplaceProp(const SceneryObject& prop) { //Search the zone for the prop, since the coordinates on edited props may be in a different page. SceneryObject *oldProp = GetPropPtr(prop.ID, NULL); if(oldProp == NULL) { //g_Log.AddMessageFormat("Prop not found(%d,%s)", prop.ID, prop.Asset); return NULL; } SceneryPageKey newKey; SceneryPageKey oldKey; SetPageKeyFromProp(newKey, prop); SetPageKeyFromProp(oldKey, *oldProp); SceneryPage *oldPage = GetOrCreatePage(oldKey); if(oldPage == NULL) { //g_Log.AddMessageFormat("Page not found (%d,%d)", oldKey.x, oldKey.y); return NULL; } if(oldKey.Compare(newKey) == true) { //g_Log.AddMessage("Replaced prop."); oldProp->copyFrom(&prop); oldPage->NotifyAccess(true); return oldProp; } else { //g_Log.AddMessage("Delete and created new."); oldPage->DeleteProp(prop.ID); return AddProp(prop, true); } return NULL; }
/* handle all WM_COMMAND messages here */ LONG WINAPI CommandHandler ( HWND hWnd, WPARAM wParam, LPARAM lParam) { HMENU hMenu; switch (LOWORD(wParam)) { // // file menu // case ID_FILE_EXIT: /* exit application */ if (!ConfirmModified()) return TRUE; PostMessage (hWnd, WM_CLOSE, 0, 0L); break; case ID_FILE_OPEN: if (!ConfirmModified()) return TRUE; OpenDialog (); break; case ID_FILE_NEW: if (!ConfirmModified()) return TRUE; Map_New (); break; case ID_FILE_SAVE: if (!strcmp(currentmap, "unnamed.map")) SaveAsDialog (); else Map_SaveFile (currentmap, false); // ignore region break; case ID_FILE_SAVEAS: SaveAsDialog (); break; case ID_FILE_LOADPROJECT: if (!ConfirmModified()) return TRUE; ProjectDialog (); break; case ID_FILE_POINTFILE: if (g_qeglobals.d_pointfile_display_list) Pointfile_Clear (); else Pointfile_Check (); break; // // view menu // case ID_VIEW_ENTITY: SetInspectorMode(W_ENTITY); break; case ID_VIEW_CONSOLE: SetInspectorMode(W_CONSOLE); break; case ID_VIEW_TEXTURE: SetInspectorMode(W_TEXTURE); break; case ID_VIEW_100: g_qeglobals.d_xy.scale = 1; Sys_UpdateWindows (W_XY|W_XY_OVERLAY); break; case ID_VIEW_ZOOMIN: g_qeglobals.d_xy.scale *= 5.0/4; if (g_qeglobals.d_xy.scale > 16) g_qeglobals.d_xy.scale = 16; Sys_UpdateWindows (W_XY|W_XY_OVERLAY); break; case ID_VIEW_ZOOMOUT: g_qeglobals.d_xy.scale *= 4.0/5; if (g_qeglobals.d_xy.scale < 0.1) g_qeglobals.d_xy.scale = 0.1; Sys_UpdateWindows (W_XY|W_XY_OVERLAY); break; case ID_VIEW_Z100: z.scale = 1; Sys_UpdateWindows (W_Z|W_Z_OVERLAY); break; case ID_VIEW_ZZOOMIN: z.scale *= 5.0/4; if (z.scale > 4) z.scale = 4; Sys_UpdateWindows (W_Z|W_Z_OVERLAY); break; case ID_VIEW_ZZOOMOUT: z.scale *= 4.0/5; if (z.scale < 0.125) z.scale = 0.125; Sys_UpdateWindows (W_Z|W_Z_OVERLAY); break; case ID_VIEW_CENTER: camera.angles[ROLL] = camera.angles[PITCH] = 0; camera.angles[YAW] = 22.5 * floor( (camera.angles[YAW]+11)/22.5 ); Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY); break; case ID_VIEW_UPFLOOR: Cam_ChangeFloor (true); break; case ID_VIEW_DOWNFLOOR: Cam_ChangeFloor (false); break; case ID_VIEW_SHOWNAMES: g_qeglobals.d_savedinfo.show_names = !g_qeglobals.d_savedinfo.show_names; CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWNAMES, MF_BYCOMMAND | (g_qeglobals.d_savedinfo.show_names ? MF_CHECKED : MF_UNCHECKED) ); Map_BuildBrushData(); Sys_UpdateWindows (W_XY); break; case ID_VIEW_SHOWCOORDINATES: g_qeglobals.d_savedinfo.show_coordinates ^= 1; CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWCOORDINATES, MF_BYCOMMAND | (g_qeglobals.d_savedinfo.show_coordinates ? MF_CHECKED : MF_UNCHECKED) ); Sys_UpdateWindows (W_XY); break; case ID_VIEW_SHOWBLOCKS: g_qeglobals.show_blocks ^= 1; CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWBLOCKS, MF_BYCOMMAND | (g_qeglobals.show_blocks ? MF_CHECKED : MF_UNCHECKED) ); Sys_UpdateWindows (W_XY); break; case ID_VIEW_SHOWLIGHTS: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_LIGHTS ) & EXCLUDE_LIGHTS ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWLIGHTS, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWPATH: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_PATHS ) & EXCLUDE_PATHS ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWPATH, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWENT: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_ENT ) & EXCLUDE_ENT ) CheckMenuItem( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWENT, MF_BYCOMMAND | MF_UNCHECKED); else CheckMenuItem( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWENT, MF_BYCOMMAND | MF_CHECKED); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWWATER: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_WATER ) & EXCLUDE_WATER ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWATER, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWCLIP: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_CLIP ) & EXCLUDE_CLIP ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWCLIP, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWDETAIL: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_DETAIL ) & EXCLUDE_DETAIL ) { CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWDETAIL, MF_BYCOMMAND | MF_UNCHECKED ); SetWindowText (g_qeglobals.d_hwndCamera, "Camera View (DETAIL EXCLUDED)"); } else { CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWDETAIL, MF_BYCOMMAND | MF_CHECKED ); SetWindowText (g_qeglobals.d_hwndCamera, "Camera View"); } Sys_UpdateWindows (W_XY|W_CAMERA); break; case ID_VIEW_SHOWWORLD: if ( ( g_qeglobals.d_savedinfo.exclude ^= EXCLUDE_WORLD ) & EXCLUDE_WORLD ) CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_UNCHECKED ); else CheckMenuItem ( GetMenu(g_qeglobals.d_hwndMain), ID_VIEW_SHOWWORLD, MF_BYCOMMAND | MF_CHECKED ); Sys_UpdateWindows (W_XY|W_CAMERA); break; // // grid menu // case ID_GRID_1: case ID_GRID_2: case ID_GRID_4: case ID_GRID_8: case ID_GRID_16: case ID_GRID_32: case ID_GRID_64: { hMenu = GetMenu(hWnd); CheckMenuItem(hMenu, ID_GRID_1, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_2, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_4, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_8, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_16, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_32, MF_BYCOMMAND | MF_UNCHECKED); CheckMenuItem(hMenu, ID_GRID_64, MF_BYCOMMAND | MF_UNCHECKED); switch (LOWORD(wParam)) { case ID_GRID_1: g_qeglobals.d_gridsize = 0; break; case ID_GRID_2: g_qeglobals.d_gridsize = 1; break; case ID_GRID_4: g_qeglobals.d_gridsize = 2; break; case ID_GRID_8: g_qeglobals.d_gridsize = 3; break; case ID_GRID_16: g_qeglobals.d_gridsize = 4; break; case ID_GRID_32: g_qeglobals.d_gridsize = 5; break; case ID_GRID_64: g_qeglobals.d_gridsize = 6; break; } g_qeglobals.d_gridsize = 1 << g_qeglobals.d_gridsize; CheckMenuItem(hMenu, LOWORD(wParam), MF_BYCOMMAND | MF_CHECKED); Sys_UpdateWindows (W_XY|W_Z); break; } // // texture menu // case ID_VIEW_NEAREST: case ID_VIEW_NEARESTMIPMAP: case ID_VIEW_LINEAR: case ID_VIEW_BILINEAR: case ID_VIEW_BILINEARMIPMAP: case ID_VIEW_TRILINEAR: case ID_TEXTURES_WIREFRAME: case ID_TEXTURES_FLATSHADE: Texture_SetMode (LOWORD(wParam)); break; case ID_TEXTURES_SHOWINUSE: Sys_BeginWait (); Texture_ShowInuse (); SetInspectorMode(W_TEXTURE); break; case ID_TEXTURES_INSPECTOR: DoSurface (); break; case CMD_TEXTUREWAD: case CMD_TEXTUREWAD+1: case CMD_TEXTUREWAD+2: case CMD_TEXTUREWAD+3: case CMD_TEXTUREWAD+4: case CMD_TEXTUREWAD+5: case CMD_TEXTUREWAD+6: case CMD_TEXTUREWAD+7: case CMD_TEXTUREWAD+8: case CMD_TEXTUREWAD+9: case CMD_TEXTUREWAD+10: case CMD_TEXTUREWAD+11: case CMD_TEXTUREWAD+12: case CMD_TEXTUREWAD+13: case CMD_TEXTUREWAD+14: case CMD_TEXTUREWAD+15: case CMD_TEXTUREWAD+16: case CMD_TEXTUREWAD+17: case CMD_TEXTUREWAD+18: case CMD_TEXTUREWAD+19: case CMD_TEXTUREWAD+20: case CMD_TEXTUREWAD+21: case CMD_TEXTUREWAD+22: case CMD_TEXTUREWAD+23: case CMD_TEXTUREWAD+24: case CMD_TEXTUREWAD+25: case CMD_TEXTUREWAD+26: case CMD_TEXTUREWAD+27: case CMD_TEXTUREWAD+28: case CMD_TEXTUREWAD+29: case CMD_TEXTUREWAD+30: case CMD_TEXTUREWAD+31: Sys_BeginWait (); Texture_ShowDirectory (LOWORD(wParam)); SetInspectorMode(W_TEXTURE); break; // // bsp menu // case CMD_BSPCOMMAND: case CMD_BSPCOMMAND+1: case CMD_BSPCOMMAND+2: case CMD_BSPCOMMAND+3: case CMD_BSPCOMMAND+4: case CMD_BSPCOMMAND+5: case CMD_BSPCOMMAND+6: case CMD_BSPCOMMAND+7: case CMD_BSPCOMMAND+8: case CMD_BSPCOMMAND+9: case CMD_BSPCOMMAND+10: case CMD_BSPCOMMAND+11: case CMD_BSPCOMMAND+12: case CMD_BSPCOMMAND+13: case CMD_BSPCOMMAND+14: case CMD_BSPCOMMAND+15: case CMD_BSPCOMMAND+16: case CMD_BSPCOMMAND+17: case CMD_BSPCOMMAND+18: case CMD_BSPCOMMAND+19: case CMD_BSPCOMMAND+20: case CMD_BSPCOMMAND+21: case CMD_BSPCOMMAND+22: case CMD_BSPCOMMAND+23: case CMD_BSPCOMMAND+24: case CMD_BSPCOMMAND+25: case CMD_BSPCOMMAND+26: case CMD_BSPCOMMAND+27: case CMD_BSPCOMMAND+28: case CMD_BSPCOMMAND+29: case CMD_BSPCOMMAND+30: case CMD_BSPCOMMAND+31: { extern char *bsp_commands[256]; RunBsp (bsp_commands[LOWORD(wParam-CMD_BSPCOMMAND)]); } break; // // misc menu // case ID_MISC_BENCHMARK: SendMessage ( g_qeglobals.d_hwndCamera, WM_USER+267, 0, 0); break; case ID_TEXTUREBK: DoColor(COLOR_TEXTUREBACK); Sys_UpdateWindows (W_ALL); break; case ID_MISC_SELECTENTITYCOLOR: { extern int inspector_mode; if ( ( inspector_mode == W_ENTITY ) && DoColor(COLOR_ENTITY) == true ) { extern void AddProp( void ); char buffer[100]; sprintf( buffer, "%f %f %f", g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][0], g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][1], g_qeglobals.d_savedinfo.colors[COLOR_ENTITY][2] ); SetWindowText( hwndEnt[EntValueField], buffer ); SetWindowText( hwndEnt[EntKeyField], "_color" ); AddProp(); } Sys_UpdateWindows( W_ALL ); } break; case ID_MISC_PRINTXY: WXY_Print(); break; case ID_COLORS_XYBK: DoColor(COLOR_GRIDBACK); Sys_UpdateWindows (W_ALL); break; case ID_COLORS_MAJOR: DoColor(COLOR_GRIDMAJOR); Sys_UpdateWindows (W_ALL); break; case ID_COLORS_MINOR: DoColor(COLOR_GRIDMINOR); Sys_UpdateWindows (W_ALL); break; case ID_MISC_GAMMA: DoGamma(); break; case ID_MISC_FINDBRUSH: DoFind(); break; case ID_MISC_NEXTLEAKSPOT: Pointfile_Next(); break; case ID_MISC_PREVIOUSLEAKSPOT: Pointfile_Prev(); break; // // brush menu // case ID_BRUSH_3SIDED: Brush_MakeSided (3); break; case ID_BRUSH_4SIDED: Brush_MakeSided (4); break; case ID_BRUSH_5SIDED: Brush_MakeSided (5); break; case ID_BRUSH_6SIDED: Brush_MakeSided (6); break; case ID_BRUSH_7SIDED: Brush_MakeSided (7); break; case ID_BRUSH_8SIDED: Brush_MakeSided (8); break; case ID_BRUSH_9SIDED: Brush_MakeSided (9); break; case ID_BRUSH_ARBITRARYSIDED: DoSides (); break; // // select menu // case ID_BRUSH_FLIPX: Select_FlipAxis (0); break; case ID_BRUSH_FLIPY: Select_FlipAxis (1); break; case ID_BRUSH_FLIPZ: Select_FlipAxis (2); break; case ID_BRUSH_ROTATEX: Select_RotateAxis (0, 90); break; case ID_BRUSH_ROTATEY: Select_RotateAxis (1, 90); break; case ID_BRUSH_ROTATEZ: Select_RotateAxis (2, 90); break; case ID_SELECTION_ARBITRARYROTATION: DoRotate (); break; case ID_SELECTION_UNGROUPENTITY: Select_Ungroup (); break; case ID_SELECTION_CONNECT: ConnectEntities (); break; case ID_SELECTION_DRAGVERTECIES: if (g_qeglobals.d_select_mode == sel_vertex) { g_qeglobals.d_select_mode = sel_brush; Sys_UpdateWindows (W_ALL); } else { SetupVertexSelection (); if (g_qeglobals.d_numpoints) g_qeglobals.d_select_mode = sel_vertex; } break; case ID_SELECTION_DRAGEDGES: if (g_qeglobals.d_select_mode == sel_edge) { g_qeglobals.d_select_mode = sel_brush; Sys_UpdateWindows (W_ALL); } else { SetupVertexSelection (); if (g_qeglobals.d_numpoints) g_qeglobals.d_select_mode = sel_edge; } break; case ID_SELECTION_SELECTPARTIALTALL: Select_PartialTall (); break; case ID_SELECTION_SELECTCOMPLETETALL: Select_CompleteTall (); break; case ID_SELECTION_SELECTTOUCHING: Select_Touching (); break; case ID_SELECTION_SELECTINSIDE: Select_Inside (); break; case ID_SELECTION_CSGSUBTRACT: CSG_Subtract (); break; case ID_SELECTION_MAKEHOLLOW: CSG_MakeHollow (); break; case ID_SELECTION_CLONE: Select_Clone (); break; case ID_SELECTION_DELETE: Select_Delete (); break; case ID_SELECTION_DESELECT: Select_Deselect (); break; case ID_SELECTION_MAKE_DETAIL: Select_MakeDetail (); break; case ID_SELECTION_MAKE_STRUCTURAL: Select_MakeStructural (); break; // // region menu // case ID_REGION_OFF: Map_RegionOff (); break; case ID_REGION_SETXY: Map_RegionXY (); break; case ID_REGION_SETTALLBRUSH: Map_RegionTallBrush (); break; case ID_REGION_SETBRUSH: Map_RegionBrush (); break; case ID_REGION_SETSELECTION: Map_RegionSelectedBrushes (); break; case IDMRU+1: case IDMRU+2: case IDMRU+3: case IDMRU+4: case IDMRU+5: case IDMRU+6: case IDMRU+7: case IDMRU+8: case IDMRU+9: DoMru(hWnd,LOWORD(wParam)); break; // // help menu // case ID_HELP_ABOUT: DoAbout(); break; default: return FALSE; } return TRUE; }
void SceneryPage::LoadSceneryFromFile(const char *fileName) { FileReader3 fr; if(fr.OpenFile(fileName) != FileReader3::SUCCESS) { //g_Log.AddMessageFormat("Could not open file to load scenery: [%s]", fileName); return; } fr.SetCommentChar(';'); SceneryObject prop; int propertyIndex = 0; int linkIndex = 0; while(fr.Readable() == true) { int r = fr.ReadLine(); if(r == 0) continue; r = fr.MultiBreak("=,"); fr.BlockToStringC(0, FileReader3::CASE_UPPER); if(strcmp(fr.CopyBuffer, "[ENTRY]") == 0) { if(prop.ID != 0) { if(prop.Name[0] == 0) prop.SetName("Untitled"); AddProp(prop, false); } prop.Clear(); propertyIndex = 0; linkIndex = 0; } else if(strcmp(fr.CopyBuffer, "ID") == 0) prop.ID = fr.BlockToIntC(1); else if(strcmp(fr.CopyBuffer, "ASSET") == 0) { //The asset string needs to be single broken. fr.SingleBreak("="); prop.SetAsset(fr.BlockToStringC(1)); } else if(strcmp(fr.CopyBuffer, "NAME") == 0) prop.SetName(fr.BlockToStringC(1, 0)); else if(strcmp(fr.CopyBuffer, "POS") == 0) { prop.LocationX = fr.BlockToFloatC(1); prop.LocationY = fr.BlockToFloatC(2); prop.LocationZ = fr.BlockToFloatC(3); } else if(strcmp(fr.CopyBuffer, "ORIENT") == 0) { prop.QuatX = fr.BlockToFloatC(1); prop.QuatY = fr.BlockToFloatC(2); prop.QuatZ = fr.BlockToFloatC(3); prop.QuatW = fr.BlockToFloatC(4); } else if(strcmp(fr.CopyBuffer, "SCALE") == 0) { prop.ScaleX = fr.BlockToFloatC(1); prop.ScaleY = fr.BlockToFloatC(2); prop.ScaleZ = fr.BlockToFloatC(3); } else if(strcmp(fr.CopyBuffer, "FLAGS") == 0) prop.Flags = fr.BlockToIntC(1); else if(strcmp(fr.CopyBuffer, "LAYER") == 0) prop.Layer = fr.BlockToIntC(1); else if(strcmp(fr.CopyBuffer, "PATROLSPEED") == 0) prop.patrolSpeed = fr.BlockToIntC(1); else if(strcmp(fr.CopyBuffer, "PATROLEVENT") == 0) prop.SetPatrolEvent(fr.BlockToStringC(1)); else if(strcmp(fr.CopyBuffer, "PROPS_COUNT") == 0) prop.SetPropertyCount(fr.BlockToIntC(1)); else if(strcmp(fr.CopyBuffer, "PROPERTY") == 0) { //Calling BlockToStringC() overwrites the previous copy, so we need yet another //copy buffer to hold one parameter while we get another. char buffer[256]; Util::SafeCopy(buffer, fr.BlockToStringC(1), sizeof(buffer)); prop.SetProperty(propertyIndex++, buffer, fr.BlockToIntC(2), fr.BlockToStringC(3)); } else if(strcmp(fr.CopyBuffer, "LINKS_COUNT") == 0) prop.SetLinkCount(fr.BlockToIntC(1)); else if(strcmp(fr.CopyBuffer, "LINK") == 0) { int propID = fr.BlockToIntC(1); int linkType = fr.BlockToIntC(2); if(propID != 0) //Fix to prevent null props. prop.SetLink(linkIndex++, propID, linkType); } else if(strcmp(fr.CopyBuffer, "FACING") == 0) { //Degree rotation facing is generated by the log rips and is used //to more easily spawn creatures with predetermined directional //facings rather than trying to look at the quaternion rotation of //the spawnpoint prop itself. if(prop.CreateExtraData() == true) prop.extraData->facing = fr.BlockToIntC(1); } else if(prop.IsExtendedProperty(fr.BlockToStringC(0)) == true) { char buffer[256]; Util::SafeCopy(buffer, fr.CopyBuffer, sizeof(buffer)); prop.SetExtendedProperty(buffer, fr.BlockToStringC(1)); } //BEGIN DEPRECATED, PROVIDED FOR COMPATIBILITY WITH OLD FILES else if(strcmp(fr.CopyBuffer, "PX") == 0) prop.LocationX = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "PY") == 0) prop.LocationY = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "PZ") == 0) prop.LocationZ = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "QX") == 0) prop.QuatX = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "QY") == 0) prop.QuatY = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "QZ") == 0) prop.QuatZ = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "QW") == 0) prop.QuatW = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "SX") == 0) prop.ScaleX = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "SY") == 0) prop.ScaleY = fr.BlockToFloatC(1); else if(strcmp(fr.CopyBuffer, "SZ") == 0) prop.ScaleZ = fr.BlockToFloatC(1); //END DEPRECATED } if(prop.ID != 0) { if(prop.Name[0] == 0) prop.SetName("Untitled"); AddProp(prop, false); } fr.CloseFile(); mHasSourceFile = true; //g_Log.AddMessageFormat("Loaded scenery file: [%s]", fileName); }
BOOL CEntityDlg::PreTranslateMessage(MSG* pMsg) { // ---> sikk - Added //if ( pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_RBUTTONDOWN || pMsg->message == WM_MBUTTONDOWN ) { // g_Inspectors->BringWindowToTop(); //} // <--- sikk - Added if (pMsg->hwnd == editVal.GetSafeHwnd()) { if (pMsg->message == WM_LBUTTONDOWN) { editVal.SetFocus(); // return TRUE; // sikk - Don't return so we can do default message handling } } if (pMsg->hwnd == editKey.GetSafeHwnd()) { if (pMsg->message == WM_LBUTTONDOWN) { editKey.SetFocus(); // return TRUE; // sikk - Don't return so we can do default message handling } } if (GetFocus() == &editVal || GetFocus() == &editKey) { if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) { AddProp(); return TRUE; } } if (GetFocus() == listKeyVal.GetEditBox()) { if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) { listKeyVal.OnChangeEditBox(); listKeyVal.OnSelchange(); listKeyVal.OnKillfocusEditBox(); AddProp(); SetKeyValPairs(); return TRUE; } } if (GetFocus() == &listKeyVal) { if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE && editEntity) { DelProp(); return TRUE; } } if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) { if (pMsg->wParam == VK_ESCAPE) { g_pParentWnd->GetCamera()->SetFocus(); Select_Deselect(); } return TRUE; } if ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) { // keeps ENTER from closing the dialog return TRUE; } if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB) { if (GetFocus()) { int id = GetFocus()->GetDlgCtrlID(); for (int i = 0; i < TabCount; i++) { if (TabOrder[i] == id) { i++; if (i >= TabCount) { i = 0; } CWnd *next = GetDlgItem(TabOrder[i]); if (next) { next->SetFocus(); if (TabOrder[i] == IDC_EDIT_VAL) { editVal.SetSel(0, -1); } return TRUE; } } } } } if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RIGHT && pMsg->hwnd == slFrameSlider.GetSafeHwnd()) { int pos = slFrameSlider.GetPos() + 1; pos = (pos % slFrameSlider.GetRangeMax()); slFrameSlider.SetPos ( pos ); UpdateFromAnimationFrame (); return TRUE; } if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_LEFT && pMsg->hwnd == slFrameSlider.GetSafeHwnd()) { int pos = slFrameSlider.GetPos() - 1; if ( pos < 1 ) { pos = slFrameSlider.GetRangeMax(); } slFrameSlider.SetPos ( pos ); UpdateFromAnimationFrame (); return TRUE; } return CDialog::PreTranslateMessage(pMsg); }
void Player::DropInventoryItemOnGround(std::shared_ptr<IProp> prop) { auto currentLandmark = GameState::Get().GetCurrentLandmark(); this->RemoveFromInventory(prop); currentLandmark->AddProp(this->GetPositionX(), this->GetPositionY(), prop); }
void AssignModel() { #ifdef QUAKE3 if (strASSIGNMODEL.GetLength()) { SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)"model"); SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM) ((LPCSTR)strASSIGNMODEL));//.GetBuffer(0)); strASSIGNMODEL=""; gEntityToSetBoundsOf = edit_entity; AddProp(); edit_entity->md3Class = NULL; g_pParentWnd->GetXYWnd()->SetFocus(); //----------- #if 1 // brush is currently built at 0 angle, now fake a rotate away and back to fill inthe mins/maxs fields... // SetKeyValue(edit_entity, "angle", "0", false); // tell it that it has no angle, and don't rebuild SetFocus (g_qeglobals.d_hwndCamera); SetKeyValuePairs (); SetKeyValue(edit_entity, "angle", "90", true); // true = rebuild brush, rotate to some other angle SetFocus (g_qeglobals.d_hwndCamera); SetKeyValuePairs (); SetKeyValue(edit_entity, "angle", "0", true); // true = rebuild brush, rotate back to 0 SetFocus (g_qeglobals.d_hwndCamera); SetKeyValuePairs (); #endif //----------- } else #endif { CString strBasePath = ValueForKey(g_qeglobals.d_project_entity, "basepath"); AddSlash(strBasePath); CString strPath = strBasePath; strPath += "models\\mapobjects\\"; CFileDialog dlgFile(TRUE, NULL, NULL, OFN_OVERWRITEPROMPT, "Model files (*.md3)|*.md3||", g_pParentWnd); dlgFile.m_ofn.lpstrInitialDir = strPath; if (dlgFile.DoModal() == IDOK) { SendMessage(hwndEnt[EntKeyField], WM_SETTEXT, 0, (LPARAM)"model"); CString str = dlgFile.GetPathName().GetBuffer(0); str.MakeLower(); strBasePath.MakeLower(); QE_ConvertDOSToUnixName(str.GetBuffer(0), str.GetBuffer(0)); QE_ConvertDOSToUnixName(strBasePath.GetBuffer(0), strBasePath.GetBuffer(0)); int n = str.Find(strBasePath); if (n == 0) { str = str.Right(str.GetLength() - strBasePath.GetLength()); } SendMessage(hwndEnt[EntValueField], WM_SETTEXT, 0, (LPARAM)str.GetBuffer(0)); gEntityToSetBoundsOf = edit_entity; AddProp(); edit_entity->md3Class = NULL; g_pParentWnd->GetXYWnd()->SetFocus(); } } }
vtkActor* PropScene::AddPolyData(std::string name, vtkPolyData *poly) { vtkActor* actor = NewActor(poly); AddProp(name, actor); return actor; }