ui.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 3; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // All rights reserved.
  5. //
  6. // This file is part of SDLPAL.
  7. //
  8. // SDLPAL is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #include "main.h"
  22. LPSPRITE gpSpriteUI = NULL;
  23. INT
  24. PAL_InitUI(
  25. VOID
  26. )
  27. /*++
  28. Purpose:
  29. Initialze the UI subsystem.
  30. Parameters:
  31. None.
  32. Return value:
  33. 0 = success, -1 = fail.
  34. --*/
  35. {
  36. int iSize;
  37. //
  38. // Load the UI sprite.
  39. //
  40. iSize = PAL_MKFGetChunkSize(CHUNKNUM_SPRITEUI, gpGlobals->f.fpDATA);
  41. if (iSize < 0)
  42. {
  43. return -1;
  44. }
  45. gpSpriteUI = (LPSPRITE)calloc(1, iSize);
  46. if (gpSpriteUI == NULL)
  47. {
  48. return -1;
  49. }
  50. PAL_MKFReadChunk(gpSpriteUI, iSize, CHUNKNUM_SPRITEUI, gpGlobals->f.fpDATA);
  51. return 0;
  52. }
  53. VOID
  54. PAL_FreeUI(
  55. VOID
  56. )
  57. /*++
  58. Purpose:
  59. Shutdown the UI subsystem.
  60. Parameters:
  61. None.
  62. Return value:
  63. None.
  64. --*/
  65. {
  66. if (gpSpriteUI != NULL)
  67. {
  68. free(gpSpriteUI);
  69. gpSpriteUI = NULL;
  70. }
  71. }
  72. LPBOX
  73. PAL_CreateBox(
  74. PAL_POS pos,
  75. INT nRows,
  76. INT nColumns,
  77. INT iStyle,
  78. BOOL fSaveScreen
  79. )
  80. /*++
  81. Purpose:
  82. Create a box on the screen.
  83. Parameters:
  84. [IN] pos - position of the box.
  85. [IN] nRows - number of rows of the box.
  86. [IN] nColumns - number of columns of the box.
  87. [IN] iStyle - style of the box (0 or 1).
  88. [IN] fSaveScreen - whether save the used screen area or not.
  89. Return value:
  90. Pointer to a BOX structure. NULL if failed.
  91. If fSaveScreen is false, then always returns NULL.
  92. --*/
  93. {
  94. int i, j, x, m, n;
  95. LPCBITMAPRLE rglpBorderBitmap[3][3];
  96. LPBOX lpBox = NULL;
  97. SDL_Surface *save;
  98. SDL_Rect rect;
  99. //
  100. // Get the bitmaps
  101. //
  102. for (i = 0; i < 3; i++)
  103. {
  104. for (j = 0; j < 3; j++)
  105. {
  106. rglpBorderBitmap[i][j] = PAL_SpriteGetFrame(gpSpriteUI, i * 3 + j + iStyle * 9);
  107. }
  108. }
  109. rect.x = PAL_X(pos);
  110. rect.y = PAL_Y(pos);
  111. rect.w = 0;
  112. rect.h = 0;
  113. //
  114. // Get the total width and total height of the box
  115. //
  116. for (i = 0; i < 3; i++)
  117. {
  118. if (i == 1)
  119. {
  120. rect.w += PAL_RLEGetWidth(rglpBorderBitmap[0][i]) * nColumns;
  121. rect.h += PAL_RLEGetHeight(rglpBorderBitmap[i][0]) * nRows;
  122. }
  123. else
  124. {
  125. rect.w += PAL_RLEGetWidth(rglpBorderBitmap[0][i]);
  126. rect.h += PAL_RLEGetHeight(rglpBorderBitmap[i][0]);
  127. }
  128. }
  129. if (fSaveScreen)
  130. {
  131. //
  132. // Save the used part of the screen
  133. //
  134. save = SDL_CreateRGBSurface(gpScreen->flags, rect.w, rect.h, 8,
  135. gpScreen->format->Rmask, gpScreen->format->Gmask,
  136. gpScreen->format->Bmask, gpScreen->format->Amask);
  137. if (save == NULL)
  138. {
  139. return NULL;
  140. }
  141. lpBox = (LPBOX)calloc(1, sizeof(BOX));
  142. if (lpBox == NULL)
  143. {
  144. SDL_FreeSurface(save);
  145. return NULL;
  146. }
  147. SDL_BlitSurface(gpScreen, &rect, save, NULL);
  148. lpBox->lpSavedArea = save;
  149. lpBox->pos = pos;
  150. lpBox->wWidth = rect.w;
  151. lpBox->wHeight = rect.h;
  152. }
  153. //
  154. // Border takes 2 additional rows and columns...
  155. //
  156. nRows += 2;
  157. nColumns += 2;
  158. //
  159. // Draw the box
  160. //
  161. for (i = 0; i < nRows; i++)
  162. {
  163. x = rect.x;
  164. m = (i == 0) ? 0 : ((i == nRows - 1) ? 2 : 1);
  165. for (j = 0; j < nColumns; j++)
  166. {
  167. n = (j == 0) ? 0 : ((j == nColumns - 1) ? 2 : 1);
  168. PAL_RLEBlitToSurface(rglpBorderBitmap[m][n], gpScreen, PAL_XY(x, rect.y));
  169. x += PAL_RLEGetWidth(rglpBorderBitmap[m][n]);
  170. }
  171. rect.y += PAL_RLEGetHeight(rglpBorderBitmap[m][0]);
  172. }
  173. return lpBox;
  174. }
  175. LPBOX
  176. PAL_CreateSingleLineBox(
  177. PAL_POS pos,
  178. INT nLen,
  179. BOOL fSaveScreen
  180. )
  181. /*++
  182. Purpose:
  183. Create a single-line box on the screen.
  184. Parameters:
  185. [IN] pos - position of the box.
  186. [IN] nLen - length of the box.
  187. [IN] fSaveScreen - whether save the used screen area or not.
  188. Return value:
  189. Pointer to a BOX structure. NULL if failed.
  190. If fSaveScreen is false, then always returns NULL.
  191. --*/
  192. {
  193. static const int iNumLeftSprite = 44;
  194. static const int iNumMidSprite = 45;
  195. static const int iNumRightSprite = 46;
  196. LPCBITMAPRLE lpBitmapLeft;
  197. LPCBITMAPRLE lpBitmapMid;
  198. LPCBITMAPRLE lpBitmapRight;
  199. SDL_Surface *save;
  200. SDL_Rect rect;
  201. LPBOX lpBox = NULL;
  202. int i;
  203. //
  204. // Get the bitmaps
  205. //
  206. lpBitmapLeft = PAL_SpriteGetFrame(gpSpriteUI, iNumLeftSprite);
  207. lpBitmapMid = PAL_SpriteGetFrame(gpSpriteUI, iNumMidSprite);
  208. lpBitmapRight = PAL_SpriteGetFrame(gpSpriteUI, iNumRightSprite);
  209. rect.x = PAL_X(pos);
  210. rect.y = PAL_Y(pos);
  211. //
  212. // Get the total width and total height of the box
  213. //
  214. rect.w = PAL_RLEGetWidth(lpBitmapLeft) + PAL_RLEGetWidth(lpBitmapRight);
  215. rect.w += PAL_RLEGetWidth(lpBitmapMid) * nLen;
  216. rect.h = PAL_RLEGetHeight(lpBitmapLeft);
  217. if (fSaveScreen)
  218. {
  219. //
  220. // Save the used part of the screen
  221. //
  222. save = SDL_CreateRGBSurface(gpScreen->flags, rect.w, rect.h, 8,
  223. gpScreen->format->Rmask, gpScreen->format->Gmask,
  224. gpScreen->format->Bmask, gpScreen->format->Amask);
  225. if (save == NULL)
  226. {
  227. return NULL;
  228. }
  229. lpBox = (LPBOX)calloc(1, sizeof(BOX));
  230. if (lpBox == NULL)
  231. {
  232. SDL_FreeSurface(gpScreen);
  233. return NULL;
  234. }
  235. SDL_BlitSurface(gpScreen, &rect, save, NULL);
  236. lpBox->pos = pos;
  237. lpBox->lpSavedArea = save;
  238. lpBox->wHeight = (WORD)rect.w;
  239. lpBox->wWidth = (WORD)rect.h;
  240. }
  241. //
  242. // Draw the box
  243. //
  244. PAL_RLEBlitToSurface(lpBitmapLeft, gpScreen, pos);
  245. rect.x += PAL_RLEGetWidth(lpBitmapLeft);
  246. for (i = 0; i < nLen; i++)
  247. {
  248. PAL_RLEBlitToSurface(lpBitmapMid, gpScreen, PAL_XY(rect.x, rect.y));
  249. rect.x += PAL_RLEGetWidth(lpBitmapMid);
  250. }
  251. PAL_RLEBlitToSurface(lpBitmapRight, gpScreen, PAL_XY(rect.x, rect.y));
  252. return lpBox;
  253. }
  254. VOID
  255. PAL_DeleteBox(
  256. LPBOX lpBox
  257. )
  258. /*++
  259. Purpose:
  260. Delete a box and restore the saved part of the screen.
  261. Parameters:
  262. [IN] lpBox - pointer to the BOX struct.
  263. Return value:
  264. None.
  265. --*/
  266. {
  267. SDL_Rect rect;
  268. //
  269. // Check for NULL pointer.
  270. //
  271. if (lpBox == NULL)
  272. {
  273. return;
  274. }
  275. //
  276. // Restore the saved screen part
  277. //
  278. rect.x = PAL_X(lpBox->pos);
  279. rect.y = PAL_Y(lpBox->pos);
  280. rect.w = lpBox->wWidth;
  281. rect.h = lpBox->wHeight;
  282. SDL_BlitSurface(lpBox->lpSavedArea, NULL, gpScreen, &rect);
  283. //
  284. // Free the memory used by the box
  285. //
  286. SDL_FreeSurface(lpBox->lpSavedArea);
  287. free(lpBox);
  288. }
  289. WORD
  290. PAL_ReadMenu(
  291. LPITEMCHANGED_CALLBACK lpfnMenuItemChanged,
  292. LPMENUITEM rgMenuItem,
  293. INT nMenuItem,
  294. WORD wDefaultItem,
  295. BYTE bLabelColor
  296. )
  297. /*++
  298. Purpose:
  299. Execute a menu.
  300. Parameters:
  301. [IN] lpfnMenuItemChanged - Callback function which is called when user
  302. changed the current menu item.
  303. [IN] rgMenuItem - Array of the menu items.
  304. [IN] nMenuItem - Number of menu items.
  305. [IN] wDefaultItem - default item index.
  306. [IN] bLabelColor - color of the labels.
  307. Return value:
  308. Return value of the selected menu item. MENUITEM_VALUE_CANCELLED if cancelled.
  309. --*/
  310. {
  311. int i;
  312. WORD wCurrentItem = (wDefaultItem < nMenuItem) ? wDefaultItem : 0;
  313. //
  314. // Draw all the menu texts.
  315. //
  316. for (i = 0; i < nMenuItem; i++)
  317. {
  318. BYTE bColor = bLabelColor;
  319. if (!rgMenuItem[i].fEnabled)
  320. {
  321. if (i == wCurrentItem)
  322. {
  323. bColor = MENUITEM_COLOR_SELECTED_INACTIVE;
  324. }
  325. else
  326. {
  327. bColor = MENUITEM_COLOR_INACTIVE;
  328. }
  329. }
  330. PAL_DrawText(PAL_GetWord(rgMenuItem[i].wNumWord), rgMenuItem[i].pos,
  331. bColor, TRUE, TRUE);
  332. }
  333. if (lpfnMenuItemChanged != NULL)
  334. {
  335. (*lpfnMenuItemChanged)(rgMenuItem[wDefaultItem].wValue);
  336. }
  337. while (TRUE)
  338. {
  339. PAL_ClearKeyState();
  340. //
  341. // Redraw the selected item if needed.
  342. //
  343. if (rgMenuItem[wCurrentItem].fEnabled)
  344. {
  345. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  346. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_SELECTED, FALSE, TRUE);
  347. }
  348. PAL_ProcessEvent();
  349. if (g_InputState.dwKeyPress & (kKeyDown | kKeyRight))
  350. {
  351. //
  352. // User pressed the down or right arrow key
  353. //
  354. if (rgMenuItem[wCurrentItem].fEnabled)
  355. {
  356. //
  357. // Dehighlight the unselected item.
  358. //
  359. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  360. rgMenuItem[wCurrentItem].pos, bLabelColor, FALSE, TRUE);
  361. }
  362. else
  363. {
  364. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  365. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_INACTIVE, FALSE, TRUE);
  366. }
  367. wCurrentItem++;
  368. if (wCurrentItem >= nMenuItem)
  369. {
  370. wCurrentItem = 0;
  371. }
  372. //
  373. // Highlight the selected item.
  374. //
  375. if (rgMenuItem[wCurrentItem].fEnabled)
  376. {
  377. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  378. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_SELECTED, FALSE, TRUE);
  379. }
  380. else
  381. {
  382. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  383. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_SELECTED_INACTIVE, FALSE, TRUE);
  384. }
  385. if (lpfnMenuItemChanged != NULL)
  386. {
  387. (*lpfnMenuItemChanged)(rgMenuItem[wCurrentItem].wValue);
  388. }
  389. }
  390. else if (g_InputState.dwKeyPress & (kKeyUp | kKeyLeft))
  391. {
  392. //
  393. // User pressed the up or left arrow key
  394. //
  395. if (rgMenuItem[wCurrentItem].fEnabled)
  396. {
  397. //
  398. // Dehighlight the unselected item.
  399. //
  400. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  401. rgMenuItem[wCurrentItem].pos, bLabelColor, FALSE, TRUE);
  402. }
  403. else
  404. {
  405. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  406. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_INACTIVE, FALSE, TRUE);
  407. }
  408. if (wCurrentItem > 0)
  409. {
  410. wCurrentItem--;
  411. }
  412. else
  413. {
  414. wCurrentItem = nMenuItem - 1;
  415. }
  416. //
  417. // Highlight the selected item.
  418. //
  419. if (rgMenuItem[wCurrentItem].fEnabled)
  420. {
  421. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  422. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_SELECTED, FALSE, TRUE);
  423. }
  424. else
  425. {
  426. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  427. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_SELECTED_INACTIVE, FALSE, TRUE);
  428. }
  429. if (lpfnMenuItemChanged != NULL)
  430. {
  431. (*lpfnMenuItemChanged)(rgMenuItem[wCurrentItem].wValue);
  432. }
  433. }
  434. else if (g_InputState.dwKeyPress & kKeyMenu)
  435. {
  436. //
  437. // User cancelled
  438. //
  439. if (rgMenuItem[wCurrentItem].fEnabled)
  440. {
  441. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  442. rgMenuItem[wCurrentItem].pos, bLabelColor, FALSE, TRUE);
  443. }
  444. else
  445. {
  446. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  447. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_INACTIVE, FALSE, TRUE);
  448. }
  449. break;
  450. }
  451. else if (g_InputState.dwKeyPress & kKeySearch)
  452. {
  453. //
  454. // User pressed Enter
  455. //
  456. if (rgMenuItem[wCurrentItem].fEnabled)
  457. {
  458. PAL_DrawText(PAL_GetWord(rgMenuItem[wCurrentItem].wNumWord),
  459. rgMenuItem[wCurrentItem].pos, MENUITEM_COLOR_CONFIRMED, FALSE, TRUE);
  460. return rgMenuItem[wCurrentItem].wValue;
  461. }
  462. }
  463. //
  464. // Use delay function to avoid high CPU usage.
  465. //
  466. SDL_Delay(50);
  467. }
  468. return MENUITEM_VALUE_CANCELLED;
  469. }
  470. VOID
  471. PAL_DrawNumber(
  472. UINT iNum,
  473. UINT nLength,
  474. PAL_POS pos,
  475. NUMCOLOR color,
  476. NUMALIGN align
  477. )
  478. /*++
  479. Purpose:
  480. Draw the specified number with the bitmaps in the UI sprite.
  481. Parameters:
  482. [IN] iNum - the number to be drawn.
  483. [IN] nLength - max. length of the number.
  484. [IN] pos - position on the screen.
  485. [IN] color - color of the number (yellow or blue).
  486. [IN] align - align mode of the number.
  487. Return value:
  488. None.
  489. --*/
  490. {
  491. UINT nActualLength, i;
  492. int x, y;
  493. LPCBITMAPRLE rglpBitmap[10];
  494. //
  495. // Get the bitmaps. Blue starts from 29, Cyan from 56, Yellow from 19.
  496. //
  497. x = (color == kNumColorBlue) ? 29 : ((color == kNumColorCyan) ? 56 : 19);
  498. for (i = 0; i < 10; i++)
  499. {
  500. rglpBitmap[i] = PAL_SpriteGetFrame(gpSpriteUI, (UINT)x + i);
  501. }
  502. i = iNum;
  503. nActualLength = 0;
  504. //
  505. // Calculate the actual length of the number.
  506. //
  507. while (i > 0)
  508. {
  509. i /= 10;
  510. nActualLength++;
  511. }
  512. if (nActualLength > nLength)
  513. {
  514. nActualLength = nLength;
  515. }
  516. else if (nActualLength == 0)
  517. {
  518. nActualLength = 1;
  519. }
  520. x = PAL_X(pos) - 6;
  521. y = PAL_Y(pos);
  522. switch (align)
  523. {
  524. case kNumAlignLeft:
  525. x += 6 * nActualLength;
  526. break;
  527. case kNumAlignMid:
  528. x += 3 * (nLength + nActualLength);
  529. break;
  530. case kNumAlignRight:
  531. x += 6 * nLength;
  532. break;
  533. }
  534. //
  535. // Draw the number.
  536. //
  537. while (nActualLength-- > 0)
  538. {
  539. PAL_RLEBlitToSurface(rglpBitmap[iNum % 10], gpScreen, PAL_XY(x, y));
  540. x -= 6;
  541. iNum /= 10;
  542. }
  543. }
  544. LPOBJECTDESC
  545. PAL_LoadObjectDesc(
  546. LPCSTR lpszFileName
  547. )
  548. /*++
  549. Purpose:
  550. Load the object description strings from file.
  551. Parameters:
  552. [IN] lpszFileName - the filename to be loaded.
  553. Return value:
  554. Pointer to loaded data, in linked list form. NULL if unable to load.
  555. --*/
  556. {
  557. FILE *fp;
  558. PAL_LARGE char buf[512];
  559. char *p;
  560. LPOBJECTDESC lpDesc = NULL, pNew = NULL;
  561. unsigned int i;
  562. fp = fopen(lpszFileName, "r");
  563. if (fp == NULL)
  564. {
  565. return NULL;
  566. }
  567. //
  568. // Load the description data
  569. //
  570. while (fgets(buf, 512, fp) != NULL)
  571. {
  572. p = strchr(buf, '=');
  573. if (p == NULL)
  574. {
  575. continue;
  576. }
  577. *p = '\0';
  578. p++;
  579. pNew = UTIL_calloc(1, sizeof(OBJECTDESC));
  580. sscanf(buf, "%x", &i);
  581. pNew->wObjectID = i;
  582. pNew->lpDesc = strdup(p);
  583. pNew->next = lpDesc;
  584. lpDesc = pNew;
  585. }
  586. fclose(fp);
  587. return lpDesc;
  588. }
  589. VOID
  590. PAL_FreeObjectDesc(
  591. LPOBJECTDESC lpObjectDesc
  592. )
  593. /*++
  594. Purpose:
  595. Free the object description data.
  596. Parameters:
  597. [IN] lpObjectDesc - the description data to be freed.
  598. Return value:
  599. None.
  600. --*/
  601. {
  602. LPOBJECTDESC p;
  603. while (lpObjectDesc != NULL)
  604. {
  605. p = lpObjectDesc->next;
  606. free(lpObjectDesc->lpDesc);
  607. free(lpObjectDesc);
  608. lpObjectDesc = p;
  609. }
  610. }
  611. LPCSTR
  612. PAL_GetObjectDesc(
  613. LPOBJECTDESC lpObjectDesc,
  614. WORD wObjectID
  615. )
  616. /*++
  617. Purpose:
  618. Get the object description string from the linked list.
  619. Parameters:
  620. [IN] lpObjectDesc - the description data linked list.
  621. [IN] wObjectID - the object ID.
  622. Return value:
  623. The description string. NULL if the specified object ID
  624. is not found.
  625. --*/
  626. {
  627. while (lpObjectDesc != NULL)
  628. {
  629. if (lpObjectDesc->wObjectID == wObjectID)
  630. {
  631. return lpObjectDesc->lpDesc;
  632. }
  633. lpObjectDesc = lpObjectDesc->next;
  634. }
  635. return NULL;
  636. }