| 517 | void LoadGameDialogCB(newuiTiledWindow *wnd, void *data) |
| 518 | #else |
| 519 | void __cdecl LoadGameDialogCB(newuiTiledWindow *wnd, void *data) |
| 520 | #endif |
| 521 | { |
| 522 | tLoadGameDialogData *cb_data = (tLoadGameDialogData *)data; |
| 523 | UIGadget *cur_gadget; |
| 524 | int id; |
| 525 | |
| 526 | cur_gadget = wnd->GetFocus(); |
| 527 | |
| 528 | for (id = SAVE_HOTSPOT_ID; id < (SAVE_HOTSPOT_ID + N_SAVE_SLOTS); id++) { |
| 529 | if (cur_gadget->GetID() == id) { |
| 530 | break; |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | if (id < (SAVE_HOTSPOT_ID + N_SAVE_SLOTS) && id != cb_data->cur_slot) { |
| 535 | // new bitmap to be displayed! |
| 536 | char filename[PSFILENAME_LEN + 1]; |
| 537 | char pathname[_MAX_PATH]; |
| 538 | char savegame_dir[_MAX_PATH]; |
| 539 | char desc[GAMESAVE_DESCLEN + 1]; |
| 540 | int bm_handle; |
| 541 | |
| 542 | if (cb_data->chunk.bm_array) { |
| 543 | bm_DestroyChunkedBitmap(&cb_data->chunk); |
| 544 | } |
| 545 | |
| 546 | mprintf(0, "savegame slot=%d\n", id - SAVE_HOTSPOT_ID); |
| 547 | |
| 548 | ddio_MakePath(savegame_dir, Base_directory, "savegame", NULL); |
| 549 | snprintf(filename, sizeof(filename), "saveg00%d", (id - SAVE_HOTSPOT_ID)); |
| 550 | ddio_MakePath(pathname, savegame_dir, filename, NULL); |
| 551 | |
| 552 | if (GetGameStateInfo(pathname, desc, &bm_handle)) { |
| 553 | if (bm_handle > 0) { |
| 554 | bm_CreateChunkedBitmap(bm_handle, &cb_data->chunk); |
| 555 | bm_FreeBitmap(bm_handle); |
| 556 | } |
| 557 | } |
| 558 | cb_data->cur_slot = id; |
| 559 | } |
| 560 | |
| 561 | // draw bitmap if there is one |
| 562 | if (cb_data->chunk.bm_array) { |
| 563 | UIBitmapItem bm_item; |
| 564 | int x, y; |
| 565 | bm_item.set_chunked_bitmap(&cb_data->chunk); |
| 566 | x = (wnd->W() - bm_item.width()) / 2; |
| 567 | y = (wnd->H() - bm_item.height()) / 4; |
| 568 | bm_item.draw(x, y); |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | bool LoadGameDialog() { |
| 573 | tLoadGameDialogData lgd_data; |
nothing calls this directly
no test coverage detected