MCPcopy Create free account
hub / github.com/diasurgical/devilution / Cl2DrawLightTbl

Function Cl2DrawLightTbl

Source/engine.cpp:1298–1322  ·  view source on GitHub ↗

* @brief Blit CL2 sprite, and apply a given lighting, to the back buffer at the given coordianates * @param sx Back buffer coordinate * @param sy Back buffer coordinate * @param pCelBuff CL2 buffer * @param nCel CL2 frame number * @param nWidth Width of sprite * @param light Light shade to use */

Source from the content-addressed store, hash-verified

1296 * @param light Light shade to use
1297 */
1298void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light)
1299{
1300 int nDataSize, idx;
1301 BYTE *pRLEBytes, *pDecodeTo;
1302
1303 assert(gpBuffer != NULL);
1304 assert(pCelBuff != NULL);
1305 assert(nCel > 0);
1306
1307 pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
1308 pDecodeTo = &gpBuffer[sx + BUFFER_WIDTH * sy];
1309
1310 idx = light4flag ? 1024 : 4096;
1311 if (light == 2)
1312 idx += 256;
1313 if (light >= 4)
1314 idx += (light - 1) << 8;
1315
1316 Cl2BlitLightSafe(
1317 pDecodeTo,
1318 pRLEBytes,
1319 nDataSize,
1320 nWidth,
1321 &pLightTbl[idx]);
1322}
1323
1324/**
1325 * @brief Blit CL2 sprite, and apply lighting, to the given buffer

Callers 4

DrawMissilePrivateFunction · 0.85
DrawMonsterFunction · 0.85
DrawPlayerFunction · 0.85
scrollrt_draw_dungeonFunction · 0.85

Calls 2

CelGetFrameClippedFunction · 0.85
Cl2BlitLightSafeFunction · 0.85

Tested by

no test coverage detected