| 947 | } |
| 948 | |
| 949 | int CreateButtonEffect(TCBUTTONDESC* desc, int monitor, int screen, int id) { |
| 950 | ASSERT(desc); |
| 951 | ASSERT(monitor == MONITOR_MAIN); |
| 952 | |
| 953 | // Creates an instance of the Effect |
| 954 | int efxnum = EfxCreate(EFX_BUTTON, monitor, screen, id, desc->tab_stop); |
| 955 | if (efxnum == -1) |
| 956 | return -1; |
| 957 | tceffect *tce = &TCEffects[efxnum]; |
| 958 | |
| 959 | // Load in regular bitmap |
| 960 | tce->buttoninfo.chunk_bmp.pw = tce->buttoninfo.chunk_bmp.ph = 0; |
| 961 | tce->buttoninfo.bm_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(desc->filename), 0); |
| 962 | if (tce->buttoninfo.bm_handle == -1) { |
| 963 | desc->w = desc->h = 0; |
| 964 | tce->buttoninfo.bm_handle = BAD_BITMAP_HANDLE; |
| 965 | mprintf(0, "Unable to load bmp '%s'\n", desc->filename); |
| 966 | } else { |
| 967 | desc->w = bm_w(tce->buttoninfo.bm_handle, 0); |
| 968 | desc->h = bm_h(tce->buttoninfo.bm_handle, 0); |
| 969 | bm_CreateChunkedBitmap(tce->buttoninfo.bm_handle, &tce->buttoninfo.chunk_bmp); |
| 970 | } |
| 971 | |
| 972 | tce->buttoninfo.chunkfocus_bmp.pw = tce->buttoninfo.chunkfocus_bmp.ph = 0; |
| 973 | tce->buttoninfo.bmfocus_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(desc->filename_focus), 0); |
| 974 | if (tce->buttoninfo.bmfocus_handle == -1) { |
| 975 | tce->buttoninfo.bmfocus_handle = BAD_BITMAP_HANDLE; |
| 976 | mprintf(0, "Unable to load bmp '%s'\n", desc->filename_focus); |
| 977 | } else { |
| 978 | bm_CreateChunkedBitmap(tce->buttoninfo.bmfocus_handle, &tce->buttoninfo.chunkfocus_bmp); |
| 979 | } |
| 980 | |
| 981 | // Load in flash/glow bitmap |
| 982 | tce->buttoninfo.flash_chunk.pw = tce->buttoninfo.flash_chunk.ph = 0; |
| 983 | if (desc->flasher) { |
| 984 | tce->buttoninfo.flash_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(desc->flash_filename), 0); |
| 985 | if (tce->buttoninfo.flash_handle == -1) { |
| 986 | mprintf(0, "Unable to load bmp '%s'\n", desc->flash_filename); |
| 987 | } else { |
| 988 | bm_CreateChunkedBitmap(tce->buttoninfo.flash_handle, &tce->buttoninfo.flash_chunk); |
| 989 | } |
| 990 | } else { |
| 991 | tce->buttoninfo.flash_handle = -1; |
| 992 | } |
| 993 | |
| 994 | tce->buttoninfo.flashfocus_chunk.pw = tce->buttoninfo.flashfocus_chunk.ph = 0; |
| 995 | if (desc->flasher) { |
| 996 | tce->buttoninfo.flashfocus_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(desc->flash_filename_focus), 0); |
| 997 | if (tce->buttoninfo.flashfocus_handle == -1) { |
| 998 | mprintf(0, "Unable to load bmp '%s'\n", desc->flash_filename_focus); |
| 999 | } else { |
| 1000 | bm_CreateChunkedBitmap(tce->buttoninfo.flashfocus_handle, &tce->buttoninfo.flashfocus_chunk); |
| 1001 | } |
| 1002 | } else { |
| 1003 | tce->buttoninfo.flashfocus_handle = -1; |
| 1004 | } |
| 1005 | |
| 1006 | if (desc->button_type == BUTT_INTERNAL) { |
no test coverage detected