Esempio n. 1
0
void gui_init() {
	panJetpackBorder = pan_create("", 2);
	panJetpackBorder.bmap = bmapJetpackColor;
	panJetpack = pan_create("", 3);
	panJetpack.bmap = bmapJetpackBorder;
	
	panHeart1 = pan_create("", 2);
	panHeart2 = pan_create("", 2);
	panHeart3 = pan_create("", 2);
	panHeart1.bmap = bmapZorroLife;
	panHeart2.bmap = bmapZorroLife;
	panHeart3.bmap = bmapZorroLife;
	txtLifes = txt_create(1, 2);
	set(txtLifes, OUTLINE);
	txtLifes.font = font_create("Arial#32b");
		
	panA4Cube = pan_create("", 2);
	panA4Cube.bmap = bmapA4Cube;
	txtA4Cube = txt_create(1, 3);
	set(txtA4Cube, OUTLINE);
	txtA4Cube.font = font_create("Arial#32b");
	
	txtGameOver = txt_create(1, 10);
	set(txtGameOver, OUTLINE | CENTER_X | CENTER_Y);
	txtGameOver.font = font_create("Arial#90b");
	vec_set(txtGameOver.blue, vector(0,0,255));
	str_cpy((txtGameOver.pstring)[0], "Game Over");
}
Esempio n. 2
0
File: log.c Progetto: Acknex/TUST
// Initialize log
void log_init(STRING* _logFile) {
	txtLog = txt_create(LOG_LINES,999);
	txtLog.font = fontLog;
	txtLog.size_x = screen_size.x;
	txtLog.size_y = 100;
	set(txtLog, SHOW | OUTLINE);
	int i;
	for(i=0; i<txtLog.strings; i++) {
		(txtLog.pstring)[i] = str_create("#256");
	}

	// Color for log text
	vec_set(cLogColor, vector(255,255,255));

	// Log to file, too?
	if (_logFile != NULL) {
		nLogToFile = 1;
		str_cpy(strLogFile, _logFile);
	}
	
	// If logging to file, initialize file IO
	if (nLogToFile == 1) {
		log_write_header();
	}
}
Esempio n. 3
0
function dialogs_init()
{
	STRING *file = "#256";
	make_path(file, "messages.ini");
	int i;
	for(i = 0; i < MAX_DIALOG_ENTRIES; i++)
	{
		/*
		[Message 0]
		text=Oh man, nice bell!
		sound=just_stupid_sound.wav
		*/
		STRING *section = "#64";
		str_cpy(section, "Message ");
		str_cat(section, str_for_int(NULL, i));
		char buffer[256];
		ini_read_buffer(file, section, "text", "FIXIT: You forgot a message here!", buffer, 256);
		
		if(strlen(buffer) > 0)
		{
			dialogEntries[i].initialized = 1;
			dialogEntries[i].text = str_create(buffer);
			
			ini_read_buffer(file, section, "sound", "", buffer, 256);
			if(strlen(buffer) > 0)
				dialogEntries[i].sound = snd_create(buffer);
			else
				dialogEntries[i].sound = NULL;
		}
	}
	
	dialogText = txt_create(1, 20);
	dialogText->flags |= CENTER_X | TRANSLUCENT | OUTLINE;
	dialogText->font = dialogFont;
}
Esempio n. 4
0
/*
 * int main(int argc, char **argl)
 *
 * GiN entry point. Initialize variables, structs, video devices, parsing
 * configuration files, setting up parameters, booting up subsystems,
 * and handling the main game loop, as well as cleaning up.
 */
