| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/TelcomEffectsRender.cpp $ |
| 21 | * $Revision: 15 $ |
| 22 | * $Date: 3/20/00 12:21p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * <insert description of file here> |
| 26 | * |
| 27 | * $Log: /DescentIII/main/TelcomEffectsRender.cpp $ |
| 28 | * |
| 29 | * 15 3/20/00 12:21p Matt |
| 30 | * Merge of Duane's post-1.3 changes. |
| 31 | * Minor optimization. |
| 32 | * |
| 33 | * 14 7/28/99 3:41p Kevin |
| 34 | * Macintosh! |
| 35 | * |
| 36 | * 13 5/17/99 1:46p Ardussi |
| 37 | * changed to compile on Mac |
| 38 | * |
| 39 | * 12 5/03/99 1:16p Jeff |
| 40 | * play sounds at full volume |
| 41 | * |
| 42 | * 11 4/20/99 12:46p Jeff |
| 43 | * telcom main menu, mouse over button sets focus. if you go into telcom |
| 44 | * main menu, when you leave a system it will return you to main menu. |
| 45 | * |
| 46 | * 10 4/14/99 3:57a Jeff |
| 47 | * fixed case mismatch in #includes |
| 48 | * |
| 49 | * $NoKeywords: $ |
| 50 | */ |
| 51 | #include "TelComEffects.h"cxx . . $ `<file>/Descent3/TelComEffects.h`/ |
| 52 | #include "textaux.h"cxx . . $ `<file>/lib/textaux.h`/ |
| 53 | #include "mem.h"cxx . . $ `<file>/mem/mem.h`/ |
| 54 | #include "hlsoundlib.h"cxx . . $ `<file>/sndlib/hlsoundlib.h`/ |
| 55 | #include <string.h> |
| 56 | |
| 57 | #include <stdlib.h> |
| 58 | |
| 59 | int glitch_dxcxx . . $ glitch_dx. = 0, glitch_dycxx . . $ glitch_dy. = 0; |
| 60 | #define DISABLED_TEXT_COLORcxx . . $ `Descent3/TelcomEffectsRender.cpp:60:9`! GR_RGB(180, 180, 180); |
| 61 | int GetTextEffectWithTabStopsOnScreencxx . . $ GetTextEffectWithTabStopsOnScreen(7864480464b09eea).(int screen) { |
| 62 | int count = 0; |
| 63 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(screen >= 0 && screen < MAX_TELCOM_SCREENScxx . . $ `Descent3/TelCom.h:93:9`!); |
| 64 | int node = Screen_rootscxx . . $ Screen_roots.[screen]; |
| 65 | while (node != -1) { |
| 66 | if (TCEffectscxx . . $ TCEffects.[node].typecxx . . $ tceffect#type. == EFX_TEXT_STATICcxx . . $ `Descent3/TelComEffects.h:141:9`! || TCEffectscxx . . $ TCEffects.[node].typecxx . . $ tceffect#type. == EFX_TEXT_FADEcxx . . $ `Descent3/TelComEffects.h:143:9`! || |
| 67 | TCEffectscxx . . $ TCEffects.[node].typecxx . . $ tceffect#type. == EFX_TEXT_TYPEcxx . . $ `Descent3/TelComEffects.h:142:9`!) { |
| 68 | if (TCEffectscxx . . $ TCEffects.[node].tab_stopcxx . . $ tceffect#tab_stop.) |
| 69 | count++; |
| 70 | } |
| 71 | node = TCEffectscxx . . $ TCEffects.[node].nextcxx . . $ tceffect#next.; |
| 72 | } |
| 73 | return count; |
| 74 | } |
| 75 | void RenderTextStaticcxx . . $ RenderTextStatic(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 76 | if (!ok_to_render) |
| 77 | return; |
| 78 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_TEXT_STATICcxx . . $ `Descent3/TelComEffects.h:141:9`!); |
| 79 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->text_buffer); |
| 80 | // See if we have any events waiting |
| 81 | tTCEventcxx . . $ tTCEvent# evt; |
| 82 | while (PopEventcxx . . $ PopEvent(6a9d2426593e3e3).(tce, &evt)) { |
| 83 | switch (evt.idcxx . . $ tTCEvent#id.) { |
| 84 | case TEVT_SCROLLDOWNcxx . . $ `Descent3/TelComEffects.h:166:9`!: |
| 85 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d.) { |
| 86 | // mprintf(0,"Down Baby Down!\n"); |
| 87 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.++; |
| 88 | } |
| 89 | break; |
| 90 | case TEVT_SCROLLUPcxx . . $ `Descent3/TelComEffects.h:167:9`!: |
| 91 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index. > 0) { |
| 92 | // mprintf(0,"Up Baby Up!\n"); |
| 93 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.--; |
| 94 | } |
| 95 | break; |
| 96 | case TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!: { |
| 97 | // mprintf(0,"Text %d Gain Focus\n",tce-TCEffects); |
| 98 | } break; |
| 99 | case TEVT_LOSTFOCUScxx . . $ `Descent3/TelComEffects.h:157:9`!: { |
| 100 | // mprintf(0,"Text %d Lost Focus\n",tce-TCEffects); |
| 101 | } break; |
| 102 | } |
| 103 | } |
| 104 | ddgr_colorcxx . . $ ddgr_color# color_to_use = tce->colorcxx . . $ tceffect#color.; |
| 105 | int tab_count = GetTextEffectWithTabStopsOnScreencxx . . $ GetTextEffectWithTabStopsOnScreen(7864480464b09eea).(tce->screencxx . . $ tceffect#screen.); |
| 106 | if (tab_count > 1) { |
| 107 | // we need to see what color to use for the text, cause there is more than |
| 108 | // one text item with a tab stop. |
| 109 | if (!tce->has_focuscxx . . $ tceffect#has_focus.) { |
| 110 | // use the disable text color |
| 111 | color_to_use = DISABLED_TEXT_COLORcxx . . $ `Descent3/TelcomEffectsRender.cpp:60:9`!; |
| 112 | } |
| 113 | } |
| 114 | uint8_tcxx . . $ uint8_t# old_alpha = grtext_GetAlphacxx . . $ grtext_GetAlpha(7c4be072098b358f).(); |
| 115 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(Game_fontscxx . . $ Game_fonts.[tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..font_indexcxx . . $ tTextInfo#font_index.]); |
| 116 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(color_to_use); |
| 117 | grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(tce->alphacxx . . $ tceffect#alpha.); |
| 118 | int curry = tce->pos_ycxx . . $ tceffect#pos_y. + yoff; |
| 119 | int height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(Game_fontscxx . . $ Game_fonts.[tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..font_indexcxx . . $ tTextInfo#font_index.]) + 1; |
| 120 | char buff[256]; |
| 121 | const char *nextline; |
| 122 | int count = 0; // get to the first line of text (scrolling) |
| 123 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(tce->text_buffercxx . . $ tceffect#text_buffer., buff); |
| 124 | if ((tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.) && (nextline)) { |
| 125 | count++; |
| 126 | while (count <= tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.) { |
| 127 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(nextline, buff); |
| 128 | count++; |
| 129 | } |
| 130 | } |
| 131 | int lcount = 0; |
| 132 | while ((nextline) && ((curry + height) < tce->pos_ycxx . . $ tceffect#pos_y. + tce->hcxx . . $ tceffect#h.)) { |
| 133 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, curry + glitch_dycxx . . $ glitch_dy., buff); |
| 134 | lcount++; |
| 135 | curry += height; |
| 136 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(nextline, buff); |
| 137 | } |
| 138 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, curry + glitch_dycxx . . $ glitch_dy., buff); |
| 139 | lcount++; |
| 140 | grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(old_alpha); |
| 141 | |
| 142 | if ((lcount * height) > tce->hcxx . . $ tceffect#h.) { |
| 143 | // we can scroll down |
| 144 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d. = true; |
| 145 | } else { |
| 146 | // we can't scroll down |
| 147 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d. = false; |
| 148 | } |
| 149 | tce->agecxx . . $ tceffect#age. += frametime; |
| 150 | } |
| 151 | void RenderTextTypecxx . . $ RenderTextType(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 152 | if (!ok_to_render) |
| 153 | return; |
| 154 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_TEXT_TYPEcxx . . $ `Descent3/TelComEffects.h:142:9`!); |
| 155 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->text_buffer); |
| 156 | // See if we have any events waiting |
| 157 | tTCEventcxx . . $ tTCEvent# evt; |
| 158 | while (PopEventcxx . . $ PopEvent(6a9d2426593e3e3).(tce, &evt)) { |
| 159 | switch (evt.idcxx . . $ tTCEvent#id.) { |
| 160 | case TEVT_SCROLLDOWNcxx . . $ `Descent3/TelComEffects.h:166:9`!: |
| 161 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d.) { |
| 162 | // mprintf(0,"Down Baby Down!\n"); |
| 163 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.++; |
| 164 | } |
| 165 | break; |
| 166 | case TEVT_SCROLLUPcxx . . $ `Descent3/TelComEffects.h:167:9`!: |
| 167 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index. > 0) { |
| 168 | // mprintf(0,"Up Baby Up!\n"); |
| 169 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.--; |
| 170 | } |
| 171 | break; |
| 172 | case TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!: { |
| 173 | // mprintf(0,"Text %d Gain Focus\n",tce-TCEffects); |
| 174 | } break; |
| 175 | case TEVT_LOSTFOCUScxx . . $ `Descent3/TelComEffects.h:157:9`!: { |
| 176 | // mprintf(0,"Text %d Lost Focus\n",tce-TCEffects); |
| 177 | } break; |
| 178 | } |
| 179 | } |
| 180 | if ((!tce->text_buffercxx . . $ tceffect#text_buffer.) || (tce->text_buffercxx . . $ tceffect#text_buffer.[0] == '\0')) |
| 181 | return; |
| 182 | float flash_step; |
| 183 | ddgr_colorcxx . . $ ddgr_color# hi_color = tce->colorcxx . . $ tceffect#color.; //@JEFF: GR_RGB(255,255,255); |
| 184 | int strlength = strlen(tce->text_buffercxx . . $ tceffect#text_buffer.); |
| 185 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..last_lettercxx . . $ tTextInfo#last_letter. >= strlength - 1) { |
| 186 | TelcomStopSoundcxx . . $ TelcomStopSound(d4f767463ce0a6b3).(TCSND_TYPINGcxx . . $ `Descent3/TelCom.h:323:9`!); |
| 187 | } |
| 188 | flash_step = frametime * (((float)strlength) / tce->speedcxx . . $ tceffect#speed.); |
| 189 | char *temp; |
| 190 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..last_lettercxx . . $ tTextInfo#last_letter. < strlength - 1) { |
| 191 | TelcomStartSoundcxx . . $ TelcomStartSound(d4f767463ce0a6b3).(TCSND_TYPINGcxx . . $ `Descent3/TelCom.h:323:9`!); |
| 192 | } |
| 193 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..last_lettercxx . . $ tTextInfo#last_letter. += flash_step; |
| 194 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..last_lettercxx . . $ tTextInfo#last_letter. > strlength) |
| 195 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..last_lettercxx . . $ tTextInfo#last_letter. = strlength; |
| 196 | int ll = (int)tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..last_lettercxx . . $ tTextInfo#last_letter.; |
| 197 | temp = (char *)mem_malloccxx . . $ `mem/mem.h:79:9`!(strlength + 10); |
| 198 | if (!temp) { |
| 199 | tce->agecxx . . $ tceffect#age. += frametime; |
| 200 | return; |
| 201 | } |
| 202 | strcpy(temp, tce->text_buffercxx . . $ tceffect#text_buffer.); |
| 203 | temp[ll] = '\0'; |
| 204 | |
| 205 | uint8_tcxx . . $ uint8_t# old_alpha = grtext_GetAlphacxx . . $ grtext_GetAlpha(7c4be072098b358f).(); |
| 206 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(Game_fontscxx . . $ Game_fonts.[tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..font_indexcxx . . $ tTextInfo#font_index.]); |
| 207 | char buff[1024]; |
| 208 | const char *nextline; |
| 209 | int height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(Game_fontscxx . . $ Game_fonts.[tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..font_indexcxx . . $ tTextInfo#font_index.]) + 1; |
| 210 | int curry = tce->pos_ycxx . . $ tceffect#pos_y.; |
| 211 | ddgr_colorcxx . . $ ddgr_color# color_to_use = hi_color; |
| 212 | int tab_count = GetTextEffectWithTabStopsOnScreencxx . . $ GetTextEffectWithTabStopsOnScreen(7864480464b09eea).(tce->screencxx . . $ tceffect#screen.); |
| 213 | if (tab_count > 1) { |
| 214 | // we need to see what color to use for the text, cause there is more than |
| 215 | // one text item with a tab stop. |
| 216 | if (!tce->has_focuscxx . . $ tceffect#has_focus.) { |
| 217 | // use the disable text color |
| 218 | color_to_use = DISABLED_TEXT_COLORcxx . . $ `Descent3/TelcomEffectsRender.cpp:60:9`!; |
| 219 | } |
| 220 | } |
| 221 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(color_to_use); |
| 222 | grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(255.0); |
| 223 | |
| 224 | int count = 0; // get to the first line of text (scrolling) |
| 225 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(temp, buff); |
| 226 | if ((tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.) && (nextline)) { |
| 227 | count++; |
| 228 | while (count <= tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.) { |
| 229 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(nextline, buff); |
| 230 | count++; |
| 231 | } |
| 232 | } |
| 233 | int lcount = 0; |
| 234 | while ((nextline) && ((curry + height) <= tce->pos_ycxx . . $ tceffect#pos_y. + tce->hcxx . . $ tceffect#h.)) { |
| 235 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(tce->pos_xcxx . . $ tceffect#pos_x. + xoff + glitch_dxcxx . . $ glitch_dx., curry + yoff + glitch_dycxx . . $ glitch_dy., buff); |
| 236 | lcount++; |
| 237 | curry += height; |
| 238 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(nextline, buff); |
| 239 | } |
| 240 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(tce->pos_xcxx . . $ tceffect#pos_x. + xoff + glitch_dxcxx . . $ glitch_dx., curry + yoff + glitch_dycxx . . $ glitch_dy., buff); |
| 241 | lcount++; |
| 242 | if ((lcount * height) > tce->hcxx . . $ tceffect#h.) { |
| 243 | // we can scroll down |
| 244 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d. = true; |
| 245 | } else { |
| 246 | // we can't scroll down |
| 247 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d. = false; |
| 248 | } |
| 249 | /* |
| 250 | if( ll>2 ){ |
| 251 | grtext_SetColor(tce->color); //!<<_---------USE CORRECT COLOR HERE WHEN IMPLEMENTED |
| 252 | if(ll<strlength-1){ |
| 253 | temp[ll-2]='\0'; |
| 254 | }else{ |
| 255 | //strcpy(temp,tce->text_buffer); |
| 256 | temp[11]='\0'; |
| 257 | } |
| 258 | curry = tce->pos_y; |
| 259 | count = 0; //get to the first line of text (scrolling) |
| 260 | nextline = textaux_CopyTextLine(temp,buff); |
| 261 | if((tce->textinfo.line_index)&&(nextline)){ |
| 262 | count++; |
| 263 | while(count<=tce->textinfo.line_index){ |
| 264 | nextline = textaux_CopyTextLine(nextline,buff); |
| 265 | count++; |
| 266 | } |
| 267 | } |
| 268 | while((nextline)&&((curry+height)<=tce->pos_y+tce->h) ){ |
| 269 | grtext_Printf(tce->pos_x+xoff+glitch_dx,curry+yoff+glitch_dy,buff); |
| 270 | curry += height; |
| 271 | nextline = textaux_CopyTextLine(nextline,buff); |
| 272 | } |
| 273 | grtext_Printf(tce->pos_x+xoff+glitch_dx,curry+yoff+glitch_dy,buff); |
| 274 | } |
| 275 | //draw scroll buttons now (if needed) |
| 276 | //if m_iIndex!=0 then we can scroll up |
| 277 | if(tce->textinfo.line_index){ |
| 278 | tce->textinfo.scroll_u = true; |
| 279 | }else |
| 280 | tce->textinfo.scroll_u = false; |
| 281 | //if curry+height>m_iBottomY then we can scroll down |
| 282 | if( (curry+height)>tce->pos_y+tce->h){ |
| 283 | tce->textinfo.scroll_d = true; |
| 284 | } |
| 285 | else |
| 286 | tce->textinfo.scroll_d = false; |
| 287 | */ |
| 288 | grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(old_alpha); |
| 289 | mem_freecxx . . $ `mem/mem.h:80:9`!(temp); |
| 290 | tce->agecxx . . $ tceffect#age. += frametime; |
| 291 | } |
| 292 | void RenderTextFadecxx . . $ RenderTextFade(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 293 | if (!ok_to_render) |
| 294 | return; |
| 295 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_TEXT_FADEcxx . . $ `Descent3/TelComEffects.h:143:9`!); |
| 296 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->text_buffer); |
| 297 | // See if we have any events waiting |
| 298 | tTCEventcxx . . $ tTCEvent# evt; |
| 299 | while (PopEventcxx . . $ PopEvent(6a9d2426593e3e3).(tce, &evt)) { |
| 300 | switch (evt.idcxx . . $ tTCEvent#id.) { |
| 301 | case TEVT_SCROLLDOWNcxx . . $ `Descent3/TelComEffects.h:166:9`!: |
| 302 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d.) { |
| 303 | // mprintf(0,"Down Baby Down!\n"); |
| 304 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.++; |
| 305 | } |
| 306 | break; |
| 307 | case TEVT_SCROLLUPcxx . . $ `Descent3/TelComEffects.h:167:9`!: |
| 308 | if (tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index. > 0) { |
| 309 | // mprintf(0,"Up Baby Up!\n"); |
| 310 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.--; |
| 311 | } |
| 312 | break; |
| 313 | case TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!: { |
| 314 | // mprintf(0,"Text %d Gain Focus\n",tce-TCEffects); |
| 315 | } break; |
| 316 | case TEVT_LOSTFOCUScxx . . $ `Descent3/TelComEffects.h:157:9`!: { |
| 317 | // mprintf(0,"Text %d Lost Focus\n",tce-TCEffects); |
| 318 | } break; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | if (tce->speedcxx . . $ tceffect#speed. == 0) |
| 323 | tce->speedcxx . . $ tceffect#speed. = 0.0001f; |
| 324 | float amount = tce->agecxx . . $ tceffect#age. * (255.0 / tce->speedcxx . . $ tceffect#speed.); |
| 325 | uint8_tcxx . . $ uint8_t# alpha; |
| 326 | if (tce->flagscxx . . $ tceffect#flags. == TC_TEXTF_INcxx . . $ `Descent3/TelComEfxStructs.h:154:9`!) { |
| 327 | // fade in, but not fade out |
| 328 | tce->alphacxx . . $ tceffect#alpha. += amount; |
| 329 | if (tce->alphacxx . . $ tceffect#alpha. > 255.0f) { |
| 330 | tce->alphacxx . . $ tceffect#alpha. = 255.0f; |
| 331 | } |
| 332 | alpha = tce->alphacxx . . $ tceffect#alpha.; |
| 333 | } else if (tce->flagscxx . . $ tceffect#flags. == TC_TEXTF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:155:9`!) { |
| 334 | // fade out, but not fade in |
| 335 | tce->alphacxx . . $ tceffect#alpha. -= amount; |
| 336 | if (tce->alphacxx . . $ tceffect#alpha. < 0.0f) { |
| 337 | tce->alphacxx . . $ tceffect#alpha. = 0.0f; |
| 338 | } |
| 339 | alpha = tce->alphacxx . . $ tceffect#alpha.; |
| 340 | } else { |
| 341 | // fade in, then fade out (if alpha is negative, then we are fading out) |
| 342 | if (tce->alphacxx . . $ tceffect#alpha. < 0.0f) { |
| 343 | tce->alphacxx . . $ tceffect#alpha. += amount; |
| 344 | alpha = (-tce->alphacxx . . $ tceffect#alpha.); |
| 345 | if (tce->alphacxx . . $ tceffect#alpha. > 0.0f) { |
| 346 | // we're done fading out |
| 347 | tce->alphacxx . . $ tceffect#alpha. = 1234.0f; |
| 348 | alpha = 0; |
| 349 | } |
| 350 | } else if (tce->alphacxx . . $ tceffect#alpha. != 1234.0f) { |
| 351 | tce->alphacxx . . $ tceffect#alpha. += amount; |
| 352 | alpha = tce->alphacxx . . $ tceffect#alpha.; |
| 353 | if (tce->alphacxx . . $ tceffect#alpha. > 255.0f) { |
| 354 | // switch to fading out |
| 355 | alpha = 255; |
| 356 | tce->alphacxx . . $ tceffect#alpha. = -255.0f; |
| 357 | } |
| 358 | } else |
| 359 | alpha = 0; |
| 360 | } |
| 361 | ddgr_colorcxx . . $ ddgr_color# color_to_use = tce->colorcxx . . $ tceffect#color.; |
| 362 | int tab_count = GetTextEffectWithTabStopsOnScreencxx . . $ GetTextEffectWithTabStopsOnScreen(7864480464b09eea).(tce->screencxx . . $ tceffect#screen.); |
| 363 | if (tab_count > 1) { |
| 364 | // we need to see what color to use for the text, cause there is more than |
| 365 | // one text item with a tab stop. |
| 366 | if (!tce->has_focuscxx . . $ tceffect#has_focus.) { |
| 367 | // use the disable text color |
| 368 | color_to_use = DISABLED_TEXT_COLORcxx . . $ `Descent3/TelcomEffectsRender.cpp:60:9`!; |
| 369 | } |
| 370 | } |
| 371 | uint8_tcxx . . $ uint8_t# old_alpha = grtext_GetAlphacxx . . $ grtext_GetAlpha(7c4be072098b358f).(); |
| 372 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(Game_fontscxx . . $ Game_fonts.[tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..font_indexcxx . . $ tTextInfo#font_index.]); |
| 373 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(color_to_use); |
| 374 | grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(alpha); |
| 375 | int curry = tce->pos_ycxx . . $ tceffect#pos_y.; |
| 376 | int height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(Game_fontscxx . . $ Game_fonts.[tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..font_indexcxx . . $ tTextInfo#font_index.]) + 1; |
| 377 | char buff[256]; |
| 378 | const char *nextline; |
| 379 | int count = 0; // get to the first line of text (scrolling) |
| 380 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(tce->text_buffercxx . . $ tceffect#text_buffer., buff); |
| 381 | if ((tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.) && (nextline)) { |
| 382 | count++; |
| 383 | while (count <= tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index.) { |
| 384 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(nextline, buff); |
| 385 | count++; |
| 386 | } |
| 387 | } |
| 388 | int lcount = 0; |
| 389 | while ((nextline) && ((curry + height) < tce->pos_ycxx . . $ tceffect#pos_y. + tce->hcxx . . $ tceffect#h.)) { |
| 390 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, curry + glitch_dycxx . . $ glitch_dy. + yoff, buff); |
| 391 | lcount++; |
| 392 | curry += height; |
| 393 | nextline = textaux_CopyTextLinecxx . . $ textaux_CopyTextLine(327ecc8d2b0bb221).(nextline, buff); |
| 394 | } |
| 395 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, curry + glitch_dycxx . . $ glitch_dy. + yoff, buff); |
| 396 | lcount++; |
| 397 | grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(old_alpha); |
| 398 | if ((lcount * height) > tce->hcxx . . $ tceffect#h.) { |
| 399 | // we can scroll down |
| 400 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d. = true; |
| 401 | } else { |
| 402 | // we can't scroll down |
| 403 | tce->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d. = false; |
| 404 | } |
| 405 | tce->agecxx . . $ tceffect#age. += frametime; |
| 406 | } |
| 407 | void RenderBmpStaticcxx . . $ RenderBmpStatic(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 408 | if (!ok_to_render) |
| 409 | return; |
| 410 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_BMP_STATICcxx . . $ `Descent3/TelComEffects.h:144:9`!); |
| 411 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff, &tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 412 | tce->agecxx . . $ tceffect#age. += frametime; |
| 413 | } |
| 414 | void BlurBitmapAreacxx . . $ BlurBitmapArea(c1512f2bf60ea757).(uint16_tcxx . . $ uint16_t# *srcbm, uint16_tcxx . . $ uint16_t# *dstbm, int16_t width, int16_t height, int16_t startx, int16_t starty, int16_t bmw) { |
| 415 | int pixel_count, blue_total, red_total, green_total; |
| 416 | pixel_count = width * height; |
| 417 | blue_total = red_total = green_total = 0; |
| 418 | int16_t x, y; |
| 419 | int16_t pos; |
| 420 | if (!pixel_count) |
| 421 | return; |
| 422 | |
| 423 | for (y = starty; y < height + starty; y++) |
| 424 | for (x = startx; x < width + startx; x++) { |
| 425 | pos = y * bmw + x; |
| 426 | if (srcbm[pos] & OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`!) { |
| 427 | blue_total += GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(srcbm[pos])); |
| 428 | red_total += GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(srcbm[pos])); |
| 429 | green_total += GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(srcbm[pos])); |
| 430 | } |
| 431 | } |
| 432 | uint16_tcxx . . $ uint16_t# col; |
| 433 | if (red_total + green_total + blue_total) |
| 434 | col = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(red_total / pixel_count, green_total / pixel_count, blue_total / pixel_count); |
| 435 | else |
| 436 | col = 0; |
| 437 | for (x = startx; x < width + startx; x++) |
| 438 | for (y = starty; y < height + starty; y++) { |
| 439 | dstbm[y * bmw + x] = col; |
| 440 | } |
| 441 | } |
| 442 | void RenderBmpBlurcxx . . $ RenderBmpBlur(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 443 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_BMP_BLURcxx . . $ `Descent3/TelComEffects.h:145:9`!); |
| 444 | if (!ok_to_render) { |
| 445 | if (tce->flagscxx . . $ tceffect#flags. == TC_BMPF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:159:9`! && (!(tce->flagscxx . . $ tceffect#flags. & TC_NOEARLYRENDERcxx . . $ `Descent3/TelComEfxStructs.h:160:9`!))) { |
| 446 | UploadChunkcxx . . $ UploadChunk(1635f60f4d3c1317).(&tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 447 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff, &tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 448 | } |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | if ((tce->flagscxx . . $ tceffect#flags. == TC_BMPF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:159:9`!) && (tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..stagecxx . . $ tBitmapInfo#stage. <= 0)) |
| 453 | return; |
| 454 | int sbm_handle = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..bm_handlecxx . . $ tBitmapInfo#bm_handle.; |
| 455 | int dbm_handle = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..temp_bmhandlecxx . . $ tBitmapInfo#temp_bmhandle.; |
| 456 | bm_ClearBitmapcxx . . $ bm_ClearBitmap(d4f767463ce0a6b3).(dbm_handle); |
| 457 | int x = 0; |
| 458 | int y = 0; |
| 459 | bool done = false; |
| 460 | if ((tce->flagscxx . . $ tceffect#flags. == TC_BMPF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:159:9`!) && (tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..stagecxx . . $ tBitmapInfo#stage. < 0)) |
| 461 | done = true; |
| 462 | if ((tce->flagscxx . . $ tceffect#flags. == TC_BMPF_INcxx . . $ `Descent3/TelComEfxStructs.h:158:9`!) && (tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..stagecxx . . $ tBitmapInfo#stage. > BLUR_STAGEScxx . . $ `Descent3/TelComEffects.h:174:9`!)) |
| 463 | done = true; |
| 464 | |
| 465 | uint16_tcxx . . $ uint16_t# *src, *dest; |
| 466 | int rowsize, w, h; |
| 467 | |
| 468 | if (!done) { |
| 469 | src = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(sbm_handle, 0); |
| 470 | dest = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(dbm_handle, 0); |
| 471 | rowsize = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(sbm_handle, 0); |
| 472 | w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(sbm_handle, 0); |
| 473 | h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(sbm_handle, 0); |
| 474 | int current_stage; |
| 475 | int block_size; |
| 476 | current_stage = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..stagecxx . . $ tBitmapInfo#stage.; |
| 477 | block_size = 1 << (BLUR_STAGEScxx . . $ `Descent3/TelComEffects.h:174:9`! - current_stage); |
| 478 | int x = 0, y = 0, bs_w, bs_h; |
| 479 | |
| 480 | for (x = 0; x < w; x += block_size) |
| 481 | for (y = 0; y < h; y += block_size) { |
| 482 | if (x + block_size > w) |
| 483 | bs_w = w - x; |
| 484 | else |
| 485 | bs_w = block_size; |
| 486 | if (y + block_size > h) |
| 487 | bs_h = h - y; |
| 488 | else |
| 489 | bs_h = block_size; |
| 490 | BlurBitmapAreacxx . . $ BlurBitmapArea(c1512f2bf60ea757).(src, dest, bs_w, bs_h, x, y, w); |
| 491 | } |
| 492 | int dim = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..bm_arraycxx . . $ chunked_bitmap#bm_array.[0], 0); |
| 493 | int how_many_across = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..wcxx . . $ chunked_bitmap#w.; |
| 494 | int bh = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..phcxx . . $ chunked_bitmap#ph.; |
| 495 | int bw = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..pwcxx . . $ chunked_bitmap#pw.; |
| 496 | uint16_tcxx . . $ uint16_t# *src_data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(dbm_handle, 0); |
| 497 | for (y = 0; y < bh; y++) { |
| 498 | for (x = 0; x < bw; x++) { |
| 499 | int piece_y = y / dim; |
| 500 | int piece_x = x / dim; |
| 501 | int sub_x = x % dim; |
| 502 | int sub_y = y % dim; |
| 503 | int bm = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..bm_arraycxx . . $ chunked_bitmap#bm_array.[piece_y * how_many_across + piece_x]; |
| 504 | uint16_tcxx . . $ uint16_t# *dest_data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(bm, 0); |
| 505 | uint16_tcxx . . $ uint16_t# pix = src_data[y * bw + x]; |
| 506 | dest_data[sub_y * dim + sub_x] = pix; |
| 507 | } |
| 508 | } |
| 509 | UploadChunkcxx . . $ UploadChunk(1635f60f4d3c1317).(&tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 510 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff, &tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 511 | |
| 512 | float amt = tce->speedcxx . . $ tceffect#speed. * frametime; |
| 513 | if (tce->flagscxx . . $ tceffect#flags. == TC_BMPF_INcxx . . $ `Descent3/TelComEfxStructs.h:158:9`!) |
| 514 | tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..stagecxx . . $ tBitmapInfo#stage. += amt; |
| 515 | else |
| 516 | tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..stagecxx . . $ tBitmapInfo#stage. -= amt; |
| 517 | } else { |
| 518 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff, &tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 519 | } |
| 520 | tce->agecxx . . $ tceffect#age. += frametime; |
| 521 | } |
| 522 | #define N_FADE_STAGEScxx . . $ `Descent3/TelcomEffectsRender.cpp:522:9`! 4 |
| 523 | void RenderBmpScanlinecxx . . $ RenderBmpScanline(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 524 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_BMP_SCANLINEcxx . . $ `Descent3/TelComEffects.h:146:9`!); |
| 525 | if (!ok_to_render) { |
| 526 | if (tce->flagscxx . . $ tceffect#flags. == TC_BMPF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:159:9`! && (!(tce->flagscxx . . $ tceffect#flags. & TC_NOEARLYRENDERcxx . . $ `Descent3/TelComEfxStructs.h:160:9`!))) { |
| 527 | UploadChunkcxx . . $ UploadChunk(1635f60f4d3c1317).(&tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 528 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff, &tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 529 | } |
| 530 | return; |
| 531 | } |
| 532 | |
| 533 | bool changed = true; |
| 534 | bool done; |
| 535 | int x, y; |
| 536 | int sbm_handle = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..bm_handlecxx . . $ tBitmapInfo#bm_handle.; |
| 537 | int dbm_handle = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..temp_bmhandlecxx . . $ tBitmapInfo#temp_bmhandle.; |
| 538 | uint16_tcxx . . $ uint16_t# *src, *dest; |
| 539 | int rowsize, w, h, xx, yy, stage; |
| 540 | float k; |
| 541 | if (dbm_handle == BAD_BITMAP_HANDLEcxx . . $ `lib/bitmap.h:42:9`!) |
| 542 | goto done_scanline; |
| 543 | bm_ClearBitmapcxx . . $ bm_ClearBitmap(d4f767463ce0a6b3).(dbm_handle); |
| 544 | |
| 545 | x = 0; |
| 546 | y = 0; |
| 547 | done = false; |
| 548 | |
| 549 | k = tce->agecxx . . $ tceffect#age. / tce->speedcxx . . $ tceffect#speed.; |
| 550 | |
| 551 | if (k > 1.2) |
| 552 | goto done_scanline; |
| 553 | if (k > 1.0) { |
| 554 | k = 1.0; |
| 555 | done = 1; |
| 556 | } |
| 557 | if (tce->flagscxx . . $ tceffect#flags. == TC_BMPF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:159:9`!) { |
| 558 | k = 1.0 - k; |
| 559 | } |
| 560 | src = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(sbm_handle, 0); |
| 561 | dest = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(dbm_handle, 0); |
| 562 | rowsize = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(sbm_handle, 0); |
| 563 | w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(sbm_handle, 0); |
| 564 | h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(sbm_handle, 0); |
| 565 | for (yy = stage = 0; yy < h; yy++) { |
| 566 | int span_width; |
| 567 | span_width = w * ((k - ((float)stage / N_FADE_STAGEScxx . . $ `Descent3/TelcomEffectsRender.cpp:522:9`!)) * N_FADE_STAGEScxx . . $ `Descent3/TelcomEffectsRender.cpp:522:9`!); |
| 568 | if (span_width < 0) |
| 569 | span_width = 0; |
| 570 | if (span_width > w) |
| 571 | span_width = w; |
| 572 | for (xx = 0; xx < span_width; xx++) |
| 573 | if (dest && src) |
| 574 | *dest++ = *src++; |
| 575 | |
| 576 | dest += (rowsize - xx); |
| 577 | src += (w - span_width); |
| 578 | switch (stage) { |
| 579 | case 0: |
| 580 | stage = 2; |
| 581 | break; |
| 582 | case 1: |
| 583 | stage = 3; |
| 584 | break; |
| 585 | case 2: |
| 586 | stage = 1; |
| 587 | break; |
| 588 | case 3: |
| 589 | stage = 0; |
| 590 | break; |
| 591 | } |
| 592 | } |
| 593 | // we now chunk the bitmap (this is slow, the above should be done right to the chunk) |
| 594 | if (changed) { |
| 595 | int dim = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..bm_arraycxx . . $ chunked_bitmap#bm_array.[0], 0); |
| 596 | int how_many_across = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..wcxx . . $ chunked_bitmap#w.; |
| 597 | int bh = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..phcxx . . $ chunked_bitmap#ph.; |
| 598 | int bw = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..pwcxx . . $ chunked_bitmap#pw.; |
| 599 | uint16_tcxx . . $ uint16_t# *src_data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(dbm_handle, 0); |
| 600 | int x, y; |
| 601 | for (y = 0; y < bh; y++) { |
| 602 | for (x = 0; x < bw; x++) { |
| 603 | int piece_y = y / dim; |
| 604 | int piece_x = x / dim; |
| 605 | int sub_x = x % dim; |
| 606 | int sub_y = y % dim; |
| 607 | int bm = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..bm_arraycxx . . $ chunked_bitmap#bm_array.[piece_y * how_many_across + piece_x]; |
| 608 | uint16_tcxx . . $ uint16_t# *dest_data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(bm, 0); |
| 609 | uint16_tcxx . . $ uint16_t# pix = src_data[y * bw + x]; |
| 610 | dest_data[sub_y * dim + sub_x] = pix; |
| 611 | } |
| 612 | } |
| 613 | UploadChunkcxx . . $ UploadChunk(1635f60f4d3c1317).(&tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 614 | } |
| 615 | done_scanline: |
| 616 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff, &tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 617 | tce->agecxx . . $ tceffect#age. += frametime; |
| 618 | } |
| 619 | void RenderBmpInvertcxx . . $ RenderBmpInvert(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 620 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_BMP_INVERTcxx . . $ `Descent3/TelComEffects.h:147:9`!); |
| 621 | int srcbmph = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..bm_handlecxx . . $ tBitmapInfo#bm_handle.; |
| 622 | bool changed = true; |
| 623 | if (!ok_to_render && tce->flagscxx . . $ tceffect#flags. & TC_NOEARLYRENDERcxx . . $ `Descent3/TelComEfxStructs.h:160:9`!) |
| 624 | return; |
| 625 | float k; |
| 626 | |
| 627 | if (ok_to_render) { |
| 628 | k = tce->agecxx . . $ tceffect#age. / tce->speedcxx . . $ tceffect#speed.; |
| 629 | } else { |
| 630 | k = 0; |
| 631 | } |
| 632 | int inv; |
| 633 | if (k > 1.0) { |
| 634 | k = 1.0; |
| 635 | changed = false; |
| 636 | } else if (k < 0) { |
| 637 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "k<0 on inverse bitmap...bashing (%.2f/%.2f)\n", tce->age, tce->speed); |
| 638 | if (tce->agecxx . . $ tceffect#age. < 0) |
| 639 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 640 | if (tce->speedcxx . . $ tceffect#speed. < 0) |
| 641 | tce->speedcxx . . $ tceffect#speed. = 0.1f; |
| 642 | k = 0; |
| 643 | changed = false; |
| 644 | } |
| 645 | if (tce->flagscxx . . $ tceffect#flags. == TC_BMPF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:159:9`!) |
| 646 | k = 1 - k; |
| 647 | inv = 255 - (255.0f * k); |
| 648 | uint8_tcxx . . $ uint8_t# r, g, b; |
| 649 | int bh = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(srcbmph, 0); |
| 650 | int bw = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(srcbmph, 0); |
| 651 | int how_many = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..wcxx . . $ chunked_bitmap#w. * tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..hcxx . . $ chunked_bitmap#h.; |
| 652 | int how_many_across = tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..wcxx . . $ chunked_bitmap#w.; |
| 653 | int dim = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..bm_arraycxx . . $ chunked_bitmap#bm_array.[0], 0); |
| 654 | int shift; // speed up (since dim is always a power of 2) |
| 655 | switch (dim) { |
| 656 | case 32: |
| 657 | shift = 5; |
| 658 | break; |
| 659 | case 64: |
| 660 | shift = 6; |
| 661 | break; |
| 662 | case 128: |
| 663 | shift = 7; |
| 664 | break; |
| 665 | } |
| 666 | uint16_tcxx . . $ uint16_t# *src_data = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(srcbmph, 0); |
| 667 | uint16_tcxx . . $ uint16_t# *sdata; |
| 668 | uint16_tcxx . . $ uint16_t# *ddata; |
| 669 | uint16_tcxx . . $ uint16_t# pix; |
| 670 | int maxx, maxy; |
| 671 | int windex, hindex; |
| 672 | int s_y, s_x, d_y, d_x; |
| 673 | // is there any need to do this if !changed!?!? |
| 674 | for (hindex = 0; hindex < tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..hcxx . . $ chunked_bitmap#h.; hindex++) { |
| 675 | for (windex = 0; windex < tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..wcxx . . $ chunked_bitmap#w.; windex++) { |
| 676 | // loop through the chunks |
| 677 | // find end x and y |
| 678 | if (windex < tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..wcxx . . $ chunked_bitmap#w. - 1) |
| 679 | maxx = dim; |
| 680 | else |
| 681 | maxx = bw - (windex << shift); |
| 682 | if (hindex < tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..hcxx . . $ chunked_bitmap#h. - 1) |
| 683 | maxy = dim; |
| 684 | else |
| 685 | maxy = bh - (hindex << shift); |
| 686 | // find the starting source x and y |
| 687 | s_x = (windex << shift); |
| 688 | s_y = (hindex << shift); |
| 689 | // get the pointers pointing to the right spot |
| 690 | ddata = bm_datacxx . . $ bm_data(501e1bc9f482c6bd).(tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp..bm_arraycxx . . $ chunked_bitmap#bm_array.[hindex * how_many_across + windex], 0); |
| 691 | sdata = &src_data[s_y * bw + s_x]; |
| 692 | // copy the data |
| 693 | for (d_y = 0; d_y < maxy; d_y++) { |
| 694 | for (d_x = 0; d_x < maxx; d_x++) { |
| 695 | pix = sdata[d_x]; |
| 696 | if (pix) { |
| 697 | r = GR_COLOR_REDcxx . . $ GR_COLOR_RED(4c679297bf94b9eb).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(pix)); |
| 698 | g = GR_COLOR_GREENcxx . . $ GR_COLOR_GREEN(4c679297bf94b9eb).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(pix)); |
| 699 | b = GR_COLOR_BLUEcxx . . $ GR_COLOR_BLUE(4c679297bf94b9eb).(GR_16_TO_COLORcxx . . $ GR_16_TO_COLOR(909d59720f161188).(pix)); |
| 700 | ddata[d_x] = OPAQUE_FLAGcxx . . $ `lib/grdefs.h:72:9`! | GR_RGB16cxx . . $ GR_RGB16(6461fafb79bad5b9).(abscxx . . $ abs(a1851578aea3f541).(r - inv), abscxx . . $ abs(a1851578aea3f541).(g - inv), abscxx . . $ abs(a1851578aea3f541).(b - inv)); |
| 701 | } else { |
| 702 | ddata[d_x] = 0; |
| 703 | } |
| 704 | } // end for d_x |
| 705 | sdata += bw; |
| 706 | ddata += dim; |
| 707 | } // end for d_y |
| 708 | } // end for windex |
| 709 | } // end for hindex |
| 710 | |
| 711 | if (changed) |
| 712 | UploadChunkcxx . . $ UploadChunk(1635f60f4d3c1317).(&tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 713 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff, &tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..chunk_bmpcxx . . $ tBitmapInfo#chunk_bmp.); |
| 714 | if (ok_to_render) |
| 715 | tce->agecxx . . $ tceffect#age. += frametime; |
| 716 | } |
| 717 | void RenderBmpStretchcxx . . $ RenderBmpStretch(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 718 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_BMP_STRETCHcxx . . $ `Descent3/TelComEffects.h:148:9`!); |
| 719 | if (!ok_to_render) { |
| 720 | return; |
| 721 | } |
| 722 | |
| 723 | float k = (tce->agecxx . . $ tceffect#age.) / tce->speedcxx . . $ tceffect#speed.; |
| 724 | if (k > 1.0) { |
| 725 | k = 1.0; |
| 726 | } else if (k < 0) { |
| 727 | k = 0; |
| 728 | } |
| 729 | if (tce->flagscxx . . $ tceffect#flags. == TC_BMPF_OUTcxx . . $ `Descent3/TelComEfxStructs.h:159:9`!) |
| 730 | k = 1 - k; |
| 731 | int w, h; |
| 732 | // width |
| 733 | // h = 64; |
| 734 | // w = k*64.0; |
| 735 | // height |
| 736 | // w = 64; |
| 737 | // h = k*64.0; |
| 738 | // width & height |
| 739 | h = w = (k * 64.0); |
| 740 | int src_w = bm_wcxx . . $ bm_w(9b79fb6aee4c0440).(tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..bm_handlecxx . . $ tBitmapInfo#bm_handle., 0); |
| 741 | int src_h = bm_hcxx . . $ bm_h(9b79fb6aee4c0440).(tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..bm_handlecxx . . $ tBitmapInfo#bm_handle., 0); |
| 742 | int realx, realy; |
| 743 | int w_count = (src_w + 63) / 64; |
| 744 | int h_count = (src_h + 63) / 64; |
| 745 | float tw = ((float)k * src_w) / ((float)w_count); |
| 746 | float th = ((float)k * src_h) / ((float)h_count); |
| 747 | int startx = tce->pos_xcxx . . $ tceffect#pos_x. + (src_w / 2) - (((float)w_count) * tw / 2.0f); |
| 748 | int starty = tce->pos_ycxx . . $ tceffect#pos_y. + (src_h / 2) - (((float)h_count) * th / 2.0f); |
| 749 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANT_TEXTUREcxx . . $ `lib/renderer.h:402:9`!); |
| 750 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(255.0); |
| 751 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 752 | rend_SetColorModelcxx . . $ rend_SetColorModel(e3c5062d5af601c7).(CM_MONOcxx . . $ CM_MONO.); |
| 753 | rend_SetOverlayTypecxx . . $ rend_SetOverlayType(ac50b47256ae7414).(OT_NONEcxx . . $ `lib/renderer.h:333:9`!); |
| 754 | rend_SetWrapTypecxx . . $ rend_SetWrapType(da524b148887c0e7).(WT_CLAMPcxx . . $ WT_CLAMP.); |
| 755 | rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(0); |
| 756 | int dx, dy; |
| 757 | int index; |
| 758 | index = 0; |
| 759 | for (dy = 0, realy = starty; dy < h_count; dy++, realy += h) |
| 760 | for (dx = 0, realx = startx; dx < w_count; dx++, realx += w) { |
| 761 | rend_DrawScaledBitmapcxx . . $ rend_DrawScaledBitmap(bffd21ce5f93b71b).(realx + xoff + glitch_dxcxx . . $ glitch_dx., realy + yoff + glitch_dycxx . . $ glitch_dy., realx + w + xoff + glitch_dxcxx . . $ glitch_dx., |
| 762 | realy + h + yoff + glitch_dycxx . . $ glitch_dy., tce->bmpinfocxx . . $ tceffect#$anonymous_type_0#bmpinfo..bitmapscxx . . $ tBitmapInfo#bitmaps.[index], 0, 0, 1, 1); |
| 763 | index++; |
| 764 | } |
| 765 | rend_SetFilteringcxx . . $ rend_SetFiltering(4af4fd0e2b26c4ac).(1); |
| 766 | tce->agecxx . . $ tceffect#age. += frametime; |
| 767 | } |
| 768 | void RenderBackgroundcxx . . $ RenderBackground(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 769 | if (!ok_to_render) |
| 770 | return; |
| 771 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_BACKGROUNDcxx . . $ `Descent3/TelComEffects.h:149:9`!); |
| 772 | int lx, rx, ty, by; |
| 773 | lx = tce->pos_xcxx . . $ tceffect#pos_x. + xoff; |
| 774 | rx = tce->pos_xcxx . . $ tceffect#pos_x. + xoff + tce->wcxx . . $ tceffect#w.; |
| 775 | ty = tce->pos_ycxx . . $ tceffect#pos_y. + yoff; |
| 776 | by = tce->pos_ycxx . . $ tceffect#pos_y. + yoff + tce->hcxx . . $ tceffect#h.; |
| 777 | rend_FillRectcxx . . $ rend_FillRect(fe09a4b73d8d396f).(tce->colorcxx . . $ tceffect#color., lx, ty, rx, by); |
| 778 | tce->agecxx . . $ tceffect#age. += frametime; |
| 779 | } |
| 780 | void RenderMoviecxx . . $ RenderMovie(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 781 | if (!ok_to_render) |
| 782 | return; |
| 783 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_MOVIEcxx . . $ `Descent3/TelComEffects.h:150:9`!); |
| 784 | |
| 785 | if (!tce->movieinfocxx . . $ tceffect#$anonymous_type_0#movieinfo..handlecxx . . $ tMovieInfo#handle.) |
| 786 | return; |
| 787 | bool done = false; |
| 788 | FrameMoviecxx . . $ FrameMovie(3359cecd32520d88).(tce->movieinfocxx . . $ tceffect#$anonymous_type_0#movieinfo..handlecxx . . $ tMovieInfo#handle., tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx., tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy., false); |
| 789 | float end_time = tce->agecxx . . $ tceffect#age. + frametime; |
| 790 | while ((end_time > tce->agecxx . . $ tceffect#age.) && (!done)) { |
| 791 | if (!FrameMoviecxx . . $ FrameMovie(3359cecd32520d88).(tce->movieinfocxx . . $ tceffect#$anonymous_type_0#movieinfo..handlecxx . . $ tMovieInfo#handle., tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx. + xoff, tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy. + yoff)) { |
| 792 | /* |
| 793 | if(IsLooping()) //looping? |
| 794 | { |
| 795 | EndMovie(m_MovieHandle); |
| 796 | m_MovieHandle = StartMovie(m_szMovieName); |
| 797 | } |
| 798 | else |
| 799 | { |
| 800 | EndMovie(m_MovieHandle); |
| 801 | m_MovieHandle = NULL; |
| 802 | done = true; |
| 803 | }*/ |
| 804 | EndMoviecxx . . $ EndMovie(3a711f4329c1fcf3).(tce->movieinfocxx . . $ tceffect#$anonymous_type_0#movieinfo..handlecxx . . $ tMovieInfo#handle.); |
| 805 | tce->movieinfocxx . . $ tceffect#$anonymous_type_0#movieinfo..handlecxx . . $ tMovieInfo#handle. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 806 | done = true; |
| 807 | } else |
| 808 | tce->agecxx . . $ tceffect#age. += 1.0f / tce->movieinfocxx . . $ tceffect#$anonymous_type_0#movieinfo..fpscxx . . $ tMovieInfo#fps.; |
| 809 | } |
| 810 | } |
| 811 | void RenderPolyModelcxx . . $ RenderPolyModel(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 812 | /* |
| 813 | if(!ok_to_render) |
| 814 | return; |
| 815 | ASSERT(tce->type==EFX_POLYMODEL); |
| 816 | if(tce->polyinfo.handle==-1) |
| 817 | return false; |
| 818 | float k = tce->age; |
| 819 | //setup how much we're gonna rotate |
| 820 | float xrot = k*tce->polyinfo.m_Rot.x + tce->polyinfo.m_Ori.x; |
| 821 | float yrot = k*tce->polyinfo.m_Rot.y + tce->polyinfo.m_Ori.y; |
| 822 | float zrot = k*tce->polyinfo.m_Rot.z + tce->polyinfo.m_Ori.z; |
| 823 | //fade in speed 2.0f |
| 824 | k*=(1.0f/2.0f); |
| 825 | if (k > 1.3) { |
| 826 | k = 1.3f; |
| 827 | } |
| 828 | else |
| 829 | if (k < 0){ |
| 830 | k = 0.0f; |
| 831 | } |
| 832 | poly_model *pm=GetPolymodelPointer(tce->polyinfo.handle); |
| 833 | vector view_vec; |
| 834 | matrix view_orient; |
| 835 | float light_scalar; |
| 836 | //set all animation to default position |
| 837 | float norm_angles[MAX_SUBOBJECTS]; |
| 838 | for (int i=0;i<MAX_SUBOBJECTS;i++){ |
| 839 | norm_angles[i]=0; |
| 840 | } |
| 841 | //viewer at origin |
| 842 | vm_MakeIdentity(&view_orient); |
| 843 | vector pos; |
| 844 | pos.x = - (tce->polyinfo.m_Pos.x + (((float)glitch_dx)/tce->polyinfo.m_Pos.z)); |
| 845 | pos.y = - (tce->polyinfo.m_Pos.y + (((float)glitch_dy)/tce->polyinfo.m_Pos.z)); |
| 846 | pos.z = - tce->polyinfo.m_Pos.z; |
| 847 | |
| 848 | g3_StartFrame (&pos,&view_orient,D3_DEFAULT_ZOOM); |
| 849 | //shed some light on the subject |
| 850 | light_scalar = 0.86f; |
| 851 | //we need to rotate our model about Y 180 degrees so it faces the camera |
| 852 | vm_AnglesToMatrix(&view_orient,xrot,yrot,zrot); |
| 853 | tce->polyinfo.m_mOrient += view_orient; |
| 854 | vm_Orthogonalize(&tce->polyinfo.m_mOrient); |
| 855 | |
| 856 | //draw the polymodel with our little fade in effect |
| 857 | polymodel_effect pe={0}; |
| 858 | pe.type=PEF_ALPHA; |
| 859 | if(k>=0.3) |
| 860 | pe.alpha=k-0.3f; |
| 861 | else |
| 862 | pe.alpha=0.005f; |
| 863 | SetPolymodelEffect(&pe); |
| 864 | vm_MakeZero (&view_vec); |
| 865 | rend_SetZBufferState(1); |
| 866 | DrawPolygonModel(&view_vec,&tce->polyinfo.m_mOrient,tce->polyinfo.handle,norm_angles,0,light_scalar,light_scalar,light_scalar,0xFFFFFFFF,1); |
| 867 | //DrawPolygonModel(&m_Pos,&m_mOrient,m_iHandle,norm_angles,0,light_scalar,0xFFFFFFFF,1); |
| 868 | if(k<1) |
| 869 | DrawModelOutline(GR_RGB(255,255,255),1.0-k); |
| 870 | g3_EndFrame(); |
| 871 | rend_SetZBufferState(0); |
| 872 | */ |
| 873 | tce->agecxx . . $ tceffect#age. += frametime; |
| 874 | } |
| 875 | void RenderSoundcxx . . $ RenderSound(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 876 | if (!ok_to_render) |
| 877 | return; |
| 878 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_SOUNDcxx . . $ `Descent3/TelComEffects.h:152:9`!); |
| 879 | tce->agecxx . . $ tceffect#age. += frametime; |
| 880 | if (tce->soundinfocxx . . $ tceffect#$anonymous_type_0#soundinfo..startedcxx . . $ tSoundInfo#started.) |
| 881 | return; |
| 882 | tce->soundinfocxx . . $ tceffect#$anonymous_type_0#soundinfo..startedcxx . . $ tSoundInfo#started. = true; |
| 883 | if (tce->soundinfocxx . . $ tceffect#$anonymous_type_0#soundinfo..handlecxx . . $ tSoundInfo#handle. != -1) |
| 884 | Sound_systemcxx . . $ Sound_system..Play2dSoundcxx . . $ hlsSystem#Play2dSound(d251026853493025).(tce->soundinfocxx . . $ tceffect#$anonymous_type_0#soundinfo..handlecxx . . $ tSoundInfo#handle., MAX_GAME_VOLUMEcxx . . $ `sndlib/ssl_lib.h:265:9`!); |
| 885 | } |
| 886 | #define FLASH_SWITCHcxx . . $ `Descent3/TelcomEffectsRender.cpp:886:9`! 1.0f |
| 887 | extern tceffectcxx . . $ tceffect# TCEffectscxx . . $ TCEffects.[MAX_TCEFFECTScxx . . $ `Descent3/TelComEffects.h:135:9`!]; |
| 888 | void RenderButtoncxx . . $ RenderButton(cedd11bfcbfae79).(tceffectcxx . . $ tceffect# *tce, float frametime, int xoff, int yoff, bool ok_to_render) { |
| 889 | if (!ok_to_render) |
| 890 | return; |
| 891 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(tce->type == EFX_BUTTONcxx . . $ `Descent3/TelComEffects.h:153:9`!); |
| 892 | tTCEventcxx . . $ tTCEvent# evt; |
| 893 | bool time_to_flash = false; |
| 894 | bool glow = false; |
| 895 | while (PopEventcxx . . $ PopEvent(6a9d2426593e3e3).(tce, &evt)) { |
| 896 | switch (evt.idcxx . . $ tTCEvent#id.) { |
| 897 | case TEVT_GAINFOCUScxx . . $ `Descent3/TelComEffects.h:156:9`!: { |
| 898 | int num = tce - TCEffectscxx . . $ TCEffects.; |
| 899 | // mprintf(0,"Button: Recv'd GAIN FOCUS Event (%d)\n",num); |
| 900 | } break; |
| 901 | case TEVT_LOSTFOCUScxx . . $ `Descent3/TelComEffects.h:157:9`!: { |
| 902 | int num = tce - TCEffectscxx . . $ TCEffects.; |
| 903 | // mprintf(0,"Button: Recv'd LOST FOCUS Event (%d)\n",num); |
| 904 | } break; |
| 905 | case TEVT_MOUSEOVERcxx . . $ `Descent3/TelComEffects.h:158:9`!: { |
| 906 | if (tce->flagscxx . . $ tceffect#flags. & OBF_GLOWcxx . . $ `Descent3/TelComEfxStructs.h:306:9`!) { |
| 907 | if (tce->flagscxx . . $ tceffect#flags. & OBF_MOUSEOVERFOCUScxx . . $ `Descent3/TelComEfxStructs.h:308:9`!) { |
| 908 | // for effects with this flag set, only glow if we have focus |
| 909 | if (tce->tab_stopcxx . . $ tceffect#tab_stop. && tce->has_focuscxx . . $ tceffect#has_focus.) { |
| 910 | time_to_flash = true; |
| 911 | glow = true; |
| 912 | } |
| 913 | } else { |
| 914 | time_to_flash = true; |
| 915 | glow = true; |
| 916 | } |
| 917 | } |
| 918 | } break; |
| 919 | case TEVT_MOUSEENTERcxx . . $ `Descent3/TelComEffects.h:170:9`!: { |
| 920 | if (tce->flagscxx . . $ tceffect#flags. & OBF_MOUSEOVERFOCUScxx . . $ `Descent3/TelComEfxStructs.h:308:9`!) { |
| 921 | // check to see if we have focus, if not, and we are a tab, set focus |
| 922 | if (tce->tab_stopcxx . . $ tceffect#tab_stop. && !tce->has_focuscxx . . $ tceffect#has_focus.) { |
| 923 | // set the focus on us! |
| 924 | TelComSetFocusOnEffectcxx . . $ TelComSetFocusOnEffect(d4f767463ce0a6b3).(tce - TCEffectscxx . . $ TCEffects.); |
| 925 | } |
| 926 | } |
| 927 | } break; |
| 928 | case TEVT_MOUSECLICKcxx . . $ `Descent3/TelComEffects.h:159:9`!: |
| 929 | case TEVT_MOUSEDOWNcxx . . $ `Descent3/TelComEffects.h:160:9`!: |
| 930 | case TEVT_MOUSEUPcxx . . $ `Descent3/TelComEffects.h:161:9`!: { |
| 931 | // send out the event to the appropriate system/effect |
| 932 | switch (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..button_typecxx . . $ tButtonInfo#button_type.) { |
| 933 | case BUTT_UPARROWcxx . . $ `Descent3/TelComEffects.h:178:9`!: { |
| 934 | // mprintf(0,"Button: Telling Text to Scroll Up\n"); |
| 935 | int efxnum = GetEfxNumFromIDcxx . . $ GetEfxNumFromID(9b79fb6aee4c0440).(tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..parentcxx . . $ tButtonInfo#parent., tce->screencxx . . $ tceffect#screen.); |
| 936 | if (efxnum != -1) { |
| 937 | SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_SCROLLUPcxx . . $ `Descent3/TelComEffects.h:167:9`!); |
| 938 | } |
| 939 | } break; |
| 940 | case BUTT_DOWNARROWcxx . . $ `Descent3/TelComEffects.h:179:9`!: { |
| 941 | // mprintf(0,"Button: Telling Text to Scroll Down\n"); |
| 942 | int efxnum = GetEfxNumFromIDcxx . . $ GetEfxNumFromID(9b79fb6aee4c0440).(tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..parentcxx . . $ tButtonInfo#parent., tce->screencxx . . $ tceffect#screen.); |
| 943 | if (efxnum != -1) { |
| 944 | SendEventToEffectcxx . . $ SendEventToEffect(748afa4755bc9595).(efxnum, TEVT_SCROLLDOWNcxx . . $ `Descent3/TelComEffects.h:166:9`!); |
| 945 | } |
| 946 | } break; |
| 947 | case BUTT_NEXTPAGEcxx . . $ `Descent3/TelComEffects.h:180:9`!: |
| 948 | // mprintf(0,"Button: Telling TelCom to go to Next Page\n"); |
| 949 | TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCNEXTcxx . . $ `Descent3/TelComEffects.h:163:9`!); |
| 950 | break; |
| 951 | case BUTT_PREVPAGEcxx . . $ `Descent3/TelComEffects.h:181:9`!: |
| 952 | // mprintf(0,"Button: Telling TelCom to go to Prev Page\n"); |
| 953 | TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCPREVcxx . . $ `Descent3/TelComEffects.h:164:9`!); |
| 954 | break; |
| 955 | case BUTT_QUITcxx . . $ `Descent3/TelComEffects.h:182:9`!: |
| 956 | // mprintf(0,"Button: Telling TelCom to go to Quit\n"); |
| 957 | TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCQUITcxx . . $ `Descent3/TelComEffects.h:162:9`!); |
| 958 | break; |
| 959 | case BUTT_JUMPcxx . . $ `Descent3/TelComEffects.h:184:9`!: |
| 960 | // mprintf(0,"Button: Telling TelCom to jump to %d\n",tce->buttoninfo.jump_page); |
| 961 | TelComSendEventcxx . . $ TelComSendEvent(b1146eedae1e1d0b).(TEVT_TCJUMPcxx . . $ `Descent3/TelComEffects.h:165:9`!, tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..jump_pagecxx . . $ tButtonInfo#jump_page.); |
| 962 | break; |
| 963 | case BUTT_INTERNALcxx . . $ `Descent3/TelComEffects.h:183:9`!: |
| 964 | // mprintf(0,"Button: Calling internal callback\n"); |
| 965 | if (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..internalcxx . . $ tButtonInfo#internal.) |
| 966 | tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..internalcxx . . $ tButtonInfo#internal.((int)(tce - TCEffectscxx . . $ TCEffects.)); |
| 967 | break; |
| 968 | default: |
| 969 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Button: Invalid Button Type\n"); |
| 970 | Int3cxx . . $ `misc/pserror.h:247:9`!(); // invalid button type |
| 971 | // missing JUMP!!!!!!!!!!!!!!!! |
| 972 | }; |
| 973 | } break; |
| 974 | default: { |
| 975 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Button: Recv'd Evt %d\n", evt.id); |
| 976 | } break; |
| 977 | }; |
| 978 | } |
| 979 | tce->agecxx . . $ tceffect#age. += frametime; |
| 980 | if (tce->agecxx . . $ tceffect#age. > FLASH_SWITCHcxx . . $ `Descent3/TelcomEffectsRender.cpp:886:9`!) { |
| 981 | tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_statecxx . . $ tButtonInfo#flash_state. = !tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_statecxx . . $ tButtonInfo#flash_state.; |
| 982 | tce->agecxx . . $ tceffect#age. = 0; |
| 983 | } |
| 984 | if (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_statecxx . . $ tButtonInfo#flash_state. && tce->flagscxx . . $ tceffect#flags. & OBF_FLASHcxx . . $ `Descent3/TelComEfxStructs.h:305:9`!) { |
| 985 | time_to_flash = true; |
| 986 | } |
| 987 | if (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_timecxx . . $ tButtonInfo#flash_time. > 0) |
| 988 | tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_timecxx . . $ tButtonInfo#flash_time. -= frametime; |
| 989 | if (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_timecxx . . $ tButtonInfo#flash_time. > 0 && !glow) |
| 990 | time_to_flash = false; |
| 991 | if (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_statecxx . . $ tButtonInfo#flash_state. && |
| 992 | (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..button_typecxx . . $ tButtonInfo#button_type. == BUTT_UPARROWcxx . . $ `Descent3/TelComEffects.h:178:9`! || tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..button_typecxx . . $ tButtonInfo#button_type. == BUTT_DOWNARROWcxx . . $ `Descent3/TelComEffects.h:179:9`!)) { |
| 993 | // this is an up/down arrow check to see if we can scroll in the appropriate direction |
| 994 | if (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..parentcxx . . $ tButtonInfo#parent. > -1) { |
| 995 | int pid = GetEfxNumFromIDcxx . . $ GetEfxNumFromID(9b79fb6aee4c0440).(tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..parentcxx . . $ tButtonInfo#parent., tce->screencxx . . $ tceffect#screen.); |
| 996 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(pid != -1); |
| 997 | if (pid != -1) { |
| 998 | tceffectcxx . . $ tceffect# *t = &TCEffectscxx . . $ TCEffects.[pid]; |
| 999 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(t->type == EFX_TEXT_STATICcxx . . $ `Descent3/TelComEffects.h:141:9`! || t->type == EFX_TEXT_TYPEcxx . . $ `Descent3/TelComEffects.h:142:9`! || t->type == EFX_TEXT_FADEcxx . . $ `Descent3/TelComEffects.h:143:9`!); |
| 1000 | switch (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..button_typecxx . . $ tButtonInfo#button_type.) { |
| 1001 | case BUTT_UPARROWcxx . . $ `Descent3/TelComEffects.h:178:9`!: { |
| 1002 | if (t->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..line_indexcxx . . $ tTextInfo#line_index. > 0) { |
| 1003 | time_to_flash = true; |
| 1004 | } |
| 1005 | } break; |
| 1006 | case BUTT_DOWNARROWcxx . . $ `Descent3/TelComEffects.h:179:9`!: { |
| 1007 | if (t->textinfocxx . . $ tceffect#$anonymous_type_0#textinfo..scroll_dcxx . . $ tTextInfo#scroll_d.) { |
| 1008 | time_to_flash = true; |
| 1009 | } |
| 1010 | } break; |
| 1011 | } |
| 1012 | } |
| 1013 | } |
| 1014 | } |
| 1015 | if (tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_handlecxx . . $ tButtonInfo#flash_handle. == -1 && time_to_flash) |
| 1016 | time_to_flash = false; |
| 1017 | if (tce->has_focuscxx . . $ tceffect#has_focus.) { |
| 1018 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx., tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy., |
| 1019 | (time_to_flash) ? &tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flashfocus_chunkcxx . . $ tButtonInfo#flashfocus_chunk. : &tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..chunkfocus_bmpcxx . . $ tButtonInfo#chunkfocus_bmp.); |
| 1020 | } else { |
| 1021 | BltBmpToScreencxx . . $ BltBmpToScreen(df47d900db23a9c5).(tce->pos_xcxx . . $ tceffect#pos_x. + glitch_dxcxx . . $ glitch_dx., tce->pos_ycxx . . $ tceffect#pos_y. + glitch_dycxx . . $ glitch_dy., |
| 1022 | (time_to_flash) ? &tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..flash_chunkcxx . . $ tButtonInfo#flash_chunk. : &tce->buttoninfocxx . . $ tceffect#$anonymous_type_0#buttoninfo..chunk_bmpcxx . . $ tButtonInfo#chunk_bmp.); |
| 1023 | } |
| 1024 | } |