/* * UserStartDrag: User wants to drag object under mouse pointer. If there is no * object there, do nothing. If there is more than one object, ask user which * one to pick up. If there is exactly one, begin dragging object. */ void UserStartDrag(void) { list_type objects, sel_list, l; int x, y; object_node *obj; /* Find out where in the the room the user clicked on, if anywhere */ if (!MouseToRoom(&x, &y)) return; objects = GetObjects3D(x, y, CLOSE_DISTANCE, OF_GETTABLE | OF_CONTAINER, 0); if (objects == NULL) return; if (objects->next == NULL) { SetCapture(hMain); capture = True; obj = (object_node *) objects->data; drag_object = obj->id; SetMainCursor(LoadCursor(hInst, MAKEINTRESOURCE(IDC_GETCURSOR))); } else { sel_list = DisplayLookList(hMain, GetString(hInst, IDS_GET), objects, LD_SINGLEAUTO); for (l = sel_list; l != NULL; l = l->next) RequestPickup(((room_contents_node *) (l->data))->obj.id); ObjectListDestroy(sel_list); } list_delete(objects); }
/* * MainInit: Called when main window is created. */ BOOL MainInit(HWND hwnd, LPCREATESTRUCT lpCreateStruct) { connection = CON_NONE; state = STATE_INIT; /* Verify that user's hardware is sufficient to run game */ if (!StartupCheck()) exit(1); /* Make standard palette */ hPal = InitializePalette(); InitStandardXlats(hPal); LoadSettings(); MenuDisplaySettings(hwnd); // Load rich edit control DLL and common controls hRichEditLib = LoadLibrary("riched32.dll"); InitCommonControls(); MusicInitialize(); SetMainCursor(LoadCursor(NULL, IDC_ARROW)); // Find default Web browser, if not set manually if (config.default_browser) WebFindDefaultBrowser(); return TRUE; }
/* * InventoryLButtonDown: User pressed left mouse button on inventory box. */ void InventoryLButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) { if (fDoubleClick) { InventoryKey(hwnd, VK_LDBLCLK, True, 0, keyFlags); return; } // Set cursor to correct place if (InventoryClick(hwnd, fDoubleClick, x, y, keyFlags)) { // Handle user action InventoryKey(hwnd, VK_LBUTTON, True, 0, keyFlags); SetCapture(hwndInv); capture = True; SetMainCursor(LoadCursor(cinfo->hInst, MAKEINTRESOURCE(IDC_DROPCURSOR))); } }