📄 nationsys.cpp
字号:
#include "stdafx.h"
#include "gameproc.h"
#include "NetWork.h"
#include "NationSys.h"
#include "menu.h"
#include "SmallMenu.h"
#include "map.h"
#include "LineCommand.h"
#include "DirectSound.h"
#include "tool.h"
#include "hong_sub.h"
#include "NATIONSUPPORT.H"//010910 LSW
#include <io.h>
extern void RecvCMD_SQUAD_CHAT(t_packet* p);
// Gloabl Variable
cNation* g_pNation=NULL;
CDontManager* g_pDontManager=NULL;
int g_Squad=1; // 唱吝俊 努贰胶俊 器窃茄促. //何措牢磐其捞胶 坷锹 窍扁困茄 单捞磐
int g_Commander=0; // 荤飞包 牢磐抛捞胶 坷锹窍扁困茄 单捞磐
int g_AttackNation=0; // 傍拜惫 惫啊锅龋 // 傈里磐俊 甸绢艾阑锭 技飘等促
int g_DefenceNation=0; // 规绢惫 惫啊锅龋
int g_ObjectWarfieldNo=0; // 2-4扁埃(捧钎->傈里) 鳖瘤狼 措惑 傈里磐 锅龋
int g_ObjectWarfieldStatus=0; // 秦寸 傈里磐狼 惑怕
int g_CommanderCandidaterLevel=0; //唱吝俊 官槽促..
bool g_bWarBegin=false; // RecvCMD_WAR_START,END俊辑 荤侩
bool g_bNewWarBegin=false;
int g_SquadLoadingPoint; //肺爹器牢飘 锅龋 // 何犁皋春俊辑 荤侩窍绰 烙矫 历厘侩 单捞鸥
int g_SquadNum; //何措皋春 // 付蛮啊瘤
extern SHN SHideNomal[MAX_SHN][MAX_SHN_FIELD];//011004 lsw
// Tile Concern__________________________________________________________________________________ // 010906 LTS
const POINTS Map0_133[MAP0_133]={ // 010927 LTS
{131,259},{131,260},{131,261},{131,262},{131,263},{131,264},{131,265},
{131,266},{132,258},{132,259},{132,260},{132,261},{132,262},{132,263},
{132,264},{132,265},{133,257},{133,258},{133,259},{133,260},{133,261},
{133,262},{133,263},{133,264},{134,256},{134,257},{134,258},{134,259},
{134,260},{134,261},{134,262},{134,263} };
const POINTS Map0_138[MAP0_138]={
{135,255},{135,256},{135,257},{135,258},{135,259},{135,260},{135,261},
{135,262},{136,255},{136,256},{136,257},{136,258},{136,259},{136,260},
{136,261},{137,256},{137,257},{137,258},{137,259},{137,260},{138,257},
{138,258},{138,259},{139,258} };
const POINTS Map0_203[MAP0_203] ={
{200,192},{200,193},{200,194},{200,195},{200,196},{200,197},{200,198},
{200,199},{201,192},{201,193},{201,194},{201,195},{201,196},{201,197},
{201,198},{202,193},{202,194},{202,195},{202,196},{202,197},{203,194},
{203,195},{203,196},{204,195} };
const POINTS Map0_198[MAP0_198] = {
{199,193},{199,194},{199,195},{199,196},{199,197},{199,198},{199,199},
{199,200},{198,194},{198,195},{198,196},{198,197},{198,198},{198,199},
{198,200},{198,201},{197,195},{197,196},{197,197},{197,198},{197,199},
{197,200},{197,201},{197,202},{196,196},{196,197},{196,198},{196,199},
{196,200},{196,201},{196,202},{196,203},{195,196},{195,197} };
const POINTS Map0_263[MAP0_263] ={
{261,133},{261,134},{261,135},{261,136},{261,137},{261,138},{261,139},
{261,140},{262,132},{262,133},{262,134},{262,135},{262,136},{262,137},
{262,138},{262,139},{263,131},{263,132},{263,133},{263,134},{263,135},
{263,136},{263,137},{263,138},{264,130},{264,131},{264,132},{264,133},
{264,134},{264,135},{264,136},{264,137} };
const POINTS Map0_268[MAP0_268] ={ // 010927 LTS
{265,129},{265,130},{265,131},{265,132},{265,133},{265,134},{265,135},
{265,136},{266,129},{266,130},{266,131},{266,132},{266,133},{266,134},
{266,135},{267,130},{267,131},{267,132},{267,133},{267,134},{268,131},
{268,132},{268,133} };
//________________________________________________________________________________________________ // 010906 LTS
//________________________________________________________________________________________________ // 010915 LTS
const POINTS Map1_450[MAP1_450]=
{ {451,521},{451,522},{451,523},{451,524},{451,525},{451,526},
{450,522},{450,523},{450,524},{450,525},{450,526},{450,527},
{449,523},{449,524},{449,525},{449,526},{449,527},{449,528},
{448,524},{448,525},{448,526},{448,527},{448,528},{448,529},
{447,525},{447,526},{447,527},{447,528},{447,529},{446,526},
{446,527},{446,527} };
const POINTS Map1_527[MAP1_527]= // 010927 LTS
{ {528,525},{528,526},{528,527},{528,528},{528,529},{528,530},
{527,526},{527,527},{527,528},{527,529},{527,530},{527,531},
{526,527},{526,528},{526,529},{526,530},{526,531},{526,532},
{525,528},{525,529},{525,530},{525,531},{525,532},{525,533},
{524,529},{524,530},{524,531},{524,532},{524,533},{523,530},
{523,531},{523,532} };
const POINTS Map1_524[MAP1_524]=
{ {525,451},{525,452},{525,453},{525,454},{525,455},{525,456},
{524,452},{524,453},{524,454},{524,455},{524,456},{524,457},
{523,453},{523,454},{523,455},{523,456},{523,457},{523,458},
{522,454},{522,455},{522,456},{522,457},{522,458},{522,459},
{521,455},{521,456},{521,457},{521,458},{521,459},{520,456},
{520,457},{520,458} };
const POINTS Map1_E450[15]=
{ {451,523},{451,524},{451,525},{450,524},{450,525},{450,526},
{449,525},{449,526},{449,527},{448,526},{448,527},{448,528},
{447,527},{447,528},{447,529} };
const POINTS Map1_E527[15]=
{ {528,527},{528,528},{528,529},{527,528},{527,529},{527,530},
{526,529},{526,530},{526,531},{525,530},{525,531},{525,532},
{524,531},{524,532},{524,533} };
const POINTS Map1_E524[15]=
{ {525,453},{525,454},{525,455},{524,454},{524,455},{524,456},
{523,455},{523,456},{523,457},{522,456},{522,457},{522,458},
{521,457},{521,458},{521,459} };
//________________________________________________________________________________________________ // 011015 LTS
const POINTS Map2_114[MAP2_114]=
{
{112,165},{113,164},{114,163},{112,164},{113,163},{114,162},
{112,163},{113,162},{114,161},{112,162},{113,161},{114,160},
{112,161},{113,160},{114,159},{111,161},{112,160},{113,159},
{114,158},{111,160},{112,159},{113,158},{114,157},{110,160},
{111,159},{112,158},{113,157},{114,156} };
const POINTS Map2_119[MAP2_119]=
{
{115,162},{116,161},{117,160},{118,159},{119,158},{115,161},
{116,160},{117,159},{118,158},{115,160},{116,159},{117,158},
{118,157},{115,159},{116,158},{117,157},{118,156},{115,158},
{116,157},{117,156},{118,155},{115,157},{116,156},{117,155},
{118,154},{115,156},{116,155},{117,154},{118,153},{115,155},
{116,154},{117,153} };
const POINTS Map2_151[MAP2_151]=
{
{149,130},{150,129},{151,128},{152,127},{149,129},{150,128},
{151,127},{152,126},{149,128},{150,127},{151,126},{152,125},
{149,127},{150,126},{151,125},{152,124},{149,126},{150,125},
{151,124},{152,123},{149,125},{150,124},{151,123},{152,122},
{149,124},{150,123},{151,122},{152,121},{148,124},{149,123},
{150,122},{151,121},{152,120} };
const POINTS Map2_156[MAP2_156]=
{
{153,126},{154,125},{155,124},{156,123},{153,125},{154,124},
{155,123},{156,122},{153,124},{154,123},{155,122},{153,123},
{154,122},{155,121},{153,122},{154,121},{155,120},{153,121},
{154,120},{155,119},{153,120},{154,119},{155,118},{153,119},
{154,118},{155,117} };
const POINTS Map2_274[MAP2_274]=
{
{272,286},{273,285},{274,284},{275,283},{272,285},{273,284},
{274,283},{275,282},{272,284},{273,283},{274,282},{275,281},
{272,283},{273,282},{274,281},{275,280},{272,282},{273,281},
{274,280},{275,279},{271,282},{272,281},{273,280},{274,279},
{275,278},{271,281},{272,280},{273,279},{274,278},{275,277},
{270,281},{271,280},{272,279},{273,278},{274,277},{275,276} };
const POINTS Map2_279[MAP2_279]=
{
{276,282},{277,281},{278,280},{279,279},{276,281},{277,280},
{278,279},{279,278},{276,280},{277,279},{278,278},{276,279},
{277,278},{278,277},{276,278},{277,277},{276,277},{277,276},
{276,276},{276,275} };
const POINTS Map2_E114[8]=
{ {112,165},{113,164},{114,163},{115,162},{112,164},{113,163},
{114,162},{115,161} };
const POINTS Map2_E119[8]=
{ {116,161},{117,160},{118,159},{119,158},{116,160},{117,159},
{118,158},{119,157} };
const POINTS Map2_E151[8]=
{ {149,129},{150,128},{151,127},{152,126},{149,128},{150,127},
{151,126},{152,125} };
const POINTS Map2_E156[9]=
{ {153,125},{154,124},{155,123},{156,122},{157,121},{153,124},
{154,123},{155,122},{156,121} };
const POINTS Map2_E274[8]=
{ {272,285},{273,284},{274,283},{275,282},{272,284},{273,283},
{274,282},{275,281} };
const POINTS Map2_E279[8]={ {276,281},{277,280},{278,279},{279,278},{276,280},{277,279},
{278,278},{279,277} };
//________________________________________________________________________________________________ // 011015 LTS
// Extern Variable Definition
extern SMENU SMenu[MAX_MENU];
extern DEVELOPE_ENVIR SysInfo;
// Extern Function Definition
extern void ShowComeOutGM(char *name);
extern void AddCurrentStatusMessage( BYTE r, BYTE g, BYTE b, char *msg, ... ); // CSD-030324
extern void LoadHeroClothAccessoryDataOne( int sprno, int no );
extern void FreeHeroClothAccessoryDataOne( int sprno, int no );
extern void InsertMagic(LPCHARACTER lpChar_Own, LPCHARACTER lpChar_Target, int magicNum, int magicSubNum, int s_X, int s_Y, int t_X, int t_Y, bool firePattern=0, int next_Effect=0, bool failed=0, DWORD dwDuration = 0);
extern LPCHARACTER ExistHe( char *name ); // 郴 矫具俊 粮犁窍绰 逞牢瘤 舅酒焊绰 风凭
extern int convert565to555(Spr *sp);
extern int convert565to555_LoadSprite(Spr *sp);
extern void PutCompressedImageFX(int x, int y, Spr *sp, DWORD alpha, DWORD op);
extern void PutCompressedImage(int x, int y, Spr *sp );
extern int CheckHandleByLTSSupport(t_packet* p); // 011201 LTS // LTS MENU
extern void SendCMD_LOCALWAR_STATUS(); // LTS LOCALWAR
extern int LoadLocalWarInfoPic(char* FileName); // LTS LOCALWAR
extern int LoadChairPic(int ChairNum); // LTS SITDOWN BUG
extern void InitSitDownData();
extern void FreeLocalWarInfoPicBuffer(); // LTS LOCALWAR
extern void FreeChairPicBuffer(); // LTS SITDOWN
extern int GetNationIndex(int Nation); // LTS HORSERIDER
char* SquadPicBuffer=NULL;
Spr SquadPic[3][5];
void WarControl(char* Arg) // 011025 LTS
{
t_packet packet; // Ex) /W 0 0 (View) // 魂吝傈里磐狼 惑怕甫 夯促
char Active; // /W 1 0 1 // 魂吝傈里磐甫 Active肺 技飘茄促.
// /W 1 0 0 // 魂吝傈里磐甫 DeActive肺 技飘茄促.
char Type=Arg[0]-48;
char WarfieldNo=Arg[2]-48;
if (Type) Active=Arg[4]-48; // Set // 傍鄂 促澜
if( GetSysInfo( SI_GAME_MAKE_MODE ) ) // 霸烙力累 葛靛 老锭父 敬促..
{
if (!Type) // View
{
packet.h.header.type=CMD_WAR_CONTROL;
packet.u.NationWar.WarControl.Type=Type;
packet.u.NationWar.WarControl.WarfieldNo=WarfieldNo;
packet.u.NationWar.WarControl.Status=0; // 焊尘锭绰 鞘夸绝绰 沥焊促
packet.u.NationWar.WarControl.Active=0; // View俊辑绰 鞘夸绝绰 沥焊捞促.
packet.h.header.size=sizeof(t_WarControl);
AddCurrentStatusMessage( 255,255,0,"Request : Request Current Warfield Loop Status...");
}
else // Set
{
packet.h.header.type=CMD_WAR_CONTROL;
packet.u.NationWar.WarControl.Type=Type;
packet.u.NationWar.WarControl.WarfieldNo=WarfieldNo;
packet.u.NationWar.WarControl.Status=0; // 焊尘锭绰 鞘夸绝绰 沥焊促
packet.u.NationWar.WarControl.Active=Active;
packet.h.header.size=sizeof(t_WarControl);
AddCurrentStatusMessage( 255,255,0,"Request :Setting current warfield loop status to [%d]",Active);
}
QueuePacket(&packet,1);
}
}
void WarLoopTime(char* Arg) // 011025 LTS
{
t_packet packet;
DWORD LoopTime;
char Type=Arg[0]-48;
char WarfieldNo=Arg[2]-48; // 傍鄂促澜
if (Type) LoopTime=atoi(&Arg[4]); // Set // 风橇鸥烙阑 涝仿罐绰促.
if (GetSysInfo( SI_GAME_MAKE_MODE ))
{
if (!Type) // View
{
packet.h.header.type=CMD_WAR_LOOP_TIME;
packet.u.NationWar.WarLoopTime.Type=Type;
packet.u.NationWar.WarLoopTime.WarfieldNo=WarfieldNo;
packet.u.NationWar.WarLoopTime.Status=0; //焊尘锭绰 鞘夸绝绰 沥焊捞促.
packet.u.NationWar.WarLoopTime.LoopTime=0; //焊尘锭绰 鞘夸绝绰 沥焊捞促.
packet.h.header.size=sizeof(t_WarLoopTime);
AddCurrentStatusMessage( 255,255,0,"Requesting current warfield loop time...");
}
else // Set
{
packet.h.header.type=CMD_WAR_LOOP_TIME;
packet.u.NationWar.WarLoopTime.Type=Type;
packet.u.NationWar.WarLoopTime.WarfieldNo=WarfieldNo;
packet.u.NationWar.WarLoopTime.Status=0; //焊尘锭绰 鞘夸绝绰 沥焊捞促.
packet.u.NationWar.WarLoopTime.LoopTime=LoopTime;
packet.h.header.size=sizeof(t_WarLoopTime);
AddCurrentStatusMessage( 255,255,0,"Requesting current warfield loop time to alter to [%d]",LoopTime);
}
QueuePacket(&packet,1);
}
}
void SendCMD_CHECK_AM_I_DEFEAT() //烙矫窃荐 // 011015 LTS
{
t_packet packet;
packet.h.header.type=CMD_CHECK_AM_I_DEFEAT;
packet.h.header.size=0;
QueuePacket(&packet,1);
if (Hero->name_status.nation==NW_YL) memset(&Hero->NWCharacter,0,sizeof(DWORD)); //老胶捞搁 檬扁拳 矫挪促 // 011020 LTS
}
void SendCMD_CHECK_DEFEAT()
{
t_packet packet;
packet.h.header.type=CMD_CHECK_DEFEAT;
packet.h.header.size=0;
QueuePacket(&packet,1);
memset(&Hero->NWCharacter,0,sizeof(DWORD));
}
void InitSquadPic()
{
for (int i=0;i<3;i++)
{
for (int j=0;j<4;j++)
{
SquadPic[i][j].img=NULL;
}
}
}
int LoadSquadPic(char* FileName)
{
FILE *fp;
short no;
DWORD sprfilelength, size;
DWORD nOff = 0;
int i,j;
Spr *s;
int length;
fp = Fopen(FileName,"rb" );
if( fp == NULL ) return 0;
fread( &no, 2,1, fp);
fseek( fp, no * 4, SEEK_CUR ); // 坷橇悸 胶诺
length = sprfilelength = _filelength( _fileno( fp) ) - no * 4 * 2 - 2;
if( SquadPicBuffer != NULL ) return 0;
MemFree( SquadPicBuffer ); // 0201 YGI
MemAlloc( SquadPicBuffer, sprfilelength );
for( i = 0 ; i < 3 ; i ++)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -