File: init.cpp

package info (click to toggle)
rafkill 1.2.2-3.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 13,268 kB
  • sloc: cpp: 13,508; makefile: 64; sh: 14
file content (50 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download | duplicates (12)
1
2
3
4
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
45
46
47
48
49
50
#include <allegro.h>
#include "defs.h"
#include <dumb.h>
#include <aldumb.h>

void inc_speed_counter() {
	Util::speed_counter++;
}

END_OF_FUNCTION( inc_speed_counter );

void init( int windowMode, int GAME_SPEED ) {

	allegro_init();
	srand( time( NULL ) );
	install_timer();
	install_keyboard();

	/*
	if ( get_desktop_resolution(&Util::screen_x,&Util::screen_y) == -1 ){
		Util::screen_x = 640;
		Util::screen_y = 480;
	}
	*/

	set_color_depth( 16 );
	if ( windowMode ){
		Bitmap::setGfxModeWindowed( GRAPHICS_X, GRAPHICS_Y );
	} else {
		Bitmap::setGfxModeFullscreen( GRAPHICS_X, GRAPHICS_Y );
	}
	
	reserve_voices (8, -1);
	set_volume_per_voice( 0 );
	install_sound( DIGI_AUTODETECT, MIDI_NONE, "" );
	atexit( &dumb_exit );
	dumb_register_packfiles();

	LOCK_VARIABLE( speed_counter );
	LOCK_FUNCTION( (void *)inc_speed_counter );
	install_int_ex( inc_speed_counter, MSEC_TO_TIMER( GAME_SPEED ) );
	Util::explColor();
	set_trans_blender( 0, 0, 0, 128 );
	//set_config_int( "sound", "quality", 2 );
	get_config_int( "sound", "quality", 2 );
	Util::sound_vol = 1.0;			  //max volume to begin with
	// music_vol = 0.50;
	dumb_resampling_quality = get_config_int( "sound", "dumb_resampling_quality", 1 );
}