MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / CreateTextEffect

Function CreateTextEffect

Descent3/TelComEffects.cpp:694–761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692}
693
694bool 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

Callers 10

TelComMainMenuFunction · 0.85
TelcomCreateDummyScreenFunction · 0.85
TelComSingleShipSelectFunction · 0.85
TelComGoalStatusFunction · 0.85
TelComCargoFunction · 0.85
TelComAutoMapFunction · 0.85
PBAddTextEffectFunction · 0.85
PBStartScreenFunction · 0.85

Calls 4

EfxCreateFunction · 0.85
CreateTextStaticFunction · 0.85
CreateTextFadeFunction · 0.85
CreateTextTypeFunction · 0.85

Tested by

no test coverage detected