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

📄 map.cpp

📁 国内著名网络游戏dragon的客户端登陆用完整源码 配套一起上传的服务端部分可开服 无说明文档
💻 CPP
📖 第 1 页 / 共 5 页
字号:
						}
					}
				}
				break;
			}	
			case 1 :	// 瘤贺
			{	
				nIndex = t->roof;
				if ( nIndex && nIndex < TotalTileNo )
				{
					if ( t->show_roof == 0 )
					{
						if( Sou[nIndex].xl == -1 )
						{
							PutTile( x, y, Sou[ nIndex].img, g_DestBackBuf );
						//if(g_GameInfo.displayOption==1)
							//	PutTile( x+rand()%5-2, y+rand()%5-2, Sou[ nIndex].img, g_DestBackBuf );
						}
						else 
						{
							PutCompressedImage( x, y, &Sou[nIndex] );
							//if(g_GameInfo.displayOption==1)
							//	PutCompressedImage( x+rand()%5-2, y+rand()%5-2, &Sou[nIndex] );
						}
					}
				}
				break;
			}	
			case 2 :
			{	// 寒
#ifdef _DEBUG
				if( tool_DrawFrontMap ) return;
#endif					
				if ( t->roof == 0	||	 t->show_roof || t->rooftype == 1 )
				{		
					nIndex = t->front;
					if ( nIndex && nIndex < TotalTileNo )
					{	
						if( Sou[nIndex].xl == -1 )
								PutTile( x, y, Sou[ nIndex].img, g_DestBackBuf );
						else 
								PutCompressedImage( x, y, &Sou[nIndex] );
					}	
				}
				break;
			}	
			}// switch
		}
		mapx = temp_X;
	}
}		
			
			
		
//////////////////////////////////////////////////////
/////  View Mapattr..

