Ejemplo n.º 1
0
int Examine_Semantic_Analyser(int *tokens,int *i,int *whereabout)

{
	char input[Max_input];
	int t[Max_tokens],error=0,k=0;
	Initialize_Tokens(t);
	if(tokens[*i]=='\0')
	{
		printf("What do you want to examine?\n");
		gets(input);
		Tokens_Num=0;
		if(Input_Process(input,t,&error)==-1)
			return -1;
		if(t[1])
		{
			printf("Just \"object\" is okay.\n");
			return -1;
		}
		while(k<Max_carries)
		{
			if(t[0]==player.inventory[k])
			{
				*whereabout=k;
				tokens[*i]=t[0];
				return 0;
			}
			k++;
		}
		if(_find(t[0]))
		{
			tokens[*i]=t[0];
			return 0;
		}
		printf("The object is either not here or not important.\n");
		return -1;
	}
	if(isart(tokens[*i]))
		(*i)++;
	if(!isobj(tokens[*i])||tokens[*i+1]!='\0')
	{
		printf("Illegal sentence.\n");
		return -1;
	}
	while(k<Max_carries)
	{
		if(tokens[*i]==player.inventory[k])
		{
			*whereabout=k;
			return 0;
		}
		k++;
	}
	if(_find(tokens[*i]))
		return 0;
	printf("The object is either not here or not important.\n");
	return -1;
}
Ejemplo n.º 2
0
/*	Displays a text string in the center of the screen and waits for a Y or N
	keypress.
*/
int SCR_ModalMessage (char *text, float timeout) //johnfitz -- timeout
{
	double time1, time2; //johnfitz -- timeout

	if (cls.state == ca_dedicated)
		return true;

	scr_notifystring = text;

	// draw a fresh screen
	bDrawDialog = true;
	Video_Process();
	bDrawDialog = false;

	S_ClearBuffer ();		// so dma doesn't loop current sound

	time1 = System_DoubleTime () + timeout; //johnfitz -- timeout
	time2 = 0.0f; //johnfitz -- timeout

	do
	{
		key_count = -1;		// wait for a key down and up

		Input_Process();

		if (timeout)
			time2 = System_DoubleTime (); //johnfitz -- zero timeout means wait forever.
	} while(	key_lastpress != 'y'		&&
				key_lastpress != 'n'		&&
				key_lastpress != K_ESCAPE	&&
				time2 <= time1);

//	SCR_UpdateScreen (); //johnfitz -- commented out

	//johnfitz -- timeout
	if (time2 > time1)
		return false;
	//johnfitz

	return key_lastpress == 'y';
}
Ejemplo n.º 3
0
int Move_Semantic_Analyser(int *tokens,int *i)

{
	int error=0,t[Max_tokens];
	char input[Max_input];
	Initialize_Tokens(t);
	if(tokens[*i]=='\0'||((tokens[*i]==Prep_to||tokens[*i]==Prep_toward)&&tokens[*i+1]=='\0'))
	{
		printf("To which direction?\n");
		gets(input);
		Tokens_Num=0;
		if(Input_Process(input,t,&error)==-1)
			return -1;
		if(t[1])
		{
			printf("Just \"direction\" is okay.\n");
			return -1;
		}
		if(!isdir(t[0]))
		{
			printf("Illegal sentence.\n");
			return -1;
		}
		tokens[*i]=t[0];
		return 0;
	}
	if(tokens[*i]==Prep_to||tokens[*i]==Prep_toward)
		(*i)++;
	if(isart(tokens[*i]))
		(*i)++;
	if(!isdir(tokens[*i])||tokens[*i+1]!='\0')
	{
		printf("Illegal sentence.\n");
		return -1;
	}
	return 0;
}
Ejemplo n.º 4
0
int Put_Semantic_Analyser(int *tokens,int *i,int *whereabout)

{
	char input[Max_input];
	//8 is where object begins.
	int t[Max_tokens],k=0,error=0;
	Initialize_Tokens(t);
	if(tokens[*i]=='\0'||(tokens[*i]==Prep_down&&tokens[*i+1]=='\0'))
	{
		printf("What do you want to put down?\n");
		gets(input);
		Tokens_Num=0;
		if(Input_Process(input,t,&error)==-1)
			return -1;
		if(t[1])
		{
			printf("Just \"object\" is okay.\n");
			return -1;
		}
		if(!isobj(t[0]))
		{
			printf("Illegal sentence.\n");
			return -1;
		}
		if(isuobj(t[0]))
		{
			printf("You can't possibly be in possession of this.\n");
			return -1;
		}
		while(k<Max_carries)
		{
			if(t[0]==player.inventory[k])
			{
				*whereabout=k;
				tokens[*i]=t[0];
				return 0;
			}
			k++;
		}
		printf("You are not in possession of this.\n");
		return -1;
	}
	if(tokens[*i]==Prep_down)
		(*i)++;
	if(isart(tokens[*i]))
		(*i)++;
	if(!isobj(tokens[*i])||tokens[*i+1]!='\0')
	{
		printf("Illegal sentence.\n");
		return -1;
	}
	if(isuobj(tokens[*i]))
	{
		printf("You can't possibly have it.\n");
		return -1;
	}
	k=0;
	while(k<Max_carries)
	{
		if(tokens[*i]==player.inventory[k])
		{
			*whereabout=k;
			return 0;
		}
		k++;
	}
	printf("You are not in possession of this.\n");
	return -1;
}
Ejemplo n.º 5
0
int Pick_Semantic_Analyser(int *tokens,int *i)

