📄 ltssupprot.cpp
字号:
#include "stdafx.h"
#include "MyTypes.h" // LTS NEW LOCALWAR
#include "gameproc.h"
#include "NetWork.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 "NationSys.h"
#include <io.h>
#include "cScreenEffect.h" // LTS DRAGON
#include "Hangul.h"
#define BLUETEAM 1 // LTS DRAGONLORD
#define REDTEAM 2
extern void RecvCMD_LOCALWAR_CHAT(t_packet* p);// LTS NEW LOCALWAR
// Global Variable Define _______________________________________________________
int g_LocalWarBegin=0;
char g_SealStoneStatus[3][9];
short g_AreaCount[7][3];
unsigned short g_LocalWarPoint[3]={0,0,0}; // 020130 LTS
unsigned short g_LocalWarDefencePoint[3]={0,0,0}; // LTS NEW LOCALWAR
char g_LocalWarResult=0;
char* LocalWarInfoPicBuffer=NULL;
Spr LocalWarInfoPic[5]; // LTS BUG
char* ChairPicBuffer[3];
Spr ChairPic[3][8];
__int64 g_LocalWarRemainTime; // 020115 LTS
int g_EventLocalWarBegin=0; // 020115 LTS
DWORD g_dEventPoint=0; // LTS BUG
__int64 g_dEventRemainTime=0; // LTS BUG
char g_LocalWarMapMoveIndex=-1; // LTS NEW LOCALWAR
int g_ActionAnger=0; // LTS ACTION
// Glocal Variable Define End ___________________________________________________
// Extern Variable Define _______________________________________________________
extern char* g_DestBackBuf;
extern Spr SquadPic[3][5]; // LTS HORSERIDER
extern int g_nLButtonState; // LTS NEW LOCALWAR
// Extern Variable Define End ___________________________________________________
// Extern Function Define _______________________________________________________
extern void LoadHeroClothAccessoryDataOne( int sprno, int no );
extern LPCHARACTER FindHim(int ServerID);
extern Spr* GetSprOfMenu( int type, int nImageNumber );
extern void PutCompressedImage(int x, int y, Spr *sp );
extern void PutCompressedImageFX(int x, int y, Spr *sp, DWORD alpha, DWORD op);
extern void PutCompressedImageShadow(int x, int y, Spr *sp );
extern void Hcolor( WORD color );
extern void HprintBold( int x, int y, int fc, int bc, char *s, ... );
extern int convert565to555_LoadSprite(Spr *sp);
extern void GetTime(DWORD RemainTime,WORD& Hour,WORD& Min,WORD& Sec);
// Extern Function Define End ___________________________________________________
int GetNationIndex(int Nation)
{
switch(Nation)
{
case NW_BY : return 0;
case NW_ZY : return 1;
case NW_YL : return 2;
}
return 0;
}
void DrawLocalWarDefeat(int ImageType,int MenuNumber,int BaseX,int BaseY) // LTS NEW LOCALWAR
{
POINTS DefeatPoint[3]= { {55,108},{174,242}, {336,172}};
Spr* DefeatSpr;
if (g_LocalWarDefencePoint[0]==0)
{
DefeatSpr=GetSprOfMenu(ImageType,36);
int BaseXX=BaseX+DefeatSpr->ox+DefeatPoint[0].x;
int BaseYY=BaseY+DefeatSpr->oy+DefeatPoint[0].y;
if (DefeatSpr) PutCompressedImage(BaseXX,BaseYY, DefeatSpr );
}
if (g_LocalWarDefencePoint[1]==0)
{
DefeatSpr=GetSprOfMenu(ImageType,36);
int BaseXX=BaseX+DefeatSpr->ox+DefeatPoint[1].x;
int BaseYY=BaseY+DefeatSpr->oy+DefeatPoint[1].y;
if (DefeatSpr) PutCompressedImage(BaseXX,BaseYY, DefeatSpr );
}
if (g_LocalWarDefencePoint[2]==0)
{
DefeatSpr=GetSprOfMenu(ImageType,36);
int BaseXX=BaseX+DefeatSpr->ox+DefeatPoint[2].x;
int BaseYY=BaseY+DefeatSpr->oy+DefeatPoint[2].y;
if (DefeatSpr) PutCompressedImage(BaseXX,BaseYY, DefeatSpr );
}
}
void DrawLocalWarJoinInterface(int ImageType,int MenuNumber,int BaseX,int BaseY) // LTS NEW LOCALWAR
{
const POINT MapPoint[7][12]={
{ {0,5},{0,6},{0,7},{0,8},{1,5},{1,6},{1,7},{1,8},{2,5},{2,6},{2,7},{2,8} }, // 措檬盔
{ {0,2},{0,3},{0,4},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0} }, // 绒促牢绊俺 {4.0} 后磊丰
{ {1,2},{1,3},{1,4},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0} }, // 饭呈胶寇何
{ {2,2},{2,3},{2,4},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0} }, // 措沥臂
{ {0,0},{0,1},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0} }, // 绒促牢碍
{ {1,0},{1,1},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0} }, // 漠扼老付阑
{ {2,0},{2,1},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0},{4,0} } }; // 技甸饭胶
const POINT Locate[3][9]= { // Interface Sealstone Locate x,y
{ {143,289},{ 87,283},{140,302},{ 61,302},{100,307},{ 88,298},{ 75,313},{ 67,300},{ 78,278} },
{ { 85,308},{119,311},{ 85,305},{ 90,327},{120,303},{124,342},{ 99,336},{136,332},{113,324} },
{ { 89,283},{112,329},{128,350},{117,314},{ 89,286},{168,270},{144,262},{123,269},{133,286} } };
const char SprNo[3][2]={ {21,20}, {17,16},{19,18} }; // 磷菌促, 混疽促
const char MatchTBL[7]= { 15, 9,11,14,10,12,13 };
Spr* s;
s=GetSprOfMenu(ImageType, MatchTBL[MenuNumber]);
if (s) PutCompressedImage(BaseX+s->ox+15,BaseY+s->oy+239, s );
for (int i=0;i<12;i++)
{
if (MapPoint[MenuNumber][i].x<=2) //单捞磐啊 乐绰巴
{
if (g_SealStoneStatus[MapPoint[MenuNumber][i].x][MapPoint[MenuNumber][i].y]) //混酒乐促
{
s=GetSprOfMenu(ImageType,SprNo[MapPoint[MenuNumber][i].x][1]);
}
else
{
s=GetSprOfMenu(ImageType,SprNo[MapPoint[MenuNumber][i].x][0]);
}
if (s) PutCompressedImage(
BaseX+s->ox+Locate[MapPoint[MenuNumber][i].x][MapPoint[MenuNumber][i].y].x,
BaseY+s->oy+Locate[MapPoint[MenuNumber][i].x][MapPoint[MenuNumber][i].y].y, s );
}
}
Hcolor( FONT_COLOR_NUMBER );
Hprint2( BaseX+410, BaseY+290, g_DestBackBuf, lan->OutputMessage(0,333),g_AreaCount[MenuNumber][0] );
Hprint2( BaseX+410, BaseY+320, g_DestBackBuf, lan->OutputMessage(0,333),g_AreaCount[MenuNumber][1] );
Hprint2( BaseX+410, BaseY+350, g_DestBackBuf, lan->OutputMessage(0,333),g_AreaCount[MenuNumber][2] );
}
void DrawWinSpr()
{
static char count=0;
if (count>120)
{
g_LocalWarResult=0;
count=0;
return;
}
switch(count)
{
case 0 :
case 104 : MP3(2211); break;
case 44 : MP3(2204); break;
case 60 : MP3(60); break;
}
Spr* s=GetSprOfMenu( FIGHT_MAP_WIN,count);
Spr* sfx=GetSprOfMenu( FIGHT_MAP_WIN,count+1);
if (s) PutCompressedImage(370,250, s );
if (sfx) PutCompressedImageFX(370,250, sfx,17,2 );
count+=2;
}
void DrawLooseSpr()
{
static char count=0;
if (count>90)
{
g_LocalWarResult=0;
count=0;
return;
}
switch(count)
{
case 22 :
case 32 : MP3(302); break;
case 70 : MP3(2203); break;
case 84 : MP3(252); break;
}
Spr* s=GetSprOfMenu( FIGHT_MAP_LOSE,count);
Spr* sfx=GetSprOfMenu( FIGHT_MAP_LOSE,count+1);
if (s) PutCompressedImage(380,270, s );
if (sfx) PutCompressedImageFX(380,270, sfx,17,2 );
count+=2;
}
void LocalWarInfoDisPlay() // LTS BUG // LTS NEW LOCALWAR
{ //< CSD-030723
Spr* s = NULL;
WORD Hour = 0, Min= 0, Sec= 0;
if (g_LocalWarBegin&&Hero->JoinLocalWar)
{
const int iClockX = 710;
s=&LocalWarInfoPic[0];
if(s){::PutCompressedImage(iClockX+s->ox+5 ,s->oy+7+40, s );}
GetTime(g_LocalWarRemainTime-(g_ClientTime/1000),Hour,Min,Sec); // 020115 LTS
::HprintBold( iClockX+32, 55, ::Convert16to32(FONT_COLOR_WHITE) ,::Convert16to32(FONT_COLOR_BLACK),
"[%02d:%02d]",Hour,Min);
const int iByX = 520;
s=&LocalWarInfoPic[1];
if (s) {PutCompressedImage(iByX+s->ox,s->oy+7, s );}
::HprintBold( iByX+32, 10, ::Convert16to32(FONT_COLOR_BLIGHT_BLUE) ,::Convert16to32(FONT_COLOR_BLACK),
"DP:<%4d>",g_LocalWarDefencePoint[0] );
::HprintBold( iByX+32, 25, ::Convert16to32(FONT_COLOR_BLIGHT_BLUE), ::Convert16to32(FONT_COLOR_BLACK),
"WP:[%4d]",g_LocalWarPoint[0] );
const int iZyX = 615;
s=&LocalWarInfoPic[2];
if (s) {PutCompressedImage(iZyX+s->ox,s->oy+7, s );}
::HprintBold( iZyX+32, 10, ::Convert16to32(FONT_COLOR_BLIGHT_RED), ::Convert16to32(FONT_COLOR_BLACK),
"DP:<%4d>",g_LocalWarDefencePoint[1] );
::HprintBold( iZyX+32, 25, ::Convert16to32(FONT_COLOR_BLIGHT_RED), ::Convert16to32(FONT_COLOR_BLACK),
"WP:[%4d]",g_LocalWarPoint[1] );
const int iYlX = 710;
s=&LocalWarInfoPic[3];
if (s) {PutCompressedImage(iYlX+s->ox,s->oy+7, s );}
::HprintBold( iYlX+32, 10, ::Convert16to32(FONT_COLOR_SOLID_YELLOW), ::Convert16to32(FONT_COLOR_BLACK),
"DP:<%4d>",g_LocalWarDefencePoint[2] );
::HprintBold( iYlX+32, 25, ::Convert16to32(FONT_COLOR_SOLID_YELLOW), ::Convert16to32(FONT_COLOR_BLACK),
"WP:[%4d]",g_LocalWarPoint[2] );
}
switch (g_LocalWarResult)
{
case 0 : break;
case 1 : DrawWinSpr(); break; // WIN
case 2 : DrawLooseSpr(); break; // LOOSE
}
if ((MapNumber==39)&&(g_EventLocalWarBegin==3)) // 甘锅龋 捞寇俊 亮篮霸 绝促. ::stricmp甫 窍搁 加档啊 逞 蠢府促.
{
s=&LocalWarInfoPic[0];
if (s) PutCompressedImage(600+s->ox,s->oy+10, s );
s=&LocalWarInfoPic[4];
if (s) PutCompressedImage(700+s->ox,s->oy+10, s );
GetTime(g_dEventRemainTime-(g_ClientTime/1000),Hour,Min,Sec);
HprintBold( 650+30, 18, RGB(255, 255, 0),0, "[%02d:%02d:%02d]",Hour,Min,Sec);
HprintBold( 725+30, 18, RGB(255, 255, 0),0, "[%5d]",g_dEventPoint );
}
} //> CSD-030723
int LoadLocalWarInfoPic(char* FileName) // LTS BUG
{
FILE *fp;
short no;
DWORD sprfilelength, size;
DWORD nOff = 0;
int i;
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( LocalWarInfoPicBuffer != NULL ) return 0;
MemFree( LocalWarInfoPicBuffer ); // 0201 YGI
MemAlloc( LocalWarInfoPicBuffer, sprfilelength );
for( i = 0 ; i < 5 ; i ++)
{
s = &LocalWarInfoPic[i];
fread( &size, 4,1, fp);
if( size== 0 )
{
s->xl = 0;
s->yl = 0;
s->size = 0;
s->img = NULL;
continue;
}
fread( &(s->xl), sizeof( short ), 1, fp);
fread( &(s->yl), sizeof( short ), 1, fp);
//s->yl ++;
fread( &(s->ox), sizeof( short ), 1, fp);
fread( &(s->oy), sizeof( short ), 1, fp);
fread( &(s->size),sizeof( unsigned int ), 1, fp);
if( nOff + s->size >= sprfilelength )
{
JustMsg( "%s File Error !!",FileName);
ExitApplication(EA_LOAD_LOACL_WAR_INFO_SPR_DATA);
}
fread( LocalWarInfoPicBuffer + nOff, s->size, 1, fp);
s->img = LocalWarInfoPicBuffer + nOff;
convert565to555_LoadSprite( s );
nOff += size;
}
fclose(fp);
return sprfilelength;
}
void InitSitDownData() // 狼磊 滚欺狼 檬扁拳 // LTS SITDOWN BUG
{
ChairPicBuffer[0]=NULL; // 绝澜
ChairPicBuffer[1]=NULL; // 920001.DAT
ChairPicBuffer[2]=NULL; // 920002.DAT
}
int LoadChairPic(int ChairNum) // LTS SITDOWN BUG
{
FILE *fp;
short no;
DWORD sprfilelength, size;
DWORD nOff = 0;
int i;
Spr *s;
int length;
char FileName[MAX_PATH];
if (ChairNum<=0||ChairNum>2) return 0;
sprintf(FileName,"./char/92000%d.spr",ChairNum);
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( ChairPicBuffer[ChairNum] != NULL ) return 0;
MemFree( ChairPicBuffer[ChairNum]); // 0201 YGI
MemAlloc( ChairPicBuffer[ChairNum], sprfilelength );
for( i = 0 ; i < 8 ; i ++)
{
s = &ChairPic[ChairNum][i];
fread( &size, 4,1, fp);
if( size== 0 )
{
s->xl = 0;
s->yl = 0;
s->size = 0;
s->img = NULL;
continue;
}
fread( &(s->xl), sizeof( short ), 1, fp);
fread( &(s->yl), sizeof( short ), 1, fp);
//s->yl ++;
fread( &(s->ox), sizeof( short ), 1, fp);
fread( &(s->oy), sizeof( short ), 1, fp);
fread( &(s->size),sizeof( unsigned int ), 1, fp);
if( nOff + s->size >= sprfilelength )
{
JustMsg( "%s File Error !!",FileName);
ExitApplication(EA_LOAD_LOACL_CHAIR_SPR_DATA);
}
fread( ChairPicBuffer[ChairNum] + nOff, s->size, 1, fp);
s->img = ChairPicBuffer[ChairNum] + nOff;
convert565to555_LoadSprite( s );
nOff += size;
}
fclose(fp);
return sprfilelength;
}
void FreeLocalWarInfoPicBuffer()
{
MemFree( LocalWarInfoPicBuffer );
}
void FreeChairPicBuffer()
{
MemFree( ChairPicBuffer[0] );
MemFree( ChairPicBuffer[1] );
MemFree( ChairPicBuffer[2] );
}
extern int Mapx, Mapy; // 泅犁焊咯瘤绰 甘狼 矫累例措谅钎.
void DrawChair(LPCHARACTER ch) // LTS SITDOWN
{
const char CVTBL[8] = { 4,5,6,7,0,1,2,3 }; //胶橇扼捞飘 规氢苞 DIRECT狼 背沥抛捞喉
if (ch->ChairNum<=0||ch->ChairNum>2) return;
if (ChairPicBuffer[ch->ChairNum]==NULL)
{
LoadChairPic(ch->ChairNum);
}
Spr* s=&ChairPic[ch->ChairNum][ch->direction];
if (s)
{
PutCompressedImageShadow(ch->x-Mapx,ch->y-Mapy,s);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -