* @brief Render a player sprite * @param pnum Player id * @param x dPiece coordinate * @param y dPiece coordinate * @param px Back buffer coordinate * @param py Back buffer coordinate * @param pCelBuff sprite buffer * @param nCel frame * @param nWidth width */
| 345 | * @param nWidth width |
| 346 | */ |
| 347 | static void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, int nCel, int nWidth) |
| 348 | { |
| 349 | int l, frames; |
| 350 | |
| 351 | if (dFlags[x][y] & BFLAG_LIT || plr[myplr]._pInfraFlag || !setlevel && !currlevel) { |
| 352 | if (!pCelBuff) { |
| 353 | // app_fatal("Drawing player %d \"%s\": NULL Cel Buffer", pnum, plr[pnum]._pName); |
| 354 | return; |
| 355 | } |
| 356 | frames = SDL_SwapLE32(*(DWORD *)pCelBuff); |
| 357 | if (nCel < 1 || frames > 50 || nCel > frames) { |
| 358 | /* |
| 359 | const char *szMode = "unknown action"; |
| 360 | if(plr[pnum]._pmode <= PM_QUIT) |
| 361 | szMode = szPlrModeAssert[plr[pnum]._pmode]; |
| 362 | app_fatal( |
| 363 | "Drawing player %d \"%s\" %s: facing %d, frame %d of %d", |
| 364 | pnum, |
| 365 | plr[pnum]._pName, |
| 366 | szMode, |
| 367 | plr[pnum]._pdir, |
| 368 | nCel, |
| 369 | frames); |
| 370 | */ |
| 371 | return; |
| 372 | } |
| 373 | if (pnum == pcursplr) |
| 374 | Cl2DrawOutline(165, px, py, pCelBuff, nCel, nWidth); |
| 375 | if (pnum == myplr) { |
| 376 | Cl2Draw(px, py, pCelBuff, nCel, nWidth); |
| 377 | if (plr[pnum].pManaShield) |
| 378 | Cl2Draw( |
| 379 | px + plr[pnum]._pAnimWidth2 - misfiledata[MFILE_MANASHLD].mAnimWidth2[0], |
| 380 | py, |
| 381 | misfiledata[MFILE_MANASHLD].mAnimData[0], |
| 382 | 1, |
| 383 | misfiledata[MFILE_MANASHLD].mAnimWidth[0]); |
| 384 | } else if (!(dFlags[x][y] & BFLAG_LIT) || plr[myplr]._pInfraFlag && light_table_index > 8) { |
| 385 | Cl2DrawLightTbl(px, py, pCelBuff, nCel, nWidth, 1); |
| 386 | if (plr[pnum].pManaShield) |
| 387 | Cl2DrawLightTbl( |
| 388 | px + plr[pnum]._pAnimWidth2 - misfiledata[MFILE_MANASHLD].mAnimWidth2[0], |
| 389 | py, |
| 390 | misfiledata[MFILE_MANASHLD].mAnimData[0], |
| 391 | 1, |
| 392 | misfiledata[MFILE_MANASHLD].mAnimWidth[0], |
| 393 | 1); |
| 394 | } else { |
| 395 | l = light_table_index; |
| 396 | if (light_table_index < 5) |
| 397 | light_table_index = 0; |
| 398 | else |
| 399 | light_table_index -= 5; |
| 400 | Cl2DrawLight(px, py, pCelBuff, nCel, nWidth); |
| 401 | if (plr[pnum].pManaShield) |
| 402 | Cl2DrawLight( |
| 403 | px + plr[pnum]._pAnimWidth2 - misfiledata[MFILE_MANASHLD].mAnimWidth2[0], |
| 404 | py, |
no test coverage detected