{
	char input[Max_input];
	int t[Max_tokens],error=0;
	if(player.num_object+1>Max_carries)
	{
		printf("You can't carry this much.\n");
		return -1;
	}
	Initialize_Tokens(t);
	if(tokens[*i]=='\0'||(tokens[*i]==Prep_up&&tokens[*i+1]=='\0'))
	{
		printf("What do you want to pick up?\n");
		gets(input);
		Tokens_Num=0;
		if(Input_Process(input,t,&error)==-1)
			return -1;
		if(t[1])
		{
			printf("Just \"object\" is okay.\n");
			return -1;
		}
		if(!isobj(t[0]))
		{
			printf("Illegal sentence.\n");
			return -1;
		}
		if(isuobj(t[0]))
		{
			printf("Yeah.Man,Like you can just pick it up.\n");
			return -1;
		}
		if(!_find(t[0]))
		{
			printf("The object is either not here or not important.\n");
			return -1;
		}
		tokens[*i]=t[0];
		return 0;
	}
	if(tokens[*i]==Prep_up)
		(*i)++;
	if(isart(tokens[*i]))
		(*i)++;
	if(!isobj(tokens[*i])||tokens[*i+1]!='\0')
	{
		printf("Illegal sentence.\n");
		return -1;
	}
	if(isuobj(tokens[*i]))
	{
		printf("Yeah.Man,Like you can just pick it up.\n");
		return -1;
	}
	if(!_find(tokens[*i]))
	{
		printf("The object is either not here or not important.\n");
		return -1;
	}
	return 0;
}
Ejemplo n.º 6
0
int Talk_Semantic_Analyser(int *tokens,int *i)

{
	char input[Max_input];
	int t[Max_tokens],error=0,j=0;
	Initialize_Tokens(t);
	if(tokens[*i]=='\0'||(tokens[*i]==Prep_to&&tokens[*i+1]=='\0'))
	{
		printf("Who do you want to talk to?\n");
		gets(input);
		Tokens_Num=0;
		if(Input_Process(input,t,&error)==-1)
			return -1;
		if(isart(t[j]))
			j++;
		if(t[j]==Adj_wise_looking||t[j]==Adj_old)
			j++;
		if(t[j]==Adj_old)
			j++;
		if(t[j+1])
		{
			printf("Just the \"subject\" is okay.\n");
			return -1;
		}
		if(!isobj(t[j]))
		{
			printf("Illegal sentence.\n");
			return -1;
		}
		if(t[j]==uObj_man)
		{
			if(!_find(uObj_man))
			{
				printf("Well,he's not here.\n");
				return -1;
			}
		}
		tokens[*i]=t[j];
		return 0;
	}
	if(tokens[*i]==Prep_to)
		(*i)++;
	if(isart(tokens[*i]))
		(*i)++;
	if(tokens[*i]==Adj_wise_looking||tokens[*i]==Adj_old)
		(*i)++;
	if(tokens[*i]==Adj_old)
		(*i)++;
	if(!isobj(tokens[*i])||tokens[*i+1]!='\0')
	{
		printf("Illegal sentence.\n");
		return -1;
	}
	if(tokens[*i]==uObj_man)
	{
		if(!_find(uObj_man))
		{
			printf("Well,he's not here.\n");
			return -1;
		}
		return 0;
	}
	return 0;
}
Ejemplo n.º 7
0
// WinMain
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
	// ウインドウモードで起動
	ChangeWindowMode( TRUE ) ;

	// Direct3D9Ex を使用する
	SetUseDirect3DVersion( DX_DIRECT3D_9EX ) ;

	// ライブラリの初期化
	if( DxLib_Init() < 0 )
		return -1 ;

	// キャラクターの共通情報を初期化
	CharaCommon_Initialize() ;

	// プレイヤーの初期化
	Player_Initialize() ;

	// プレイヤー以外キャラの初期化
	NotPlayer_Initialize() ;

	// ステージの初期化
	Stage_Initialize() ;

	// カメラの初期化
	Camera_Initialize() ;

	// 描画先を裏画面にする
	SetDrawScreen( DX_SCREEN_BACK ) ;

	// ESCキーが押されるか、ウインドウが閉じられるまでループ
	while( ProcessMessage() == 0 && CheckHitKey( KEY_INPUT_ESCAPE ) == 0 )
	{
		// 画面をクリア
		ClearDrawScreen() ;

		// 入力処理
		Input_Process() ;

		// プレイヤー以外キャラの処理
		NotPlayer_Process() ;

		// プレイヤーの処理
		Player_Process() ;

		// カメラの処理
		Camera_Process() ;

		// 描画処理
		Render_Process() ;

		// 裏画面の内容を表画面に反映
		ScreenFlip() ;
	}

	// プレイヤー以外キャラの後始末
	NotPlayer_Terminate() ;

	// プレイヤーの後始末
	Player_Terminate() ;

	// キャラクター共通情報の後始末
	CharaCommon_Terminate() ;

	// ステージの後始末
	Stage_Terminate() ;

	// ライブラリの後始末
	DxLib_End() ;

	// ソフト終了
	return 0 ;
}