⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameproc.cpp

📁 网络游戏龙族 完整的登陆器 C++ 源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		if( ret != 1 ) 
		{
			goto __CheckFail;
		}
	}
	else 
	{	
		strcpy( g_GameInfo.agent_ip, g_pBill->ReturnIPaddress() );
		g_GameInfo.agent_port = g_pBill->ReturnPORTNumber();
	}
	
	Release( c );
	if( ConnectServer( c, g_GameInfo.agent_ip, g_GameInfo.agent_port ) <= 0 )
	{	
		ret = -1;
		goto __CheckFail;
	}	

	//1206 zhh
	if( g_pBill->ReturnLineNum()>=0)
	{
		g_pBill->SendSpecifiedMessage(g_hwndMain);
	}
	goto __CheckSuccss;

__CheckSuccss://己傍 窍搁
	{
		ret = 1;
		strcpy( IIDD, sId );//酒第 菩胶甫 持绊
		strcpy( PPWW, sPassword );
		goto __ClearID_PASSWORD;
	}
__CheckFail://己傍 窍搁
	{
		strcpy( IIDD, "" );
		strcpy( PPWW, "" );
		goto __ClearID_PASSWORD;
	}
__ClearID_PASSWORD:
	{
		strcpy( sId ,"");//酒第 菩胶 涝仿登绢乐绰芭 瘤快绊
		strcpy( sPassword,"" );
		EWndMgr.ClearAllTxt();//Hwnd俊 乐绰 皋技瘤档 瘤款促
		return ret;
	}
}
		
