void Screen::splashScreen() { byte *bgfile = _vm->_resman->openResource(2950); initialiseBackgroundLayer(NULL); initialiseBackgroundLayer(NULL); initialiseBackgroundLayer(_vm->fetchBackgroundLayer(bgfile)); initialiseBackgroundLayer(NULL); initialiseBackgroundLayer(NULL); _vm->fetchPalette(bgfile, _palette); setPalette(0, 256, _palette, RDPAL_FADE); renderParallax(_vm->fetchBackgroundLayer(bgfile), 2); closeBackgroundLayer(); byte *loadingBar = _vm->_resman->openResource(2951); byte *frame = _vm->fetchFrameHeader(loadingBar, 0); AnimHeader animHead; CdtEntry cdt; FrameHeader frame_head; animHead.read(_vm->fetchAnimHeader(loadingBar)); cdt.read(_vm->fetchCdtEntry(loadingBar, 0)); frame_head.read(_vm->fetchFrameHeader(loadingBar, 0)); SpriteInfo barSprite; barSprite.x = cdt.x; barSprite.y = cdt.y; barSprite.w = frame_head.width; barSprite.h = frame_head.height; barSprite.scale = 0; barSprite.scaledWidth = 0; barSprite.scaledHeight = 0; barSprite.type = RDSPR_RLE256FAST | RDSPR_TRANS; barSprite.blend = 0; barSprite.colourTable = 0; barSprite.data = frame + FrameHeader::size(); barSprite.isText = false; drawSprite(&barSprite); fadeUp(); waitForFade(); for (int i = 0; i < animHead.noAnimFrames; i++) { frame = _vm->fetchFrameHeader(loadingBar, i); barSprite.data = frame + FrameHeader::size(); drawSprite(&barSprite); updateDisplay(); _vm->_system->delayMillis(30); } _vm->_resman->closeResource(2951); fadeDown(); waitForFade(); }
byte *Sword2Engine::fetchFrameHeader(byte *animFile, uint16 frameNo) { // required address = (address of the start of the anim header) + frameOffset CdtEntry cdt; cdt.read(fetchCdtEntry(animFile, frameNo)); return animFile + ResHeader::size() + cdt.frameOffset; }