* @brief Check if and how a mosnter should be rendered * @param y dPiece coordinate * @param x dPiece coordinate * @param oy dPiece Y offset * @param sx Back buffer coordinate * @param sy Back buffer coordinate * @param eflag Should the sorting workaround be applied */
| 604 | * @param eflag Should the sorting workaround be applied |
| 605 | */ |
| 606 | static void DrawMonsterHelper(int x, int y, int oy, int sx, int sy, int eflag) |
| 607 | { |
| 608 | int mi, px, py; |
| 609 | MonsterStruct *pMonster; |
| 610 | |
| 611 | if (!(dFlags[x][y] & BFLAG_LIT) && !plr[myplr]._pInfraFlag) |
| 612 | return; |
| 613 | |
| 614 | mi = dMonster[x][y + oy]; |
| 615 | mi = mi > 0 ? mi - 1 : -(mi + 1); |
| 616 | |
| 617 | if (leveltype == DTYPE_TOWN) { |
| 618 | px = sx - towner[mi]._tAnimWidth2; |
| 619 | if (mi == pcursmonst) { |
| 620 | CelBlitOutline(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth); |
| 621 | } |
| 622 | assert(towner[mi]._tAnimData); |
| 623 | CelClippedDraw(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth); |
| 624 | return; |
| 625 | } |
| 626 | |
| 627 | if ((DWORD)mi >= MAXMONSTERS) { |
| 628 | // app_fatal("Draw Monster: tried to draw illegal monster %d", mi); |
| 629 | } |
| 630 | |
| 631 | pMonster = &monster[mi]; |
| 632 | if (pMonster->_mFlags & MFLAG_HIDDEN) { |
| 633 | return; |
| 634 | } |
| 635 | |
| 636 | if (pMonster->MType != NULL) { |
| 637 | // app_fatal("Draw Monster \"%s\": uninitialized monster", pMonster->mName); |
| 638 | } |
| 639 | |
| 640 | px = sx + pMonster->_mxoff - pMonster->MType->width2; |
| 641 | py = sy + pMonster->_myoff; |
| 642 | if (mi == pcursmonst) { |
| 643 | Cl2DrawOutline(233, px, py, pMonster->_mAnimData, pMonster->_mAnimFrame, pMonster->MType->width); |
| 644 | } |
| 645 | DrawMonster(x, y, px, py, mi); |
| 646 | if (eflag && !pMonster->_meflag) { |
| 647 | scrollrt_draw_e_flag(x - 1, y + 1, sx - 64, sy); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | /** |
| 652 | * @brief Check if and how a player should be rendered |
no test coverage detected