| 692 | } |
| 693 | |
| 694 | bool CreateTextEffect(TCTEXTDESC* desc, const char *text, int monitor, int screen, int id) { |
| 695 | ASSERT(desc); |
| 696 | ASSERT(text); |
| 697 | |
| 698 | int efxtype = -1; |
| 699 | switch (desc->type) { |
| 700 | case TC_TEXT_STATIC: |
| 701 | efxtype = EFX_TEXT_STATIC; |
| 702 | break; |
| 703 | case TC_TEXT_FADE: |
| 704 | efxtype = EFX_TEXT_FADE; |
| 705 | break; |
| 706 | case TC_TEXT_FLASH: |
| 707 | efxtype = EFX_TEXT_TYPE; |
| 708 | break; |
| 709 | default: |
| 710 | Int3(); // not supported |
| 711 | } |
| 712 | if (efxtype == -1) |
| 713 | return false; |
| 714 | |
| 715 | // Creates an instance of the Effect |
| 716 | int efxnum = EfxCreate(efxtype, monitor, screen, id, (desc->caps & TCTD_TABSTOP) ? true : false); |
| 717 | if (efxnum == -1) |
| 718 | return false; |
| 719 | tceffect *tce = &TCEffects[efxnum]; |
| 720 | |
| 721 | if (desc->caps & TCTD_FONT) |
| 722 | tce->textinfo.font_index = desc->font; |
| 723 | if (desc->caps & TCTD_COLOR) |
| 724 | tce->color = desc->color; |
| 725 | if (desc->caps & TCTD_SPEED) |
| 726 | tce->speed = desc->speed; |
| 727 | else |
| 728 | tce->speed = 1.0f; |
| 729 | if (desc->caps & TCTD_TEXTBOX) { |
| 730 | tce->pos_x = desc->textbox.left; |
| 731 | tce->pos_y = desc->textbox.top; |
| 732 | tce->w = desc->textbox.right - desc->textbox.left; |
| 733 | tce->h = desc->textbox.bottom - desc->textbox.top; |
| 734 | } else |
| 735 | Int3(); // need a text box |
| 736 | |
| 737 | if (desc->caps & TCTD_SCROLL) |
| 738 | tce->textinfo.scroll = true; |
| 739 | |
| 740 | tce->flags = desc->flags; |
| 741 | if (desc->caps & TCTD_WAITTIME) |
| 742 | tce->start_time = desc->waittime; |
| 743 | else |
| 744 | tce->start_time = 0; |
| 745 | if (desc->caps & TCTD_TABSTOP) |
| 746 | tce->tab_stop = true; |
| 747 | else |
| 748 | tce->tab_stop = false; |
| 749 | |
| 750 | tce->id = id; |
| 751 |
no test coverage detected