Beispiel #1
0
/**
 * Creates a bit set whose initial size is large enough to explicitly
 * represent bits with indices in the range {@code 0} through
 * {@code nbits-1}. All bits are initially {@code false}.
 *
 * @param  nbits the initial size of the bit set
 * @throws NegativeArraySizeException if the specified initial size
 *         is negative
 */
 /*public*/ BitSet::BitSet(int nbits, QObject *parent) : QObject(parent)
{
 common();
    // nbits can't be negative; size 0 is OK
    if (nbits < 0)
        throw  NegativeArraySizeException("nbits < 0: " + QString::number(nbits));

    initWords(nbits);
    sizeIsSticky = true;
}
Beispiel #2
0
void Study1::setWords(char *words)
{
//get words from web!!
    
    
    std::string str1,str2,str3,str4,str5,str6;
    str1.assign("虫");
    str2.assign("牛");
    str3.assign("鸟");
    str4.assign("鱼");
    str5.assign("马");
    str6.assign("鸭");
    strWords.push_back(str1);
    strWords.push_back(str2);
    strWords.push_back(str3);
    strWords.push_back(str4);
    strWords.push_back(str5);
    strWords.push_back(str6);

    str1.assign("云");
    str2.assign("日");
    str3.assign("月");
    str4.assign("山");
    str5.assign("水");
    str6.assign("田");
    strWords.push_back(str1);
    strWords.push_back(str2);
    strWords.push_back(str3);
    strWords.push_back(str4);
    strWords.push_back(str5);
    strWords.push_back(str6);

    
    
    initWords();
    
    
}
Beispiel #3
0
int AgiEngine::agiInit() {
    int ec, i;

    debug(2, "initializing");
    debug(2, "game version = 0x%x", getVersion());

    // initialize with adj.ego.move.to.x.y(0, 0) so to speak
    _game.adjMouseX = _game.adjMouseY = 0;

    // reset all flags to false and all variables to 0
    for (i = 0; i < MAX_FLAGS; i++)
        _game.flags[i] = 0;
    for (i = 0; i < MAX_VARS; i++)
        _game.vars[i] = 0;

    // clear all resources and events
    for (i = 0; i < MAX_DIRS; i++) {
        memset(&_game.views[i], 0, sizeof(struct AgiView));
        memset(&_game.pictures[i], 0, sizeof(struct AgiPicture));
        memset(&_game.logics[i], 0, sizeof(struct AgiLogic));
        memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now
        memset(&_game.dirView[i], 0, sizeof(struct AgiDir));
        memset(&_game.dirPic[i], 0, sizeof(struct AgiDir));
        memset(&_game.dirLogic[i], 0, sizeof(struct AgiDir));
        memset(&_game.dirSound[i], 0, sizeof(struct AgiDir));
    }

    // clear view table
    for (i = 0; i < MAX_VIEWTABLE; i++)
        memset(&_game.viewTable[i], 0, sizeof(struct VtEntry));

    initWords();

    if (!_menu)
        _menu = new Menu(this, _gfx, _picture);

    initPriTable();

    // Clear the string buffer on startup, but not when the game restarts, as
    // some scripts expect that the game strings remain unaffected after a
    // restart. An example is script 98 in SQ2, which is not invoked on restart
    // to ask Ego's name again. The name is supposed to be maintained in string 1.
    // Fixes bug #3292784.
    if (!_restartGame) {
        for (i = 0; i < MAX_STRINGS; i++)
            _game.strings[i][0] = 0;
    }

    // setup emulation

    switch (getVersion() >> 12) {
    case 2:
        debug("Emulating Sierra AGI v%x.%03x",
              (int)(getVersion() >> 12) & 0xF,
              (int)(getVersion()) & 0xFFF);
        break;
    case 3:
        debug("Emulating Sierra AGI v%x.002.%03x",
              (int)(getVersion() >> 12) & 0xF,
              (int)(getVersion()) & 0xFFF);
        break;
    }

    if (getPlatform() == Common::kPlatformAmiga)
        _game.gameFlags |= ID_AMIGA;

    if (getFeatures() & GF_AGDS)
        _game.gameFlags |= ID_AGDS;

    // Make the 256 color AGI screen the default AGI screen when AGI256 or AGI256-2 is used
    if (getFeatures() & (GF_AGI256 | GF_AGI256_2))
        _game.sbuf = _game.sbuf256c;

    if (_game.gameFlags & ID_AMIGA)
        debug(1, "Amiga padded game detected.");

    if (_game.gameFlags & ID_AGDS)
        debug(1, "AGDS mode enabled.");

    ec = _loader->init();	// load vol files, etc

    if (ec == errOK)
        ec = _loader->loadObjects(OBJECTS);

    // note: demogs has no words.tok
    if (ec == errOK)
        ec = _loader->loadWords(WORDS);

    // FIXME: load IIgs instruments and samples
    // load_instruments("kq.sys16");

    // Load logic 0 into memory
    if (ec == errOK)
        ec = _loader->loadResource(rLOGIC, 0);

#ifdef __DS__
    // Normally, the engine loads the predictive text dictionary when the predictive dialog
    // is shown.  On the DS version, the word completion feature needs the dictionary too.

    // FIXME - loadDict() no long exists in AGI as this has been moved to within the
    // GUI Predictive Dialog, but DS Word Completion is probably broken due to this...
#endif

    _egoHoldKey = false;

    _game.mouseFence.setWidth(0); // Reset

    return ec;
}
Beispiel #4
0
/**
 * Creates a new bit set. All bits are initially {@code false}.
 */
/*public*/ BitSet::BitSet(QObject *parent) : QObject(parent)
{
 common();
 initWords(BITS_PER_WORD);
 sizeIsSticky = false;
}