HYPNO: use CLUT8 instead of converting images and load palettes when necessary as well some fixes in spider

This commit is contained in:
neuromancer 2022-01-10 20:22:07 +01:00
parent 640d5a730a
commit 63b7a6b5a6
15 changed files with 941 additions and 1077 deletions

View File

@ -70,13 +70,16 @@ void HypnoEngine::runMenu(Hotspots hs) {
// runMice(h, (Mice*) action);
}
//if (h.stype == "SINGLE_RUN")
// loadImage("int_main/mainbutt.smk", 0, 0);
if (_conversation.empty()) {
if (h.flags[0] == "HINTS" || h.flags[1] == "HINTS" || h.flags[2] == "HINTS")
loadImage("int_main/hint1.smk", 0, 0, true);
else if (h.flags[0] == "AUTO_BUTTONS")
loadImage("int_main/resume.smk", 0, 0, true);
else if (h.flags[0] == "AUTO_BUTTONS") {
if (isDemo())
loadImage("int_main/resume.smk", 0, 0, true, false, 0);
else
loadImage("int_main/menu.smk", 0, 0, true, false, 0);
}
}
}
@ -114,19 +117,8 @@ void HypnoEngine::runMice(Mice *a) {
}
void HypnoEngine::runPalette(Palette *a) {
return; // remove when palette are working
Common::File *file = new Common::File();
Common::String path = convertPath(a->path);
if (!_prefixDir.empty())
path = _prefixDir + "/" + path;
if (!file->open(path))
error("unable to find video file %s", path.c_str());
debugC(1, kHypnoDebugScene, "Loading palette from %s", path.c_str());
byte *videoPalette = (byte*) malloc(file->size());
file->read(videoPalette, file->size());
g_system->getPaletteManager()->setPalette(videoPalette+8, 0, 256);
//return; // remove when palette are working
loadPalette(a->path);
}
void HypnoEngine::runEscape() {
@ -179,7 +171,7 @@ void HypnoEngine::runPlay(Play *a) {
void HypnoEngine::runAmbient(Ambient *a) {
if (a->flag == "/BITMAP") {
Graphics::Surface *frame = decodeFrame(a->path, a->frameNumber, true);
Graphics::Surface *frame = decodeFrame(a->path, a->frameNumber);
Graphics::Surface *sframe;
if (a->fullscreen)
sframe = frame->scale(_screenW, _screenH);

View File

@ -109,13 +109,12 @@ void HypnoEngine::hitPlayer() {
if (_playerFrameIdx < _playerFrameSep)
_playerFrameIdx = _playerFrameSep;
} else {
uint32 red = _pixelFormat.ARGBToColor(1, 255, 0, 0);
_compositeSurface->fillRect(Common::Rect(0, 0, 640, 480), red);
uint32 c = 251; // red
_compositeSurface->fillRect(Common::Rect(0, 0, 640, 480), c);
drawScreen();
}
//if (!_hitSound.empty())
// playSound(_soundPath + _hitSound, 1);
}
void HypnoEngine::runArcade(ArcadeShooting *arc) {
@ -141,10 +140,8 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
_skipLevel = false;
for (Frames::iterator it =_playerFrames.begin(); it != _playerFrames.end(); ++it) {
if ((*it)->getPixel(0, 0) == _pixelFormat.RGBToColor(0, 255, 255))
break;
if ((*it)->getPixel(0, 0) == _pixelFormat.RGBToColor(0, 0, 255))
break;
if ((*it)->getPixel(0, 0) == 255)
break;
_playerFrameSep++;
}
@ -161,6 +158,7 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
changeCursor("arcade");
playVideo(background);
loadPalette(arc->palette);
background.decoder->setRate(1.5);
bool shootingPrimary = false;
bool shootingSecondary = false;
@ -282,6 +280,7 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
s.video = new MVideo(it->animation, it->position, true, false, false);
playVideo(*s.video);
s.video->currentFrame = s.video->decoder->decodeNextFrame(); // Skip the first frame
loadPalette(s.video->decoder->getPalette(), s.paletteOffset, s.paletteSize);
_shoots.push_back(s);
playSound(_soundPath + arc->enemySound, 1);
}

View File

@ -120,8 +120,10 @@ void HypnoEngine::changeCursor(const Common::String &cursor) {
}
void HypnoEngine::changeCursor(const Common::String &cursor, uint32 n) {
Graphics::Surface *entry = decodeFrame(cursor, n, false);
CursorMan.replaceCursor(entry->getPixels(), entry->w, entry->h, 0, 0, 0);
byte *palette;
Graphics::Surface *entry = decodeFrame(cursor, n, &palette);
CursorMan.replaceCursor(entry->getPixels(), entry->w, entry->h, 0, 0, 0, &_pixelFormat);
CursorMan.replaceCursorPalette(palette, 0, 256);
entry->free();
delete entry;
CursorMan.showMouse(true);

View File

@ -34,13 +34,28 @@
namespace Hypno {
typedef Common::String Filename;
typedef Common::List<Filename> Filenames;
class HypnoSmackerDecoder : public Video::SmackerDecoder {
public:
bool loadStream(Common::SeekableReadStream *stream) override;
};
typedef Common::String Filename;
typedef Common::List<Filename> Filenames;
class MVideo {
public:
MVideo(Filename, Common::Point, bool, bool, bool);
Filename path;
Common::Point position;
bool scaled;
bool transparent;
bool loop;
bool palette;
HypnoSmackerDecoder *decoder;
const Graphics::Surface *currentFrame;
};
typedef Common::Array<MVideo> Videos;
enum HotspotType {
MakeMenu,
@ -80,20 +95,6 @@ class Hotspot;
typedef Common::Array<Hotspot> Hotspots;
typedef Common::Array<Hotspots *> HotspotsStack;
class MVideo {
public:
MVideo(Filename, Common::Point, bool, bool, bool);
Filename path;
Common::Point position;
bool scaled;
bool transparent;
bool loop;
HypnoSmackerDecoder *decoder;
const Graphics::Surface *currentFrame;
};
typedef Common::Array<MVideo> Videos;
class Hotspot {
public:
Hotspot(HotspotType type_, Common::Rect rect_ = Common::Rect(0, 0, 0, 0)) {
@ -352,6 +353,10 @@ public:
uint32 pointsToShoot;
uint32 attackWeight;
// Palette
uint32 paletteOffset;
uint32 paletteSize;
// Sounds
Filename deathSound;
Filename hitSound;
@ -392,6 +397,7 @@ public:
Filename background;
Filename player;
Filename palette;
int health;
Shoots shoots;
ShootSequence shootSequence;

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,9 @@ hline: CTOK NUM {
g_parsedArc->background = $2;
debugC(1, kHypnoDebugParser, "N %s", $2);
}
| RTOK FILENAME { debugC(1, kHypnoDebugParser, "R %s", $2); }
| RTOK FILENAME {
g_parsedArc->palette = $2;
debugC(1, kHypnoDebugParser, "R %s", $2); }
| ITOK FILENAME {
g_parsedArc->player = $2;
debugC(1, kHypnoDebugParser, "I %s", $2);
@ -248,7 +250,10 @@ bline: FNTOK FILENAME {
shoot->explosionFrame = $3;
debugC(1, kHypnoDebugParser, "KN %d %d", $2, $3);
}
| P0TOK NUM NUM { debugC(1, kHypnoDebugParser, "P0 %d %d", $2, $3); }
| P0TOK NUM NUM {
shoot->paletteSize = $2;
shoot->paletteOffset = $3;
debugC(1, kHypnoDebugParser, "P0 %d %d", $2, $3); }
| OTOK NUM NUM {
debugC(1, kHypnoDebugParser, "O %d %d", $2, $3);
}

View File

@ -46,16 +46,6 @@ Hotspots *g_parsedHots;
ArcadeShooting *g_parsedArc;
HypnoEngine *g_hypno;
MVideo::MVideo(Common::String path_, Common::Point position_, bool transparent_, bool scaled_, bool loop_) {
decoder = nullptr;
currentFrame = nullptr;
path = path_;
position = position_;
scaled = scaled_;
transparent = transparent_;
loop = loop_;
}
HypnoEngine::HypnoEngine(OSystem *syst, const ADGameDescription *gd)
: Engine(syst), _gameDescription(gd), _image(nullptr),
_compositeSurface(nullptr), _transparentColor(0),
@ -128,10 +118,8 @@ Common::Error HypnoEngine::run() {
initGraphicsModes(modes);
// Initialize graphics
initGraphics(_screenW, _screenH, nullptr);
_pixelFormat = g_system->getScreenFormat();
if (_pixelFormat == Graphics::PixelFormat::createFormatCLUT8())
return Common::kUnsupportedColorMode;
_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
initGraphics(_screenW, _screenH, &_pixelFormat);
_compositeSurface = new Graphics::ManagedSurface();
_compositeSurface->create(_screenW, _screenH, _pixelFormat);
@ -258,9 +246,17 @@ void HypnoEngine::runIntro(MVideo &video) {
void HypnoEngine::runCode(Code *code) { error("Function \"%s\" not implemented", __FUNCTION__); }
void HypnoEngine::showCredits() { error("Function \"%s\" not implemented", __FUNCTION__); }
void HypnoEngine::loadImage(const Common::String &name, int x, int y, bool transparent, int frameNumber) {
void HypnoEngine::loadImage(const Common::String &name, int x, int y, bool transparent, bool palette, int frameNumber) {
debugC(1, kHypnoDebugMedia, "%s(%s, %d, %d, %d)", __FUNCTION__, name.c_str(), x, y, transparent);
Graphics::Surface *surf = decodeFrame(name, frameNumber);
Graphics::Surface *surf;
if (palette) {
byte *array;
surf = decodeFrame(name, frameNumber, &array);
loadPalette(array, 0, 256);
} else
surf = decodeFrame(name, frameNumber);
drawImage(*surf, x, y, transparent);
}
@ -296,7 +292,7 @@ Common::File *HypnoEngine::fixSmackerHeader(Common::File *file) {
return file;
}
Graphics::Surface *HypnoEngine::decodeFrame(const Common::String &name, int n, bool convert) {
Graphics::Surface *HypnoEngine::decodeFrame(const Common::String &name, int n, byte **palette) {
Common::File *file = new Common::File();
Common::String path = convertPath(name);
if (!_prefixDir.empty())
@ -315,13 +311,11 @@ Graphics::Surface *HypnoEngine::decodeFrame(const Common::String &name, int n, b
vd.decodeNextFrame();
const Graphics::Surface *frame = vd.decodeNextFrame();
Graphics::Surface *rframe;
if (convert) {
rframe = frame->convertTo(_pixelFormat, vd.getPalette());
} else {
rframe = frame->convertTo(frame->format, vd.getPalette());
//rframe->create(frame->w, frame->h, frame->format);
//rframe->copyRectToSurface(frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h);
Graphics::Surface *rframe = frame->convertTo(frame->format, vd.getPalette());
if (palette != nullptr) {
byte *newPalette = (byte*) malloc(3*256);
memcpy(newPalette, vd.getPalette(), 3*256);
*palette = newPalette;
}
return rframe;
@ -360,7 +354,7 @@ void HypnoEngine::changeScreenMode(const Common::String &mode) {
_screenW = 640;
_screenH = 480;
initGraphics(_screenW, _screenH, nullptr);
initGraphics(_screenW, _screenH, &_pixelFormat);
_compositeSurface->free();
delete _compositeSurface;
@ -375,7 +369,7 @@ void HypnoEngine::changeScreenMode(const Common::String &mode) {
_screenW = 320;
_screenH = 200;
initGraphics(_screenW, _screenH, nullptr);
initGraphics(_screenW, _screenH, &_pixelFormat);
_compositeSurface->free();
delete _compositeSurface;
@ -383,38 +377,62 @@ void HypnoEngine::changeScreenMode(const Common::String &mode) {
_compositeSurface = new Graphics::ManagedSurface();
_compositeSurface->create(_screenW, _screenH, _pixelFormat);
_transparentColor = _pixelFormat.RGBToColor(0, 0, 0);
_transparentColor = 0; //_pixelFormat.RGBToColor(0, 0, 0);
_compositeSurface->setTransparentColor(_transparentColor);
} else
error("Unknown screen mode %s", mode.c_str());
}
void HypnoEngine::loadPalette(const Common::String &fname) {
Common::File *file = new Common::File();
Common::String path = convertPath(fname);
if (!_prefixDir.empty())
path = _prefixDir + "/" + path;
if (!file->open(path))
error("unable to find palette file %s", path.c_str());
debugC(1, kHypnoDebugMedia, "Loading palette from %s", path.c_str());
byte *videoPalette = (byte*) malloc(file->size());
file->read(videoPalette, file->size());
g_system->getPaletteManager()->setPalette(videoPalette+8, 0, 256);
}
void HypnoEngine::loadPalette(const byte *palette, uint32 offset, uint32 size) {
debugC(1, kHypnoDebugMedia, "Loading palette from byte array with offset %d and size %d", offset, size);
g_system->getPaletteManager()->setPalette(palette + 3*offset, offset, size);
}
void HypnoEngine::updateScreen(MVideo &video) {
const Graphics::Surface *frame = video.decoder->decodeNextFrame();
video.currentFrame = frame;
if (frame->h == 0 || frame->w == 0 || video.decoder->getPalette() == nullptr)
return;
Graphics::Surface *sframe, *cframe;
bool dirtyPalette = video.decoder->hasDirtyPalette();
const byte *videoPalette = nullptr;
//bool fullscreen = video.scaled || (frame->h == _screenH && frame->w == _screenW);
if (video.scaled && (dirtyPalette || video.decoder->getCurFrame() <= 1)) {
videoPalette = video.decoder->getPalette();
g_system->getPaletteManager()->setPalette(videoPalette, 0, 256);
}
Graphics::Surface *sframe;
if (video.scaled) {
sframe = frame->scale(_screenW, _screenH);
cframe = sframe->convertTo(_pixelFormat, video.decoder->getPalette());
} else
cframe = frame->convertTo(_pixelFormat, video.decoder->getPalette());
sframe = (Graphics::Surface*) frame;
if (video.transparent)
_compositeSurface->transBlitFrom(*cframe, video.position, _transparentColor);
_compositeSurface->transBlitFrom(*sframe, video.position, _transparentColor);
else
_compositeSurface->blitFrom(*cframe, video.position);
_compositeSurface->blitFrom(*sframe, video.position);
if (video.scaled) {
sframe->free();
delete sframe;
}
cframe->free();
delete cframe;
}
void HypnoEngine::drawScreen() {

View File

@ -135,10 +135,12 @@ public:
void skipVideo(MVideo &video);
Common::File *fixSmackerHeader(Common::File *file);
Graphics::Surface *decodeFrame(const Common::String &name, int frame, bool convert = true);
Graphics::Surface *decodeFrame(const Common::String &name, int frame, byte **palette = nullptr);
Frames decodeFrames(const Common::String &name);
void loadImage(const Common::String &file, int x, int y, bool transparent, int frameNumber = 0);
void loadImage(const Common::String &file, int x, int y, bool transparent, bool palette = false, int frameNumber = 0);
void drawImage(Graphics::Surface &image, int x, int y, bool transparent);
void loadPalette(const Common::String &fname);
void loadPalette(const byte *palette, uint32 offset, uint32 size);
// Cursors
Common::String _defaultCursor;

View File

@ -1,6 +1,6 @@
#line 2 "engines/hypno/lexer_arc.cpp"
#line 1 "engines/hypno/lexer_arc.cpp"
#line 4 "engines/hypno/lexer_arc.cpp"
#line 3 "engines/hypno/lexer_arc.cpp"
#define YY_INT_ALIGNED short int
@ -817,7 +817,7 @@ char *yytext;
*
*/
#define YY_NO_INPUT 1
#line 33 "engines/hypno/lexer_arc.l"
#line 32 "engines/hypno/lexer_arc.l"
#define YY_NO_UNISTD_H
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#define YYERROR_VERBOSE
@ -826,8 +826,8 @@ char *yytext;
#include "hypno/grammar.h"
#include "hypno/tokens_arc.h"
#line 831 "engines/hypno/lexer_arc.cpp"
#line 832 "engines/hypno/lexer_arc.cpp"
#line 829 "engines/hypno/lexer_arc.cpp"
#line 830 "engines/hypno/lexer_arc.cpp"
#define INITIAL 0
@ -1042,9 +1042,9 @@ YY_DECL
}
{
#line 43 "engines/hypno/lexer_arc.l"
#line 42 "engines/hypno/lexer_arc.l"
#line 1049 "engines/hypno/lexer_arc.cpp"
#line 1047 "engines/hypno/lexer_arc.cpp"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@ -1109,216 +1109,216 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 44 "engines/hypno/lexer_arc.l"
#line 43 "engines/hypno/lexer_arc.l"
return NONETOK;
YY_BREAK
case 2:
YY_RULE_SETUP
#line 45 "engines/hypno/lexer_arc.l"
#line 44 "engines/hypno/lexer_arc.l"
return CTOK;
YY_BREAK
case 3:
YY_RULE_SETUP
#line 46 "engines/hypno/lexer_arc.l"
#line 45 "engines/hypno/lexer_arc.l"
return DTOK;
YY_BREAK
case 4:
YY_RULE_SETUP
#line 47 "engines/hypno/lexer_arc.l"
#line 46 "engines/hypno/lexer_arc.l"
return HETOK;
YY_BREAK
case 5:
YY_RULE_SETUP
#line 48 "engines/hypno/lexer_arc.l"
#line 47 "engines/hypno/lexer_arc.l"
return HTOK;
YY_BREAK
case 6:
YY_RULE_SETUP
#line 49 "engines/hypno/lexer_arc.l"
#line 48 "engines/hypno/lexer_arc.l"
return PTOK;
YY_BREAK
case 7:
YY_RULE_SETUP
#line 50 "engines/hypno/lexer_arc.l"
#line 49 "engines/hypno/lexer_arc.l"
return ATOK;
YY_BREAK
case 8:
YY_RULE_SETUP
#line 51 "engines/hypno/lexer_arc.l"
#line 50 "engines/hypno/lexer_arc.l"
return VTOK;
YY_BREAK
case 9:
YY_RULE_SETUP
#line 52 "engines/hypno/lexer_arc.l"
#line 51 "engines/hypno/lexer_arc.l"
return OTOK;
YY_BREAK
case 10:
YY_RULE_SETUP
#line 53 "engines/hypno/lexer_arc.l"
#line 52 "engines/hypno/lexer_arc.l"
return ONTOK;
YY_BREAK
case 11:
YY_RULE_SETUP
#line 54 "engines/hypno/lexer_arc.l"
#line 53 "engines/hypno/lexer_arc.l"
return NTOK;
YY_BREAK
case 12:
YY_RULE_SETUP
#line 55 "engines/hypno/lexer_arc.l"
#line 54 "engines/hypno/lexer_arc.l"
return RTOK;
YY_BREAK
case 13:
YY_RULE_SETUP
#line 56 "engines/hypno/lexer_arc.l"
#line 55 "engines/hypno/lexer_arc.l"
return R0TOK;
YY_BREAK
case 14:
YY_RULE_SETUP
#line 57 "engines/hypno/lexer_arc.l"
#line 56 "engines/hypno/lexer_arc.l"
return ITOK;
YY_BREAK
case 15:
YY_RULE_SETUP
#line 58 "engines/hypno/lexer_arc.l"
#line 57 "engines/hypno/lexer_arc.l"
return JTOK;
YY_BREAK
case 16:
YY_RULE_SETUP
#line 59 "engines/hypno/lexer_arc.l"
#line 58 "engines/hypno/lexer_arc.l"
return QTOK;
YY_BREAK
case 17:
YY_RULE_SETUP
#line 60 "engines/hypno/lexer_arc.l"
#line 59 "engines/hypno/lexer_arc.l"
return ZTOK;
YY_BREAK
case 18:
YY_RULE_SETUP
#line 61 "engines/hypno/lexer_arc.l"
#line 60 "engines/hypno/lexer_arc.l"
return WTOK;
YY_BREAK
case 19:
YY_RULE_SETUP
#line 62 "engines/hypno/lexer_arc.l"
#line 61 "engines/hypno/lexer_arc.l"
return XTOK;
YY_BREAK
case 20:
YY_RULE_SETUP
#line 63 "engines/hypno/lexer_arc.l"
#line 62 "engines/hypno/lexer_arc.l"
return TTOK;
YY_BREAK
case 21:
YY_RULE_SETUP
#line 64 "engines/hypno/lexer_arc.l"
#line 63 "engines/hypno/lexer_arc.l"
return TPTOK;
YY_BREAK
case 22:
YY_RULE_SETUP
#line 65 "engines/hypno/lexer_arc.l"
#line 64 "engines/hypno/lexer_arc.l"
return FNTOK;
YY_BREAK
case 23:
YY_RULE_SETUP
#line 66 "engines/hypno/lexer_arc.l"
#line 65 "engines/hypno/lexer_arc.l"
return FTOK;
YY_BREAK
case 24:
YY_RULE_SETUP
#line 67 "engines/hypno/lexer_arc.l"
#line 66 "engines/hypno/lexer_arc.l"
HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return SNTOK;
YY_BREAK
case 25:
YY_RULE_SETUP
#line 68 "engines/hypno/lexer_arc.l"
#line 67 "engines/hypno/lexer_arc.l"
return A0TOK;
YY_BREAK
case 26:
YY_RULE_SETUP
#line 69 "engines/hypno/lexer_arc.l"
#line 68 "engines/hypno/lexer_arc.l"
HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return BNTOK;
YY_BREAK
case 27:
YY_RULE_SETUP
#line 70 "engines/hypno/lexer_arc.l"
#line 69 "engines/hypno/lexer_arc.l"
return KNTOK;
YY_BREAK
case 28:
YY_RULE_SETUP
#line 71 "engines/hypno/lexer_arc.l"
#line 70 "engines/hypno/lexer_arc.l"
return P0TOK;
YY_BREAK
case 29:
YY_RULE_SETUP
#line 72 "engines/hypno/lexer_arc.l"
#line 71 "engines/hypno/lexer_arc.l"
HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return YXTOK;
YY_BREAK
case 30:
YY_RULE_SETUP
#line 73 "engines/hypno/lexer_arc.l"
#line 72 "engines/hypno/lexer_arc.l"
return ENCTOK;
YY_BREAK
case 31:
YY_RULE_SETUP
#line 74 "engines/hypno/lexer_arc.l"
#line 73 "engines/hypno/lexer_arc.l"
return ENCTOK;
YY_BREAK
case 32:
YY_RULE_SETUP
#line 75 "engines/hypno/lexer_arc.l"
#line 74 "engines/hypno/lexer_arc.l"
HYPNO_ARC_lval.i = atoi(HYPNO_ARC_text); return NUM;
YY_BREAK
case 33:
YY_RULE_SETUP
#line 76 "engines/hypno/lexer_arc.l"
#line 75 "engines/hypno/lexer_arc.l"
HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return NAME;
YY_BREAK
case 34:
YY_RULE_SETUP
#line 77 "engines/hypno/lexer_arc.l"
#line 76 "engines/hypno/lexer_arc.l"
HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return FILENAME;
YY_BREAK
case 35:
YY_RULE_SETUP
#line 78 "engines/hypno/lexer_arc.l"
#line 77 "engines/hypno/lexer_arc.l"
HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return FILENAME;
YY_BREAK
case 36:
/* rule 36 can match eol */
YY_RULE_SETUP
#line 79 "engines/hypno/lexer_arc.l"
#line 78 "engines/hypno/lexer_arc.l"
return RETTOK;
YY_BREAK
case 37:
YY_RULE_SETUP
#line 80 "engines/hypno/lexer_arc.l"
#line 79 "engines/hypno/lexer_arc.l"
return CB3TOK;
YY_BREAK
case 38:
YY_RULE_SETUP
#line 81 "engines/hypno/lexer_arc.l"
#line 80 "engines/hypno/lexer_arc.l"
return C02TOK;
YY_BREAK
case 39:
YY_RULE_SETUP
#line 82 "engines/hypno/lexer_arc.l"
#line 81 "engines/hypno/lexer_arc.l"
/* ignore comment */
YY_BREAK
case 40:
YY_RULE_SETUP
#line 83 "engines/hypno/lexer_arc.l"
#line 82 "engines/hypno/lexer_arc.l"
/* ignore whitespace */;
YY_BREAK
case 41:
YY_RULE_SETUP
#line 84 "engines/hypno/lexer_arc.l"
#line 83 "engines/hypno/lexer_arc.l"
debugC(1, Hypno::kHypnoDebugParser, "<no match: %c>", *yytext); return *yytext;
YY_BREAK
case 42:
YY_RULE_SETUP
#line 85 "engines/hypno/lexer_arc.l"
#line 84 "engines/hypno/lexer_arc.l"
ECHO;
YY_BREAK
#line 1323 "engines/hypno/lexer_arc.cpp"
#line 1321 "engines/hypno/lexer_arc.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@ -2295,7 +2295,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 85 "engines/hypno/lexer_arc.l"
#line 84 "engines/hypno/lexer_arc.l"
namespace Hypno {

View File

@ -34,7 +34,7 @@ static const int shootOriginIndex[9][2] = {
{41, 3}, {51, 3}, {65, 6}, {68, 9}, {71, 22}, {57, 20}, {37, 14}, {37, 11}, {57, 20}};
void SpiderEngine::drawShoot(const Common::Point &target) {
uint32 c = _pixelFormat.RGBToColor(255, 255, 255);
uint32 c = 248; // white
uint32 ox = 0;
uint32 oy = 0;
@ -180,14 +180,14 @@ void SpiderEngine::drawHealth() {
r = Common::Rect(256, 152 + d, 272, 174);
if (d >= 11)
c = _pixelFormat.RGBToColor(255, 0, 0);
c = 250; // green
else
c = _pixelFormat.RGBToColor(32, 208, 32);
c = 251; // red
_compositeSurface->fillRect(r, c);
r = Common::Rect(256, 152, 272, 174);
c = _pixelFormat.RGBToColor(0, 0, 255);
c = 252; // blue
_compositeSurface->frameRect(r, c);
_font->drawString(_compositeSurface, "ENERGY", 248, 180, 38, c);

View File

@ -73,16 +73,16 @@ void SpiderEngine::runMatrix(Code *code) {
};
Common::Rect matrix(175, 96, 461, 385);
Common::Rect cell(0, 0, 27, 27);
uint32 activeColor = _pixelFormat.RGBToColor(0, 130, 0);
uint32 deactiveColor = _pixelFormat.RGBToColor(0, 0, 0);
uint32 activeColor = 2;
uint32 deactiveColor = 0;
MVideo *v;
if (isDemo()) {
loadImage("sixdemo/puz_matr/matrixbg.smk", 0, 0, false);
v = new MVideo("sixdemo/puz_matr/matintro.smk", Common::Point(0, 0), false, false, false);
loadImage("puz_matr/matrixbg.smk", 0, 0, false, true);
v = new MVideo("puz_matr/matintro.smk", Common::Point(0, 0), false, false, false);
} else {
loadImage("spider/puz_ally/matrixbg.smk", 0, 0, false);
loadImage("spider/puz_ally/matrixbg.smk", 0, 0, false, true);
v = new MVideo("spider/puz_ally/matintro.smk", Common::Point(0, 0), false, false, false);
}
@ -284,11 +284,11 @@ void SpiderEngine::runNote(Code *code) {
if (_sceneState["GS_PUZZLELEVEL"] == 0) { // easy
MVideo v("spider/int_ball/ppv007es.smk", Common::Point(0, 0), false, false, false);
runIntro(v);
loadImage("spider/int_ball/enote.smk", 0, 0, false);
loadImage("spider/int_ball/enote.smk", 0, 0, false, true);
} else { // hard
MVideo v("spider/int_ball/ppv007hs.smk", Common::Point(0, 0), false, false, false);
runIntro(v);
loadImage("spider/int_ball/hnote.smk", 0, 0, false);
loadImage("spider/int_ball/hnote.smk", 0, 0, false, true);
}
while (!shouldQuit()) {
@ -428,16 +428,16 @@ void SpiderEngine::runFusePanel(Code *code) {
_intros[intro] = true;
}
loadImage("spider/int_alof/fuserust.smk", 0, 0, false);
loadImage("spider/int_alof/fuserust.smk", 0, 0, false, true);
} else if (isFuseUnreadable)
loadImage("spider/int_alof/fuseclea.smk", 0, 0, false);
loadImage("spider/int_alof/fuseclea.smk", 0, 0, false, true);
else
loadImage("spider/int_alof/fuseread.smk", 0, 0, false);
loadImage("spider/int_alof/fuseread.smk", 0, 0, false, true);
} else {
isFuseRust = false;
isFuseUnreadable = false;
loadImage("spider/int_alof/fuse.smk", 0, 0, false);
loadImage("spider/int_alof/fuse.smk", 0, 0, false, true);
}
while (!shouldQuit()) {
@ -462,13 +462,13 @@ void SpiderEngine::runFusePanel(Code *code) {
runIntro(v);
isFuseRust = false;
isFuseUnreadable = true;
loadImage("spider/int_alof/fuseclea.smk", 0, 0, false);
loadImage("spider/int_alof/fuseclea.smk", 0, 0, false, true);
} else if (isFuseUnreadable && _sceneState["GS_SWITCH9"]) {
MVideo v("spider/cine/spv032s.smk", Common::Point(0, 0), false, false, false);
runIntro(v);
isFuseRust = false;
isFuseUnreadable = false;
loadImage("spider/int_alof/fuseread.smk", 0, 0, false);
loadImage("spider/int_alof/fuseread.smk", 0, 0, false, true);
}
if (isFuseRust || isFuseUnreadable)
@ -536,7 +536,7 @@ void SpiderEngine::runFileCabinet(Code *code) {
defaultCursor();
Common::Rect back(0, 446, 640, 480);
loadImage("spider/int_alof/combobg.smk", 0, 0, false);
loadImage("spider/int_alof/combobg.smk", 0, 0, false, true);
for (int i = 0; i < 6; i++) {
drawImage(*nums[comb[i]], sel[i].left, sel[i].top, true);
}
@ -569,7 +569,7 @@ void SpiderEngine::runFileCabinet(Code *code) {
comb[i] = (comb[i] + 1) % 10;
}
loadImage("spider/int_alof/combobg.smk", 0, 0, false);
loadImage("spider/int_alof/combobg.smk", 0, 0, false, true);
for (int i = 0; i < 6; i++) {
drawImage(*nums[comb[i]], sel[i].left, sel[i].top, true);
}
@ -584,7 +584,7 @@ void SpiderEngine::runFileCabinet(Code *code) {
comb[i] = comb[i] - 1;
}
loadImage("spider/int_alof/combobg.smk", 0, 0, false);
loadImage("spider/int_alof/combobg.smk", 0, 0, false, true);
for (int i = 0; i < 6; i++) {
drawImage(*nums[comb[i]], sel[i].left, sel[i].top, true);
}
@ -619,11 +619,11 @@ void SpiderEngine::runLock(Code *code) {
if (_sceneState["GS_PUZZLELEVEL"] == 0) { // easy
MVideo v("spider/cine/spv051s.smk", Common::Point(0, 0), false, false, false);
runIntro(v);
loadImage("spider/factory/elockbg.smk", 0, 0, false);
loadImage("spider/factory/elockbg.smk", 0, 0, false, true);
} else {
MVideo v("spider/cine/spv051as.smk", Common::Point(0, 0), false, false, false);
runIntro(v);
loadImage("spider/factory/hlockbg.smk", 0, 0, false);
loadImage("spider/factory/hlockbg.smk", 0, 0, false, true);
}
Frames nums = decodeFrames("spider/factory/button.smk");
@ -660,9 +660,9 @@ void SpiderEngine::runLock(Code *code) {
}
if (_sceneState["GS_PUZZLELEVEL"] == 0) // easy
loadImage("spider/factory/elockbg.smk", 0, 0, false);
loadImage("spider/factory/elockbg.smk", 0, 0, false, true);
else
loadImage("spider/factory/hlockbg.smk", 0, 0, false);
loadImage("spider/factory/hlockbg.smk", 0, 0, false, true);
for (int i = 0; i < 5; i++) {
drawImage(*nums[comb[i]], sel[i].left, sel[i].top, true);
@ -730,11 +730,11 @@ void SpiderEngine::runFuseBox(Code *code) {
if (_sceneState["GS_PUZZLELEVEL"] == 0) { // easy
MVideo v("spider/cine/ppv011es.smk", Common::Point(0, 0), false, false, false);
runIntro(v);
loadImage("spider/movie2/efusebg.smk", 0, 0, false);
loadImage("spider/movie2/efusebg.smk", 0, 0, false, true);
} else { // hard
MVideo v("spider/cine/ppv011hs.smk", Common::Point(0, 0), false, false, false);
runIntro(v);
loadImage("spider/movie2/hfusebg.smk", 0, 0, false);
loadImage("spider/movie2/hfusebg.smk", 0, 0, false, true);
}
Frames fuses = decodeFrames("spider/movie2/onoffuse.smk");
@ -753,9 +753,9 @@ void SpiderEngine::runFuseBox(Code *code) {
case Common::EVENT_LBUTTONDOWN:
if (matrix.contains(mousePos)) {
if (_sceneState["GS_PUZZLELEVEL"] == 0) { // easy
loadImage("spider/movie2/efusebg.smk", 0, 0, false);
loadImage("spider/movie2/efusebg.smk", 0, 0, false, true);
} else { // hard
loadImage("spider/movie2/hfusebg.smk", 0, 0, false);
loadImage("spider/movie2/hfusebg.smk", 0, 0, false, true);
}
debug("\nvdata:");
@ -850,10 +850,12 @@ void SpiderEngine::showCredits() {
return;
}
changeScreenMode("640x480");
MVideo video("cine/credits.smk", Common::Point(0, 0), false, false, false);
runIntro(video);
_nextLevel = "mainmenu.mi_";
if (!isDemo()) { // No credits in demo
changeScreenMode("640x480");
MVideo video("cine/credits.smk", Common::Point(0, 0), false, false, false);
runIntro(video);
_nextLevel = "mainmenu.mi_";
}
}
} // End of namespace Hypno

View File

@ -978,7 +978,7 @@ void SpiderEngine::loadAssetsDemo() {
Code *matrix = new Code();
matrix->name = "<puz_matr>";
matrix->intros.push_back("sixdemo/demo/aleyc01s.smk");
matrix->intros.push_back("demo/aleyc01s.smk");
matrix->levelIfWin = "sixdemo/mis/demo.mis";
matrix->levelIfLose = "sixdemo/mis/demo.mis";
_levels["<puz_matr>"] = matrix;

View File

@ -1,8 +1,9 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
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
@ -15,7 +16,7 @@
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, see <http://www.gnu.org/licenses/>. */
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@ -30,6 +31,10 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_HYPNO_ARC_ENGINES_HYPNO_TOKENS_ARC_H_INCLUDED
# define YY_HYPNO_ARC_ENGINES_HYPNO_TOKENS_ARC_H_INCLUDED
/* Debug traces. */
@ -48,64 +53,68 @@
extern int HYPNO_ARC_debug;
#endif
/* Token type. */
/* Token kinds. */
#ifndef HYPNO_ARC_TOKENTYPE
# define HYPNO_ARC_TOKENTYPE
enum HYPNO_ARC_tokentype
{
NAME = 258,
FILENAME = 259,
BNTOK = 260,
SNTOK = 261,
KNTOK = 262,
YXTOK = 263,
NUM = 264,
COMMENT = 265,
CTOK = 266,
DTOK = 267,
HTOK = 268,
HETOK = 269,
RETTOK = 270,
QTOK = 271,
ENCTOK = 272,
PTOK = 273,
FTOK = 274,
TTOK = 275,
TPTOK = 276,
ATOK = 277,
VTOK = 278,
OTOK = 279,
ONTOK = 280,
NTOK = 281,
RTOK = 282,
R0TOK = 283,
ITOK = 284,
JTOK = 285,
ZTOK = 286,
FNTOK = 287,
NONETOK = 288,
A0TOK = 289,
P0TOK = 290,
WTOK = 291,
XTOK = 292,
CB3TOK = 293,
C02TOK = 294
HYPNO_ARC_EMPTY = -2,
HYPNO_ARC_EOF = 0, /* "end of file" */
HYPNO_ARC_error = 256, /* error */
HYPNO_ARC_UNDEF = 257, /* "invalid token" */
NAME = 258, /* NAME */
FILENAME = 259, /* FILENAME */
BNTOK = 260, /* BNTOK */
SNTOK = 261, /* SNTOK */
KNTOK = 262, /* KNTOK */
YXTOK = 263, /* YXTOK */
NUM = 264, /* NUM */
COMMENT = 265, /* COMMENT */
CTOK = 266, /* CTOK */
DTOK = 267, /* DTOK */
HTOK = 268, /* HTOK */
HETOK = 269, /* HETOK */
RETTOK = 270, /* RETTOK */
QTOK = 271, /* QTOK */
ENCTOK = 272, /* ENCTOK */
PTOK = 273, /* PTOK */
FTOK = 274, /* FTOK */
TTOK = 275, /* TTOK */
TPTOK = 276, /* TPTOK */
ATOK = 277, /* ATOK */
VTOK = 278, /* VTOK */
OTOK = 279, /* OTOK */
ONTOK = 280, /* ONTOK */
NTOK = 281, /* NTOK */
RTOK = 282, /* RTOK */
R0TOK = 283, /* R0TOK */
ITOK = 284, /* ITOK */
JTOK = 285, /* JTOK */
ZTOK = 286, /* ZTOK */
FNTOK = 287, /* FNTOK */
NONETOK = 288, /* NONETOK */
A0TOK = 289, /* A0TOK */
P0TOK = 290, /* P0TOK */
WTOK = 291, /* WTOK */
XTOK = 292, /* XTOK */
CB3TOK = 293, /* CB3TOK */
C02TOK = 294 /* C02TOK */
};
typedef enum HYPNO_ARC_tokentype HYPNO_ARC_token_kind_t;
#endif
/* Value type. */
#if ! defined HYPNO_ARC_STYPE && ! defined HYPNO_ARC_STYPE_IS_DECLARED
union HYPNO_ARC_STYPE
{
#line 54 "engines/hypno/grammar_arc.y" /* yacc.c:1909 */
#line 53 "engines/hypno/grammar_arc.y"
char *s; /* string value */
int i; /* integer value */
#line 107 "engines/hypno/tokens_arc.h" /* yacc.c:1909 */
};
#line 116 "engines/hypno/tokens_arc.h"
};
typedef union HYPNO_ARC_STYPE HYPNO_ARC_STYPE;
# define HYPNO_ARC_STYPE_IS_TRIVIAL 1
# define HYPNO_ARC_STYPE_IS_DECLARED 1
@ -114,6 +123,8 @@ typedef union HYPNO_ARC_STYPE HYPNO_ARC_STYPE;
extern HYPNO_ARC_STYPE HYPNO_ARC_lval;
int HYPNO_ARC_parse (void);
#endif /* !YY_HYPNO_ARC_ENGINES_HYPNO_TOKENS_ARC_H_INCLUDED */

View File

@ -24,6 +24,16 @@
namespace Hypno {
MVideo::MVideo(Common::String path_, Common::Point position_, bool transparent_, bool scaled_, bool loop_) {
decoder = nullptr;
currentFrame = nullptr;
path = path_;
position = position_;
scaled = scaled_;
transparent = transparent_;
loop = loop_;
}
bool HypnoSmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
if (!SmackerDecoder::loadStream(stream))
return false;

View File

@ -248,7 +248,7 @@ void WetEngine::runMainMenu(Code *code) {
Common::Event event;
_font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
uint32 c = _pixelFormat.RGBToColor(0, 252, 0);
Graphics::Surface *frame = decodeFrame("c_misc/menus.smk", 16, true);
Graphics::Surface *frame = decodeFrame("c_misc/menus.smk", 16);
Common::String _name = "";
drawImage(*frame, 0, 0, false);
_font->drawString(_compositeSurface, "ENTER NAME :", 48, 50, 100, c);