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

Function TelcomCreateStaticOverlays

Descent3/TelCom.cpp:2118–2198  ·  view source on GitHub ↗

Creates the static bitmap overlays

Source from the content-addressed store, hash-verified

2116
2117// Creates the static bitmap overlays
2118void TelcomCreateStaticOverlays(void) {
2119 int i;
2120 for (i = 0; i < STATIC_BMPS; i++)
2121 StaticBmps[i] = BAD_BITMAP_HANDLE;
2122
2123 int j;
2124 int size;
2125 int saturation = 10;
2126 int result;
2127 float amount;
2128 uint16_t *data[8];
2129
2130 amount = ((float)saturation) * 0.4f;
2131
2132 uint16_t def_color = OPAQUE_FLAG | GR_RGB16(24, 255, 0);
2133
2134 size = 64 * 64;
2135 for (i = 0; i < 4; i++) {
2136 // last 4 bitmaps
2137 StaticBmps[i + 8] = bm_AllocBitmap(64, 64, 0);
2138 data[i + 4] = bm_data(StaticBmps[i + 8], 0);
2139
2140 // middle 4 bitmaps
2141 StaticBmps[i + 4] = bm_AllocBitmap(64, 64, 0);
2142 data[i] = bm_data(StaticBmps[i + 4], 0);
2143
2144 // first 4 bitmaps
2145 StaticBmps[i] = bm_AllocBitmap(128, 128, 0);
2146 data[i] = bm_data(StaticBmps[i], 0);
2147 }
2148
2149 float t = timer_GetTime();
2150
2151 for (j = 0; j < size; j++) {
2152 for (i = 0; i < 4; i++) {
2153
2154 // last 4 bitmaps
2155 result = (int)myrand(amount);
2156 if (!result) {
2157 if ((int)myrand(5) == 3)
2158 data[i + 4][j] = def_color;
2159 else {
2160 uint8_t grey = (uint8_t)myrand(200) + 55;
2161 data[i + 4][j] = OPAQUE_FLAG | GR_RGB16(grey, grey, grey);
2162 }
2163 } else
2164 data[i + 4][j] = NEW_TRANSPARENT_COLOR;
2165
2166 // middle 4 bitmaps
2167 ps_srand(t * 674338);
2168 result = (int)myrand(amount);
2169 if (!result) {
2170 if ((int)myrand(5) == 3)
2171 data[i][j] = def_color;
2172 else {
2173 uint8_t grey = (uint8_t)myrand(200) + 55;
2174 data[i][j] = OPAQUE_FLAG | GR_RGB16(grey, grey, grey);
2175 }

Callers

nothing calls this directly

Calls 6

GR_RGB16Function · 0.85
bm_AllocBitmapFunction · 0.85
bm_dataFunction · 0.85
myrandFunction · 0.85
ps_srandFunction · 0.85
ps_randFunction · 0.85

Tested by

no test coverage detected