Beispiel #1
0
void PreAgiEngine::initialize() {
	initRenderMode();

	_gfx = new GfxMgr(this);
	_picture = new PictureMgr(this, _gfx);

	if (getGameID() == GID_MICKEY) {
		_fontData = fontData_Mickey;
	} else {
		_fontData = fontData_IBM;
	}

	_gfx->initMachine();

	_game.gameFlags = 0;

	_game.colorFg = 15;
	_game.colorBg = 0;

	_defaultColor = 0xF;

	_game.name[0] = '\0';

	_game.sbufOrig = (uint8 *)calloc(_WIDTH, _HEIGHT * 2); // Allocate space for two AGI screens vertically
	_game.sbuf16c  = _game.sbufOrig + SBUF16_OFFSET; // Make sbuf16c point to the 16 color (+control line & priority info) AGI screen
	_game.sbuf     = _game.sbuf16c; // Make sbuf point to the 16 color (+control line & priority info) AGI screen by default

	_game.lineMinPrint = 0; // hardcoded

	_gfx->initVideo();

	_speakerStream = new Audio::PCSpeaker();
	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
							_speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);

	debugC(2, kDebugLevelMain, "Detect game");

	// clear all resources and events
	for (int i = 0; i < MAX_DIRS; i++) {
		memset(&_game.pictures[i], 0, sizeof(struct AgiPicture));
		memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now
		memset(&_game.dirPic[i], 0, sizeof(struct AgiDir));
		memset(&_game.dirSound[i], 0, sizeof(struct AgiDir));
	}
}
Beispiel #2
0
void AgiEngine::initialize() {
    // TODO: Some sound emulation modes do not fit our current music
    //       drivers, and I'm not sure what they are. For now, they might
    //       as well be called "PC Speaker" and "Not PC Speaker".

    // If used platform is Apple IIGS then we must use Apple IIGS sound emulation
    // because Apple IIGS AGI games use only Apple IIGS specific sound resources.
    if (getPlatform() == Common::kPlatformApple2GS) {
        _soundemu = SOUND_EMU_APPLE2GS;
    } else if (getPlatform() == Common::kPlatformCoCo3) {
        _soundemu = SOUND_EMU_COCO3;
    } else if (ConfMan.get("music_driver") == "auto") {
        // Default sound is the proper PCJr emulation
        _soundemu = SOUND_EMU_PCJR;
    } else {
        switch (MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK|MDT_AMIGA|MDT_ADLIB|MDT_PCJR|MDT_MIDI))) {
        case MT_PCSPK:
            _soundemu = SOUND_EMU_PC;
            break;
        case MT_ADLIB:
            _soundemu = SOUND_EMU_NONE;
            break;
        case MT_PCJR:
            _soundemu = SOUND_EMU_PCJR;
            break;
        case MT_AMIGA:
            _soundemu = SOUND_EMU_AMIGA;
            break;
        default:
            debug(0, "DEF");
            _soundemu = SOUND_EMU_MIDI;
            break;
        }
    }

    initRenderMode();

    _buttonStyle = AgiButtonStyle(_renderMode);
    _defaultButtonStyle = AgiButtonStyle();
    _console = new Console(this);
    _gfx = new GfxMgr(this);
    _sound = new SoundMgr(this, _mixer);
    _picture = new PictureMgr(this, _gfx);
    _sprites = new SpritesMgr(this, _gfx);

    _gfx->initMachine();

    _game.gameFlags = 0;

    _game.colorFg = 15;
    _game.colorBg = 0;

    _game.name[0] = '\0';

    _game.sbufOrig = (uint8 *)calloc(_WIDTH, _HEIGHT * 2); // Allocate space for two AGI screens vertically
    _game.sbuf16c  = _game.sbufOrig + SBUF16_OFFSET; // Make sbuf16c point to the 16 color (+control line & priority info) AGI screen
    _game.sbuf256c = _game.sbufOrig + SBUF256_OFFSET; // Make sbuf256c point to the 256 color AGI screen
    _game.sbuf     = _game.sbuf16c; // Make sbuf point to the 16 color (+control line & priority info) AGI screen by default

    _gfx->initVideo();

    _lastSaveTime = 0;

    _lastTick = _system->getMillis();

    debugC(2, kDebugLevelMain, "Detect game");

    if (agiDetectGame() == errOK) {
        _game.state = STATE_LOADED;
        debugC(2, kDebugLevelMain, "game loaded");
    } else {
        warning("Could not open AGI game");
    }

    debugC(2, kDebugLevelMain, "Init sound");
}
Beispiel #3
0
void AgiEngine::initialize() {
	// TODO: Some sound emulation modes do not fit our current music
	//       drivers, and I'm not sure what they are. For now, they might
	//       as well be called "PC Speaker" and "Not PC Speaker".

	// If used platform is Apple IIGS then we must use Apple IIGS sound emulation
	// because Apple IIGS AGI games use only Apple IIGS specific sound resources.
	if (getPlatform() == Common::kPlatformApple2GS) {
		_soundemu = SOUND_EMU_APPLE2GS;
	} else if (getPlatform() == Common::kPlatformCoCo3) {
		_soundemu = SOUND_EMU_COCO3;
	} else if (ConfMan.get("music_driver") == "auto") {
		// Default sound is the proper PCJr emulation
		_soundemu = SOUND_EMU_PCJR;
	} else {
		switch (MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_AMIGA | MDT_ADLIB | MDT_PCJR | MDT_MIDI))) {
		case MT_PCSPK:
			_soundemu = SOUND_EMU_PC;
			break;
		case MT_ADLIB:
			_soundemu = SOUND_EMU_NONE;
			break;
		case MT_PCJR:
			_soundemu = SOUND_EMU_PCJR;
			break;
		case MT_AMIGA:
			_soundemu = SOUND_EMU_AMIGA;
			break;
		default:
			debug(0, "DEF");
			_soundemu = SOUND_EMU_MIDI;
			break;
		}
	}

	initRenderMode();

	_console = new Console(this);
	_words = new Words(this);
	_font = new GfxFont(this);
	_gfx = new GfxMgr(this);
	_sound = new SoundMgr(this, _mixer);
	_picture = new PictureMgr(this, _gfx);
	_sprites = new SpritesMgr(this, _gfx);
	_text = new TextMgr(this, _words, _gfx);
	_systemUI = new SystemUI(this, _gfx, _text);
	_inventory = new InventoryMgr(this, _gfx, _text, _systemUI);

	_gfx->initVideo();

	_font->init();
	_text->init(_systemUI);

	_game.gameFlags = 0;

	_text->charAttrib_Set(15, 0);

	_game.name[0] = '\0';

	_lastSaveTime = 0;

	debugC(2, kDebugLevelMain, "Detect game");

	if (agiDetectGame() == errOK) {
		debugC(2, kDebugLevelMain, "game loaded");
	} else {
		warning("Could not open AGI game");
	}

	debugC(2, kDebugLevelMain, "Init sound");
}