/////////////////////////////////  0131 YGI 海鸥 抛胶飘 酒捞叼 眉农 ////////////////////
int CheckBetaTestId( char *id )
{		
	if( SysInfo.notconectserver == 1 ) return 1;
	LoadGameInfo(); //  LogIn 辑滚俊 立加且 IP/Port甫 佬绰促.
		
		
	if( connections.state == CONNECT_FAIL )
		if( ConnectServer( &connections, g_GameInfo.proxy_ip[0], g_GameInfo.proxy_port ) < 0 )
		{
			return	-1;
		}
		
	double		StartTime, Duration;
	t_packet	packet;
	packet.h.header.type = CMD_CHECK_BETA_TEST;
	{
		memcpy( packet.u.kein.beta_check_id.id, id, ID_LENGTH );
	}
	packet.h.header.size = sizeof( k_beta_check_id );
	QueuePacket( &packet, 1 );
		
	StartTime = ::timeGetTime( );
	ListenCommand = 0;
		
	while ( 1 )
	{	
		Duration = ::timeGetTime( ) - StartTime;
		if ( Duration > WAIT_TIME_RESPONSE_DURATION ) //030930 kyo
		{
			return( -2 );
		}
		
		if ( HandleRunning(&connections ) <= 0  )
		{
			Release( &connections);
			return( -3 );
		}
		
		if ( ListenCommand == 100 )		// 沥惑 楷搬
		{
			break;
		}
		else if( ListenCommand == 10 )
		{
			return(-4);			// 海鸥 抛胶磐啊 酒聪促.
		}
	}	
		
	return 1;
}		
////////////////////////////////////////////////////////////////////////////////
int ProtocolProc( t_connection *c, bool flag )
{		
	if ( HandleRunning( c, flag )  <= 0 )
	{				
		Release( c );
	}				
		
	return	0;		
}		

		
int ProtocolWritingProc( t_connection *c )
{		
	int ret;
	struct timeval	tv;
	fd_set			wfds;
		
	if ( !c->socket )	return( 1 );
	if( c->outbuf == NULL ) return 1;
		
	FD_ZERO( &wfds );
	FD_SET( c->socket, &wfds );
		
		
	tv.tv_sec  = 0;
	tv.tv_usec = 0;
	ret = select( c->socket, NULL, &wfds, NULL, &tv);

	if( ret )
	ret = HandleWriting( c );

	if( ret < 0 )
	{
		Release( c );
	}

	return 0;
}


	
void CharacterProcCheck( void )
{					
	LPCHARACTER		tempch, ch = Hero;
	int sprc;		
	
//	if( ch != NULL)						
//		if( IsDead( ch ) && ch->viewtype != VIEWTYPE_GHOST_ )				
//			if( ch->nCurrentAction != ACTION_DIE )	{ ch->nCurrentAction = ACTION_DIE; ch->nCurrentFrame = 0; }
									
	while ( ch != NULL )
	{				
		switch( ch->animationType )
		{			
			case ANIMATION_TYPE_TEST  : 
					AnimationTypeTestCheck( ch );
				break;
					
			case ANIMATION_TYPE_MAN   :
			case ANIMATION_TYPE_WOMAN : 
					AnimationTypeWomanCheck( ch );	
				break;	

			case ANIMATION_TYPE_MON1  : 
					if( ch->dieani == 1 )
					{	
					  tempch= ch->lpNext;
					  DeleteCharacter(  &g_CharacterList,  ch );
					  ch = tempch;
					  continue;
					}

					AnimationType_Mon1_Check( ch );
					Check_NPC_Pattern( ch );
				break;
		}					
		// 林牢傍捞 笼救栏肺 甸绢啊芭唱 唱客辑 g_Inside蔼捞 官拆荐 乐促. 
		if( ch == Hero ) 
		{
			DWORD	mx = ch->position.x;
			DWORD	my = ch->position.y;
			g_Inside = (TileMap[ mx ][ my ].attr_inside == 1);
		}

		sprc =  ch->AnimationTable[ ch->nCurrentAction].cFrame[  ch->nCurrentFrame ];
		ch->height = ch->AnimationTable[ ch->nCurrentAction].height[  ch->nCurrentFrame ];
		ch->sp =  &CharSpr[ ch->sprno ].sp[ ch->direction ][ sprc];

		if( ch->flagattacked > 0 )	//  辑滚俊辑 磷绰 敲饭弊啊 逞绢坷搁 磷绢具 茄促. 
		{
			ch->flagattacked--;
			if( ch->flagattacked < 1 )
			{
				if( Hero == ch ) SCharacterData.nCharacterHP = 0;
				ch->hp = 0;
			}
		}

		//  付快胶俊 狼秦 Check登菌阑版快  捞抚阑 焊咯林咯具 窍绰单..   MouseCheckCharacterName啊 Setting登骨肺 捞甫 捞侩窍咯 捞抚阑 免仿茄促.  距埃狼 Delay甫 林绢 濒冠捞瘤 臼霸 茄促. 
		if( ch->viewtype != VIEWTYPE_TRANSPARENCY_ ) // 捧疙牢埃 付过阑 静搁 捞抚肚茄 焊咯林瘤 臼绰促.
		if( ch == MouseCheckCharacterName )
		{
			if(ch->namedisplaycount == 0)
			{
				if(ch!=Hero)
				{
					int	auto_Wave = 0;
					int DistanceX = (ch->x - Hero->x)/* / TILE_SIZE*/;	// LTS SOUND
					int DistanceY = (ch->y - Hero->y)/* / TILE_SIZE*/;	// LTS SOUND

					//////////////////////// 0810 lkh 付快胶 目辑甫 棵妨 躇阑锭 磊澜 瓤苞澜 拱府扁 ////////////////////////
					switch(ch->animationType)
					{
					case ANIMATION_TYPE_MAN   :
					case ANIMATION_TYPE_WOMAN :
						if(ch->sex)
								auto_Wave = 70+rand()%3;
						else	auto_Wave = 75+rand()%3;
						
						PlayListAutoSounds( auto_Wave,DistanceX, DistanceY, 0 );	//3D sound肺 钎泅 // LTS SOUND
						//PlayListAutoSounds(auto_Wave, DistanceX,DistanceY,0);	// LTS SOUND
						break;
					case ANIMATION_TYPE_MON1  :
					//	auto_Wave = ReturnWaveNatural( ch );
					//	PlayListAutoSounds(auto_Wave, 0,6,0);
						break;
					default:
						break;
					}
				}
			}
			if(ch->namedisplaycount < 30) ch->namedisplaycount = 30;
		}
		else
		{
			if(ch->namedisplaycount > 0) ch->namedisplaycount--;
		}

		if( ch->animationType == ANIMATION_TYPE_MON1  )
		{
			ch->dirdelay = !ch->dirdelay; 
			if( ch->dirdelay == 0 )
			{
				int todir	= (int)ch->todir;
				int dir		= (int)ch->direction;
				if( todir - dir > 0)
				{
					if( abs(todir - dir) <= 3 ){dir ++; dir %= 8; }
					else { dir += 7; dir %= 8; }
				}
				else if( todir - dir < 0 )
				{
					if( abs(dir - todir) <= 4 ){ dir += 7; dir %= 8; }
					else {dir ++; dir %= 8; }
				}

				ch->direction = (DIRECTION)dir;
			}
		}

		ch = ch->lpNext;
	}				

	if(LButtonDownIng==1 )								
	{						
		if( Hero != NULL )	// 霸烙救俊 甸绢吭促搁..				
		{										
			if( Hero->peacests == 0 && SMenu[ MN_PARTY].bActive == true )// 颇萍甫 备己窍扁 困茄 
			{
				if( g_GameInfo.lpcharacter == g_GameInfo.lpoldcharacter )
				{
					g_GameInfo.PopupFaceCount ++;
					if( g_GameInfo.PopupFaceCount  == 15 )
					{
						switch( g_GameInfo.nSelectedSpriteType )
						{								
							case SPRITETYPE_ON_THE_CEILING_CHAR	 :
							case SPRITETYPE_CHARACTER :	
							case SPRITETYPE_NPC :		
							case SPRITETYPE_MONSTER :		g_MouseItemType = PARTY;
															SetMouseCh( g_GameInfo.lpcharacter );	// 0929 YGI
									break;
							default : 
								break;
						}
					}
				}
				else g_GameInfo.PopupFaceCount = 0;
				{
				}
				
			}
		}
	}
	else
	{
		g_GameInfo.PopupFaceCount = 0;
	}

	g_GameInfo.lpoldcharacter = g_GameInfo.lpcharacter;
}					
					
					
void  CharacterProcFrameCount( void )
{	
	LPCHARACTER		ch = Hero;

	while ( ch != NULL )
	{
		switch( ch->animationType )
		{	
			case ANIMATION_TYPE_TEST  :
					AnimationTypeTestFrameCount( ch );
				break;
	
			case ANIMATION_TYPE_MAN   :
			case ANIMATION_TYPE_WOMAN : 
					AnimationTypeWomanFrameCount( ch );
				break;
			
			case ANIMATION_TYPE_MON1  : 
					AnimationType_Mon1_FrameCount( ch );
				break;
		}		
			
		ch = ch->lpNext;
	}		

}				
			
			
			
			
			
