?? skilltool.cpp
字號:
#include "stdafx.h"
#include "stdio.h"
#include <windowsx.H>
#include "Resource.h"
#include "SkillTool.h"
#include "Map.h"
#include "gameproc.h"
#include "Char.h"
#include "Tool.h"
#include "Hong_Sub.h"
#include "Effect.h"
#include "Hong_sprite.h"
#include "directdraw.h"
#include "dragon.h"
#include "object.h"
HWND InputSkillTableHwnd;
HWND CheckHouseObjectHwnd;
//< CSD-030324
char subFarmType[20][25] = {{""},};
char subMineType[20][25] = {{""},};
char subHubType[20][25] = {{""},};
//> CSD-030324
int radio_Statue = 0;
MAPSKILLTABLE g_MapSkillTable;
lpMAPSKILLTABLE Header[8][8];
MYHOUSETOOL g_MyhouseTool;
DRAGMOUSE g_DragMouse;
BOOL g_MyhouseDlgOpen;
extern NPC_INFO g_infNpc[MAX_CHARACTER_SPRITE_]; // CSD-030419
//--------------------------------------------------------------------------------------------------------------
// 扁 瓷 : NPC硅摹甫 瘤款促.
// 牢 磊 : 0 :葛電 NPC硅摹甫 絕矩促.
// n : n鍋 NPC硅摹甫 絕矩促.
// 搬 苞 : 絕嬌.
//--------------------------------------------------------------------------------------------------------------
//////////////////////// 0613 lkh 眠啊 /////////////////////////
void DeleteNPCGenerate(int npc_Num)
{
for( int y=0; y<g_Map.file.wHeight; y++)
{
for(int x=0; x<g_Map.file.wWidth; x++)
{
lpMAPSKILLTABLE result;
if(TileMap[x][y].attr_skill == 1)
{
result=FindSkill(&Header[(int)(x/(int)((g_Map.file.wWidth+7)/8))][(int)(y/(int)((g_Map.file.wHeight+7)/8))], x, y);
if(result==NULL)
TileMap[x][y].attr_skill = 0;
else if(result!= NULL && result->skillno == 6) // npc積己 器牢飄 包訪 單撈磐牢 版快
{
if(!npc_Num)
{
TileMap[x][y].attr_skill=0;
DeleteSkill(&Header[(int)(x/(int)((g_Map.file.wWidth+7)/8))][(int)(y/(int)((g_Map.file.wHeight+7)/8))], result);
}
else if(result->type_Num == npc_Num)
{
TileMap[x][y].attr_skill=0;
DeleteSkill(&Header[(int)(x/(int)((g_Map.file.wWidth+7)/8))][(int)(y/(int)((g_Map.file.wHeight+7)/8))], result);
}
}
}
}
}
}
void ChangeNPCGenerate(int npc_from, int npc_to )
{
for( int y=0; y<g_Map.file.wHeight; y++)
{
for(int x=0; x<g_Map.file.wWidth; x++)
{
lpMAPSKILLTABLE result;
if(TileMap[x][y].attr_skill == 1)
{
result=FindSkill(&Header[(int)(x/(int)((g_Map.file.wWidth+7)/8))][(int)(y/(int)((g_Map.file.wHeight+7)/8))], x, y);
if(result==NULL)
TileMap[x][y].attr_skill = 0;
else if(result!= NULL && result->skillno == 6) // npc積己 器牢飄 包訪 單撈磐牢 版快
{
if( result->type_Num == npc_from )
{
result->type_Num = npc_to;
}
}
}
}
}
}
void DeleteAllSkillData( void )
{
for( int i = 0 ; i < 8 ; i ++ )
{
for( int j = 0 ; j < 8 ; j ++ )
{
while( Header[i][j] )
{
DeleteSkill( &Header[i][j], Header[i][j] );
}
}
}
}
/*id DeleteAllSkillData( void )
{
for( int y=0; y<g_Map.file.wHeight; y++)
{
for(int x=0; x<g_Map.file.wWidth; x++)
{
lpMAPSKILLTABLE result;
if(TileMap[x][y].attr_skill == 1)
{
result=FindSkill(&Header[(int)(x/(int)((g_Map.file.wWidth+7)/8))][(int)(y/(int)((g_Map.file.wHeight+7)/8))], x, y);
if(result==NULL)
TileMap[x][y].attr_skill = 0;
else
{
TileMap[x][y].attr_skill = 0;
DeleteSkill(&Header[(int)(x/(int)((g_Map.file.wWidth+7)/8))][(int)(y/(int)((g_Map.file.wHeight+7)/8))], result);
}
}
}
}
}*/ // 0907 KHS
void DrawSkillBox(int mox, int moy)
{
int sx=(mox-Mapx)/TILE_SIZE*32;
int sy=(moy-Mapy)/TILE_SIZE*32;
Box( sx+1, sy+1, sx+TILE_SIZE-1, sy+TILE_SIZE-1, RGB(29,184,12));
}
BOOL LoadSkillMapTable(void)
{
int i=0;
char temp[FILENAME_MAX];
FILE *fp ;
MAPSKILLTABLE st;
int c=0;
int ret;
sprintf( temp, "./skill/%s.skb", MapName );
fp = Fopen( temp, "rb" );
if(fp == NULL) return FALSE;
int dx = (g_Map.file.wWidth+7)/8;
int dy = (g_Map.file.wHeight+7)/8;
while( !feof( fp ) )
{
ret = fread( &st, sizeof( MAPSKILLTABLE), 1, fp );
if( ret < 1 ) break;
int x = (int)(st.x / dx);
int y = (int)(st.y / dy);
TileMap[ st.x ][ st.y ].attr_skill = 1;
AddSkill( &Header[ x][y], &st );
c++;
}
fclose(fp);
return TRUE;
}
void MapSkillTool_Attr( int mx, int my ) //秦寸 鷗老狼 扁賤 加己藹 勸己 咯何 悸潑竊薦
{
if( mx < 0 ) return;
if( my < 0 ) return;
if( g_Map.file.wWidth <= mx ) return;
if( g_Map.file.wHeight <= my ) return;
LPTILE t = &TileMap[ mx][my];
if( g_MapSkillTable.skillno!=0 )
{
if( t->attr_skill==FALSE ) //秦寸 鷗老狼 扁賤 加己闌 彌檬肺 悸潑竅綽 版快
{
t->attr_skill = 1;
AddSkill( &Header[(int)(mx/(int)((g_Map.file.wWidth+7)/8))][(int)(my/(int)((g_Map.file.wHeight+7)/8))], &g_MapSkillTable);
}
else //秦寸 鷗老狼 扁賤 加己俊 撈固 加己撈 悸潑登絹 樂綽 版快
{
lpMAPSKILLTABLE result;
result=FindSkill( &Header[(int)(mx/(int)((g_Map.file.wWidth+7)/8))][(int)(my/(int)((g_Map.file.wHeight+7)/8))], mx, my);
if(result==NULL) return; //弊繁 老籃 絕擺瘤父 秦寸諒釬藹闌 愛綽 傅農(nóng)府膠飄 絕綽 版快
result->x = g_MapSkillTable.x;
result->y = g_MapSkillTable.y;
result->type = g_MapSkillTable.type;
result->skillno = g_MapSkillTable.skillno;
if(result->skillno == TOOL_DONTSKILL )
{
result->tile_Range = 0;
result->probability = 0;
result->type_Num = 0;
result->subType = 0;
}
else if(result->skillno == TOOL_BUILDHOUSE)
{
result->tile_Range = g_MapSkillTable.tile_Range;
result->probability = 0;
result->type_Num = 0;
result->subType = 0;
}
else
{
result->tile_Range = g_MapSkillTable.tile_Range;
result->probability = g_MapSkillTable.probability;
if(result->skillno == TOOL_NPC_GENER )
{
result->type_Num= g_MapSkillTable.type_Num;
result->subType = 0;
}
else
{
result->type_Num= 0;
result->subType = g_MapSkillTable.subType;
}
}
}
}
return;
}
void AddSkill( lpMAPSKILLTABLE *Header, lpMAPSKILLTABLE lpST ) //傅農(nóng)靛 府膠飄狼 贛府俊 嘿咯 持扁
{
lpMAPSKILLTABLE t, temp;
if( *Header == NULL ) //傅農(nóng)靛 府膠飄 彌檬 積己
{
MemAlloc( *Header, sizeof( MAPSKILLTABLE ));
(*Header)->type = lpST->type;
(*Header)->x = lpST->x;
(*Header)->y = lpST->y;
(*Header)->skillno = lpST->skillno;
(*Header)->tile_Range = lpST->tile_Range;
(*Header)->probability = lpST->probability;
(*Header)->type_Num = lpST->type_Num;
(*Header)->subType = lpST->subType;
(*Header)->prev = NULL;
(*Header)->next = NULL;
}
else //撈固 積己等 府膠飄俊 梅啊 楷搬/肺爹秦柯 單撈磐啊 樂闌 版快
{
t = NULL;
MemAlloc( t, sizeof( MAPSKILLTABLE ));
t->type = lpST->type;
t->x = lpST->x;
t->y = lpST->y;
t->skillno = lpST->skillno;
t->tile_Range = lpST->tile_Range;
t->probability = lpST->probability;
t->type_Num = lpST->type_Num;
t->subType = lpST->subType;
temp = *Header ;
temp->prev = t;
t->next = temp;
t->prev = NULL;
*Header = t;
}
/*
if(lpST->skillno == TOOL_FARMING || lpST->skillno == TOOL_MINING || lpST->skillno == TOOL_FISHING ||
lpST->skillno == TOOL_CHOPPING || lpST->skillno == TOOL_HUB )
{
t->tile_Range = lpST->tile_Range;
t->probability = lpST->probability;
t->type_Num = 0;
t->subType = lpST->subType;
}
else if(lpST->skillno == TOOL_NPC_GENER )
{
t->tile_Range = lpST->tile_Range;
t->probability = lpST->probability;
t->type_Num = lpST->type_Num;
t->subType = 0;
}
else if(lpST->skillno == TOOL_BUILDHOUSE )
{
t->tile_Range = lpST->tile_Range;
t->probability = 0;
t->type_Num = 0;
t->subType = 0;
}
temp = *Header ;
temp->prev = t;
t->next = temp;
t->prev = NULL;
*Header = t;
}
*/
}
void DeleteSkill( lpMAPSKILLTABLE *Header, lpMAPSKILLTABLE f)
{
lpMAPSKILLTABLE t = *Header;//g_lpMapSkillTable;
while( t != NULL )
{
if( t == f )
{
if( f == *Header ) //header啊 力芭登綽 版快
{
t = (*Header)->next;
if(*Header!=NULL)
MemFree( *Header );
if(t!=NULL)
{
*Header = t;
(*Header)->prev = NULL;
}
return;
}
else
{
if ( t->prev != NULL )
{
t->prev->next = t->next;
}
if( t->next != NULL )
{
t->next->prev = t->prev;
}
MemFree( t );
return;
}
}
t= t->next;
}
}
// 甘籃 例措諒釬...
// 010314 KHS
lpMAPSKILLTABLE FindSkill( lpMAPSKILLTABLE *H, int x, int y, int order )
{
int c = 0;
lpMAPSKILLTABLE t;
t = *H;
while( t != NULL )
{
if( t->x == x && t->y == y )
{
if( order == c ) return t;
c++;
}
t = t->next;
}
return NULL;
}
///////////////////////////// 0724 lkh 薦瀝 ///////////////////////////////
BOOL CALLBACK SkillToolproc( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam )
{
char temp[FILENAME_MAX];
static int map_X, map_Y;
static POINT checkON_Tile;
int i=0,j=0;
static int radio_Table;
static int skill_Tile_Range=DEF_SKILLTILE_RANGE;
int Farmming_Count;
int Mining_Count;
int Fishing_Count;
int Chopping_Count;
int Hub_Count;
int NPC_Count;
int NPCPositionCount;
int NPCEventCount;
int NPCNoEventCount;
static int delete_Type;
FILE *fp;
RECT rect, grect;
int tempmonsterno;
switch(Message)
{
case WM_INITDIALOG:
map_X=Mox/32;
map_Y=Moy/32;
sprintf (temp, "%d", g_MapSkillTable.skillno);
Edit_SetText (GetDlgItem(hDlg, IDC_VIEW_ATTRIB ), temp); //扁賤加己
sprintf (temp, "%d", g_MapSkillTable.x);
Edit_SetText (GetDlgItem(hDlg, IDC_INPUT_TILE_X ), temp); //急琶等 鷗老 輛諒釬
sprintf (temp, "%d", g_MapSkillTable.y);
Edit_SetText (GetDlgItem(hDlg, IDC_INPUT_TILE_Y ), temp); //急琶等 鷗老 染諒釬
sprintf (temp, "%d", g_MapSkillTable.tile_Range);
Edit_SetText (GetDlgItem(hDlg, IDC_INPUT_RANGE ), temp); //加己康氫撈 固摹綽 芭府(館瘤撫)
sprintf (temp, "%d", g_MapSkillTable.type_Num);
Edit_SetText (GetDlgItem(hDlg, IDC_VIEW_NPCNUM ), temp); //急琶等 NPC 鍋齲
//< CSD-030419
if (IsExistNpcSprNo(g_MapSkillTable.type_Num))
{
tempmonsterno = g_MapSkillTable.type_Num;
}
else
{
tempmonsterno = g_MapSkillTable.type_Num%100;
}
Edit_SetText(GetDlgItem(hDlg, IDC_MONSTER_NAME), g_infNpc[tempmonsterno].szName);
//> CSD-030419
sprintf (temp, "%d", g_MapSkillTable.probability);
Edit_SetText (GetDlgItem(hDlg, IDC_INPUT_PERCENT ), temp); //扁賤狼 己傍 咯何 犬伏
switch(delete_Type)
{
case 0:sprintf(temp, lan->OutputMessage(4,151));break;
case 1:sprintf(temp, lan->OutputMessage(4,152));break;
case 2:sprintf(temp,lan->OutputMessage(4,153) );break;
case 3:sprintf(temp, lan->OutputMessage(4,154));break;
case 4:sprintf(temp, lan->OutputMessage(4,155));break;
case 5:sprintf(temp, lan->OutputMessage(4,156));break;
case 6:sprintf(temp, lan->OutputMessage(4,157));break;
case 7:sprintf(temp, lan->OutputMessage(4,158));break;
}
// 扼叼坷 滾瓢 眉農(nóng)&免仿
switch( g_MapSkillTable.skillno )
{
case TOOL_FARMING : radio_Table = IDC_FARMING; break;
case TOOL_MINING : radio_Table = IDC_MINING; break;
case TOOL_FISHING : radio_Table = IDC_FISHING; break;
case TOOL_CHOPPING : radio_Table = IDC_CHOPPING; break;
case TOOL_HUB : radio_Table = IDC_HUB; break;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -