From 81478d8a9c68e091d23a844f54eaae7c94172a53 Mon Sep 17 00:00:00 2001 From: neuromancer Date: Tue, 22 Feb 2022 08:55:39 +0100 Subject: [PATCH] HYPNO: fixed rebase conflicts --- engines/hypno/arcade.cpp | 173 +++++---- engines/hypno/grammar.h | 35 +- engines/hypno/grammar_arc.cpp | 648 ++++++++++++++++++-------------- engines/hypno/grammar_arc.y | 62 ++- engines/hypno/hypno.cpp | 2 +- engines/hypno/hypno.h | 29 +- engines/hypno/lexer_arc.cpp | 209 +++++----- engines/hypno/lexer_arc.l | 3 +- engines/hypno/spider/arcade.cpp | 18 + engines/hypno/tokens_arc.h | 23 +- engines/hypno/wet/arcade.cpp | 171 +++++++-- engines/hypno/wet/wet.cpp | 18 +- 12 files changed, 860 insertions(+), 531 deletions(-) diff --git a/engines/hypno/arcade.cpp b/engines/hypno/arcade.cpp index 493a5d0fd7d..ca17d524c08 100644 --- a/engines/hypno/arcade.cpp +++ b/engines/hypno/arcade.cpp @@ -45,8 +45,6 @@ void HypnoEngine::splitArcadeFile(const Common::String &filename, Common::String break; list += x; } - if (list[1] == 'L') - list = ""; break; // No need to keep parsing } } @@ -72,8 +70,9 @@ void HypnoEngine::parseArcadeShooting(const Common::String &prefix, const Common g_parsedArc->segments.clear(); } -ShootSequence HypnoEngine::parseShootList(const Common::String &filename, const Common::String &data) { +SegmentShootsSequence HypnoEngine::parseShootList(const Common::String &filename, const Common::String &data) { debugC(1, kHypnoDebugParser, "Parsing %s", filename.c_str()); + debugC(1, kHypnoDebugParser, "%s", data.c_str()); // Preparsing Common::String pdata; Common::StringTokenizer lines(data, "\n"); @@ -86,29 +85,63 @@ ShootSequence HypnoEngine::parseShootList(const Common::String &filename, const continue; pdata += "\n" + t; } - - // Parsing - Common::StringTokenizer tok(pdata, " ,.\t"); Common::String n; ShootInfo si; - ShootSequence seq; - while (!tok.empty()) { - t = tok.nextToken(); - if (t[0] == '\n') - continue; - n = tok.nextToken(); - if (t == "Z") - break; + SegmentShootsSequence seq; + // Parsing + + if (pdata[1] == 'L') { // List of elements + SegmentShoots ss; + ss.segmentRepetition = 0; + Common::StringTokenizer tok(pdata, " ,.\n\t"); + while (!tok.empty()) { + t = tok.nextToken(); + while (t == "L") { + if (ss.segmentRepetition > 0) + seq.push_back(ss); + t = tok.nextToken(); + ss.segmentRepetition = atoi(t.c_str()); + ss.shootSequence.clear(); + t = tok.nextToken(); + } + + n = tok.nextToken(); + if (t == "Z") { + seq.push_back(ss); + break; + } + + si.name = n; + si.timestamp = atoi(t.c_str()); + if (si.timestamp == 0) + error("Error at parsing '%s' with timestamp: %s", n.c_str(), t.c_str()); + ss.shootSequence.push_back(si); + debugC(1, kHypnoDebugParser, "%d -> %s", si.timestamp, si.name.c_str()); + } + } else if (pdata[1] == 'S' ) { // Single element + SegmentShoots ss; + Common::StringTokenizer tok(pdata, " ,.\t"); + while (!tok.empty()) { + t = tok.nextToken(); + if (t[0] == '\n') + continue; + n = tok.nextToken(); + if (t == "Z") + break; + + Common::replace(n, "\nS", ""); + Common::replace(n, "\nZ\n", ""); + si.name = n; + si.timestamp = atoi(t.c_str()); + if (si.timestamp == 0) + error("Error at parsing '%s' with timestamp: %s", n.c_str(), t.c_str()); + ss.shootSequence.push_back(si); + debugC(1, kHypnoDebugParser, "%d -> %s", si.timestamp, si.name.c_str()); + } + seq.push_back(ss); + } else + error("Invalid shoot sequence to parse: %c", pdata[1]); - Common::replace(n, "\nS", ""); - Common::replace(n, "\nZ\n", ""); - si.name = n; - si.timestamp = atoi(t.c_str()); - if (si.timestamp == 0) - error("Error at parsing '%s' with timestamp: %s", n.c_str(), t.c_str()); - seq.push_back(si); - debugC(1, kHypnoDebugParser, "%d -> %s", si.timestamp, si.name.c_str()); - } return seq; } @@ -133,19 +166,24 @@ void HypnoEngine::hitPlayer() { error("Function \"%s\" not implemented", __FUNCT void HypnoEngine::runBeforeArcade(ArcadeShooting *arc) {} +void HypnoEngine::initSegment(ArcadeShooting *arc) { error("Function \"%s\" not implemented", __FUNCTION__); } +void HypnoEngine::findNextSegment(ArcadeShooting *arc) { error("Function \"%s\" not implemented", __FUNCTION__); } + void HypnoEngine::runArcade(ArcadeShooting *arc) { _arcadeMode = arc->mode; Common::Point mousePos; Common::List shootsToRemove; - ShootSequence shootSequence = arc->shootSequence; + + // segment/shoots + Segments segments = arc->segments; + initSegment(arc); + _levelId = arc->id; _shootSound = arc->shootSound; _hitSound = arc->hitSound; _health = arc->health; _maxHealth = _health; - Segments segments = arc->segments; - uint32 segmentIdx = 0; - debugC(1, kHypnoDebugArcade, "Starting segment of type %x", segments[segmentIdx].type); + debugC(1, kHypnoDebugArcade, "Starting segment of type %x", segments[_segmentIdx].type); changeCursor("arcade"); _shoots.clear(); if (!arc->player.empty()) @@ -179,7 +217,7 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) { playVideo(background); float rate = background.decoder->getFrameRate().toDouble(); if (rate < 10) { - debugC(1, kHypnoDebugArcade, "Using frame rate looks odd: %f, increasing x 10", rate); + debugC(1, kHypnoDebugArcade, "Used frame rate looks odd: %f, increasing x 10", rate); background.decoder->setRate(10.0); } loadPalette(arc->backgroundPalette); @@ -187,12 +225,19 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) { bool shootingSecondary = false; bool needsUpdate = true; bool transition = false; - _obj1KillsCount = 0; - _obj1MissesCount = 0; + + _objIdx = 0; + _objKillsCount[0] = 0; + _objKillsCount[1] = 0; + _objMissesCount[0] = 0; + _objMissesCount[1] = 0; + debugC(1, kHypnoDebugArcade, "Using frame delay: %d", arc->frameDelay); Common::Event event; + bool levelComplete = false; while (!shouldQuit()) { + //debug("frame: %d", background.decoder->getCurFrame()); needsUpdate = background.decoder->needsUpdate(); while (g_system->getEventManager()->pollEvent(event)) { mousePos = g_system->getEventManager()->getMousePos(); @@ -287,45 +332,35 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) { drawScreen(); } - if (background.decoder && background.decoder->getCurFrame() >= int(segments[segmentIdx].start + segments[segmentIdx].size - 1)) { - debugC(1, kHypnoDebugArcade, "Finished segment %d of type %x", segmentIdx, segments[segmentIdx].type); + if (background.decoder && background.decoder->getCurFrame() >= int(segments[_segmentIdx].start + segments[_segmentIdx].size - 1)) { + debugC(1, kHypnoDebugArcade, "Finished segment %d of type %x", _segmentIdx, segments[_segmentIdx].type); - if (segments[segmentIdx].type == 0xb3) - if (_rnd->getRandomBit() || segments.size() == 2) - segmentIdx = segmentIdx + 1; - else - segmentIdx = segmentIdx + 5; - else if (segments[segmentIdx].type == 0xc5) { - if (mousePos.x <= 100) - segmentIdx = segmentIdx + 1; - else if (mousePos.x >= 300) - segmentIdx = segmentIdx + 3; - else - segmentIdx = segmentIdx + 2; - } else if (segments[segmentIdx].type == 0xc2) { - if (mousePos.x <= 160) - segmentIdx = segmentIdx + 1; - else - segmentIdx = segmentIdx + 2; - } else { - segmentIdx = 0; + // Clear shoots + /*for (Shoots::iterator it = _shoots.begin(); it != _shoots.end(); ++it) { + if (it->video && it->video->decoder) + skipVideo(*it->video); + delete it->video; } + _shoots.clear();*/ + findNextSegment(arc); - if (segmentIdx >= segments.size()) - error("Invalid segment %d", segmentIdx); + if (_segmentIdx >= segments.size()) + error("Invalid segment %d", _segmentIdx); - debugC(1, kHypnoDebugArcade, "Starting segment %d of type %x at %d", segmentIdx, segments[segmentIdx].type, segments[segmentIdx].start); - if (!segments[segmentIdx].end) { // If it is not the end segment - background.decoder->forceSeekToFrame(segments[segmentIdx].start); + debugC(1, kHypnoDebugArcade, "Starting segment %d of type %x at %d", _segmentIdx, segments[_segmentIdx].type, segments[_segmentIdx].start); + if (!segments[_segmentIdx].end) { // If it is not the end segment + background.decoder->forceSeekToFrame(segments[_segmentIdx].start+2); + needsUpdate = true; continue; - } + } else + levelComplete = true; } - if (segments[segmentIdx].end || checkArcadeLevelCompleted(background, segments[segmentIdx])) { + if (segments[_segmentIdx].end || levelComplete) { skipVideo(background); // Objectives - if ((arc->obj1KillsRequired > 0 || arc->obj1MissesAllowed) > 0 && !_skipLevel) { - if (_obj1KillsCount < arc->obj1KillsRequired || _obj1MissesCount > arc->obj1MissesAllowed) { + if ((_objKillsCount[_objIdx] > 0 || _objMissesCount[_objIdx] > 0) && !_skipLevel) { + if (_objKillsCount[_objIdx] < arc->objKillsRequired[_objIdx] || _objMissesCount[_objIdx] > arc->objMissesAllowed[_objIdx]) { if (!arc->defeatMissBossVideo.empty()) { MVideo video(arc->defeatMissBossVideo, Common::Point(0, 0), false, true, false); runIntro(video); @@ -352,10 +387,14 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) { break; } - if (shootSequence.size() > 0) { - ShootInfo si = shootSequence.front(); - if ((int)si.timestamp <= background.decoder->getCurFrame()) { - shootSequence.pop_front(); + if (_shootSequence.size() > 0) { + ShootInfo si = _shootSequence.front(); + int idx = (int)segments[_segmentIdx].size * _segmentRepetition \ + + background.decoder->getCurFrame() \ + - (int)segments[_segmentIdx].start; + //debug("%d %d", si.timestamp, idx); + if ((int)si.timestamp <= idx) { + _shootSequence.pop_front(); for (Shoots::iterator it = arc->shoots.begin(); it != arc->shoots.end(); ++it) { if (it->name == si.name) { Shoot s = *it; @@ -504,13 +543,15 @@ void HypnoEngine::shoot(const Common::Point &mousePos) { break; explosionFrame = *it; } - + _objKillsCount[_objIdx] = _objKillsCount[_objIdx] + _shoots[i].objKillsCount; + if (_shoots[i].video->decoder->getFrameCount() < explosionFrame + 12) + explosionFrame = _shoots[i].video->decoder->getFrameCount() - 12; _shoots[i].video->decoder->forceSeekToFrame(explosionFrame + 2); } else { byte p[3] = {0x00, 0x00, 0x00}; // Always black? assert(_shoots[i].paletteSize == 1 || _shoots[i].paletteSize == 0); loadPalette((byte *) &p, _shoots[i].paletteOffset, _shoots[i].paletteSize); - _obj1KillsCount = _obj1KillsCount + _shoots[i].obj1KillsCount; + _objKillsCount[_objIdx] = _objKillsCount[_objIdx] + _shoots[i].objKillsCount; if (!_shoots[i].explosionAnimation.empty()) { _shoots[i].video = new MVideo(_shoots[i].explosionAnimation, mousePos, true, false, false); playVideo(*_shoots[i].video); diff --git a/engines/hypno/grammar.h b/engines/hypno/grammar.h index a08299ec26b..78955ae5303 100644 --- a/engines/hypno/grammar.h +++ b/engines/hypno/grammar.h @@ -363,8 +363,8 @@ public: attackWeight = 0; paletteOffset = 0; paletteSize = 0; - obj1KillsCount = 0; - obj1MissesCount = 0; + objKillsCount = 0; + objMissesCount = 0; animation = "NONE"; explosionAnimation = ""; } @@ -378,8 +378,8 @@ public: uint32 attackWeight; // Objectives - uint32 obj1KillsCount; - uint32 obj1MissesCount; + uint32 objKillsCount; + uint32 objMissesCount; // Palette uint32 paletteOffset; @@ -405,6 +405,17 @@ public: }; typedef Common::List ShootSequence; + +class SegmentShoots { +public: + SegmentShoots() { + segmentRepetition = 0; + } + ShootSequence shootSequence; + uint32 segmentRepetition; +}; + +typedef Common::Array SegmentShootsSequence; typedef Common::Array Sounds; enum SegmentType { @@ -442,10 +453,10 @@ public: health = 100; transitionTime = 0; id = 0; - obj1KillsRequired = 0; - obj1MissesAllowed = 0; - obj2KillsRequired = 0; - obj2MissesAllowed = 0; + objKillsRequired[0] = 0; + objKillsRequired[1] = 0; + objMissesAllowed[0] = 0; + objMissesAllowed[1] = 0; frameDelay = 0; } uint32 id; @@ -455,10 +466,8 @@ public: Segments segments; // Objectives - uint32 obj1KillsRequired; - uint32 obj1MissesAllowed; - uint32 obj2KillsRequired; - uint32 obj2MissesAllowed; + uint32 objKillsRequired [2]; + uint32 objMissesAllowed [2]; // Videos Filename transitionVideo; @@ -475,7 +484,7 @@ public: Filename player; int health; Shoots shoots; - ShootSequence shootSequence; + SegmentShootsSequence shootSequence; // Sounds Filename targetSound; diff --git a/engines/hypno/grammar_arc.cpp b/engines/hypno/grammar_arc.cpp index e172e83ea45..1b5d1b3c6a5 100644 --- a/engines/hypno/grammar_arc.cpp +++ b/engines/hypno/grammar_arc.cpp @@ -164,25 +164,26 @@ enum yysymbol_kind_t YYSYMBOL_NTOK = 31, /* NTOK */ YYSYMBOL_NSTOK = 32, /* NSTOK */ YYSYMBOL_RTOK = 33, /* RTOK */ - YYSYMBOL_R0TOK = 34, /* R0TOK */ + YYSYMBOL_R01TOK = 34, /* R01TOK */ YYSYMBOL_ITOK = 35, /* ITOK */ - YYSYMBOL_JTOK = 36, /* JTOK */ - YYSYMBOL_ZTOK = 37, /* ZTOK */ - YYSYMBOL_NONETOK = 38, /* NONETOK */ - YYSYMBOL_A0TOK = 39, /* A0TOK */ - YYSYMBOL_P0TOK = 40, /* P0TOK */ - YYSYMBOL_WTOK = 41, /* WTOK */ - YYSYMBOL_XTOK = 42, /* XTOK */ - YYSYMBOL_CB3TOK = 43, /* CB3TOK */ - YYSYMBOL_C02TOK = 44, /* C02TOK */ - YYSYMBOL_YYACCEPT = 45, /* $accept */ - YYSYMBOL_start = 46, /* start */ - YYSYMBOL_47_1 = 47, /* $@1 */ - YYSYMBOL_header = 48, /* header */ - YYSYMBOL_hline = 49, /* hline */ - YYSYMBOL_enc = 50, /* enc */ - YYSYMBOL_body = 51, /* body */ - YYSYMBOL_bline = 52 /* bline */ + YYSYMBOL_I1TOK = 36, /* I1TOK */ + YYSYMBOL_JTOK = 37, /* JTOK */ + YYSYMBOL_ZTOK = 38, /* ZTOK */ + YYSYMBOL_NONETOK = 39, /* NONETOK */ + YYSYMBOL_A0TOK = 40, /* A0TOK */ + YYSYMBOL_P0TOK = 41, /* P0TOK */ + YYSYMBOL_WTOK = 42, /* WTOK */ + YYSYMBOL_XTOK = 43, /* XTOK */ + YYSYMBOL_CB3TOK = 44, /* CB3TOK */ + YYSYMBOL_C02TOK = 45, /* C02TOK */ + YYSYMBOL_YYACCEPT = 46, /* $accept */ + YYSYMBOL_start = 47, /* start */ + YYSYMBOL_48_1 = 48, /* $@1 */ + YYSYMBOL_header = 49, /* header */ + YYSYMBOL_hline = 50, /* hline */ + YYSYMBOL_enc = 51, /* enc */ + YYSYMBOL_body = 52, /* body */ + YYSYMBOL_bline = 53 /* bline */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -510,19 +511,19 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 6 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 138 +#define YYLAST 149 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 45 +#define YYNTOKENS 46 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 8 /* YYNRULES -- Number of rules. */ -#define YYNRULES 70 +#define YYNRULES 76 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 142 +#define YYNSTATES 158 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 299 +#define YYMAXUTOK 300 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -565,7 +566,8 @@ static const yytype_int8 yytranslate[] = 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45 }; #if HYPNO_ARC_DEBUG @@ -573,13 +575,13 @@ static const yytype_int8 yytranslate[] = static const yytype_int16 yyrline[] = { 0, 78, 78, 78, 79, 82, 83, 84, 87, 91, - 95, 99, 100, 101, 102, 103, 108, 118, 119, 125, - 130, 131, 135, 139, 142, 146, 147, 165, 187, 193, - 198, 203, 210, 211, 214, 215, 216, 219, 227, 232, - 237, 241, 245, 249, 253, 257, 261, 265, 269, 273, - 277, 281, 285, 289, 293, 297, 301, 304, 308, 313, - 314, 315, 319, 323, 326, 327, 330, 333, 337, 344, - 345 + 95, 99, 100, 101, 102, 103, 108, 118, 127, 133, + 138, 139, 143, 147, 150, 154, 157, 158, 176, 198, + 204, 209, 214, 220, 225, 230, 235, 242, 243, 246, + 247, 248, 251, 259, 264, 269, 273, 277, 281, 285, + 289, 293, 297, 301, 305, 309, 313, 317, 321, 325, + 329, 333, 336, 340, 345, 349, 350, 354, 358, 361, + 362, 365, 366, 369, 373, 380, 381 }; #endif @@ -599,9 +601,10 @@ static const char *const yytname[] = "BNTOK", "SNTOK", "KNTOK", "YXTOK", "FNTOK", "ENCTOK", "ONTOK", "NUM", "BYTE", "COMMENT", "CTOK", "DTOK", "HTOK", "HETOK", "HLTOK", "HUTOK", "RETTOK", "QTOK", "RESTOK", "PTOK", "FTOK", "TTOK", "TPTOK", "ATOK", - "VTOK", "OTOK", "NTOK", "NSTOK", "RTOK", "R0TOK", "ITOK", "JTOK", "ZTOK", - "NONETOK", "A0TOK", "P0TOK", "WTOK", "XTOK", "CB3TOK", "C02TOK", - "$accept", "start", "$@1", "header", "hline", "enc", "body", "bline", YY_NULLPTR + "VTOK", "OTOK", "NTOK", "NSTOK", "RTOK", "R01TOK", "ITOK", "I1TOK", + "JTOK", "ZTOK", "NONETOK", "A0TOK", "P0TOK", "WTOK", "XTOK", "CB3TOK", + "C02TOK", "$accept", "start", "$@1", "header", "hline", "enc", "body", + "bline", YY_NULLPTR }; static const char * @@ -611,7 +614,7 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#define YYPACT_NINF (-77) +#define YYPACT_NINF (-92) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) @@ -623,23 +626,24 @@ yysymbol_name (yysymbol_kind_t yysymbol) /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -static const yytype_int8 yypact[] = +static const yytype_int16 yypact[] = { - -2, -77, -2, 8, 67, -77, -77, 9, 10, 3, - 5, 6, 11, 14, 29, 30, 67, 33, 34, 36, - -1, 19, 37, 21, 41, 43, 50, 51, 52, 25, - 67, -77, 48, 55, -77, -77, 57, 62, 63, 64, - -77, 65, 68, -77, 69, 78, 89, 91, 92, -77, - 93, -77, -77, -77, -77, 58, -77, -77, -77, -77, - 94, 95, 96, 97, -77, -77, -77, -77, 60, -77, - -77, -77, -5, -77, -77, -77, -77, -77, 98, 107, - 100, 1, 101, 102, 103, -5, 112, 105, -77, 106, - 108, 35, 109, -77, 110, 111, 113, 77, -5, 114, - 48, 115, -77, -77, -77, -77, -77, -77, -77, 116, - 117, 118, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, 119, - 120, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77 + 6, -92, 6, 7, 69, -92, -92, 5, 9, 3, + 19, 31, 44, 4, 32, 33, 69, 37, 38, 42, + -1, 14, 43, 11, 47, 15, 40, 52, 59, 61, + 10, 69, -92, 60, 64, -92, -92, 66, 67, 70, + 71, 80, 91, 94, 95, -92, 96, 97, -92, 98, + 99, 100, 101, 102, -92, 103, -92, -92, -92, -92, + -92, 104, -92, -92, -92, -92, 105, 106, 107, 108, + 109, 110, 111, 112, -92, -92, -92, -92, 77, -92, + -92, -92, -5, -92, -92, -92, -92, -92, -92, -92, + -92, -92, 114, 123, 116, 1, 117, 118, 119, -5, + 128, 121, 122, -92, 124, 125, 36, 126, -92, 127, + 129, 130, 73, -5, 131, 60, 132, -92, -92, -92, + -92, -92, -92, -92, -92, 133, 134, 135, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, + -92, -92, -92, -92, -92, 136, 137, -92, -92, -92, + -92, -92, -92, -92, -92, -92, -92, -92 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -650,30 +654,31 @@ static const yytype_int8 yydefact[] = 0, 2, 0, 0, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 26, 33, 17, 8, 10, 0, 0, 0, 0, - 6, 0, 0, 9, 0, 0, 0, 0, 0, 14, - 0, 21, 22, 23, 24, 0, 5, 32, 27, 16, - 0, 0, 0, 0, 25, 11, 19, 20, 0, 12, - 13, 15, 36, 31, 28, 29, 30, 18, 0, 0, - 0, 0, 0, 0, 0, 36, 0, 0, 69, 0, - 0, 0, 0, 70, 0, 0, 0, 0, 36, 0, - 33, 0, 37, 38, 64, 67, 65, 35, 39, 0, - 0, 0, 40, 41, 54, 43, 44, 46, 52, 51, - 45, 55, 42, 50, 49, 53, 47, 48, 56, 0, - 0, 66, 3, 34, 60, 68, 61, 63, 58, 59, - 57, 62 + 0, 7, 27, 38, 17, 8, 10, 0, 0, 0, + 0, 0, 0, 0, 0, 6, 0, 0, 9, 0, + 0, 0, 0, 0, 14, 0, 21, 22, 23, 24, + 25, 0, 5, 37, 28, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 26, 11, 19, 20, 0, 12, + 13, 15, 41, 32, 36, 35, 34, 33, 29, 30, + 31, 18, 0, 0, 0, 0, 0, 0, 0, 41, + 0, 0, 0, 75, 0, 0, 0, 0, 76, 0, + 0, 0, 0, 41, 0, 38, 0, 42, 43, 69, + 73, 70, 40, 44, 71, 0, 0, 0, 45, 46, + 59, 48, 49, 51, 57, 56, 50, 60, 47, 55, + 54, 58, 52, 53, 61, 0, 0, 72, 3, 39, + 65, 74, 66, 68, 63, 64, 62, 67 }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +static const yytype_int16 yypgoto[] = { - -77, 122, -77, -9, -77, 38, -76, -77 + -92, 138, -92, -10, -92, 20, -91, -92 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - 0, 3, 4, 29, 30, 58, 97, 98 + 0, 3, 4, 30, 31, 64, 112, 113 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -681,72 +686,75 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 78, 79, 80, 44, 81, 102, 1, 40, 6, 107, - 82, 83, 84, 31, 32, 33, 85, 34, 35, 2, - 86, 56, 133, 46, 36, 87, 88, 37, 89, 90, - 91, 92, 93, 48, 94, 95, 96, 45, 112, 103, - 113, 114, 38, 39, 49, 41, 42, 51, 43, 47, - 115, 116, 117, 50, 52, 53, 54, 118, 57, 119, - 120, 121, 55, 122, 77, 123, 124, 59, 125, 60, - 126, 127, 7, 8, 61, 62, 63, 64, 9, 72, - 65, 66, 10, 11, 12, 13, 14, 15, 16, 17, - 67, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 68, 28, 69, 70, 71, 73, 74, 75, 76, - 99, 100, 101, 104, 105, 106, 108, 109, 110, 132, - 111, 128, 129, 130, 5, 131, 134, 136, 137, 138, - 139, 140, 141, 0, 0, 0, 0, 0, 135 + 92, 93, 94, 49, 95, 117, 45, 6, 122, 32, + 96, 97, 98, 33, 1, 34, 99, 42, 51, 56, + 100, 62, 149, 53, 101, 102, 103, 2, 104, 105, + 106, 35, 107, 108, 54, 109, 110, 111, 50, 128, + 118, 129, 130, 36, 57, 43, 44, 37, 61, 46, + 47, 131, 132, 133, 48, 52, 58, 38, 134, 55, + 135, 136, 137, 59, 138, 60, 139, 140, 39, 141, + 63, 142, 40, 143, 7, 8, 65, 41, 66, 67, + 9, 91, 68, 69, 10, 11, 12, 13, 14, 15, + 16, 17, 70, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 71, 28, 29, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 148, 83, 84, 85, + 86, 87, 88, 89, 90, 82, 114, 115, 116, 119, + 120, 121, 123, 124, 125, 151, 126, 127, 144, 145, + 5, 146, 147, 150, 152, 153, 154, 155, 156, 157 }; static const yytype_int8 yycheck[] = { - 5, 6, 7, 4, 9, 4, 8, 16, 0, 85, - 15, 16, 17, 4, 4, 12, 21, 12, 12, 21, - 25, 30, 98, 4, 13, 30, 31, 13, 33, 34, - 35, 36, 37, 12, 39, 40, 41, 38, 3, 38, - 5, 6, 13, 13, 23, 12, 12, 4, 12, 12, - 15, 16, 17, 12, 4, 4, 4, 22, 10, 24, - 25, 26, 37, 28, 4, 30, 31, 12, 33, 12, - 35, 36, 5, 6, 12, 12, 12, 12, 11, 21, - 12, 12, 15, 16, 17, 18, 19, 20, 21, 22, - 12, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 12, 35, 12, 12, 12, 12, 12, 12, 12, - 12, 4, 12, 12, 12, 12, 4, 12, 12, 42, - 12, 12, 12, 12, 2, 12, 12, 12, 12, 12, - 12, 12, 12, -1, -1, -1, -1, -1, 100 + 5, 6, 7, 4, 9, 4, 16, 0, 99, 4, + 15, 16, 17, 4, 8, 12, 21, 13, 4, 4, + 25, 31, 113, 12, 29, 30, 31, 21, 33, 34, + 35, 12, 37, 38, 23, 40, 41, 42, 39, 3, + 39, 5, 6, 12, 4, 13, 13, 3, 38, 12, + 12, 15, 16, 17, 12, 12, 4, 13, 22, 12, + 24, 25, 26, 4, 28, 4, 30, 31, 24, 33, + 10, 35, 28, 37, 5, 6, 12, 33, 12, 12, + 11, 4, 12, 12, 15, 16, 17, 18, 19, 20, + 21, 22, 12, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 12, 35, 36, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 43, 12, 12, 12, + 12, 12, 12, 12, 12, 21, 12, 4, 12, 12, + 12, 12, 4, 12, 12, 115, 12, 12, 12, 12, + 2, 12, 12, 12, 12, 12, 12, 12, 12, 12 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { - 0, 8, 21, 46, 47, 46, 0, 5, 6, 11, + 0, 8, 21, 47, 48, 47, 0, 5, 6, 11, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 35, 48, - 49, 4, 4, 12, 12, 12, 13, 13, 13, 13, - 48, 12, 12, 12, 4, 38, 4, 12, 12, 23, - 12, 4, 4, 4, 4, 37, 48, 10, 50, 12, + 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, + 49, 50, 4, 4, 12, 12, 12, 3, 13, 24, + 28, 33, 13, 13, 13, 49, 12, 12, 12, 4, + 39, 4, 12, 12, 23, 12, 4, 4, 4, 4, + 4, 38, 49, 10, 51, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 21, 12, 12, 12, 12, 4, 5, 6, - 7, 9, 15, 16, 17, 21, 25, 30, 31, 33, - 34, 35, 36, 37, 39, 40, 41, 51, 52, 12, - 4, 12, 4, 38, 12, 12, 12, 51, 4, 12, - 12, 12, 3, 5, 6, 15, 16, 17, 22, 24, - 25, 26, 28, 30, 31, 33, 35, 36, 12, 12, - 12, 12, 42, 51, 12, 50, 12, 12, 12, 12, - 12, 12 + 12, 12, 21, 12, 12, 12, 12, 12, 12, 12, + 12, 4, 5, 6, 7, 9, 15, 16, 17, 21, + 25, 29, 30, 31, 33, 34, 35, 37, 38, 40, + 41, 42, 52, 53, 12, 4, 12, 4, 39, 12, + 12, 12, 52, 4, 12, 12, 12, 12, 3, 5, + 6, 15, 16, 17, 22, 24, 25, 26, 28, 30, + 31, 33, 35, 37, 12, 12, 12, 12, 43, 52, + 12, 51, 12, 12, 12, 12, 12, 12 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int8 yyr1[] = { - 0, 45, 47, 46, 46, 48, 48, 48, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 50, 50, 51, 51, 51, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52 + 0, 46, 48, 47, 47, 49, 49, 49, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 51, 51, 52, + 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -754,12 +762,12 @@ static const yytype_int8 yyr2[] = { 0, 2, 0, 7, 2, 2, 2, 0, 2, 2, 2, 3, 3, 3, 2, 3, 3, 2, 4, 3, - 3, 2, 2, 2, 2, 3, 2, 3, 4, 4, - 4, 4, 1, 0, 2, 2, 0, 2, 2, 2, + 3, 2, 2, 2, 2, 2, 3, 2, 3, 4, + 4, 4, 4, 4, 4, 4, 4, 1, 0, 2, + 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 2, 2, 3, 1, - 1 + 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, + 2, 2, 2, 2, 3, 1, 1 }; @@ -1225,7 +1233,7 @@ yyreduce: case 2: /* $@1: %empty */ #line 78 "engines/hypno/grammar_arc.y" { g_parsedArc->mode = (yyvsp[0].s); } -#line 1229 "engines/hypno/grammar_arc.cpp" +#line 1237 "engines/hypno/grammar_arc.cpp" break; case 8: /* hline: CTOK NUM */ @@ -1234,7 +1242,7 @@ yyreduce: g_parsedArc->id = (yyvsp[0].i); HYPNO_ARC_default_sound_rate = 0; debugC(1, kHypnoDebugParser, "C %d", (yyvsp[0].i)); } -#line 1238 "engines/hypno/grammar_arc.cpp" +#line 1246 "engines/hypno/grammar_arc.cpp" break; case 9: /* hline: FTOK NUM */ @@ -1243,7 +1251,7 @@ yyreduce: HYPNO_ARC_default_sound_rate = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "F %d", (yyvsp[0].i)); } -#line 1247 "engines/hypno/grammar_arc.cpp" +#line 1255 "engines/hypno/grammar_arc.cpp" break; case 10: /* hline: DTOK NUM */ @@ -1252,139 +1260,155 @@ yyreduce: g_parsedArc->frameDelay = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "D %d", (yyvsp[0].i)); } -#line 1256 "engines/hypno/grammar_arc.cpp" +#line 1264 "engines/hypno/grammar_arc.cpp" break; case 11: /* hline: PTOK NUM NUM */ #line 99 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "P %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1262 "engines/hypno/grammar_arc.cpp" +#line 1270 "engines/hypno/grammar_arc.cpp" break; case 12: /* hline: ATOK NUM NUM */ #line 100 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "A %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1268 "engines/hypno/grammar_arc.cpp" +#line 1276 "engines/hypno/grammar_arc.cpp" break; case 13: /* hline: VTOK NUM NUM */ #line 101 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "V %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1274 "engines/hypno/grammar_arc.cpp" +#line 1282 "engines/hypno/grammar_arc.cpp" break; case 14: /* hline: VTOK RESTOK */ #line 102 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "V 320,200"); } -#line 1280 "engines/hypno/grammar_arc.cpp" +#line 1288 "engines/hypno/grammar_arc.cpp" break; case 15: /* hline: OTOK NUM NUM */ #line 103 "engines/hypno/grammar_arc.y" { - g_parsedArc->obj1KillsRequired = (yyvsp[-1].i); - g_parsedArc->obj1MissesAllowed = (yyvsp[0].i); + g_parsedArc->objKillsRequired[0] = (yyvsp[-1].i); + g_parsedArc->objMissesAllowed[0] = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "O %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1290 "engines/hypno/grammar_arc.cpp" +#line 1298 "engines/hypno/grammar_arc.cpp" break; case 16: /* hline: ONTOK NUM NUM */ #line 108 "engines/hypno/grammar_arc.y" { if (Common::String("O0") == (yyvsp[-2].s)) { - g_parsedArc->obj1KillsRequired = (yyvsp[-1].i); - g_parsedArc->obj1MissesAllowed = (yyvsp[0].i); + g_parsedArc->objKillsRequired[0] = (yyvsp[-1].i); + g_parsedArc->objMissesAllowed[0] = (yyvsp[0].i); } else if (Common::String("O1") == (yyvsp[-2].s)) { - g_parsedArc->obj2KillsRequired = (yyvsp[-1].i); - g_parsedArc->obj2MissesAllowed = (yyvsp[0].i); + g_parsedArc->objKillsRequired[1] = (yyvsp[-1].i); + g_parsedArc->objMissesAllowed[1] = (yyvsp[0].i); } else error("Invalid objective: '%s'", (yyvsp[-2].s)); debugC(1, kHypnoDebugParser, "ON %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1305 "engines/hypno/grammar_arc.cpp" +#line 1313 "engines/hypno/grammar_arc.cpp" break; case 17: /* hline: ONTOK NUM */ #line 118 "engines/hypno/grammar_arc.y" - { debugC(1, kHypnoDebugParser, "ON %d", (yyvsp[0].i)); } -#line 1311 "engines/hypno/grammar_arc.cpp" + { + if (Common::String("O0") == (yyvsp[-1].s)) { + g_parsedArc->objKillsRequired[0] = (yyvsp[0].i); + } else if (Common::String("O1") == (yyvsp[-1].s)) { + g_parsedArc->objKillsRequired[1] = (yyvsp[0].i); + } else + error("Invalid objective: '%s'", (yyvsp[-1].s)); + debugC(1, kHypnoDebugParser, "ON %d", (yyvsp[0].i)); + } +#line 1327 "engines/hypno/grammar_arc.cpp" break; case 18: /* hline: TPTOK FILENAME NUM FILENAME */ -#line 119 "engines/hypno/grammar_arc.y" +#line 127 "engines/hypno/grammar_arc.y" { g_parsedArc->transitionVideo = (yyvsp[-2].s); g_parsedArc->transitionTime = (yyvsp[-1].i); g_parsedArc->transitionPalette = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "Tp %s %d %s", (yyvsp[-2].s), (yyvsp[-1].i), (yyvsp[0].s)); } -#line 1322 "engines/hypno/grammar_arc.cpp" +#line 1338 "engines/hypno/grammar_arc.cpp" break; case 19: /* hline: TTOK FILENAME NUM */ -#line 125 "engines/hypno/grammar_arc.y" +#line 133 "engines/hypno/grammar_arc.y" { g_parsedArc->transitionVideo = (yyvsp[-1].s); g_parsedArc->transitionTime = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "T %s %d", (yyvsp[-1].s), (yyvsp[0].i)); } -#line 1332 "engines/hypno/grammar_arc.cpp" +#line 1348 "engines/hypno/grammar_arc.cpp" break; case 20: /* hline: TTOK NONETOK NUM */ -#line 130 "engines/hypno/grammar_arc.y" +#line 138 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "T NONE %d", (yyvsp[0].i)); } -#line 1338 "engines/hypno/grammar_arc.cpp" +#line 1354 "engines/hypno/grammar_arc.cpp" break; case 21: /* hline: NTOK FILENAME */ -#line 131 "engines/hypno/grammar_arc.y" +#line 139 "engines/hypno/grammar_arc.y" { g_parsedArc->backgroundVideo = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "N %s", (yyvsp[0].s)); } -#line 1347 "engines/hypno/grammar_arc.cpp" +#line 1363 "engines/hypno/grammar_arc.cpp" break; case 22: /* hline: NSTOK FILENAME */ -#line 135 "engines/hypno/grammar_arc.y" +#line 143 "engines/hypno/grammar_arc.y" { g_parsedArc->backgroundVideo = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "N* %s", (yyvsp[0].s)); } -#line 1356 "engines/hypno/grammar_arc.cpp" +#line 1372 "engines/hypno/grammar_arc.cpp" break; case 23: /* hline: RTOK FILENAME */ -#line 139 "engines/hypno/grammar_arc.y" +#line 147 "engines/hypno/grammar_arc.y" { g_parsedArc->backgroundPalette = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "R %s", (yyvsp[0].s)); } -#line 1364 "engines/hypno/grammar_arc.cpp" +#line 1380 "engines/hypno/grammar_arc.cpp" break; case 24: /* hline: ITOK FILENAME */ -#line 142 "engines/hypno/grammar_arc.y" +#line 150 "engines/hypno/grammar_arc.y" { g_parsedArc->player = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "I %s", (yyvsp[0].s)); - } -#line 1373 "engines/hypno/grammar_arc.cpp" + } +#line 1389 "engines/hypno/grammar_arc.cpp" break; - case 25: /* hline: QTOK NUM NUM */ -#line 146 "engines/hypno/grammar_arc.y" + case 25: /* hline: I1TOK FILENAME */ +#line 154 "engines/hypno/grammar_arc.y" + { + debugC(1, kHypnoDebugParser, "I1 %s", (yyvsp[0].s)); + } +#line 1397 "engines/hypno/grammar_arc.cpp" + break; + + case 26: /* hline: QTOK NUM NUM */ +#line 157 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "Q %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1379 "engines/hypno/grammar_arc.cpp" +#line 1403 "engines/hypno/grammar_arc.cpp" break; - case 26: /* hline: BNTOK FILENAME */ -#line 147 "engines/hypno/grammar_arc.y" + case 27: /* hline: BNTOK FILENAME */ +#line 158 "engines/hypno/grammar_arc.y" { if (Common::String("B0") == (yyvsp[-1].s)) g_parsedArc->beforeVideo = (yyvsp[0].s); //else if (Common::String("B1") == $1) - // g_parsedArc->nextLevelVideo = $2; + // g_parsedArc->beforeVideo = $2; else if (Common::String("B2") == (yyvsp[-1].s)) g_parsedArc->nextLevelVideo = (yyvsp[0].s); else if (Common::String("B3") == (yyvsp[-1].s)) @@ -1398,11 +1422,11 @@ yyreduce: debugC(1, kHypnoDebugParser, "BN %s", (yyvsp[0].s)); } -#line 1402 "engines/hypno/grammar_arc.cpp" +#line 1426 "engines/hypno/grammar_arc.cpp" break; - case 27: /* hline: SNTOK FILENAME enc */ -#line 165 "engines/hypno/grammar_arc.y" + case 28: /* hline: SNTOK FILENAME enc */ +#line 176 "engines/hypno/grammar_arc.y" { uint32 sampleRate = 11025; if (Common::String("22K") == (yyvsp[0].s) || Common::String("22k") == (yyvsp[0].s)) @@ -1425,64 +1449,105 @@ yyreduce: } debugC(1, kHypnoDebugParser, "SN %s", (yyvsp[-1].s)); } -#line 1429 "engines/hypno/grammar_arc.cpp" +#line 1453 "engines/hypno/grammar_arc.cpp" break; - case 28: /* hline: HETOK BYTE NUM NUM */ -#line 187 "engines/hypno/grammar_arc.y" + case 29: /* hline: HETOK BYTE NUM NUM */ +#line 198 "engines/hypno/grammar_arc.y" { Segment segment((yyvsp[-2].i), (yyvsp[0].i), (yyvsp[-1].i)); segment.end = true; g_parsedArc->segments.push_back(segment); debugC(1, kHypnoDebugParser, "HE %x %d %d", (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1440 "engines/hypno/grammar_arc.cpp" +#line 1464 "engines/hypno/grammar_arc.cpp" break; - case 29: /* hline: HLTOK BYTE NUM NUM */ -#line 193 "engines/hypno/grammar_arc.y" + case 30: /* hline: HLTOK BYTE NUM NUM */ +#line 204 "engines/hypno/grammar_arc.y" { Segment segment((yyvsp[-2].i), (yyvsp[0].i), (yyvsp[-1].i)); g_parsedArc->segments.push_back(segment); debugC(1, kHypnoDebugParser, "HL %x %d %d", (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1450 "engines/hypno/grammar_arc.cpp" +#line 1474 "engines/hypno/grammar_arc.cpp" break; - case 30: /* hline: HUTOK BYTE NUM NUM */ -#line 198 "engines/hypno/grammar_arc.y" + case 31: /* hline: HUTOK BYTE NUM NUM */ +#line 209 "engines/hypno/grammar_arc.y" { Segment segment((yyvsp[-2].i), (yyvsp[0].i), (yyvsp[-1].i)); g_parsedArc->segments.push_back(segment); debugC(1, kHypnoDebugParser, "HU %x %d %d", (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1460 "engines/hypno/grammar_arc.cpp" +#line 1484 "engines/hypno/grammar_arc.cpp" break; - case 31: /* hline: HTOK BYTE NUM NUM */ -#line 203 "engines/hypno/grammar_arc.y" + case 32: /* hline: HTOK NAME NUM NUM */ +#line 214 "engines/hypno/grammar_arc.y" + { + assert(Common::String((yyvsp[-2].s)).size() == 1); + Segment segment((yyvsp[-2].s)[0], (yyvsp[0].i), (yyvsp[-1].i)); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H %s %d %d", (yyvsp[-2].s), (yyvsp[-1].i), (yyvsp[0].i)); + } +#line 1495 "engines/hypno/grammar_arc.cpp" + break; + + case 33: /* hline: HTOK RTOK NUM NUM */ +#line 220 "engines/hypno/grammar_arc.y" + { // Workaround for BYTE == R + Segment segment('R', (yyvsp[0].i), (yyvsp[-1].i)); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H R %d %d", (yyvsp[-1].i), (yyvsp[0].i)); + } +#line 1505 "engines/hypno/grammar_arc.cpp" + break; + + case 34: /* hline: HTOK ATOK NUM NUM */ +#line 225 "engines/hypno/grammar_arc.y" + { // Workaround for BYTE == A + Segment segment('A', (yyvsp[0].i), (yyvsp[-1].i)); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H A %d %d", (yyvsp[-1].i), (yyvsp[0].i)); + } +#line 1515 "engines/hypno/grammar_arc.cpp" + break; + + case 35: /* hline: HTOK PTOK NUM NUM */ +#line 230 "engines/hypno/grammar_arc.y" + { // Workaround for BYTE == P + Segment segment('P', (yyvsp[0].i), (yyvsp[-1].i)); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H P %d %d", (yyvsp[-1].i), (yyvsp[0].i)); + } +#line 1525 "engines/hypno/grammar_arc.cpp" + break; + + case 36: /* hline: HTOK BYTE NUM NUM */ +#line 235 "engines/hypno/grammar_arc.y" { Segment segment((yyvsp[-2].i), (yyvsp[0].i), (yyvsp[-1].i)); g_parsedArc->segments.push_back(segment); debugC(1, kHypnoDebugParser, "H %x %d %d", (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1470 "engines/hypno/grammar_arc.cpp" +#line 1535 "engines/hypno/grammar_arc.cpp" break; - case 32: /* enc: ENCTOK */ -#line 210 "engines/hypno/grammar_arc.y" + case 37: /* enc: ENCTOK */ +#line 242 "engines/hypno/grammar_arc.y" { (yyval.s) = (yyvsp[0].s); } -#line 1476 "engines/hypno/grammar_arc.cpp" +#line 1541 "engines/hypno/grammar_arc.cpp" break; - case 33: /* enc: %empty */ -#line 211 "engines/hypno/grammar_arc.y" + case 38: /* enc: %empty */ +#line 243 "engines/hypno/grammar_arc.y" { (yyval.s) = scumm_strdup(""); } -#line 1482 "engines/hypno/grammar_arc.cpp" +#line 1547 "engines/hypno/grammar_arc.cpp" break; - case 37: /* bline: FNTOK FILENAME */ -#line 219 "engines/hypno/grammar_arc.y" + case 42: /* bline: FNTOK FILENAME */ +#line 251 "engines/hypno/grammar_arc.y" { shoot = new Shoot(); if (Common::String("F0") == (yyvsp[-1].s)) @@ -1491,271 +1556,280 @@ yyreduce: shoot->explosionAnimation = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "FN %s", (yyvsp[0].s)); } -#line 1495 "engines/hypno/grammar_arc.cpp" +#line 1560 "engines/hypno/grammar_arc.cpp" break; - case 38: /* bline: FNTOK NONETOK */ -#line 227 "engines/hypno/grammar_arc.y" + case 43: /* bline: FNTOK NONETOK */ +#line 259 "engines/hypno/grammar_arc.y" { shoot = new Shoot(); shoot->animation = "NONE"; debugC(1, kHypnoDebugParser, "FN NONE"); } -#line 1505 "engines/hypno/grammar_arc.cpp" +#line 1570 "engines/hypno/grammar_arc.cpp" break; - case 39: /* bline: FTOK FILENAME */ -#line 232 "engines/hypno/grammar_arc.y" + case 44: /* bline: FTOK FILENAME */ +#line 264 "engines/hypno/grammar_arc.y" { shoot = new Shoot(); shoot->animation = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "FN %s", (yyvsp[0].s)); } -#line 1515 "engines/hypno/grammar_arc.cpp" +#line 1580 "engines/hypno/grammar_arc.cpp" break; - case 40: /* bline: ITOK NAME */ -#line 237 "engines/hypno/grammar_arc.y" + case 45: /* bline: ITOK NAME */ +#line 269 "engines/hypno/grammar_arc.y" { shoot->name = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "I %s", (yyvsp[0].s)); } -#line 1524 "engines/hypno/grammar_arc.cpp" +#line 1589 "engines/hypno/grammar_arc.cpp" break; - case 41: /* bline: ITOK BNTOK */ -#line 241 "engines/hypno/grammar_arc.y" + case 46: /* bline: ITOK BNTOK */ +#line 273 "engines/hypno/grammar_arc.y" { // Workaround for NAME == B1 shoot->name = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "I %s", (yyvsp[0].s)); } -#line 1533 "engines/hypno/grammar_arc.cpp" +#line 1598 "engines/hypno/grammar_arc.cpp" break; - case 42: /* bline: ITOK ATOK */ -#line 245 "engines/hypno/grammar_arc.y" + case 47: /* bline: ITOK ATOK */ +#line 277 "engines/hypno/grammar_arc.y" { // Workaround for NAME == A shoot->name = "A"; debugC(1, kHypnoDebugParser, "I A"); } -#line 1542 "engines/hypno/grammar_arc.cpp" +#line 1607 "engines/hypno/grammar_arc.cpp" break; - case 43: /* bline: ITOK CTOK */ -#line 249 "engines/hypno/grammar_arc.y" + case 48: /* bline: ITOK CTOK */ +#line 281 "engines/hypno/grammar_arc.y" { // Workaround for NAME == C shoot->name = "C"; debugC(1, kHypnoDebugParser, "I C"); } -#line 1551 "engines/hypno/grammar_arc.cpp" +#line 1616 "engines/hypno/grammar_arc.cpp" break; - case 44: /* bline: ITOK DTOK */ -#line 253 "engines/hypno/grammar_arc.y" + case 49: /* bline: ITOK DTOK */ +#line 285 "engines/hypno/grammar_arc.y" { // Workaround for NAME == D shoot->name = "D"; debugC(1, kHypnoDebugParser, "I D"); } -#line 1560 "engines/hypno/grammar_arc.cpp" +#line 1625 "engines/hypno/grammar_arc.cpp" break; - case 45: /* bline: ITOK FTOK */ -#line 257 "engines/hypno/grammar_arc.y" + case 50: /* bline: ITOK FTOK */ +#line 289 "engines/hypno/grammar_arc.y" { // Workaround for NAME == F shoot->name = "F"; debugC(1, kHypnoDebugParser, "I F"); } -#line 1569 "engines/hypno/grammar_arc.cpp" +#line 1634 "engines/hypno/grammar_arc.cpp" break; - case 46: /* bline: ITOK HTOK */ -#line 261 "engines/hypno/grammar_arc.y" + case 51: /* bline: ITOK HTOK */ +#line 293 "engines/hypno/grammar_arc.y" { // Workaround for NAME == H shoot->name = "H"; debugC(1, kHypnoDebugParser, "I H"); } -#line 1578 "engines/hypno/grammar_arc.cpp" +#line 1643 "engines/hypno/grammar_arc.cpp" break; - case 47: /* bline: ITOK ITOK */ -#line 265 "engines/hypno/grammar_arc.y" + case 52: /* bline: ITOK ITOK */ +#line 297 "engines/hypno/grammar_arc.y" { // Workaround for NAME == I shoot->name = "I"; debugC(1, kHypnoDebugParser, "I I"); } -#line 1587 "engines/hypno/grammar_arc.cpp" +#line 1652 "engines/hypno/grammar_arc.cpp" break; - case 48: /* bline: ITOK JTOK */ -#line 269 "engines/hypno/grammar_arc.y" + case 53: /* bline: ITOK JTOK */ +#line 301 "engines/hypno/grammar_arc.y" { // Workaround for NAME == I shoot->name = "J"; debugC(1, kHypnoDebugParser, "I J"); } -#line 1596 "engines/hypno/grammar_arc.cpp" +#line 1661 "engines/hypno/grammar_arc.cpp" break; - case 49: /* bline: ITOK NTOK */ -#line 273 "engines/hypno/grammar_arc.y" + case 54: /* bline: ITOK NTOK */ +#line 305 "engines/hypno/grammar_arc.y" { // Workaround for NAME == N shoot->name = "N"; debugC(1, kHypnoDebugParser, "I N"); } -#line 1605 "engines/hypno/grammar_arc.cpp" +#line 1670 "engines/hypno/grammar_arc.cpp" break; - case 50: /* bline: ITOK OTOK */ -#line 277 "engines/hypno/grammar_arc.y" + case 55: /* bline: ITOK OTOK */ +#line 309 "engines/hypno/grammar_arc.y" { // Workaround for NAME == O shoot->name = "O"; debugC(1, kHypnoDebugParser, "I O"); } -#line 1614 "engines/hypno/grammar_arc.cpp" +#line 1679 "engines/hypno/grammar_arc.cpp" break; - case 51: /* bline: ITOK PTOK */ -#line 281 "engines/hypno/grammar_arc.y" + case 56: /* bline: ITOK PTOK */ +#line 313 "engines/hypno/grammar_arc.y" { // Workaround for NAME == P shoot->name = "P"; debugC(1, kHypnoDebugParser, "I P"); } -#line 1623 "engines/hypno/grammar_arc.cpp" +#line 1688 "engines/hypno/grammar_arc.cpp" break; - case 52: /* bline: ITOK QTOK */ -#line 285 "engines/hypno/grammar_arc.y" + case 57: /* bline: ITOK QTOK */ +#line 317 "engines/hypno/grammar_arc.y" { // Workaround for NAME == Q shoot->name = "Q"; debugC(1, kHypnoDebugParser, "I Q"); } -#line 1632 "engines/hypno/grammar_arc.cpp" +#line 1697 "engines/hypno/grammar_arc.cpp" break; - case 53: /* bline: ITOK RTOK */ -#line 289 "engines/hypno/grammar_arc.y" + case 58: /* bline: ITOK RTOK */ +#line 321 "engines/hypno/grammar_arc.y" { // Workaround for NAME == R shoot->name = "R"; debugC(1, kHypnoDebugParser, "I R"); } -#line 1641 "engines/hypno/grammar_arc.cpp" +#line 1706 "engines/hypno/grammar_arc.cpp" break; - case 54: /* bline: ITOK SNTOK */ -#line 293 "engines/hypno/grammar_arc.y" + case 59: /* bline: ITOK SNTOK */ +#line 325 "engines/hypno/grammar_arc.y" { // Workaround for NAME == S1 shoot->name = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "I %s", (yyvsp[0].s)); } -#line 1650 "engines/hypno/grammar_arc.cpp" +#line 1715 "engines/hypno/grammar_arc.cpp" break; - case 55: /* bline: ITOK TTOK */ -#line 297 "engines/hypno/grammar_arc.y" + case 60: /* bline: ITOK TTOK */ +#line 329 "engines/hypno/grammar_arc.y" { // Workaround for NAME == T shoot->name = "T"; debugC(1, kHypnoDebugParser, "I T"); } -#line 1659 "engines/hypno/grammar_arc.cpp" +#line 1724 "engines/hypno/grammar_arc.cpp" break; - case 56: /* bline: JTOK NUM */ -#line 301 "engines/hypno/grammar_arc.y" + case 61: /* bline: JTOK NUM */ +#line 333 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "J %d", (yyvsp[0].i)); } -#line 1667 "engines/hypno/grammar_arc.cpp" +#line 1732 "engines/hypno/grammar_arc.cpp" break; - case 57: /* bline: A0TOK NUM NUM */ -#line 304 "engines/hypno/grammar_arc.y" + case 62: /* bline: A0TOK NUM NUM */ +#line 336 "engines/hypno/grammar_arc.y" { shoot->position = Common::Point((yyvsp[-1].i), (yyvsp[0].i)); debugC(1, kHypnoDebugParser, "A0 %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1676 "engines/hypno/grammar_arc.cpp" +#line 1741 "engines/hypno/grammar_arc.cpp" break; - case 58: /* bline: RTOK NUM NUM */ -#line 308 "engines/hypno/grammar_arc.y" + case 63: /* bline: RTOK NUM NUM */ +#line 340 "engines/hypno/grammar_arc.y" { - shoot->obj1KillsCount = (yyvsp[-1].i); - shoot->obj1MissesCount = (yyvsp[0].i); + shoot->objKillsCount = (yyvsp[-1].i); + shoot->objMissesCount = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "R %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1686 "engines/hypno/grammar_arc.cpp" +#line 1751 "engines/hypno/grammar_arc.cpp" break; - case 59: /* bline: R0TOK NUM NUM */ -#line 313 "engines/hypno/grammar_arc.y" - { debugC(1, kHypnoDebugParser, "R0 %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1692 "engines/hypno/grammar_arc.cpp" + case 64: /* bline: R01TOK NUM NUM */ +#line 345 "engines/hypno/grammar_arc.y" + { + shoot->objKillsCount = (yyvsp[-1].i); + shoot->objMissesCount = (yyvsp[0].i); + debugC(1, kHypnoDebugParser, "R0/1 %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } +#line 1760 "engines/hypno/grammar_arc.cpp" break; - case 60: /* bline: BNTOK NUM NUM */ -#line 314 "engines/hypno/grammar_arc.y" + case 65: /* bline: BNTOK NUM NUM */ +#line 349 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "BN %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1698 "engines/hypno/grammar_arc.cpp" +#line 1766 "engines/hypno/grammar_arc.cpp" break; - case 61: /* bline: KNTOK NUM NUM */ -#line 315 "engines/hypno/grammar_arc.y" + case 66: /* bline: KNTOK NUM NUM */ +#line 350 "engines/hypno/grammar_arc.y" { shoot->explosionFrames.push_front((yyvsp[0].i)); debugC(1, kHypnoDebugParser, "KN %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1707 "engines/hypno/grammar_arc.cpp" +#line 1775 "engines/hypno/grammar_arc.cpp" break; - case 62: /* bline: P0TOK NUM NUM */ -#line 319 "engines/hypno/grammar_arc.y" + case 67: /* bline: P0TOK NUM NUM */ +#line 354 "engines/hypno/grammar_arc.y" { shoot->paletteSize = (yyvsp[-1].i); shoot->paletteOffset = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "P0 %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1716 "engines/hypno/grammar_arc.cpp" +#line 1784 "engines/hypno/grammar_arc.cpp" break; - case 63: /* bline: OTOK NUM NUM */ -#line 323 "engines/hypno/grammar_arc.y" + case 68: /* bline: OTOK NUM NUM */ +#line 358 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "O %d %d", (yyvsp[-1].i), (yyvsp[0].i)); } -#line 1724 "engines/hypno/grammar_arc.cpp" +#line 1792 "engines/hypno/grammar_arc.cpp" break; - case 64: /* bline: CTOK NUM */ -#line 326 "engines/hypno/grammar_arc.y" + case 69: /* bline: CTOK NUM */ +#line 361 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "C %d", (yyvsp[0].i)); } -#line 1730 "engines/hypno/grammar_arc.cpp" +#line 1798 "engines/hypno/grammar_arc.cpp" break; - case 65: /* bline: HTOK NUM */ -#line 327 "engines/hypno/grammar_arc.y" + case 70: /* bline: HTOK NUM */ +#line 362 "engines/hypno/grammar_arc.y" { shoot->attackFrames.push_back((yyvsp[0].i)); debugC(1, kHypnoDebugParser, "H %d", (yyvsp[0].i)); } -#line 1738 "engines/hypno/grammar_arc.cpp" +#line 1806 "engines/hypno/grammar_arc.cpp" break; - case 66: /* bline: WTOK NUM */ -#line 330 "engines/hypno/grammar_arc.y" + case 71: /* bline: VTOK NUM */ +#line 365 "engines/hypno/grammar_arc.y" + { debugC(1, kHypnoDebugParser, "V %d", (yyvsp[0].i)); } +#line 1812 "engines/hypno/grammar_arc.cpp" + break; + + case 72: /* bline: WTOK NUM */ +#line 366 "engines/hypno/grammar_arc.y" { shoot->attackWeight = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "W %d", (yyvsp[0].i)); } -#line 1746 "engines/hypno/grammar_arc.cpp" +#line 1820 "engines/hypno/grammar_arc.cpp" break; - case 67: /* bline: DTOK NUM */ -#line 333 "engines/hypno/grammar_arc.y" + case 73: /* bline: DTOK NUM */ +#line 369 "engines/hypno/grammar_arc.y" { shoot->pointsToShoot = (yyvsp[0].i); debugC(1, kHypnoDebugParser, "D %d", (yyvsp[0].i)); } -#line 1755 "engines/hypno/grammar_arc.cpp" +#line 1829 "engines/hypno/grammar_arc.cpp" break; - case 68: /* bline: SNTOK FILENAME enc */ -#line 337 "engines/hypno/grammar_arc.y" + case 74: /* bline: SNTOK FILENAME enc */ +#line 373 "engines/hypno/grammar_arc.y" { if (Common::String("S1") == (yyvsp[-2].s)) shoot->deathSound = (yyvsp[-1].s); @@ -1763,28 +1837,28 @@ yyreduce: shoot->hitSound = (yyvsp[-1].s); debugC(1, kHypnoDebugParser, "SN %s", (yyvsp[-1].s)); } -#line 1767 "engines/hypno/grammar_arc.cpp" +#line 1841 "engines/hypno/grammar_arc.cpp" break; - case 69: /* bline: NTOK */ -#line 344 "engines/hypno/grammar_arc.y" + case 75: /* bline: NTOK */ +#line 380 "engines/hypno/grammar_arc.y" { debugC(1, kHypnoDebugParser, "N"); } -#line 1773 "engines/hypno/grammar_arc.cpp" +#line 1847 "engines/hypno/grammar_arc.cpp" break; - case 70: /* bline: ZTOK */ -#line 345 "engines/hypno/grammar_arc.y" + case 76: /* bline: ZTOK */ +#line 381 "engines/hypno/grammar_arc.y" { g_parsedArc->shoots.push_back(*shoot); //delete shoot; //shoot = nullptr; debugC(1, kHypnoDebugParser, "Z"); } -#line 1784 "engines/hypno/grammar_arc.cpp" +#line 1858 "engines/hypno/grammar_arc.cpp" break; -#line 1788 "engines/hypno/grammar_arc.cpp" +#line 1862 "engines/hypno/grammar_arc.cpp" default: break; } diff --git a/engines/hypno/grammar_arc.y b/engines/hypno/grammar_arc.y index b04e4a8df68..29fe3befa6a 100644 --- a/engines/hypno/grammar_arc.y +++ b/engines/hypno/grammar_arc.y @@ -60,7 +60,7 @@ using namespace Hypno; %token NUM BYTE // header %token COMMENT CTOK DTOK HTOK HETOK HLTOK HUTOK RETTOK QTOK RESTOK -%token PTOK FTOK TTOK TPTOK ATOK VTOK OTOK NTOK NSTOK RTOK R0TOK ITOK JTOK ZTOK +%token PTOK FTOK TTOK TPTOK ATOK VTOK OTOK NTOK NSTOK RTOK R01TOK ITOK I1TOK JTOK ZTOK // body %token NONETOK A0TOK P0TOK WTOK @@ -101,21 +101,29 @@ hline: CTOK NUM { | VTOK NUM NUM { debugC(1, kHypnoDebugParser, "V %d %d", $2, $3); } | VTOK RESTOK { debugC(1, kHypnoDebugParser, "V 320,200"); } | OTOK NUM NUM { - g_parsedArc->obj1KillsRequired = $2; - g_parsedArc->obj1MissesAllowed = $3; + g_parsedArc->objKillsRequired[0] = $2; + g_parsedArc->objMissesAllowed[0] = $3; debugC(1, kHypnoDebugParser, "O %d %d", $2, $3); } | ONTOK NUM NUM { if (Common::String("O0") == $1) { - g_parsedArc->obj1KillsRequired = $2; - g_parsedArc->obj1MissesAllowed = $3; + g_parsedArc->objKillsRequired[0] = $2; + g_parsedArc->objMissesAllowed[0] = $3; } else if (Common::String("O1") == $1) { - g_parsedArc->obj2KillsRequired = $2; - g_parsedArc->obj2MissesAllowed = $3; + g_parsedArc->objKillsRequired[1] = $2; + g_parsedArc->objMissesAllowed[1] = $3; } else error("Invalid objective: '%s'", $1); debugC(1, kHypnoDebugParser, "ON %d %d", $2, $3); } - | ONTOK NUM { debugC(1, kHypnoDebugParser, "ON %d", $2); } + | ONTOK NUM { + if (Common::String("O0") == $1) { + g_parsedArc->objKillsRequired[0] = $2; + } else if (Common::String("O1") == $1) { + g_parsedArc->objKillsRequired[1] = $2; + } else + error("Invalid objective: '%s'", $1); + debugC(1, kHypnoDebugParser, "ON %d", $2); + } | TPTOK FILENAME NUM FILENAME { g_parsedArc->transitionVideo = $2; g_parsedArc->transitionTime = $3; @@ -142,13 +150,16 @@ hline: CTOK NUM { | ITOK FILENAME { g_parsedArc->player = $2; debugC(1, kHypnoDebugParser, "I %s", $2); - } + } + | I1TOK FILENAME { + debugC(1, kHypnoDebugParser, "I1 %s", $2); + } | QTOK NUM NUM { debugC(1, kHypnoDebugParser, "Q %d %d", $2, $3); } | BNTOK FILENAME { if (Common::String("B0") == $1) g_parsedArc->beforeVideo = $2; //else if (Common::String("B1") == $1) - // g_parsedArc->nextLevelVideo = $2; + // g_parsedArc->beforeVideo = $2; else if (Common::String("B2") == $1) g_parsedArc->nextLevelVideo = $2; else if (Common::String("B3") == $1) @@ -200,6 +211,27 @@ hline: CTOK NUM { g_parsedArc->segments.push_back(segment); debugC(1, kHypnoDebugParser, "HU %x %d %d", $2, $3, $4); } + | HTOK NAME NUM NUM { + assert(Common::String($2).size() == 1); + Segment segment($2[0], $4, $3); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H %s %d %d", $2, $3, $4); + } + | HTOK RTOK NUM NUM { // Workaround for BYTE == R + Segment segment('R', $4, $3); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H R %d %d", $3, $4); + } + | HTOK ATOK NUM NUM { // Workaround for BYTE == A + Segment segment('A', $4, $3); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H A %d %d", $3, $4); + } + | HTOK PTOK NUM NUM { // Workaround for BYTE == P + Segment segment('P', $4, $3); + g_parsedArc->segments.push_back(segment); + debugC(1, kHypnoDebugParser, "H P %d %d", $3, $4); + } | HTOK BYTE NUM NUM { Segment segment($2, $4, $3); g_parsedArc->segments.push_back(segment); @@ -306,11 +338,14 @@ bline: FNTOK FILENAME { debugC(1, kHypnoDebugParser, "A0 %d %d", $2, $3); } | RTOK NUM NUM { - shoot->obj1KillsCount = $2; - shoot->obj1MissesCount = $3; + shoot->objKillsCount = $2; + shoot->objMissesCount = $3; debugC(1, kHypnoDebugParser, "R %d %d", $2, $3); } - | R0TOK NUM NUM { debugC(1, kHypnoDebugParser, "R0 %d %d", $2, $3); } + | R01TOK NUM NUM { + shoot->objKillsCount = $2; + shoot->objMissesCount = $3; + debugC(1, kHypnoDebugParser, "R0/1 %d %d", $2, $3); } | BNTOK NUM NUM { debugC(1, kHypnoDebugParser, "BN %d %d", $2, $3); } | KNTOK NUM NUM { shoot->explosionFrames.push_front($3); @@ -327,6 +362,7 @@ bline: FNTOK FILENAME { | HTOK NUM { shoot->attackFrames.push_back($2); debugC(1, kHypnoDebugParser, "H %d", $2); } + | VTOK NUM { debugC(1, kHypnoDebugParser, "V %d", $2); } | WTOK NUM { shoot->attackWeight = $2; debugC(1, kHypnoDebugParser, "W %d", $2); } diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp index a9f1a29356d..aae433c565a 100644 --- a/engines/hypno/hypno.cpp +++ b/engines/hypno/hypno.cpp @@ -55,7 +55,7 @@ HypnoEngine::HypnoEngine(OSystem *syst, const ADGameDescription *gd) _countdown(0), _timerStarted(false), _score(0), _lives(0), _defaultCursor(""), _checkpoint(""), _currentPlayerPosition(kPlayerLeft), _lastPlayerPosition(kPlayerLeft), - _obj1KillsCount(0), _obj1MissesCount(0), + //_obj1KillsCount(0), _obj1MissesCount(0), _screenW(0), _screenH(0) { // Every games initializes its own resolution _rnd = new Common::RandomSource("hypno"); diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h index bdf9f2f00dd..9ff9ed7f483 100644 --- a/engines/hypno/hypno.h +++ b/engines/hypno/hypno.h @@ -70,7 +70,6 @@ enum PlayerPosition { class HypnoEngine : public Engine { private: - Common::RandomSource *_rnd; Image::ImageDecoder *_image; public: @@ -111,7 +110,7 @@ public: // Parsing void splitArcadeFile(const Common::String &filename, Common::String &arc, Common::String &list); void parseArcadeShooting(const Common::String &prefix, const Common::String &name, const Common::String &data); - ShootSequence parseShootList(const Common::String &name, const Common::String &data); + SegmentShootsSequence parseShootList(const Common::String &name, const Common::String &data); void loadArcadeLevel(const Common::String ¤t, const Common::String &nextWin, const Common::String &nextLose, const Common::String &prefix); void loadSceneLevel(const Common::String ¤t, const Common::String &next, const Common::String &prefix); LibFile *loadLib(const Filename &prefix, const Filename &filename, bool encrypted); @@ -223,6 +222,17 @@ public: virtual void drawShoot(const Common::Point &mousePos); virtual void shoot(const Common::Point &mousePos); virtual void hitPlayer(); + + // Segments + uint32 _segmentIdx; + uint32 _segmentOffset; + uint32 _segmentRepetition; + uint32 _segmentRepetitionMax; + uint32 _segmentShootSequenceOffset; + uint32 _segmentShootSequenceMax; + ShootSequence _shootSequence; + virtual void findNextSegment(ArcadeShooting *arc); + virtual void initSegment(ArcadeShooting *arc); virtual bool checkArcadeLevelCompleted(MVideo &background, Segment segment); Common::String _difficulty; bool _skipLevel; @@ -242,8 +252,9 @@ public: int _playerFrameSep; // Objectives - uint32 _obj1KillsCount; - uint32 _obj1MissesCount; + uint32 _objIdx; + uint32 _objKillsCount[2]; + uint32 _objMissesCount[2]; // Fonts virtual void loadFonts(); @@ -265,6 +276,9 @@ public: bool startAlarm(uint32, Common::String *); bool startCountdown(uint32); void removeTimers(); + + // Random + Common::RandomSource *_rnd; }; struct chapterEntry { @@ -296,7 +310,11 @@ public: Common::String findNextLevel(const Common::String &level) override; Common::String findNextLevel(const Transition *trans) override; + // Arcade void runBeforeArcade(ArcadeShooting *arc) override; + void findNextSegment(ArcadeShooting *arc) override; + void initSegment(ArcadeShooting *arc) override; + private: void runMainMenu(Code *code); void runCheckLives(Code *code); @@ -318,6 +336,9 @@ public: void drawPlayer() override; void drawHealth() override; void hitPlayer() override; + + void findNextSegment(ArcadeShooting *arc) override; + void initSegment(ArcadeShooting *arc) override; bool checkArcadeLevelCompleted(MVideo &background, Segment segment) override; void drawBackToMenu(Hotspot *h) override; diff --git a/engines/hypno/lexer_arc.cpp b/engines/hypno/lexer_arc.cpp index cd03e0f9abf..e7d9807c0aa 100644 --- a/engines/hypno/lexer_arc.cpp +++ b/engines/hypno/lexer_arc.cpp @@ -633,8 +633,8 @@ static void yynoreturn yy_fatal_error ( const char* msg ); (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 44 -#define YY_END_OF_BUFFER 45 +#define YY_NUM_RULES 45 +#define YY_END_OF_BUFFER 46 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -642,16 +642,16 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[76] = +static const flex_int16_t yy_accept[77] = { 0, - 0, 0, 45, 43, 42, 40, 40, 43, 35, 35, - 35, 35, 43, 9, 36, 2, 3, 36, 26, 7, - 17, 18, 36, 13, 11, 8, 19, 15, 36, 23, - 10, 21, 22, 36, 20, 36, 42, 35, 38, 35, - 35, 35, 35, 0, 37, 28, 36, 29, 25, 4, - 5, 6, 30, 14, 36, 12, 31, 16, 27, 24, - 32, 36, 34, 34, 33, 33, 35, 41, 36, 0, - 1, 0, 0, 39, 0 + 0, 0, 46, 44, 43, 41, 41, 44, 36, 36, + 36, 36, 44, 9, 37, 2, 3, 37, 27, 7, + 17, 19, 37, 13, 11, 8, 20, 15, 37, 24, + 10, 22, 23, 37, 21, 37, 43, 36, 39, 36, + 36, 36, 36, 0, 38, 29, 37, 30, 26, 4, + 5, 6, 18, 31, 14, 37, 12, 32, 16, 28, + 25, 33, 37, 35, 35, 34, 34, 36, 42, 37, + 0, 1, 0, 0, 40, 0 } ; static const YY_CHAR yy_ec[256] = @@ -695,33 +695,33 @@ static const YY_CHAR yy_meta[45] = 4, 4, 4, 1 } ; -static const flex_int16_t yy_base[82] = +static const flex_int16_t yy_base[83] = { 0, - 0, 0, 200, 201, 189, 201, 201, 36, 41, 46, - 51, 56, 0, 62, 64, 178, 176, 175, 77, 83, - 174, 173, 84, 93, 95, 91, 172, 98, 102, 100, - 171, 170, 165, 108, 164, 0, 169, 113, 0, 118, - 143, 93, 132, 166, 0, 161, 159, 158, 157, 156, - 155, 154, 153, 201, 111, 152, 151, 139, 138, 137, - 134, 0, 0, 201, 0, 201, 133, 136, 125, 125, - 126, 123, 111, 201, 201, 185, 189, 191, 193, 74, - 195 + 0, 0, 203, 204, 200, 204, 204, 36, 41, 46, + 51, 56, 0, 62, 64, 185, 180, 178, 77, 83, + 84, 177, 87, 96, 97, 102, 176, 104, 110, 85, + 175, 174, 173, 95, 172, 0, 176, 120, 0, 130, + 135, 83, 125, 172, 0, 167, 166, 165, 164, 163, + 158, 157, 156, 155, 204, 141, 154, 153, 151, 150, + 149, 148, 0, 0, 204, 0, 204, 145, 151, 107, + 143, 145, 143, 107, 204, 204, 187, 191, 193, 195, + 74, 197 } ; -static const flex_int16_t yy_def[82] = +static const flex_int16_t yy_def[83] = { 0, - 75, 1, 75, 75, 75, 75, 75, 75, 76, 76, - 76, 76, 77, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 79, 78, 80, 75, 75, 76, 76, - 76, 41, 41, 77, 81, 78, 78, 78, 78, 78, - 78, 78, 78, 75, 78, 78, 78, 78, 78, 78, - 78, 80, 76, 75, 76, 75, 41, 77, 78, 75, - 78, 75, 75, 75, 0, 75, 75, 75, 75, 75, - 75 + 76, 1, 76, 76, 76, 76, 76, 76, 77, 77, + 77, 77, 78, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 80, 79, 81, 76, 76, 77, 77, + 77, 41, 41, 78, 82, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 76, 79, 79, 79, 79, 79, + 79, 79, 81, 77, 76, 77, 76, 41, 78, 79, + 76, 79, 76, 76, 76, 0, 76, 76, 76, 76, + 76, 76 } ; -static const flex_int16_t yy_nxt[246] = +static const flex_int16_t yy_nxt[249] = { 0, 4, 5, 6, 7, 4, 4, 8, 4, 9, 10, 11, 12, 9, 13, 14, 15, 16, 17, 18, 19, @@ -730,29 +730,29 @@ static const flex_int16_t yy_nxt[246] = 18, 18, 18, 7, 38, 38, 38, 38, 38, 40, 40, 40, 40, 40, 40, 41, 40, 40, 40, 40, 40, 42, 40, 40, 40, 40, 43, 40, 40, 45, - 46, 45, 48, 48, 48, 48, 48, 62, 48, 48, + 46, 45, 48, 48, 48, 48, 48, 63, 48, 48, 48, 48, 48, 48, 45, 49, 49, 49, 49, 49, - 45, 45, 53, 53, 53, 53, 53, 54, 45, 57, + 45, 45, 45, 53, 45, 54, 54, 54, 54, 54, - 45, 50, 45, 56, 56, 45, 58, 45, 51, 45, - 59, 59, 59, 59, 59, 45, 52, 65, 45, 74, - 55, 38, 38, 38, 38, 38, 40, 40, 40, 40, - 40, 73, 45, 45, 65, 72, 66, 69, 70, 68, - 67, 45, 60, 71, 45, 45, 45, 47, 47, 47, - 47, 40, 40, 40, 40, 40, 39, 39, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 63, 45, 68, - 37, 45, 45, 39, 39, 75, 75, 45, 45, 45, - 45, 45, 45, 45, 63, 45, 64, 39, 39, 44, - 37, 44, 44, 47, 47, 61, 61, 45, 45, 75, + 55, 50, 45, 45, 45, 57, 57, 66, 51, 45, + 58, 45, 59, 59, 45, 75, 52, 45, 60, 60, + 60, 60, 60, 56, 66, 72, 67, 61, 38, 38, + 38, 38, 38, 68, 47, 47, 47, 47, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 45, 39, + 71, 74, 45, 73, 69, 45, 45, 45, 45, 64, + 45, 45, 45, 45, 45, 45, 39, 70, 76, 39, + 45, 45, 45, 45, 45, 69, 64, 37, 65, 45, + 45, 45, 45, 45, 45, 45, 39, 45, 76, 39, + 39, 44, 45, 44, 44, 47, 47, 62, 62, 45, - 3, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75 + 45, 37, 76, 3, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76 } ; -static const flex_int16_t yy_chk[246] = +static const flex_int16_t yy_chk[249] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -761,34 +761,34 @@ static const flex_int16_t yy_chk[246] = 1, 1, 1, 1, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 14, - 14, 15, 15, 15, 15, 15, 15, 80, 15, 15, + 14, 15, 15, 15, 15, 15, 15, 81, 15, 15, 15, 15, 15, 15, 19, 19, 19, 19, 19, 19, - 20, 23, 23, 23, 23, 23, 23, 24, 26, 26, + 20, 21, 30, 21, 23, 23, 23, 23, 23, 23, - 24, 20, 25, 25, 25, 28, 28, 30, 20, 29, - 29, 29, 29, 29, 29, 34, 20, 42, 55, 73, - 24, 38, 38, 38, 38, 38, 40, 40, 40, 40, - 40, 72, 69, 71, 42, 70, 42, 55, 67, 68, - 43, 61, 30, 69, 60, 59, 58, 34, 34, 34, - 34, 41, 41, 41, 41, 41, 43, 67, 57, 56, - 53, 52, 51, 50, 49, 48, 47, 41, 46, 44, - 37, 35, 33, 43, 67, 43, 67, 32, 31, 27, - 22, 21, 18, 17, 41, 16, 41, 76, 76, 77, - 5, 77, 77, 78, 78, 79, 79, 81, 81, 3, + 24, 20, 34, 24, 25, 25, 25, 42, 20, 26, + 26, 28, 28, 28, 70, 74, 20, 29, 29, 29, + 29, 29, 29, 24, 42, 70, 42, 30, 38, 38, + 38, 38, 38, 43, 34, 34, 34, 34, 40, 40, + 40, 40, 40, 41, 41, 41, 41, 41, 56, 43, + 68, 73, 72, 71, 69, 62, 61, 60, 59, 41, + 58, 57, 54, 53, 52, 51, 43, 56, 43, 68, + 50, 49, 48, 47, 46, 44, 41, 37, 41, 35, + 33, 32, 31, 27, 22, 18, 68, 17, 68, 77, + 77, 78, 16, 78, 78, 79, 79, 80, 80, 82, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75 + 82, 5, 3, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76 } ; /* Table of booleans, true if rule could match eol. */ -static const flex_int32_t yy_rule_can_match_eol[45] = +static const flex_int32_t yy_rule_can_match_eol[46] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, }; + 0, 1, 0, 0, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; @@ -1080,13 +1080,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 76 ) + if ( yy_current_state >= 77 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_current_state != 75 ); + while ( yy_current_state != 76 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -1194,7 +1194,7 @@ return RTOK; case 16: YY_RULE_SETUP #line 58 "engines/hypno/lexer_arc.l" -return R0TOK; +return R01TOK; YY_BREAK case 17: YY_RULE_SETUP @@ -1204,82 +1204,82 @@ return ITOK; case 18: YY_RULE_SETUP #line 60 "engines/hypno/lexer_arc.l" -return JTOK; +return I1TOK; YY_BREAK case 19: YY_RULE_SETUP #line 61 "engines/hypno/lexer_arc.l" -return QTOK; +return JTOK; YY_BREAK case 20: YY_RULE_SETUP #line 62 "engines/hypno/lexer_arc.l" -return ZTOK; +return QTOK; YY_BREAK case 21: YY_RULE_SETUP #line 63 "engines/hypno/lexer_arc.l" -return WTOK; +return ZTOK; YY_BREAK case 22: YY_RULE_SETUP #line 64 "engines/hypno/lexer_arc.l" -return XTOK; +return WTOK; YY_BREAK case 23: YY_RULE_SETUP #line 65 "engines/hypno/lexer_arc.l" -return TTOK; +return XTOK; YY_BREAK case 24: YY_RULE_SETUP #line 66 "engines/hypno/lexer_arc.l" -return TPTOK; +return TTOK; YY_BREAK case 25: YY_RULE_SETUP #line 67 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return FNTOK; +return TPTOK; YY_BREAK case 26: YY_RULE_SETUP #line 68 "engines/hypno/lexer_arc.l" -return FTOK; +HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return FNTOK; YY_BREAK case 27: YY_RULE_SETUP #line 69 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return SNTOK; +return FTOK; YY_BREAK case 28: YY_RULE_SETUP #line 70 "engines/hypno/lexer_arc.l" -return A0TOK; +HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return SNTOK; YY_BREAK case 29: YY_RULE_SETUP #line 71 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return BNTOK; +return A0TOK; YY_BREAK case 30: YY_RULE_SETUP #line 72 "engines/hypno/lexer_arc.l" -return KNTOK; +HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return BNTOK; YY_BREAK case 31: YY_RULE_SETUP #line 73 "engines/hypno/lexer_arc.l" -return P0TOK; +return KNTOK; YY_BREAK case 32: YY_RULE_SETUP #line 74 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return YXTOK; +return P0TOK; YY_BREAK case 33: YY_RULE_SETUP #line 75 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return ENCTOK; +HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return YXTOK; YY_BREAK case 34: YY_RULE_SETUP @@ -1289,17 +1289,17 @@ HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return ENCTOK; case 35: YY_RULE_SETUP #line 77 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.i = atoi(HYPNO_ARC_text); return NUM; +HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return ENCTOK; YY_BREAK case 36: YY_RULE_SETUP #line 78 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return NAME; +HYPNO_ARC_lval.i = atoi(HYPNO_ARC_text); return NUM; YY_BREAK case 37: YY_RULE_SETUP #line 79 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return FILENAME; +HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return NAME; YY_BREAK case 38: YY_RULE_SETUP @@ -1309,35 +1309,40 @@ HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return FILENAME; case 39: YY_RULE_SETUP #line 81 "engines/hypno/lexer_arc.l" -return RESTOK; +HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return FILENAME; YY_BREAK case 40: -/* rule 40 can match eol */ YY_RULE_SETUP #line 82 "engines/hypno/lexer_arc.l" -return RETTOK; +return RESTOK; YY_BREAK case 41: +/* rule 41 can match eol */ YY_RULE_SETUP #line 83 "engines/hypno/lexer_arc.l" -/* ignore comment */ +return RETTOK; YY_BREAK case 42: YY_RULE_SETUP #line 84 "engines/hypno/lexer_arc.l" -/* ignore whitespace */; +/* ignore comment */ YY_BREAK case 43: YY_RULE_SETUP #line 85 "engines/hypno/lexer_arc.l" -HYPNO_ARC_lval.i = HYPNO_ARC_text[0]; return BYTE; +/* ignore whitespace */; YY_BREAK case 44: YY_RULE_SETUP #line 86 "engines/hypno/lexer_arc.l" +HYPNO_ARC_lval.i = HYPNO_ARC_text[0]; return BYTE; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 87 "engines/hypno/lexer_arc.l" ECHO; YY_BREAK -#line 1340 "engines/hypno/lexer_arc.cpp" +#line 1345 "engines/hypno/lexer_arc.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1635,7 +1640,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 76 ) + if ( yy_current_state >= 77 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1663,11 +1668,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 76 ) + if ( yy_current_state >= 77 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 75); + yy_is_jam = (yy_current_state == 76); return yy_is_jam ? 0 : yy_current_state; } @@ -2314,7 +2319,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 86 "engines/hypno/lexer_arc.l" +#line 87 "engines/hypno/lexer_arc.l" namespace Hypno { diff --git a/engines/hypno/lexer_arc.l b/engines/hypno/lexer_arc.l index c2a80b8cb6f..22301614634 100644 --- a/engines/hypno/lexer_arc.l +++ b/engines/hypno/lexer_arc.l @@ -55,8 +55,9 @@ O[0-1] HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return ONTOK; N return NTOK; N\* return NSTOK; R return RTOK; -R0 return R0TOK; +R[0-1] return R01TOK; I return ITOK; +I1 return I1TOK; J return JTOK; Q return QTOK; Z return ZTOK; diff --git a/engines/hypno/spider/arcade.cpp b/engines/hypno/spider/arcade.cpp index d28b277e78a..cfb30704840 100644 --- a/engines/hypno/spider/arcade.cpp +++ b/engines/hypno/spider/arcade.cpp @@ -33,6 +33,24 @@ static const int oIndexYE[9] = {4, 3, 2, 1, 0}; 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::initSegment(ArcadeShooting *arc) { + _segmentShootSequenceOffset = 0; + _segmentShootSequenceMax = 0; + + uint32 randomSegmentShootSequence = _segmentShootSequenceOffset + _rnd->getRandomNumber(_segmentShootSequenceMax); + SegmentShoots segmentShoots = arc->shootSequence[randomSegmentShootSequence]; + _shootSequence = segmentShoots.shootSequence; + _segmentRepetitionMax = segmentShoots.segmentRepetition; // Usually zero + _segmentRepetition = 0; + _segmentOffset = 0; + _segmentIdx = _segmentOffset; +} + +void SpiderEngine::findNextSegment(ArcadeShooting *arc) { + _segmentIdx = _segmentIdx + 1; +} + + void SpiderEngine::hitPlayer() { if (_playerFrameSep < (int)_playerFrames.size()) { if (_playerFrameIdx < _playerFrameSep) diff --git a/engines/hypno/tokens_arc.h b/engines/hypno/tokens_arc.h index 049558d5a85..b360758c5eb 100644 --- a/engines/hypno/tokens_arc.h +++ b/engines/hypno/tokens_arc.h @@ -93,17 +93,18 @@ extern int HYPNO_ARC_debug; NTOK = 286, /* NTOK */ NSTOK = 287, /* NSTOK */ RTOK = 288, /* RTOK */ - R0TOK = 289, /* R0TOK */ + R01TOK = 289, /* R01TOK */ ITOK = 290, /* ITOK */ - JTOK = 291, /* JTOK */ - ZTOK = 292, /* ZTOK */ - NONETOK = 293, /* NONETOK */ - A0TOK = 294, /* A0TOK */ - P0TOK = 295, /* P0TOK */ - WTOK = 296, /* WTOK */ - XTOK = 297, /* XTOK */ - CB3TOK = 298, /* CB3TOK */ - C02TOK = 299 /* C02TOK */ + I1TOK = 291, /* I1TOK */ + JTOK = 292, /* JTOK */ + ZTOK = 293, /* ZTOK */ + NONETOK = 294, /* NONETOK */ + A0TOK = 295, /* A0TOK */ + P0TOK = 296, /* P0TOK */ + WTOK = 297, /* WTOK */ + XTOK = 298, /* XTOK */ + CB3TOK = 299, /* CB3TOK */ + C02TOK = 300 /* C02TOK */ }; typedef enum HYPNO_ARC_tokentype HYPNO_ARC_token_kind_t; #endif @@ -117,7 +118,7 @@ union HYPNO_ARC_STYPE char *s; /* string value */ int i; /* integer value */ -#line 121 "engines/hypno/tokens_arc.h" +#line 122 "engines/hypno/tokens_arc.h" }; typedef union HYPNO_ARC_STYPE HYPNO_ARC_STYPE; diff --git a/engines/hypno/wet/arcade.cpp b/engines/hypno/wet/arcade.cpp index abc4cb05ac7..58c9ecca581 100644 --- a/engines/hypno/wet/arcade.cpp +++ b/engines/hypno/wet/arcade.cpp @@ -27,6 +27,120 @@ namespace Hypno { +void WetEngine::initSegment(ArcadeShooting *arc) { + if (_arcadeMode == "Y1") { + _segmentShootSequenceOffset = 0; + _segmentShootSequenceMax = 3; + } else if (_arcadeMode == "Y5") { + _segmentShootSequenceOffset = 1; + _segmentShootSequenceMax = 9; + } else { + _segmentShootSequenceOffset = 0; + _segmentShootSequenceMax = 0; + } + + uint32 randomSegmentShootSequence = _segmentShootSequenceOffset + _rnd->getRandomNumber(_segmentShootSequenceMax); + debugC(1, kHypnoDebugArcade, "Select random sequence %d", randomSegmentShootSequence); + SegmentShoots segmentShoots = arc->shootSequence[randomSegmentShootSequence]; + _shootSequence = segmentShoots.shootSequence; + _segmentRepetitionMax = segmentShoots.segmentRepetition; // Usually zero + _segmentRepetition = 0; + _segmentOffset = 0; + _segmentIdx = _segmentOffset; +} + +void WetEngine::findNextSegment(ArcadeShooting *arc) { + debugC(1, kHypnoDebugArcade, "Repetition %d of %d", _segmentRepetition, _segmentRepetitionMax); + Common::Point mousePos = g_system->getEventManager()->getMousePos(); + Segments segments = arc->segments; + + if (_segmentRepetition < _segmentRepetitionMax) { + _segmentRepetition = _segmentRepetition + 1; + } else { + _segmentRepetition = 0; + _segmentRepetitionMax = 0; + if (segments[_segmentIdx].type == 0xb3) { + if (_arcadeMode == "Y1") { + if (_rnd->getRandomBit()) + _segmentIdx = _segmentIdx + 1; + else + _segmentIdx = _segmentIdx + 5; + } else if (_arcadeMode == "Y5") { + int r = _rnd->getRandomNumber(4); + if (r == 0) + _segmentIdx = 1; + else + _segmentIdx = r + 4; + + if (segments[_segmentIdx].type == 'L') { + _shootSequence = arc->shootSequence[11].shootSequence; + _segmentRepetitionMax = 0; + } else if (segments[_segmentIdx].type == 'R') { + _shootSequence = arc->shootSequence[12].shootSequence; + _segmentRepetitionMax = 0; + } else if (segments[_segmentIdx].type == 'A') { + _shootSequence = arc->shootSequence[15].shootSequence; + _segmentRepetitionMax = 0; + } else if (segments[_segmentIdx].type == 'P') { + r = _rnd->getRandomNumber(1); + _shootSequence = arc->shootSequence[13 + r].shootSequence; //13-14 + _segmentRepetitionMax = 0; + } + } else + _segmentIdx = _segmentIdx + 1; + + } else if (segments[_segmentIdx].type == 0xc5) { + if (_arcadeMode == "Y1") { + if (mousePos.x <= 100) + _segmentIdx = _segmentIdx + 1; + else if (mousePos.x >= 300) + _segmentIdx = _segmentIdx + 3; + else + _segmentIdx = _segmentIdx + 2; + } else if (_arcadeMode == "Y5") { + if (mousePos.x <= 100) + _segmentIdx = _segmentIdx + 2; + else if (mousePos.x >= 300) + _segmentIdx = _segmentIdx + 3; + else + _segmentIdx = _segmentIdx + 1; + } else + error("Invalid segment type for mode: %s", _arcadeMode.c_str()); + + } else if (segments[_segmentIdx].type == 0xc2) { + if (mousePos.x <= 160) + _segmentIdx = _segmentIdx + 1; + else + _segmentIdx = _segmentIdx + 2; + } else { + + // Objective checking + if (arc->objKillsRequired[_objIdx] > 0) { + if (_objKillsCount[_objIdx] >= arc->objKillsRequired[_objIdx] && _objMissesCount[_objIdx] <= arc->objMissesAllowed[_objIdx]) { + if (_objIdx == 0) { + _objIdx = 1; + if (_arcadeMode == "Y1") { + _segmentOffset = 8; + _segmentRepetition = 0; + _segmentShootSequenceOffset = 8; + } + } else { + _skipLevel = true; // RENAME + return; + } + } + } + _segmentIdx = _segmentOffset; + // select a new shoot sequence + uint32 randomSegmentShootSequence = _segmentShootSequenceOffset + _rnd->getRandomNumber(_segmentShootSequenceMax); + debugC(1, kHypnoDebugArcade, "Selected random sequence %d", randomSegmentShootSequence); + SegmentShoots segmentShoots = arc->shootSequence[randomSegmentShootSequence]; + _shootSequence = segmentShoots.shootSequence; + _segmentRepetitionMax = segmentShoots.segmentRepetition; // Usually one + } + } +} + void WetEngine::runBeforeArcade(ArcadeShooting *arc) { _checkpoint = _currentLevel; MVideo *video; @@ -88,9 +202,11 @@ bool WetEngine::clickedSecondaryShoot(const Common::Point &mousePos) { } void WetEngine::hitPlayer() { - assert( _playerFrameSep < (int)_playerFrames.size()); - if (_playerFrameIdx < _playerFrameSep) - _playerFrameIdx = _playerFrameSep; + if (_arcadeMode != "Y1" && _arcadeMode != "Y5") { + assert( _playerFrameSep < (int)_playerFrames.size()); + if (_playerFrameIdx < _playerFrameSep) + _playerFrameIdx = _playerFrameSep; + } } void WetEngine::drawShoot(const Common::Point &mousePos) { @@ -106,27 +222,27 @@ void WetEngine::drawShoot(const Common::Point &mousePos) { } void WetEngine::drawPlayer() { + // TARGET ACQUIRED frame + uint32 c = 251; // green + _compositeSurface->drawLine(113, 1, 119, 1, c); + _compositeSurface->drawLine(200, 1, 206, 1, c); + + _compositeSurface->drawLine(113, 1, 113, 9, c); + _compositeSurface->drawLine(206, 1, 206, 9, c); + + _compositeSurface->drawLine(113, 9, 119, 9, c); + _compositeSurface->drawLine(200, 9, 206, 9, c); + + c = 250; // red ? + Common::Point mousePos = g_system->getEventManager()->getMousePos(); + int i = detectTarget(mousePos); + if (i > 0) + drawString("block05.fgx", "TARGET ACQUIRED", 116, 3, 80, c); + if (_arcadeMode == "Y1") return; if (_playerFrameIdx < _playerFrameSep) { - // TARGET ACQUIRED frame - uint32 c = 251; // green - _compositeSurface->drawLine(113, 1, 119, 1, c); - _compositeSurface->drawLine(200, 1, 206, 1, c); - - _compositeSurface->drawLine(113, 1, 113, 9, c); - _compositeSurface->drawLine(206, 1, 206, 9, c); - - _compositeSurface->drawLine(113, 9, 119, 9, c); - _compositeSurface->drawLine(200, 9, 206, 9, c); - - c = 250; // red ? - Common::Point mousePos = g_system->getEventManager()->getMousePos(); - int i = detectTarget(mousePos); - if (i > 0) - drawString("block05.fgx", "TARGET ACQUIRED", 120, 1, 80, c); - _playerFrameIdx++; _playerFrameIdx = _playerFrameIdx % _playerFrameSep; } else { @@ -135,23 +251,26 @@ void WetEngine::drawPlayer() { _playerFrameIdx = 0; } + if (_arcadeMode == "Y5") + _playerFrameIdx = 1; + drawImage(*_playerFrames[_playerFrameIdx], 0, 200 - _playerFrames[_playerFrameIdx]->h + 1, true); } void WetEngine::drawHealth() { - if (_arcadeMode == "Y1") - return; - uint32 c = 253; int p = (100 * _health) / _maxHealth; int s = _score; + int mo = _objKillsCount[_objIdx]; + if (_playerFrameIdx < _playerFrameSep) { const chapterEntry *entry = _chapterTable[_levelId]; //uint32 id = _levelId; - drawString("block05.fgx", Common::String::format("ENERGY %d%%", p), entry->energyPos[0], entry->energyPos[1], 65, c); - drawString("block05.fgx", Common::String::format("SCORE %04d", s), entry->scorePos[0], entry->scorePos[1], 72, c); + drawString("block05.fgx", Common::String::format("ENERGY %d%%", p), entry->energyPos[0], entry->energyPos[1], 65, c); + drawString("block05.fgx", Common::String::format("SCORE %04d", s), entry->scorePos[0], entry->scorePos[1], 72, c); // Objectives are always in the zero in the demo - //drawString("block05.fgx", Common::String::format("M.O. 0/0"), uiPos[id][2][0], uiPos[id][2][1], 60, c); + if (entry->objectivesPos[0] > 0 && entry->objectivesPos[1] > 0) + drawString("block05.fgx", Common::String::format("M.O. %d/X", mo), entry->objectivesPos[0], entry->objectivesPos[1], 60, c); } } diff --git a/engines/hypno/wet/wet.cpp b/engines/hypno/wet/wet.cpp index 913c2c6e227..abb5e6c2d15 100644 --- a/engines/hypno/wet/wet.cpp +++ b/engines/hypno/wet/wet.cpp @@ -28,20 +28,22 @@ namespace Hypno { static const chapterEntry rawChapterTable[] = { - {11, {44, 172}, {218, 172}, {0, 0}}, // c11 - {20, {44, 172}, {218, 172}, {0, 0}}, // c20 + {11, {44, 172}, {218, 172}, {0, 0}}, // c11 + {10, {19, 3}, {246, 3}, {246, 11}}, // c10 + {20, {44, 172}, {218, 172}, {0, 0}}, // c20 {21, {70, 160}, {180, 160}, {220, 185}}, // c21 {22, {70, 160}, {180, 160}, {220, 185}}, // c22 {23, {70, 160}, {180, 160}, {220, 185}}, // c23 {31, {70, 160}, {180, 160}, {220, 185}}, // c31 {32, {70, 160}, {180, 160}, {220, 185}}, // c32 + {33, {70, 160}, {180, 160}, {220, 185}}, // c33 {41, {70, 160}, {180, 160}, {220, 185}}, // c41 {42, {70, 160}, {180, 160}, {220, 185}}, // c42 {43, {70, 160}, {180, 160}, {220, 185}}, // c43 {44, {70, 160}, {180, 160}, {220, 185}}, // c44 {51, {60, 167}, {190, 167}, {135, 187}}, // c51 {52, {60, 167}, {190, 167}, {135, 187}}, // c52 - {50, {60, 167}, {190, 167}, {135, 187}}, // c50 + {50, {19, 3}, {246, 3}, {246, 11}}, // c50 (fixed) {61, {44, 172}, {218, 172}, {0, 0}}, // c61 {60, {44, 172}, {218, 172}, {0, 0}}, // c60 {0, {0, 0}, {0, 0}, {0, 0}} // NULL @@ -256,7 +258,6 @@ void WetEngine::loadAssetsFullGame() { loadArcadeLevel("c111.mi_", "c10", "", ""); loadArcadeLevel("c112.mi_", "c10", "", ""); - loadArcadeLevel("c100.mi_", "c21", "", ""); loadArcadeLevel("c101.mi_", "c21", "", ""); loadArcadeLevel("c102.mi_", "c21", "", ""); @@ -285,11 +286,11 @@ void WetEngine::loadAssetsFullGame() { loadArcadeLevel("c321.mi_", "c41", "", ""); loadArcadeLevel("c322.mi_", "c41", "", ""); - //loadArcadeLevel("c330.mi_", "???", ""); + //loadArcadeLevel("c330.mi_", "???", "", ""); //loadArcadeLevel("c331.mi_", "???", ""); //loadArcadeLevel("c332.mi_", "???", ""); - //loadArcadeLevel("c300.mi_", "???", ""); + //loadArcadeLevel("c300.mi_", "???", "", ""); //loadArcadeLevel("c301.mi_", "???", ""); //loadArcadeLevel("c302.mi_", "???", ""); @@ -321,7 +322,10 @@ void WetEngine::loadAssetsFullGame() { loadArcadeLevel("c521.mi_", "c61", "", ""); loadArcadeLevel("c522.mi_", "c61", "", ""); - //loadArcadeLevel("c500.mi_", "???", ""); + loadArcadeLevel("c500.mi_", "c61", "", ""); + ArcadeShooting *arc = (ArcadeShooting*) _levels["c500.mi_"]; + arc->id = 50; // Fixed from the original (5) + //loadArcadeLevel("c501.mi_", "???", ""); //loadArcadeLevel("c502.mi_", "???", "");