void AttackProc( LPCHARACTER ch, int minr, int maxr )
{			
	LPCHARACTER dch;
	LPITEMGROUND i;
	int ani;
	//	某腐磐甫 急琶 拱府利牢 傍拜...


	switch( ch->animationType )
	{
	case ANIMATION_TYPE_TEST  : 
		break;
				
	case ANIMATION_TYPE_MAN   :
	case ANIMATION_TYPE_WOMAN :		if( ch->changeActionFlag == 0 ) // 促弗 傍拜悼累阑 窍绊 乐瘤 臼促搁,
									{			
										switch( ch->nAttackedType )
										{		
											case SPRITETYPE_ITEM :
											{	
												i = (LPITEMGROUND) ch->lpAttacked;
												
												ChangeDirection( &ch->direction, ch->x, ch->y, i->x, i->y );
												ch->todir = ch->direction;
												ani = AttackAction( ch );
												if( ani == ch->nCurrentAction )	return;
												else  ch->nCurrentAction = ani;
												ch->nCurrentFrame = 0;
											}	
											break;
												
												
											case SPRITETYPE_CHARACTER	:
											case SPRITETYPE_NPC				:
											case SPRITETYPE_MONSTER			:
											{	
												ch->attackMinRange = minr;
												ch->attackMaxRange = maxr;
													
												
												dch = (LPCHARACTER )(ch->lpAttacked);
												ani = AttackAction( ch );
												if( ani == ch->nCurrentAction )	return;
												else  ch->nCurrentAction = ani;
												ChangeDirection( &ch->direction, ch->x, ch->y, dch->x, dch->y );
												ch->todir = ch->direction;
												ch->nCurrentFrame = 0;
											}	
											break;
										}		
									}			
		break;									
												
	case ANIMATION_TYPE_MON1  :		if( ch->changeActionFlag == 0 ) // 促弗 傍拜悼累阑 窍绊 乐瘤 臼促搁,
									{			
										ch->attackMinRange = minr;
										ch->attackMaxRange = maxr;
										dch = (LPCHARACTER )(ch->lpAttacked);
										ChangeDirection( &ch->direction, ch->x, ch->y, dch->x, dch->y );
										ch->todir = ch->direction;
										ani = AttackAction( ch );	
										if( ani == ch->nCurrentAction )	return;
										else  ch->nCurrentAction = ani;
										ch->nCurrentFrame = 0;		
									}			
		break;									
	}											


}			
			


		

			
			
			
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//////			
//////			
//////			Mouse 贸府....
//////			
//////			
			
