2003-05-14 22:33:39 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2003 The ScummVM project
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SKYSCREEN_H
|
|
|
|
#define SKYSCREEN_H
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include "common/engine.h"
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "sky/disk.h"
|
|
|
|
#include "sky/skydefs.h"
|
|
|
|
#include "sky/sky.h"
|
2003-05-27 16:42:20 +00:00
|
|
|
#include "sky/logic.h"
|
2003-05-14 22:33:39 +00:00
|
|
|
|
|
|
|
#define SCROLL_JUMP 16
|
|
|
|
#define VGA_COLOURS 256
|
|
|
|
#define GAME_COLOURS 240
|
|
|
|
#define SEQ_DELAY 3
|
|
|
|
|
2003-05-27 16:42:20 +00:00
|
|
|
#define FORE 1
|
|
|
|
#define BACK 0
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint16 yCood;
|
|
|
|
Compact *compact;
|
|
|
|
dataFileHeader *sprite;
|
|
|
|
} StSortList;
|
|
|
|
|
|
|
|
class SkyState;
|
|
|
|
|
2003-05-14 22:33:39 +00:00
|
|
|
class SkyScreen {
|
|
|
|
public:
|
|
|
|
SkyScreen(OSystem *pSystem, SkyDisk *pDisk);
|
|
|
|
~SkyScreen(void);
|
|
|
|
void setPalette(uint8 *pal);
|
2003-07-10 20:09:19 +00:00
|
|
|
void setPaletteEndian(uint8 *pal);
|
2003-05-14 22:33:39 +00:00
|
|
|
void setPalette(uint16 fileNum);
|
|
|
|
void paletteFadeUp(uint8 *pal);
|
|
|
|
void paletteFadeUp(uint16 fileNr);
|
|
|
|
|
|
|
|
void showScreen(uint16 fileNum);
|
|
|
|
void showScreen(uint8 *pScreen);
|
|
|
|
|
|
|
|
void handleTimer(void);
|
|
|
|
void startSequence(uint16 fileNum);
|
2003-06-02 06:42:42 +00:00
|
|
|
void startSequenceItem(uint16 itemNum);
|
2003-05-14 22:33:39 +00:00
|
|
|
void stopSequence(void);
|
2003-06-02 06:42:42 +00:00
|
|
|
bool sequenceRunning(void) { return _seqInfo.running; };
|
|
|
|
void waitForSequence(void) { while (_seqInfo.running) _system->delay_msecs(20); };
|
2003-05-14 22:33:39 +00:00
|
|
|
uint32 seqFramesLeft(void) { return _seqInfo.framesLeft; };
|
|
|
|
uint8 *giveCurrent(void) { return _currentScreen; };
|
2003-05-27 16:42:20 +00:00
|
|
|
void halvePalette(void);
|
|
|
|
|
|
|
|
//- regular screen.asm routines
|
|
|
|
void forceRefresh(void) { memset(_gameGrid, 0x80, GRID_X * GRID_Y); };
|
|
|
|
void fnFadeUp(uint32 palNum, uint32 scroll);
|
|
|
|
void fnFadeDown(uint32 scroll);
|
|
|
|
void fnDrawScreen(uint32 palette, uint32 scroll);
|
2003-06-02 06:42:42 +00:00
|
|
|
void clearScreen(void);
|
2003-05-27 16:42:20 +00:00
|
|
|
|
2003-05-28 21:29:50 +00:00
|
|
|
void recreate(void);
|
2003-07-11 22:59:56 +00:00
|
|
|
void flip(bool doUpdate = true);
|
2003-05-28 21:29:50 +00:00
|
|
|
|
|
|
|
void spriteEngine(void);
|
|
|
|
|
2003-07-01 01:29:29 +00:00
|
|
|
void paintBox(uint16 x, uint16 y);
|
|
|
|
void showGrid(uint8 *gridBuf);
|
|
|
|
|
2003-05-14 22:33:39 +00:00
|
|
|
private:
|
|
|
|
OSystem *_system;
|
|
|
|
SkyDisk *_skyDisk;
|
|
|
|
static uint8 _top16Colours[16*3];
|
|
|
|
uint8 _palette[1024];
|
2003-05-27 16:42:20 +00:00
|
|
|
uint32 _currentPalette;
|
2003-06-03 18:10:32 +00:00
|
|
|
uint8 _seqGrid[20 * 12];
|
2003-05-14 22:33:39 +00:00
|
|
|
|
|
|
|
bool volatile _gotTick;
|
|
|
|
void waitForTimer(void);
|
2003-05-27 16:42:20 +00:00
|
|
|
void processSequence(void);
|
2003-05-14 22:33:39 +00:00
|
|
|
|
2003-05-27 16:42:20 +00:00
|
|
|
uint8 *_gameGrid;
|
|
|
|
uint8 *_currentScreen;
|
|
|
|
uint8 *_scrollScreen;
|
|
|
|
uint8 *_backScreen;
|
2003-05-14 22:33:39 +00:00
|
|
|
struct {
|
|
|
|
uint32 framesLeft;
|
|
|
|
uint32 delay;
|
|
|
|
uint8 *seqData;
|
|
|
|
uint8 *seqDataPos;
|
2003-06-02 06:48:36 +00:00
|
|
|
volatile bool running;
|
2003-06-02 06:42:42 +00:00
|
|
|
bool runningItem; // when playing an item, don't free it afterwards.
|
2003-05-14 22:33:39 +00:00
|
|
|
} _seqInfo;
|
|
|
|
|
2003-05-27 16:42:20 +00:00
|
|
|
//- more regular screen.asm + layer.asm routines
|
2003-05-14 22:33:39 +00:00
|
|
|
void convertPalette(uint8 *inPal, uint8* outPal);
|
|
|
|
void palette_fadedown_helper(uint32 *pal, uint num);
|
2003-05-28 21:29:50 +00:00
|
|
|
|
2003-05-27 16:42:20 +00:00
|
|
|
//- sprite.asm routines
|
|
|
|
// fixme: get rid of these globals
|
|
|
|
uint32 _sprWidth, _sprHeight, _sprX, _sprY, _maskX1, _maskX2;
|
2003-05-28 21:29:50 +00:00
|
|
|
void doSprites(uint8 layer);
|
2003-05-27 16:42:20 +00:00
|
|
|
void sortSprites(void);
|
|
|
|
void drawSprite(uint8 *spriteData, Compact *sprCompact);
|
|
|
|
void verticalMask(void);
|
|
|
|
void vertMaskSub(uint16 *grid, uint32 gridOfs, uint8 *screenPtr, uint32 layerId);
|
|
|
|
void vectorToGame(uint8 gridVal);
|
2003-05-14 22:33:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //SKYSCREEN_H
|