int CMMDesktop::PlayLevel(int restart) { CGUIListItem *li = levBrowser->GetSelectedItem(); if (li) { return PlayLevel(li->GetData(), restart); } return 0; }
void MapEditor() { int key; clear(); ShowEditorWindow(); editing_terrain=FALSE; FillMap(); editing_terrain=TRUE; FillMap(); LoadLevel(); ShowEditorMap(); ShowEditorWindow(); mouse_on(ALL_MOUSE_EVENTS); nodelay(stdscr,TRUE); cbreak(); for(;;) { key=getch(); request_mouse_pos(); if (mouse_active && (MOUSE_X_POS!=cursor_x || MOUSE_Y_POS!=cursor_y)) { curs_set(0); EditorMoveCursor(MOUSE_X_POS,MOUSE_Y_POS); curs_set(2); } switch(key) { case KEY_F0+1: editing_terrain=TRUE; ShowEditorWindow(); break; case KEY_F0+2: editing_terrain=FALSE; ShowEditorWindow(); break; case KEY_F0+5: clear(); PlayLevel(); ClearAfterPlaying(); ShowEditorWindow(); mouse_on(ALL_MOUSE_EVENTS); nodelay(stdscr,TRUE); cbreak(); break; case KEY_F0+8: SaveLevel(); break; case KEY_F0+9: LoadLevel(); ShowEditorMap(); ShowEditorWindow(); break; case KEY_F0+12: FillMap(); break; case KEY_MOVE_LEFT: EditorMoveCursor(cursor_x-1,cursor_y); break; case KEY_MOVE_RIGHT: EditorMoveCursor(cursor_x+1,cursor_y); break; case KEY_MOVE_UP: EditorMoveCursor(cursor_x,cursor_y-1); break; case KEY_MOVE_DOWN: EditorMoveCursor(cursor_x,cursor_y+1); break; case KEY_MOUSE: case KEY_ACTION: curs_set(0); EditorAction(); move(cursor_y,cursor_x); curs_set(2); } } }