// 010314 KHS 窃荐傈眉... .SKB狼 NPC加己俊辑 般媚廉 乐绰 巴档 钎泅档废 窍看促. 
void  MapDisplay_Attr( void )
{			
	register int	x, y;
	int				mapx, mapy;
	int sx, sy;
	static int to;
	int range_X;
	int range_Y;
		
	
#ifndef _DEBUG
	return;
#endif					

	if( tool_ViewAttrRoofOnOff  ||
		tool_ViewAttrRiver		||
		tool_ViewAttrGEffect	||
		tool_ViewAttrOccupied	||
		tool_ViewAttrInside		||
		tool_ViewAttrNoBattle	||
		tool_ViewAttrCanMatch	||
		tool_ViewAttrEventFlag  ||
		tool_ViewAttrDontFlag	||
		tool_ViewAttrFrontFlag	||
		tool_ID_INPUT_MAP_ATTR  ||
		tool_ID_SKILL_INPUT		||
		tool_ViewAttrTop		||			//	010906 LTS
		tool_ID_INPUT_MYHOUSE
		) goto  GO_PROCESS_;

	 return;

GO_PROCESS_:
		
	 to = !to;
		
	 LPEVENTLIST		lpEventList;
	mapy = g_Map.y;
	for ( y = 0; y < GAME_SCREEN_YSIZE ; y += TILE_SIZE, mapy ++ )
	{	
		for ( mapx = g_Map.x, x = 0; x < GAME_SCREEN_XSIZE ; x+= TILE_SIZE, mapx ++ )
		{
			if( tool_ViewAttrRoofOnOff )
			if( TileMap[ mapx ][ mapy ].attr_room )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx+4, sy+4, sx + TILE_SIZE - 8, sy + TILE_SIZE - 8, RGB16( 0,255,0 ));
				
				lpEventList = FindEventList( &g_EventListHeaderRoom, ( WORD )mapx, ( WORD )mapy );
				if( lpEventList )
				{		
					if( TileMap[ mapx ][ mapy ].attr_room  == 1 ) // 凯绢扼....
					{
						Hcolor( 0 );
						Hprint2( sx- Mapx, sy-Mapy, g_DestBackBuf, lan->OutputMessage(7,10), lpEventList->index );//010216 lsw
						Hcolor( 0,255,0 );
						Hprint2( sx-Mapx-1, sy-Mapy-1, g_DestBackBuf, lan->OutputMessage(7,10), lpEventList->index );//010216 lsw
					}
					else 
					{
						Hcolor( 0 );
						Hprint2( sx- Mapx, sy-Mapy, g_DestBackBuf, lan->OutputMessage(7,29), lpEventList->index );//010216 lsw
						Hcolor( 255,255,0 );
						Hprint2( sx-Mapx-1, sy-Mapy-1, g_DestBackBuf, lan->OutputMessage(7,29), lpEventList->index );//010216 lsw
					}
				}
			}
			if( tool_ViewAttrRiver )
			if( TileMap[ mapx ][ mapy ].attr_river )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx, sy, sx + TILE_SIZE, sy + TILE_SIZE, RGB16( 0,100,200 ));
			}
			if( tool_ViewAttrGEffect )
			if( TileMap[ mapx ][ mapy ].attr_light )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx +2 , sy+2, sx + TILE_SIZE-4, sy + TILE_SIZE-4, RGB16( 255,255,255 ));
			}
			if( tool_ViewAttrEventFlag )
			if( TileMap[ mapx ][ mapy ].attr_map )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx+3, sy+3, sx + TILE_SIZE - 6, sy + TILE_SIZE - 6, RGB16( 0,0,255 ));
				Hprint2( sx-Mapx, sy-Mapy, g_DestBackBuf, "%d", ReturnEventNo( mapx, mapy ));
			}		
			if( tool_ViewAttrInside )
			if( TileMap[ mapx ][ mapy ].attr_inside )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx+3, sy+3, sx + TILE_SIZE - 6, sy + TILE_SIZE - 6, RGB16( 255,100,100 ));
			}		
			if( tool_ViewAttrNoBattle )
			if( TileMap[ mapx ][ mapy ].attr_no_battle )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx+3, sy+3, sx + TILE_SIZE - 6, sy + TILE_SIZE - 6, RGB16( 100,255,100 ));
			}		
			if( tool_ViewAttrCanMatch )
			if( TileMap[ mapx ][ mapy ].canmatch )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx+3, sy+3, sx + TILE_SIZE - 6, sy + TILE_SIZE - 6, RGB16( 100,0,100 ));
			}		

			//___________________________________________________________________	// 010904 LTS
			if( tool_ViewAttrTop )			// 惫啊傈俊辑狼 臭撤捞 鸥老.
			if( TileMap[ mapx ][ mapy ].empty__4 )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx+4, sy+4, sx + TILE_SIZE - 5, sy + TILE_SIZE - 5, RGB16( 255,255,0 ));
			}		

			if( tool_ViewAttrOccupied )		// 辨茫扁俊辑狼  痢蜡鸥老 
			if( TileMap[ mapx ][ mapy ].occupied )
			{
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
				Box( sx+3, sy+3, sx + TILE_SIZE - 6, sy + TILE_SIZE - 6, RGB16( 0, 255,100 ));
			}		
			//___________________________________________________________________	// 010904 LTS


			if( tool_ViewAttrDontFlag )
			{
				if( TileMap[ mapx ][ mapy ].occupied )
				{
					sx = mapx*TILE_SIZE;
					sy = mapy*TILE_SIZE;
					Box( sx+3, sy+3, sx + TILE_SIZE - 6, sy + TILE_SIZE - 6, RGB16( 0, 255,100 ));
				}		


				if( TileMap[ mapx ][ mapy ].attr_dont )
				{		
					sx = mapx*TILE_SIZE;
					sy = mapy*TILE_SIZE;
					Box( sx+1, sy+1, sx + 30, sy + 30, RGB16( 255,0,0 ));
				}		
			}
			if( tool_ViewAttrFrontFlag )
			if( TileMap[ mapx ][ mapy ].front )
			{		
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;

				if( to && tMapAttr_Offset_Modify == IDC_ATTR_OFFSET_YES2 && tMapAttrX == mapx && tMapAttrY == mapy )
				{	
					
				}	
				else 
				{	
					Box( sx+5, sy+5, sx + 24, sy + 24, RGB16( 255,0,255 ));
				}	
				Hcolor( 0xffff );
				Hprint2( sx-Mapx, sy-Mapy+10, g_DestBackBuf, "%3d", TileMap[ mapx ][ mapy ].frontoffset );
			}		



			
		
			if( tool_ID_INPUT_MYHOUSE )
			{
				//MouseProcess( Message, wParam, lParam);
				//付快胶 滚瓢 努腐 靛贰弊登促啊 滚瓢 up矫 
				//Box(g_DragMouse.sx,g_DragMouse.sy,g_DragMouse.ex,g_DragMouse.ey, RGB16(255,100,100));

				int select_Tile_sx=(g_DragMouse.sx)/TILE_SIZE;//(g_DragMouse.sx+32-mapx)/TILE_SIZE;
				int select_Tile_sy=(g_DragMouse.sy)/TILE_SIZE;//(g_DragMouse.sy+32-mapy)/TILE_SIZE;
				int select_Tile_ex=(g_DragMouse.ex)/TILE_SIZE;//(g_DragMouse.ex-mapx)/TILE_SIZE;
				int select_Tile_ey=(g_DragMouse.ey)/TILE_SIZE;//(g_DragMouse.ey-mapy)/TILE_SIZE;
				
				int temp_XY;
				int temp_sx=select_Tile_sx;
				int temp_sy=select_Tile_sy;
				int temp_ex=select_Tile_ex;
				int temp_ey=select_Tile_ey;
		
				if(temp_sx>temp_ex)	
				{
					temp_XY=temp_sx;
					temp_sx=temp_ex;
					temp_ex=temp_XY;
				}
				if(temp_sy>temp_ey)
				{
					temp_XY=temp_sy;
					temp_sy=temp_ey;
					temp_ey=temp_XY;
				}
				
				g_MyhouseTool.sx=temp_sx;
				g_MyhouseTool.sy=temp_sy;
				g_MyhouseTool.ex=temp_ex;
				g_MyhouseTool.ey=temp_ey;
				g_MyhouseTool.object_Num=(temp_ex-temp_sx)*(temp_ey-temp_sy);

				char	temp[FILENAME_MAX];
				if(g_MyhouseDlgOpen==1)
				{
					sprintf (temp, "%d", g_MyhouseTool.sx);			Edit_SetText (GetDlgItem(InputMyhouseHdlg, IDC_VIEW_SX ), temp);
					sprintf (temp, "%d", g_MyhouseTool.sy);			Edit_SetText (GetDlgItem(InputMyhouseHdlg, IDC_VIEW_SY ), temp);
					sprintf (temp, "%d", g_MyhouseTool.ex);			Edit_SetText (GetDlgItem(InputMyhouseHdlg, IDC_VIEW_EX ), temp);
					sprintf (temp, "%d", g_MyhouseTool.ey);			Edit_SetText (GetDlgItem(InputMyhouseHdlg, IDC_VIEW_EY ), temp);
					sprintf (temp, "%d", g_MyhouseTool.object_Num);	Edit_SetText (GetDlgItem(InputMyhouseHdlg, IDC_VIEW_TILENUM ), temp);
				}
				
				Box( temp_sx*TILE_SIZE,temp_sy*TILE_SIZE,temp_ex*TILE_SIZE,temp_ey*TILE_SIZE,RGB16(255,50,50));
			}
		

			lpMAPSKILLTABLE	result;
			DWORD		lineColor;
			int nx, ny;

			nx = (mapx-g_Map.x)*TILE_SIZE;
			ny = (mapy-g_Map.y)*TILE_SIZE;
			
			if( tool_ID_SKILL_INPUT )
			if( TileMap[ mapx ][ mapy ].attr_skill )
			{
				int count = 0;
				sx = mapx*TILE_SIZE;
				sy = mapy*TILE_SIZE;
			
				while( (result=FindSkill(&Header[(int)(mapx/(int)((g_Map.file.wWidth+7)/8))][(int)(mapy/(int)((g_Map.file.wHeight+7)/8))],mapx,mapy, count) ) )
				if(result!=NULL)
				{
					count ++;
					switch(result->skillno)
					{
						case TOOL_DONTSKILL :
							Hcolor(150,255,150);
							Hprint2( (mapx-g_Map.x)*32+2, (mapy-g_Map.y)*32+10, g_DestBackBuf, "Don't");
							Box( sx+2, sy+2, sx + TILE_SIZE - 2, sy + TILE_SIZE - 2, RGB16( 255,50,50));	
							break;
						case TOOL_MINING :
						{
							switch(result->subType)
							{
							case 0:	lineColor=RGB16(203,185,156);	break;
							case 1:	lineColor=RGB16(158,139,117);	break;
							case 2:	lineColor=RGB16(118,100,85);	break;
							case 3:	lineColor=RGB16(82,68,60);		break;
							case 4:	lineColor=RGB16(51,42,41);		break;
							}
							break;
						}
						case TOOL_FARMING :
						{
							switch(result->subType)
							{
							case 0:	lineColor=RGB16(221,189,140);			break;
							case 1:	lineColor=RGB16(200,164,110);			break;
							case 2:	lineColor=RGB16(169,131,79);			break;
							case 3:	lineColor=RGB16(132,92,42);				break;
							case 4:	lineColor=RGB16(91,55,20);				break;
							case 5:	lineColor=RGB16(165,84,5);				break;
							case 6:	lineColor=RGB16(155,77,0);				break;
							case 7:	lineColor=RGB16(197,79,0);				break;
							case 8:	lineColor=RGB16(74,33,6);				break;
							case 9:	lineColor=RGB16(55,23,2);				break;
							}
							break;
						}
						case TOOL_HUB :
						{
							switch(result->subType)
							{
							case 0:	lineColor=RGB16(137,202,157);		break;
							case 1:	lineColor=RGB16(47,180,114);		break;
							case 2:	lineColor=RGB16(0,105,63);			break;
							case 3:	lineColor=RGB16(0,75,44);			break;
							case 4:	lineColor=RGB16(31,64,50);			break;
							case 5:	lineColor=RGB16(66,109,91);			break;
							case 6:	lineColor=RGB16(82,132,19);			break;
							case 7:	lineColor=RGB16(60,102,8);			break;
							case 8:	lineColor=RGB16(103,181,4);			break;
							case 9:	lineColor=RGB16(35,52,14);			break;
							}
							break;
						}
						case TOOL_NPC_GENER :
							lineColor=RGB16(50,50,255);
							break;
						case TOOL_BUILDHOUSE :
							lineColor=RGB16(0,0,0);
							break;
					}

					if(result->skillno!=TOOL_DONTSKILL)
					{

						{
							int xl, yl;
							xl = (result->tile_Range*2*TILE_SIZE)+TILE_SIZE;
							yl = (result->tile_Range*2*TILE_SIZE)+TILE_SIZE;
							range_X=(mapx-result->tile_Range)*TILE_SIZE;
							range_Y=(mapy-result->tile_Range)*TILE_SIZE;

							Box( sx+1, sy+1, sx + TILE_SIZE - 1, sy + TILE_SIZE - 1, RGB16( 255,255,0));
							switch(radio_Statue)
							{
							case 0:
									Box( range_X, range_Y, xl, yl, lineColor);
								break;
							case 1:
								if(result->tile_Range!=0 && result->skillno==TOOL_FARMING)
											Box( range_X, range_Y, xl, yl, lineColor);
								break;
							case 2:
								if(result->tile_Range!=0 && result->skillno==TOOL_MINING)
									Box( range_X, range_Y, xl, yl, lineColor);
								break;
							case 3:
								if(result->tile_Range!=0 && result->skillno==TOOL_FISHING)
									Box( range_X, range_Y, xl, yl, lineColor);
								break;
							case 4:
								if(result->tile_Range!=0 && result->skillno==TOOL_CHOPPING)
									Box( range_X, range_Y, xl, yl, lineColor);
								break;
							case 5:
								if(result->tile_Range!=0 && result->skillno==TOOL_HUB)	
									Box( range_X, range_Y, xl, yl, lineColor);
								break;
							case 6:

								break;
							case 7:
								if(result->tile_Range!=0 && result->skillno==TOOL_BUILDHOUSE)
									Box( range_X, range_Y, xl, yl, lineColor);
								break;
							}
						}

						if( result->skillno == 6 )
						{
							// 蜡瓤裹困(惯积荐)  己傍犬伏(Script)   NPC绊蜡锅龋	窍困包访Data 
							static char othername[ 6][20]={" ", "Enchant", "Mad", "Boss"," ", " " };
							HprintBold( nx, ny,		RGB(200,200,200), RGB16(0,0,0 ), lan->OutputMessage(7,35), result->tile_Range , result->probability );//010216 lsw

							int tmon;
							int tenchant;
							//< CSD-030419
							if (result->type_Num < MAX_CHARACTER_SPRITE_)
							{ 
								tmon = result->type_Num;		
								tenchant = 0; 
							}
							else
							{ 
								tmon = result->type_Num%100;	
								tenchant = result->type_Num/100; 
							}
							//> CSD-030419
							HprintBold( nx, ny+16,  RGB(200,50 * tenchant + 50,50 * tenchant + 50 ), RGB16(0,0,0 ), "%d:%s %s", result->type_Num, othername[tenchant], g_infNpc[tmon].szName); // CSD-030419
						}
						else
						{
							HprintBold( nx, ny,		RGB(200,200,200), RGB16(0,0,0 ), "%d-%d-%d-%d", result->skillno, result->subType, result->tile_Range, result->probability);
						}
					}
				}

				if( count > 1 )	HprintBold( nx - 40, ny, RGB(200,200,200), RGB16(0,0,0 ), "<<%d>>", count );
			}
		}			
	}
}


	
	
