REminiscence/cutscene.h

169 lines
4.2 KiB
C
Raw Normal View History

2016-03-20 17:00:00 +01:00
/*
* REminiscence - Flashback interpreter
2019-10-27 17:00:00 +01:00
* Copyright (C) 2005-2019 Gregory Montoir (cyx@users.sourceforge.net)
2015-08-02 18:00:00 +02:00
*/
#ifndef CUTSCENE_H__
#define CUTSCENE_H__
#include "intern.h"
#include "graphics.h"
struct Resource;
struct SystemStub;
struct Video;
struct Cutscene {
typedef void (Cutscene::*OpcodeStub)();
enum {
2021-05-01 18:00:00 +02:00
MAX_VERTICES = 128,
2023-04-15 02:44:11 +02:00
NUM_OPCODES = 15
2015-08-02 18:00:00 +02:00
};
2018-01-20 17:00:00 +01:00
enum {
kTextJustifyLeft = 0,
kTextJustifyAlign = 1,
kTextJustifyCenter = 2,
};
2021-05-01 18:00:00 +02:00
enum {
2021-09-05 18:00:00 +02:00
kCineDebut = 0,
kCineChute = 47,
2021-05-27 18:00:00 +02:00
kCineMemo = 48,
kCineVoyage = 52,
kCineEspions = 57
2021-05-01 18:00:00 +02:00
};
2018-01-20 17:00:00 +01:00
struct SetShape {
uint16_t offset;
uint16_t size;
};
2016-05-09 18:00:00 +02:00
struct Text {
int num;
const char *str;
};
2015-08-02 18:00:00 +02:00
static const OpcodeStub _opcodeTable[];
2019-10-27 17:00:00 +01:00
static const char *_namesTableDOS[];
static const uint16_t _offsetsTableDOS[];
static const uint16_t _offsetsTableAmiga[];
2016-03-20 17:00:00 +01:00
static const uint8_t _amigaDemoOffsetsTable[];
2016-08-07 18:00:00 +02:00
static const uint8_t _ssiOffsetsTable[];
2015-08-02 18:00:00 +02:00
static const uint16_t _cosTable[];
static const uint16_t _sinTable[];
2016-05-09 18:00:00 +02:00
static const uint8_t _creditsDataDOS[];
static const uint8_t _creditsDataAmiga[];
2015-08-02 18:00:00 +02:00
static const uint16_t _creditsCutSeq[];
2023-04-15 02:44:11 +02:00
static const uint8_t _musicTableDOS[];
static const uint8_t _musicTableAmiga[];
2015-08-02 18:00:00 +02:00
static const uint8_t _protectionShapeData[];
2016-05-09 18:00:00 +02:00
static const Text _frTextsTable[];
2017-06-07 18:00:00 +02:00
static const Text _enTextsTable[];
2018-01-20 17:00:00 +01:00
static const uint8_t _caillouSetData[];
2021-05-01 18:00:00 +02:00
static const uint8_t _memoSetShape2Data[];
static const uint8_t _memoSetShape4Data[];
2015-08-02 18:00:00 +02:00
Graphics _gfx;
Resource *_res;
SystemStub *_stub;
Video *_vid;
2016-03-20 17:00:00 +01:00
const uint8_t *_patchedOffsetsTable;
2015-08-02 18:00:00 +02:00
uint16_t _id;
uint16_t _deathCutsceneId;
bool _interrupted;
bool _stop;
2018-02-10 17:00:00 +01:00
const uint8_t *_polPtr;
const uint8_t *_cmdPtr;
const uint8_t *_cmdPtrBak;
2015-08-02 18:00:00 +02:00
uint32_t _tstamp;
uint8_t _frameDelay;
bool _newPal;
2019-10-27 17:00:00 +01:00
uint8_t _palBuf[16 * sizeof(uint16_t) * 2];
2018-03-28 18:00:00 +02:00
uint16_t _baseOffset;
2015-08-02 18:00:00 +02:00
bool _creditsSequence;
2016-03-20 17:00:00 +01:00
uint32_t _rotMat[4];
2015-08-02 18:00:00 +02:00
uint8_t _primitiveColor;
uint8_t _clearScreen;
2021-05-01 18:00:00 +02:00
Point _vertices[MAX_VERTICES];
2015-08-02 18:00:00 +02:00
bool _hasAlphaColor;
uint8_t _varKey;
int16_t _shape_ix;
int16_t _shape_iy;
int16_t _shape_ox;
int16_t _shape_oy;
int16_t _shape_cur_x;
int16_t _shape_cur_y;
int16_t _shape_prev_x;
int16_t _shape_prev_y;
uint16_t _shape_count;
uint32_t _shape_cur_x16;
uint32_t _shape_cur_y16;
uint32_t _shape_prev_x16;
uint32_t _shape_prev_y16;
uint8_t _textSep[0x14];
uint8_t _textBuf[500];
const uint8_t *_textCurPtr;
uint8_t *_textCurBuf;
2021-05-27 18:00:00 +02:00
bool _creditsSlowText;
bool _creditsKeepText;
2015-08-02 18:00:00 +02:00
uint8_t _creditsTextPosX;
uint8_t _creditsTextPosY;
int16_t _creditsTextCounter;
2021-05-27 18:00:00 +02:00
int _creditsTextIndex; /* MAC has the credits data in a resource */
int _creditsTextLen;
2021-05-01 18:00:00 +02:00
uint8_t *_frontPage, *_backPage, *_auxPage;
2015-08-02 18:00:00 +02:00
Cutscene(Resource *res, SystemStub *stub, Video *vid);
2018-02-10 17:00:00 +01:00
const uint8_t *getCommandData() const;
const uint8_t *getPolygonData() const;
2023-04-15 02:44:11 +02:00
void sync(int delay);
2015-08-02 18:00:00 +02:00
void copyPalette(const uint8_t *pal, uint16_t num);
void updatePalette();
2021-05-01 18:00:00 +02:00
void updateScreen();
2016-03-20 17:00:00 +01:00
void setRotationTransform(uint16_t a, uint16_t b, uint16_t c);
2019-10-27 17:00:00 +01:00
uint16_t findTextSeparators(const uint8_t *p, int len);
2018-01-20 17:00:00 +01:00
void drawText(int16_t x, int16_t y, const uint8_t *p, uint16_t color, uint8_t *page, int textJustify);
2021-05-01 18:00:00 +02:00
void clearBackPage();
2015-08-02 18:00:00 +02:00
void drawCreditsText();
void drawProtectionShape(uint8_t shapeNum, int16_t zoom);
void drawShape(const uint8_t *data, int16_t x, int16_t y);
void drawShapeScale(const uint8_t *data, int16_t zoom, int16_t b, int16_t c, int16_t d, int16_t e, int16_t f, int16_t g);
void drawShapeScaleRotate(const uint8_t *data, int16_t zoom, int16_t b, int16_t c, int16_t d, int16_t e, int16_t f, int16_t g);
void op_markCurPos();
void op_refreshScreen();
void op_waitForSync();
void op_drawShape();
void op_setPalette();
2019-12-28 17:00:00 +01:00
void op_drawCaptionText();
2015-08-02 18:00:00 +02:00
void op_nop();
void op_skip3();
void op_refreshAll();
void op_drawShapeScale();
void op_drawShapeScaleRotate();
2021-05-01 18:00:00 +02:00
void op_copyScreen();
void op_drawTextAtPos();
2015-08-02 18:00:00 +02:00
void op_handleKeys();
uint8_t fetchNextCmdByte();
uint16_t fetchNextCmdWord();
2018-03-28 18:00:00 +02:00
void mainLoop(uint16_t num);
2018-01-20 17:00:00 +01:00
bool load(uint16_t cutName);
void unload();
2015-08-02 18:00:00 +02:00
void prepare();
2016-05-09 18:00:00 +02:00
void playCredits();
void playText(const char *str);
2015-08-02 18:00:00 +02:00
void play();
2018-01-20 17:00:00 +01:00
2021-05-01 18:00:00 +02:00
void drawSetShape(const uint8_t *p, uint16_t offset, int x, int y, const uint8_t *paletteLut);
2018-01-20 17:00:00 +01:00
void playSet(const uint8_t *p, int offset);
2015-08-02 18:00:00 +02:00
};
#endif // CUTSCENE_H__