| 543 | //=========================================================================== |
| 544 | |
| 545 | static void parseCopyTile(FScanner& sc, FScriptPosition& pos) |
| 546 | { |
| 547 | FScanner::SavedPos blockend; |
| 548 | int tile = -1, source = -1; |
| 549 | int havetile = 0, xoffset = -1024, yoffset = -1024; |
| 550 | int flags = 0, temppal = -1, tempsource = -1; |
| 551 | |
| 552 | if (!sc.GetNumber(tile, true)) return; |
| 553 | |
| 554 | if (sc.StartBraces(&blockend)) return; |
| 555 | while (!sc.FoundEndBrace(blockend)) |
| 556 | { |
| 557 | sc.MustGetString(); |
| 558 | if (sc.Compare("tile")) |
| 559 | { |
| 560 | if (sc.GetNumber(tempsource, true)) |
| 561 | { |
| 562 | if (ValidateTilenum("copytile", tempsource, pos)) |
| 563 | { |
| 564 | source = tempsource; |
| 565 | havetile = true; |
| 566 | } |
| 567 | } |
| 568 | } |
| 569 | else if (sc.Compare("pal")) |
| 570 | { |
| 571 | // This is a bit messy because it doesn't wait until everything is parsed. Sadly that quirk needs to be replicated... |
| 572 | if (sc.GetNumber(temppal, true)) |
| 573 | { |
| 574 | // palettize self case |
| 575 | if (!havetile) |
| 576 | { |
| 577 | if (ValidateTilenum("copytile", tile, pos)) havetile = true; |
| 578 | } |
| 579 | |
| 580 | if ((unsigned)temppal >= MAXREALPAL) |
| 581 | { |
| 582 | pos.Message(MSG_ERROR, "copytile: palette number %d out of range (max=%d)\n", temppal, MAXREALPAL - 1); |
| 583 | break; |
| 584 | } |
| 585 | } |
| 586 | } |
| 587 | else if (sc.Compare({ "xoff", "xoffset" })) sc.GetNumber(xoffset, true); |
| 588 | else if (sc.Compare({ "yoff", "yoffset" })) sc.GetNumber(yoffset, true); |
| 589 | else if (sc.Compare("texhitscan")) flags |= PICANM_TEXHITSCAN_BIT; |
| 590 | else if (sc.Compare("nofullbright")) flags |= PICANM_NOFULLBRIGHT_BIT; |
| 591 | } |
| 592 | |
| 593 | if (!ValidateTilenum("copytile", tile, pos)) return; |
| 594 | // if !havetile, we have never confirmed a valid source |
| 595 | if (!havetile && !ValidateTilenum("copytile", source, pos)) return; |
| 596 | |
| 597 | tileCopy(tile, source, temppal, xoffset, yoffset, flags); |
| 598 | } |
| 599 | |
| 600 | //=========================================================================== |
| 601 | // |
nothing calls this directly
no test coverage detected