Esempio n. 1
0
action ebStartSpeech ()
{
	set(my, INVISIBLE | PASSABLE);
	
	// wait
	var t = 3 * 16;
	while (t > 0)
	{
		t -= time_step;
		wait(1);
	}
	
	if (g_ebSpeech)
	{
		g_ebSpeech = false;
		var h = snd_play(g_sndWarghostBattleSpeechStart, 100, 0);
		
		while (snd_playing(h))
			wait(1);
	}
	
	// switch warghost to model without hands
	if (g_entEbWarghost != NULL)
		ent_morph(g_entEbWarghost, "warghostChop.mdl");
		
	ent_create(NULL, nullvector, ebHandsBgFly);
	ptr_remove(my);
}
Esempio n. 2
0
function dialog_say(int dialog)
{
	if(dialogEntries[dialog].initialized == NULL) return;
	proc_kill(4);
	
	var soundID = -1;
	if(dialogEntries[dialog].sound != NULL)
	{
		soundID = snd_play(dialogEntries[dialog].sound, 100, 0);
	}
	set(dialogText, SHOW);
	(dialogText->pstring)[0] = dialogEntries[dialog].text;
	dialogText->alpha = 0;
	var timer = 32;
	while(timer > 0 || snd_playing(soundID))
	{
		dialogText->pos_x = 0.5 * screen_size.x;
		dialogText->pos_y = screen_size.y - 64;
		
		if(timer > 8)
		{
			dialogText->alpha = minv(100, dialogText->alpha + 12 * time_step);
		}
		else
		{
			dialogText->alpha = maxv(0, dialogText->alpha - 12 * time_step);
		}
		
		if(!snd_playing(soundID))
			timer -= time_step;
		
		wait(1);
	}
	reset(dialogText, SHOW);
	dialogText->alpha = 0;
}
Esempio n. 3
0
		// Stone rain
		action ebHandStone () {
			set(me, PASSABLE);
			var randomFallSpeed = random(20);
			while(my.z > -100) {
				my.z -=(20+randomFallSpeed) * time_step;
				my.pan +=randomFallSpeed * time_step;
				my.tilt +=randomFallSpeed * time_step;
				my.roll +=randomFallSpeed * time_step;
				
				// Give player 2 seconds to recover from last hit
				if (g_playerJustBeenHit == 0) {
					
					// Stone hits player?
					if (vec_dist(player.x, my.x) < 30) {
						
						// Play sounds
						if (!snd_playing(vPlayerSndHandle))
							vPlayerSndHandle = snd_play(g_sndHitByStone, 100, 0);
						snd_play(g_sndStoneImpact, 100, 0);	
							
						player.PL_HEALTH -=1;
						ent_remove(me);
						
						g_playerJustBeenHit = 2;
						
						// Wait 2 seconds
						while(g_playerJustBeenHit > 0) {
							g_playerJustBeenHit -=1;
							wait(-1);
						}
						return;
					}
				}
				
				wait(1);
			}
			ent_remove(me);
		}
