Esempio n. 1
0
/*
	Game  - Constructor, this method begins the 
	construction and loading of all major game objects. 
	This method only needs to be called once, when the 
	application is first started.

	NOTE: This constructor will not initialize the custom
	game objects: graphics, input, os, & timer.
	These must be constructed separately and fed to this
	object using the init method. Doing it this way allows for
	more platform independence.
*/
Game::Game()
{
	// NOTE THAT graphics, input, os, & timer
	// ARE CUSTOM GAME OBJECTS. DEPENDING ON WHAT TECHNOLOGY 
	// IS TO BE USED THESE OBJECT SHOULD BE CONSTRUCTED
	// AND THEN FED TO THIS Game USING THE init METHOD
	initMusic();
	initBox2d();
	gsm = new GameStateManager();
	gui = new GameGUI();
	text = new GameText();
}
Esempio n. 2
0
void Player_SID::startSound(int nr) {
	byte *data = _vm->getResourceAddress(rtSound, nr);
	assert(data);

	// WORKAROUND:
	// sound[4] contains either a song prio or a music channel usage byte.
	// As music channel usage is always 0x07 for all music files and
	// prio 7 is never used in any sound file use this byte for auto-detection.
	bool isMusic = (data[4] == 0x07);

	Common::StackLock lock(_mutex);

	if (isMusic) {
		initMusic(nr);
	} else {
		stopSound_intern(nr);
		initSound(nr);
	}
}
Esempio n. 3
0
Game::Game()
:mPauseButtonPressed(false),
mLevel(NULL)
{
    allegro_init();
    install_keyboard();
    install_mouse();
	
    set_window_title("Dr. Madness Or: How Fluffy Love Learned to Stop "
                      "Worrying and Love The Bomb");

    int driver = GFX_AUTODETECT_FULLSCREEN;

    set_color_depth(32);
    if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) {
	    set_color_depth(24);
	    if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) {
		    set_color_depth(16);
		    if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) {
			    set_color_depth(15);
			    if (set_gfx_mode(driver, 640, 480, 0, 0) < 0) 
                {
					throw DBSH07_EXCEPTION("Unable to set graphics mode.");
			    }
		    }
	    }
    }

	install_sound(DIGI_AUTODETECT, MIDI_NONE, NULL);

    initTimer();

    mScreenBuffer = create_bitmap(640, 480);
	mBuffer = create_bitmap(320, 240);

    mSplashScreen = new SplashScreen();
	mEnding = new Ending();
	initGui();
	initMusic();

    setState(SPLASHSCREEN);
}
Esempio n. 4
0
void
gfuiInit(void)
{
    gfuiInitObject();
    gfuiInitColor();
    gfuiLoadFonts();
    gfuiInitButton();
    gfuiInitCombobox();
    gfuiInitEditbox();
    gfuiInitScrollBar();
    gfuiInitScrollList();
    gfuiInitLabel();
    gfuiInitHelp();
    gfuiInitMenu();
    initMusic();

#ifdef WIN32
    glUseProgram = (PFNGLUSEPROGRAMOBJECTARBPROC)wglGetProcAddress("glUseProgram");
    glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
#endif
    gfctrlJoyInit(); // Not here ; done later on the fly, when really needed.
}
Music::Music(const std::string & path) : music(NULL), playing(false)
{
	mPath = path;
	initMusic();
}
Esempio n. 6
0
/**
 * Initialize the game
 */
Common::ErrorCode TonyEngine::init() {
	// Load DAT file (used by font manager)
	if (!loadTonyDat())
		return Common::kUnknownError;

	if (isCompressed()) {
		Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember("data1.cab");
		if (!stream)
			error("Failed to open data1.cab");

		Common::Archive *cabinet = Common::makeInstallShieldArchive(stream);
		if (!cabinet)
			error("Failed to parse data1.cab");

		SearchMan.add("data1.cab", cabinet);
	}

	_hEndOfFrame = CoroScheduler.createEvent(false, false);

	_bPaused = false;
	_bDrawLocation = true;
	_startTime = g_system->getMillis();

	// Init static class fields
	RMText::initStatics();
	RMTony::initStatics();

	// Reset the scheduler
	CoroScheduler.reset();

	// Initialize the graphics window
	_window.init();

	// Initialize the function list
	Common::fill(_funcList, _funcList + 300, (LPCUSTOMFUNCTION)NULL);
	initCustomFunctionMap();

	// Initializes MPAL system, passing the custom functions list
	Common::File f;
	if (!f.open("ROASTED.MPC"))
		return Common::kReadingFailed;
	f.close();

	if (!mpalInit("ROASTED.MPC", "ROASTED.MPR", _funcList, _funcListStrings))
		return Common::kUnknownError;

	// Initialize the update resources
	_resUpdate.init("ROASTED.MPU");

	// Initialize the music
	initMusic();

	// Initialize the voices database
	if (!openVoiceDatabase())
		return Common::kReadingFailed;

	// Initialize the boxes
	_theBoxes.init();

	// Link to the custom graphics engine
	_theEngine.initCustomDll();
	_theEngine.init();

	// Allocate space for thumbnails when saving the game
	_curThumbnail = new uint16[160 * 120];

	_bQuitNow = false;

	return Common::kNoError;
}
Esempio n. 7
0
////////////////////////////////////////////////////
//初期設定
////////////////////////////////////////////////////
void init(void)
{
	glGenTextures(TEXTURE_ID::TEXTURE_MAX, textures);
	initMusic();
}