| 149 | tce->age += frametime; |
| 150 | } |
| 151 | void RenderTextType(tceffect *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 152 | if (!ok_to_render) |
| 153 | return; |
| 154 | ASSERT(tce->type == EFX_TEXT_TYPE); |
| 155 | ASSERT(tce->text_buffer); |
| 156 | // See if we have any events waiting |
| 157 | tTCEvent evt; |
| 158 | while (PopEvent(tce, &evt)) { |
| 159 | switch (evt.id) { |
| 160 | case TEVT_SCROLLDOWN: |
| 161 | if (tce->textinfo.scroll_d) { |
| 162 | // mprintf(0,"Down Baby Down!\n"); |
| 163 | tce->textinfo.line_index++; |
| 164 | } |
| 165 | break; |
| 166 | case TEVT_SCROLLUP: |
| 167 | if (tce->textinfo.line_index > 0) { |
| 168 | // mprintf(0,"Up Baby Up!\n"); |
| 169 | tce->textinfo.line_index--; |
| 170 | } |
| 171 | break; |
| 172 | case TEVT_GAINFOCUS: { |
| 173 | // mprintf(0,"Text %d Gain Focus\n",tce-TCEffects); |
| 174 | } break; |
| 175 | case TEVT_LOSTFOCUS: { |
| 176 | // mprintf(0,"Text %d Lost Focus\n",tce-TCEffects); |
| 177 | } break; |
| 178 | } |
| 179 | } |
| 180 | if ((!tce->text_buffer) || (tce->text_buffer[0] == '\0')) |
| 181 | return; |
| 182 | float flash_step; |
| 183 | ddgr_color hi_color = tce->color; //@JEFF: GR_RGB(255,255,255); |
| 184 | int strlength = strlen(tce->text_buffer); |
| 185 | if (tce->textinfo.last_letter >= strlength - 1) { |
| 186 | TelcomStopSound(TCSND_TYPING); |
| 187 | } |
| 188 | flash_step = frametime * (((float)strlength) / tce->speed); |
| 189 | char *temp; |
| 190 | if (tce->textinfo.last_letter < strlength - 1) { |
| 191 | TelcomStartSound(TCSND_TYPING); |
| 192 | } |
| 193 | tce->textinfo.last_letter += flash_step; |
| 194 | if (tce->textinfo.last_letter > strlength) |
| 195 | tce->textinfo.last_letter = strlength; |
| 196 | int ll = (int)tce->textinfo.last_letter; |
| 197 | temp = (char *)mem_malloc(strlength + 10); |
| 198 | if (!temp) { |
| 199 | tce->age += frametime; |
| 200 | return; |
| 201 | } |
| 202 | strcpy(temp, tce->text_buffer); |
| 203 | temp[ll] = '\0'; |
| 204 | |
| 205 | uint8_t old_alpha = grtext_GetAlpha(); |
| 206 | grtext_SetFont(Game_fonts[tce->textinfo.font_index]); |
| 207 | char buff[1024]; |
| 208 | const char *nextline; |
no test coverage detected