int main(int argc, char **argl)
{
	const char *__err_launcher = "Please run the game through the launcher!";
	const char *__err_language = "Language list cannot be found! Run generate_language_list.exe to let the language definition be generated once.";
	const char *__wrn_lowres   = "The game requires a monitor with a resolution of at least 1,024 x 768. The game will still run, but certain GUI elements won't be displayed correctly.";
	const char *__wrn_lowram   = "You need at least 3 GB RAM in order to play the game. If you're having less than 3 GB RAM, clicking \"OK\" will force the game to run, but it may causes unexpected issues. If you want to quit now, open Task Manager and close the game process.\n\nSorry for the inconvenience.";
	const char *__wrn_redist   = "One or more required DLLs for music playback cannot be found.\n\nOn Steam, try verifying game files and make sure you've installed the redistributable files before launching the game.\n\nitch.io users can launch the game through Launcher.bat.";

	// See if the game was launched through the Go-based launcher.
	#ifndef    DEBUG
		// ASSERT(game_locker_check() != 0, __err_launcher);
	#endif

	if( sys_metrics(0) < 1024.0 && sys_metrics(1) < 768.0 )
		printf(__wrn_lowres);

	if( os_get_ram(S_MB) < 3072 )
		printf(__wrn_lowram);

	String *temp = "";
	str_cat(temp, os_get_system_directory());
	str_cat(temp, "ogg.dll");

	if( !file_exists(temp) )
	{
		printf(__wrn_redist);
	}

	#ifndef    DEBUG
		ASSERT(file_exists("./translation/__language.pad") != 0, __err_language);
	#else
		if( !file_exists("./translation/__language.pad") )
		{
			printf(__err_language);

			sys_exit((void *) 0);
		}
	#endif

	// Overrides some of the global variables (their default values are way too low)
	game_globals_set();

	// mouse_lock(true);

	// Wait for the video device.
	while( !ready() )
		wait(1.0);

	// After the video device is initialized, parse the video configuration file
	// and apply video settings to the current video device, and set the new game title.
	game_video_cfg_parse();
	game_title_set();

	// Exports the game version to the game folder. This is used by the external launcher
	// which uses the file for updating purposes. The completed, released version should
	// have a versioning file ready already.
	__game_version_export();

	// Pops up the GUI to let the user chooses their desired language.
	// After that, a call to nov_region_init() will be invoked to pick the chosen language and perform string initialization.
	nov_region_init("en");

	// Initializes subsystems (game state, GUI, PhysX, ...)
	nov_modules_init();

	// Static initialization.
	nov_gui_static_init();

	// Initializes the scene list, the scenes, and push them into the list.
	nov_scene_list_init();

	game_gui_set_state(STATE_INTRO);
	game_gui_render();

	Vector3 tx;
	tx.x = screen_size.x - 150.0;
	tx.y = 15.0;
	tx.z = 0;

	Text *todo = txt_create(1, LAYER_DEBUG_1);
	todo->font = font_create("UVN remind#30b");

	gui_text_set_color(todo, COLOR_DARK_GREY);
	gui_text_set_pos(todo, __GUIState_singleton->todo_texture->pos_x + 10.0, __GUIState_singleton->todo_texture->pos_y + 10.0);
	gui_text_set_pos(txtSubtitleHandler, (screen_size.x / 2.0) - 156.0, __GUIState_singleton->todo_texture->pos_y + bmap_height(__GUIState_singleton->todo_texture->bmap) + 25.0);

	// Main game loop, which can be terminated with the "Alt + F4" key.
	while(!(__GameState_singleton->exit_switch))
	{
		__GameState_singleton->exit_switch = key_alt && key_f4;

		// Updates PhysX.
		game_physx_loop();

		// Updates the GUI state.
		game_gui_update();

		// Continuously update the area the player is currently in.
		#ifndef    UI_LESS
			if( STATE_NULL == game_gui_get_state() && game_intro_done ) // Because draw_*() functions don't take layers into account,
			                                                            // I have to rely a lot on GUI states in order to manage rendering orders of GUI objects.
			{
				draw_text(game_region_check(), tx.x, tx.y, COLOR_WHITE);
			}
		#endif

		// Updates FOV.
		if( NULL != camera )
		{
			if( !var_cmp(fov, camera->arc) )
				camera->arc = fov;
		}

		// Updates the global volume.
		if( !var_cmp(volume, game_volume) )
			game_volume = volume;

		// Updates the mouse sensivity.
		mickey.x *= sensivity_mul;
		mickey.y *= sensivity_mul;

		if( key_f1 )
		{
			while ( key_f1 ) wait(1.0);
				switch( __invert_y )
				{
					case    1: __invert_y = -1; break;
					case   -1: __invert_y = 1;
				}
		}

		if( key_tab && (STATE_NULL == game_gui_get_state()) )
		{
			switch ( game_day_get() )
			{
				case DAY_3:
				case DAY_4:
				case DAY_5:
				case DAY_6:
				{
					if( (todo->pstring)[0] != lstr_todo_c3 )
						(todo->pstring)[0] = lstr_todo_c3;
					break;
				}

				case DAY_1:
				{
					draw_obj( __GUIState_singleton->todo_texture );

					if( (todo->pstring)[0] != lstr_todo_c1 )
						(todo->pstring)[0] = lstr_todo_c1;
					break;
				}

				case DAY_2:
				{
					draw_obj( __GUIState_singleton->todo_texture );

					if( (todo->pstring)[0] != lstr_todo_c2 )
						(todo->pstring)[0] = lstr_todo_c2;
				}
			}

			draw_obj( todo );
		}

		if( key_esc && __can_press_esc && (game_gui_get_state() != STATE_ENDING) )
		{
			while(key_esc) wait(1.0);

			wait(1.0);

			__GameState_singleton->menu_switch = 1 - __GameState_singleton->menu_switch;

			switch(__GameState_singleton->menu_switch)
			{
				case    1:    game_gui_set_state(STATE_MAIN_MENU); game_gui_render(); break;
				case    0:    game_gui_set_state(STATE_NULL);      game_gui_render();
			}
		}

		wait(1.0);
	}

	RETURN(0);
}