///////////////////////////////////////////////////////////////////////////////
	
///////////////////////////////////////////////////////////////////////////////
// roof
	
BOOL
BuildRoofHeader( LPROOFHEADER lpRoofHeader, char* mapname )
{	
	char lpszFileName[ FILENAME_MAX];

	lpRoofHeader->lpFirst = lpRoofHeader->lpLast = NULL;
	lpRoofHeader->count = 0;

	wsprintf( lpszFileName, "%s/event/%s.rof", GetCurrentWorkingDirectory( ), MapName );

	FILE *fp;
	fp = Fopen( lpszFileName, "rb" );
	if( fp == NULL ) return FALSE;
	
	if ( !ReadRoofData( lpRoofHeader, lpszFileName ) )
	{
		Error( "[%s] \n LoadError", lpszFileName );
		return	FALSE;
	}
	
	return	TRUE;
}
	
// 瘤贺 捞亥飘狼 xy甫 啊瘤绊 乐绰 府胶飘俊辑 蔼阑 茫酒 弊 器牢飘甫 逞败 霖促.
// 031110 YGI
LPROOFGROUP
FindRoofGroupByXY( LPROOFHEADER lpRoofHeader, int x, int y )
{
	LPROOFGROUP		lpRoofGroup, lpRoofGroupNext;
	LPROOF			lpRoof, lpRoofNext;

	lpRoofGroup = lpRoofGroupNext = lpRoofHeader->lpFirst;

	while ( lpRoofGroup )
	{
		lpRoof = lpRoofNext = lpRoofGroup->lpFirst;
		while ( lpRoof )
		{
			if( lpRoof->x == x && lpRoof->y == y ) 
			{
				return lpRoofGroup;
			}
			lpRoofNext = lpRoof->lpNext;
			lpRoof = lpRoofNext;
		}

		lpRoofGroupNext = lpRoofGroup->lpNext;
		lpRoofGroup = lpRoofGroupNext;
	}
	return NULL;
}
	
void
DestroyRoofHeader( LPROOFHEADER lpRoofHeader )
{
	LPROOFGROUP		lpRoofGroup, lpRoofGroupNext;
	LPROOF			lpRoof, lpRoofNext;

	lpRoofGroup = lpRoofGroupNext = lpRoofHeader->lpFirst;

	while ( lpRoofGroup )
	{
		lpRoof = lpRoofNext = lpRoofGroup->lpFirst;

		while ( lpRoof )
		{
			lpRoofNext = lpRoof->lpNext;
			DeleteRoof( lpRoofGroup, lpRoof );
			lpRoof = lpRoofNext;
		}

		lpRoofGroupNext = lpRoofGroup->lpNext;

⌨️ 快捷键说明

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