| 382 | } |
| 383 | |
| 384 | void cGraphics_Amiga::Load_And_Draw_Image(const std::string& pFilename, unsigned int pColors, size_t pBackColor) { |
| 385 | std::string Filename = pFilename; |
| 386 | |
| 387 | if (Filename.find('.') == std::string::npos) |
| 388 | Filename.append(".raw"); |
| 389 | |
| 390 | // Try it as an IFF |
| 391 | auto Decoded = DecodeIFF(Filename); |
| 392 | |
| 393 | // Did we decode an IFF? |
| 394 | if (!Decoded.mData->size()) { |
| 395 | |
| 396 | // No, treat as a raw file |
| 397 | Decoded.mData = g_Resource->fileGet(Filename); |
| 398 | |
| 399 | if (!Decoded.mData->size()) |
| 400 | return; |
| 401 | |
| 402 | // Calculate planes based on file size |
| 403 | if (Decoded.mData->size() == 51464) |
| 404 | Decoded.mPlanes = 5; |
| 405 | else |
| 406 | Decoded.mPlanes = 4; |
| 407 | |
| 408 | // Not an iff, probably RAW which has the palette at the start |
| 409 | Decoded.LoadPalette_Amiga(Decoded.mData->data(), (1LL << Decoded.mPlanes)); |
| 410 | |
| 411 | // Remove the palette |
| 412 | Decoded.mData->erase(Decoded.mData->begin(), Decoded.mData->begin() + ((2LL << Decoded.mPlanes))); |
| 413 | |
| 414 | // All raws are 320x257 |
| 415 | Decoded.mDimension.mWidth = 0x140; |
| 416 | Decoded.mDimension.mHeight = 0x101; |
| 417 | } |
| 418 | |
| 419 | // Load the palette |
| 420 | Decoded.CopyPalette(mPalette, (1LL << Decoded.mPlanes)); |
| 421 | |
| 422 | mBMHD_Current = Decoded.GetHeader(); |
| 423 | |
| 424 | mFodder->mVideo_Draw_FrameDataPtr = Decoded.mData->data(); |
| 425 | mFodder->mVideo_Draw_PosX = 16; |
| 426 | mFodder->mVideo_Draw_PosY = 16; |
| 427 | mFodder->mVideo_Draw_Columns = Decoded.mDimension.mWidth >> 3; |
| 428 | mFodder->mVideo_Draw_Rows = Decoded.mDimension.mHeight; |
| 429 | mFodder->mVideo_Draw_PaletteIndex = 0; |
| 430 | |
| 431 | mSurface->clearBuffer(pBackColor); |
| 432 | |
| 433 | Video_Draw_16(); |
| 434 | mBMHD_Current = 0; |
| 435 | } |
| 436 | |
| 437 | void cGraphics_Amiga::PaletteLoad(const uint8* pBuffer, uint32 pColorID, uint32 pColors) { |
| 438 |
nothing calls this directly
no test coverage detected