| 1042 | } |
| 1043 | |
| 1044 | int LoadTelcomBitmap(const char *filename, chunked_bitmap *chunk) { |
| 1045 | int bm_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(filename), 0); |
| 1046 | if (bm_handle == -1) |
| 1047 | return 0; |
| 1048 | |
| 1049 | // make monitor windows transparent |
| 1050 | menutga_LoadHotSpotMap(bm_handle, IGNORE_TABLE(HOTSPOT_DISPLAY), &hotspotmap, &windowmap); |
| 1051 | |
| 1052 | uint16_t *data = bm_data(bm_handle, 0); |
| 1053 | int wnd, x, y, bmw; |
| 1054 | int bord_left, bord_right, bord_top, bord_bottom; |
| 1055 | |
| 1056 | bmw = bm_w(bm_handle, 0); |
| 1057 | |
| 1058 | int starty, startx, endy, endx; |
| 1059 | for (wnd = 0; wnd < windowmap.num_of_windows; wnd++) { |
| 1060 | bord_left = windowmap.wm[wnd].l_start_x - windowmap.wm[wnd].x; |
| 1061 | bord_right = windowmap.wm[wnd].x + windowmap.wm[wnd].width - windowmap.wm[wnd].r_end_x; |
| 1062 | bord_top = windowmap.wm[wnd].t_top_y - windowmap.wm[wnd].y; |
| 1063 | bord_bottom = windowmap.wm[wnd].y + windowmap.wm[wnd].height - windowmap.wm[wnd].b_bottom_y; |
| 1064 | |
| 1065 | starty = windowmap.wm[wnd].y + bord_top; |
| 1066 | endy = windowmap.wm[wnd].y + windowmap.wm[wnd].height - bord_bottom; |
| 1067 | startx = windowmap.wm[wnd].x + bord_left; |
| 1068 | endx = windowmap.wm[wnd].x + windowmap.wm[wnd].width - bord_right; |
| 1069 | for (y = starty; y < endy; y++) |
| 1070 | for (x = startx; x < endx; x++) { |
| 1071 | data[y * bmw + x] = NEW_TRANSPARENT_COLOR; |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | FreeHotSpotMapInternals(&hotspotmap); |
| 1076 | FreeViewports(); |
| 1077 | if (windowmap.wm) |
| 1078 | mem_free(windowmap.wm); |
| 1079 | |
| 1080 | bm_CreateChunkedBitmap(bm_handle, chunk); |
| 1081 | |
| 1082 | if (bm_handle > BAD_BITMAP_HANDLE) |
| 1083 | bm_FreeBitmap(bm_handle); |
| 1084 | |
| 1085 | return 1; |
| 1086 | } |
| 1087 | |
| 1088 | #define MAINMENU_BUTTON "TelComMenuButton.ogf" |
| 1089 | #define MAINMENU_BUTTONGLOW "TelComMenuButtonGlow.ogf" |
no test coverage detected