Esempio n. 4
0
void game_start()
{
	#ifndef SKIP_INTRO
	
		
		resetPpSwirl ();
		level_load("menu2.wmb");
		wait(3);
		
		setHdr(LVL_INTRO_HDR_STRENGTH, LVL_INTRO_HDR_THRESHOLD, LVL_INTRO_HDR_EXPOSURE);
		
		camera->arc = 60;
		camera->ambient = 0;
		fog_color = 0;
		
		camera_path("path1");
		PANEL* panBlack = pan_create(" ", 100);
		vec_set(panBlack.blue, vector(8,8,8));
		pan_setdigits(panBlack, 0, 5, 5, "Press [Space] to skip", font_create("Arial#24b"), 1, vDummy);
		pan_setcolor(panBlack, 1, 1, vector(255,255,255));
		set(panBlack, SHOW | LIGHT | OVERLAY);
		
		var vMediaHandle = snd_play(g_musicIntro, 100, 0);
		
		while (key_esc || key_space || key_enter)
			wait(1);
		
		while (snd_playing(vMediaHandle) && !key_esc && !key_space && !key_enter)
			wait(1);
		
		proc_kill((void*)camera_path);
		ptr_remove(panBlack);
		
		snd_stop(vMediaHandle);
		vMediaHandle = 0;
	
	#endif
	
	nPlayerLifes = 3;
	flying_man = 0;
	gui_start();
	
	// standard start level = temple
	#ifndef SKIP_TO
		lvlTempleInit();
	#else
		
		#ifdef SKIP_TO_LOTTIFANTLEVEL
			lvlLfInit();
		#endif
	
		#ifdef SKIP_TO_BOSSLEVEL
			lvlBossInit();
		#endif
		
		#ifdef SKIP_TO_LAVASTAGE
			lvlLavastageInit();
		#endif
		
		#ifdef SKIP_TO_CREDITS
			creditsInit();
		#endif
		
	#endif
}
Esempio n. 5
0
void creditsText ()
{
	static char strIni [256];
	sprintf(strIni, "%s\\credits.ini", _chr(work_dir));
	
	// start music and lyrics
	{
		snd_stop(g_fhCreditsSong);
		g_fhCreditsSong = snd_play(g_musicCredits, 100, 0);
		
		lyricsStart(NULL, g_txtCreditsLyrics, g_fhCreditsSong);
	}
	
	int pos = 0;
	int count = ini_read_int(strIni, "Credits", "max", "0");
	var duration = ini_read_int(strIni, "Credits", "duration", "15");
	
	var itemDuration = duration / (var)count;
	
	creditsHead1.flags |= SHOW;
	creditsBody1.flags |= SHOW;
	creditsHead2.flags |= SHOW;
	creditsBody2.flags |= SHOW;
	
	creditsHead2.pos_y = screen_size.y - g_lyricsBarHeight - 150;
	creditsBody2.pos_y = screen_size.y - g_lyricsBarHeight - 100;
		
	int size1 = 300;
	int size2 = 600;
	
	var x = 0;
	var len = 0;
	
	while (snd_playing(g_fhCreditsSong) != 0 && !g_bCreditsAllExplode)
	{
		static char section [256];
		sprintf(section, "Credit%d", pos + 1);

		ini_read(creditsText1Head, strIni, section, "Head1", " ");
		ini_read(creditsText1Body, strIni, section, "Body1", " ");
		ini_read(creditsText2Head, strIni, section, "Head2", " ");
		ini_read(creditsText2Body, strIni, section, "Body2", " ");
		
		str_replaceall(creditsText1Body, "##", "\n");
		str_replaceall(creditsText2Body, "##", "\n");
		
		creditsHead1.pos_x = -size1;
		creditsBody1.pos_x = -size1;
		
		creditsHead2.pos_x = screen_size.x + size2;
		creditsBody2.pos_x = screen_size.x + size2;
		
		var fadetime = 0.22 * itemDuration;
		
		var fade = 0;
		var fadespeed = 16 / fadetime;
		
		for (fade = 0; fade < 100; fade += fadespeed * time_step)
		{
			creditsHead1.pos_x = -size1 + 1.5 * size1 * (1 - pow(1 - 0.01 * fade, 2));
			creditsBody1.pos_x = -size1 + 1.7 * size1 * (1 - pow(1 - 0.01 * fade, 2));
			
			if (g_bCreditsAllExplode)
				break;
			
			wait(1);
		}
		
		for (fade = 0; fade < 100; fade += fadespeed * time_step)
		{
			creditsHead2.pos_x = screen_size.x + size2 - 1.2 * size2 * (1 - pow(1 - 0.01 * fade, 2));
			creditsBody2.pos_x = screen_size.x + size2 - 1.3 * size2 * (1 - pow(1 - 0.01 * fade, 2));
			
			if (g_bCreditsAllExplode)
				break;
			
			wait(1);
		}
		
		var t_id = 0.6 * itemDuration * 16;
		
		while (t_id > 0 && !g_bCreditsAllExplode)
		{
			t_id -= time_step;
			wait(1);
		}
		
		var scrollspeed = 100;
		
		for (fade = 0; fade < 100; fade += fadespeed * time_step)
		{
			creditsHead1.pos_x += scrollspeed * time_step;
			
			if (fade > 20)
				creditsBody1.pos_x += scrollspeed * time_step;
				
			if (g_bCreditsAllExplode)
				break;
				
			wait(1);
		}
		
		for (fade = 0; fade < 100; fade += fadespeed * time_step)
		{
			creditsHead2.pos_x -= scrollspeed * time_step;
			
			if (fade > 20)
				creditsBody2.pos_x -= scrollspeed * time_step;
				
			if (g_bCreditsAllExplode)
				break;
				
			wait(1);
		}
		
		pos += 1;
		
		wait(1);
	} 
	
	snd_stopall(4);
	
	creditsHead1.flags &= ~SHOW;
	creditsBody1.flags &= ~SHOW;
	creditsHead2.flags &= ~SHOW;
	creditsBody2.flags &= ~SHOW;
	
	g_bCreditsAllExplode = true;
	
	creditsFinished = true;
	
	var et = 5 * 16;
	
	while (et > 0)
	{
		camera->tilt += time_step * 0.2;
		camera->arc += time_step * 0.2;
		
		et -= time_step;
		wait(1);
	}
	
	// show space text
	{
		set(g_txtCreditsSpace, SHOW);
		g_txtCreditsSpace->pos_x = screen_size.x / 2;
		g_txtCreditsSpace->pos_y = screen_size.y * 0.8;
		
		on_space = creditsSpace;
	}
}