/* // 捞何盒篮 Server俊辑 倾遏阑 罐绊 捞悼茄促. 
if ( Hero->nCurrentAction != ACTION_RUN )
{			
Hero->nCurrentAction = ACTION_RUN;
Hero->nCurrentFrame = 0;
}			
*/			
// type : 0- walk..
// type : 1- run..



void DoHeroMove( int movetype, int x, int y )
{
	int mx = x / TILE_SIZE;
	int my = y / TILE_SIZE;
	CHARACTER t;
	DWORD temptime;
	
	static int oldmovetype;
	
	if( DontMoveAttackFlag == TRUE ) 
		return;

  if ( Hero->nCurrentAction==17)		// LTS 011214 LTS			// 旧篮 惑怕俊辑 规氢阑 官操绢 霖促.
	{
		/*AddCurrentStatusMessage( 255,255,0,"旧扁 惑怕俊辑绰 框流老荐 绝嚼聪促.");
		switch(Hero->direction)
		{
		case DIRECTION_UP			: Hero->direction=DIRECTION_RIGHTUP;	break;
		case DIRECTION_RIGHTUP		: Hero->direction=DIRECTION_RIGHT;		break;
		case DIRECTION_RIGHT		: Hero->direction=DIRECTION_RIGHTDOWN;	break;
		case DIRECTION_RIGHTDOWN	: Hero->direction=DIRECTION_DOWN;		break;
		case DIRECTION_DOWN			: Hero->direction=DIRECTION_LEFTDOWN;	break;
		case DIRECTION_LEFTDOWN		: Hero->direction=DIRECTION_LEFT;		break;
		case DIRECTION_LEFT			: Hero->direction=DIRECTION_LEFTUP;		break;
		case DIRECTION_LEFTUP		: Hero->direction=DIRECTION_UP;			break;
		}
		t_packet p;
		p.h.header.type=CMD_SITDOWN_DIRECTION_CHANGED;
		p.u.LocalWar.SDChanged.Direction=Hero->direction;
		p.h.header.size=sizeof(t_SDChanged);
		QueuePacket(&p,1);*/
		return;	// LTS SITDOWN
	}
	//if( !SysInfo.gamemakemode )

	PathBuildSuccess = 0;

	if( SkillStatus == SKILL_OFF )
	{	
	}	
	else 
	{	
		return;
	}	

	if( IsDead( Hero) && Hero->viewtype != VIEWTYPE_GHOST_ ) 
	{	
		if(!Hero->sex)		//咯磊
			PlayListAutoSounds( 80,0,0,0 ); // 捞悼角菩.
		else
			PlayListAutoSounds( 81,0,0,0 ); // 捞悼角菩.
		AddCurrentStatusMessage( 255,100,100,lan->OutputMessage(5,20) );//010216 lsw
		return;
	}	
	else 
	if( SCharacterData.nCharacterSP <= 0  && !IsDead( Hero) ) 
	{
	//	0910 YGI
	//		if(!Hero->sex)		//咯磊
	//			PlayListAutoSounds( 80,0,0,0 ); // 捞悼角菩.
	//		else
	//			PlayListAutoSounds( 81,0,0,0 ); // 捞悼角菩.
		AddCurrentStatusMessage( 255,100,100,lan->OutputMessage(9,3) );//010215 lsw
	}
		
	if( TileMap[ Hero->x/ TILE_SIZE][Hero->y/TILE_SIZE].attr_dont ) return;		// 捣飘冠胶搁 给框流牢促. 
			
	if ( !TileMap[ mx ][ my ].attr_dont && FreeTile( Hero, mx, my , mx, my ))
	{		
//		if( IsTooNearCharacter( x, y, Hero ) )	
//		{
//			PlayListAutoSounds( 10,0,0,0 ); // 捞悼角菩.
//			return; // 傍拜裹困焊促 救率栏肺 啊妨茄促搁..
//		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -