* @brief Render a monster sprite * @param x dPiece coordinate * @param y dPiece coordinate * @param mx Back buffer coordinate * @param my Back buffer coordinate * @param m Id of monster */
| 282 | * @param m Id of monster |
| 283 | */ |
| 284 | static void DrawMonster(int x, int y, int mx, int my, int m) |
| 285 | { |
| 286 | int nCel, frames; |
| 287 | char trans; |
| 288 | BYTE *pCelBuff; |
| 289 | |
| 290 | if ((DWORD)m >= MAXMONSTERS) { |
| 291 | // app_fatal("Draw Monster: tried to draw illegal monster %d", m); |
| 292 | return; |
| 293 | } |
| 294 | |
| 295 | pCelBuff = monster[m]._mAnimData; |
| 296 | if (!pCelBuff) { |
| 297 | // app_fatal("Draw Monster \"%s\": NULL Cel Buffer", monster[m].mName); |
| 298 | return; |
| 299 | } |
| 300 | |
| 301 | nCel = monster[m]._mAnimFrame; |
| 302 | frames = SDL_SwapLE32(*(DWORD *)pCelBuff); |
| 303 | if (nCel < 1 || frames > 50 || nCel > frames) { |
| 304 | /* |
| 305 | const char *szMode = "unknown action"; |
| 306 | if(monster[m]._mmode <= 17) |
| 307 | szMode = szMonModeAssert[monster[m]._mmode]; |
| 308 | app_fatal( |
| 309 | "Draw Monster \"%s\" %s: facing %d, frame %d of %d", |
| 310 | monster[m].mName, |
| 311 | szMode, |
| 312 | monster[m]._mdir, |
| 313 | nCel, |
| 314 | frames); |
| 315 | */ |
| 316 | return; |
| 317 | } |
| 318 | |
| 319 | if (!(dFlags[x][y] & BFLAG_LIT)) { |
| 320 | Cl2DrawLightTbl(mx, my, monster[m]._mAnimData, monster[m]._mAnimFrame, monster[m].MType->width, 1); |
| 321 | } else { |
| 322 | trans = 0; |
| 323 | if (monster[m]._uniqtype) |
| 324 | trans = monster[m]._uniqtrans + 4; |
| 325 | if (monster[m]._mmode == MM_STONE) |
| 326 | trans = 2; |
| 327 | if (plr[myplr]._pInfraFlag && light_table_index > 8) |
| 328 | trans = 1; |
| 329 | if (trans) |
| 330 | Cl2DrawLightTbl(mx, my, monster[m]._mAnimData, monster[m]._mAnimFrame, monster[m].MType->width, trans); |
| 331 | else |
| 332 | Cl2DrawLight(mx, my, monster[m]._mAnimData, monster[m]._mAnimFrame, monster[m].MType->width); |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * @brief Render a player sprite |
no test coverage detected