* @brief Render an object sprite * @param x dPiece coordinate * @param y dPiece coordinate * @param ox Back buffer coordinate * @param oy Back buffer coordinate * @param pre Is the sprite in the background */
| 456 | * @param pre Is the sprite in the background |
| 457 | */ |
| 458 | static void DrawObject(int x, int y, int ox, int oy, BOOL pre) |
| 459 | { |
| 460 | int sx, sy, xx, yy, nCel, frames; |
| 461 | char bv; |
| 462 | BYTE *pCelBuff; |
| 463 | |
| 464 | if (dObject[x][y] == 0 || light_table_index >= lightmax) |
| 465 | return; |
| 466 | |
| 467 | if (dObject[x][y] > 0) { |
| 468 | bv = dObject[x][y] - 1; |
| 469 | if (object[bv]._oPreFlag != pre) |
| 470 | return; |
| 471 | sx = ox - object[bv]._oAnimWidth2; |
| 472 | sy = oy; |
| 473 | } else { |
| 474 | bv = -(dObject[x][y] + 1); |
| 475 | if (object[bv]._oPreFlag != pre) |
| 476 | return; |
| 477 | xx = object[bv]._ox - x; |
| 478 | yy = object[bv]._oy - y; |
| 479 | sx = (xx << 5) + ox - object[bv]._oAnimWidth2 - (yy << 5); |
| 480 | sy = oy + (yy << 4) + (xx << 4); |
| 481 | } |
| 482 | |
| 483 | assert((unsigned char)bv < MAXOBJECTS); |
| 484 | |
| 485 | pCelBuff = object[bv]._oAnimData; |
| 486 | if (!pCelBuff) { |
| 487 | // app_fatal("Draw Object type %d: NULL Cel Buffer", object[bv]._otype); |
| 488 | return; |
| 489 | } |
| 490 | |
| 491 | nCel = object[bv]._oAnimFrame; |
| 492 | frames = SDL_SwapLE32(*(DWORD *)pCelBuff); |
| 493 | if (nCel < 1 || frames > 50 || nCel > (int)frames) { |
| 494 | // app_fatal("Draw Object: frame %d of %d, object type==%d", nCel, frames, object[bv]._otype); |
| 495 | return; |
| 496 | } |
| 497 | |
| 498 | if (bv == pcursobj) |
| 499 | CelBlitOutline(194, sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth); |
| 500 | if (object[bv]._oLight) { |
| 501 | CelClippedDrawLight(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth); |
| 502 | } else { |
| 503 | CelClippedDraw(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth); |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | static void scrollrt_draw_dungeon(int sx, int sy, int dx, int dy, int eflag); |
| 508 |
no test coverage detected