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

Function TelcomDisplayStatic

Descent3/TelCom.cpp:2208–2252  ·  view source on GitHub ↗

Displays static on the screen

Source from the content-addressed store, hash-verified

2206
2207// Displays static on the screen
2208void TelcomDisplayStatic(float alpha) {
2209 int x, y;
2210 int height = (Telcom_system.Monitor_coords[MONITOR_MAIN].bottom) - (Telcom_system.Monitor_coords[MONITOR_MAIN].top);
2211 int width = (Telcom_system.Monitor_coords[MONITOR_MAIN].right) - (Telcom_system.Monitor_coords[MONITOR_MAIN].left);
2212 int type;
2213
2214 if (alpha < 0)
2215 alpha = 0;
2216 if (alpha > 1)
2217 alpha = 1;
2218
2219 type = (int)myrand(21);
2220 if ((type < 7))
2221 type = 0;
2222 else if ((type < 14))
2223 type = 4;
2224 else
2225 type = 8;
2226
2227 int xoff = Telcom_system.Monitor_coords[MONITOR_MAIN].left;
2228 int yoff = Telcom_system.Monitor_coords[MONITOR_MAIN].top;
2229
2230 rend_SetAlphaType(AT_CONSTANT_TEXTURE);
2231 rend_SetAlphaValue(alpha * 255.0);
2232 rend_SetLighting(LS_NONE);
2233 rend_SetColorModel(CM_MONO);
2234 rend_SetOverlayType(OT_NONE);
2235 rend_SetWrapType(WT_CLAMP);
2236 rend_SetFiltering(0);
2237
2238 int dy = ((int)myrand(32)) - 16;
2239
2240 int h = bm_h(StaticBmps[type], 0);
2241 int w = bm_w(StaticBmps[type], 0);
2242 int j = 0;
2243 for (y = dy; y < height; y += h)
2244 for (x = 0; x < width; x += w) {
2245 rend_DrawScaledBitmap(x + xoff, y + yoff, x + w + xoff, y + h + yoff, StaticBmps[type + (j % 4)], 0, 0, 1, 1);
2246 h = bm_h(StaticBmps[type + (j % 4)], 0);
2247 w = bm_w(StaticBmps[type + (j % 4)], 0);
2248 j++;
2249 }
2250
2251 rend_SetFiltering(1);
2252}
2253
2254// Frees the mouse cursor
2255void TelcomFreeMouseCursor(void) {

Callers 1

TelcomRenderOverlaysFunction · 0.85

Calls 11

myrandFunction · 0.85
bm_hFunction · 0.85
bm_wFunction · 0.85
rend_SetAlphaTypeFunction · 0.50
rend_SetAlphaValueFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetOverlayTypeFunction · 0.50
rend_SetWrapTypeFunction · 0.50
rend_SetFilteringFunction · 0.50
rend_DrawScaledBitmapFunction · 0.50

Tested by

no test coverage detected