stoneage8.5/石器时代8.5客户端最新源代码/石器源码/CharTitle.cpp
2020-06-23 15:53:23 +08:00

404 lines
12 KiB
C++

#include "../systeminc/version.h"
#include "../systeminc/system.h"
#include "../systeminc/font.h"
#include "../systeminc/action.h"
#include "systeminc\sprdisp.h"
#include "systeminc\menu.h"
#include "systeminc\mouse.h"
#include "newproto\autil.h"
#include "newproto\protocol.h"
#ifdef _CHARTITLE_STR_
extern unsigned int sockfd;
typedef struct{
BOOL ;
BOOL ;
int ;
int ;
char [100][32];
int [100];
TITLE_STR title;//当前称号
TITLE_STR titledata[100];//称号数据
BOOL ;
};
extern int play_se(int tone, int x, int y);
;
void ()
{
if(.){
.=FALSE;
.=FALSE;
}else{
.=0;
.=TRUE;
.=FALSE;
}
}
extern void PutTitleText(int x,int y,char fontPrio,TITLE_STR str,BOOL hitFlag);
BOOL ()
{
return .;
}
void ()
{
if(.) .=FALSE;
else .=TRUE;
}
BOOL ()
{
return .title.flg;
}
void ()
{
if(.title.flg){
PutTitleText(78-.title.len/2,49,FONT_PRIO_FRONT,.title,0);
}
int bnt;
bnt = StockFontBuffer(18,49,1,FONT_PAL_GREEN," ",2);
if(mouse.onceState & MOUSE_LEFT_CRICK>0){
if(HitFontNo == bnt){
if(.) .=FALSE;
else .=TRUE;
play_se(203, 320, 240);
}
}
}
BOOL (ACTION * pct)
{
int x,y;
x = pct->x;
y = pct->y + 133;
int =-1;
int =-1;
int =-1;
int ID;
= StockDispBuffer( x -55, y + 7, DISP_PRIO_IME3, 55250, 2 );
= StockDispBuffer( x -20, y + 7, DISP_PRIO_IME3, 55251, 2 );
= StockDispBuffer( x+40, y + 7, DISP_PRIO_IME3, 55252, 2 );
if( mouse.onceState & MOUSE_LEFT_CRICK ){
if(!.){
if( == HitDispNo){
if(.){
.--;
}
}
if( == HitDispNo){
if(.!=19 && .titledata[(.+1)*5].flg)
{
.++;
}
}
if( == HitDispNo){
DeathAction(pct);
.=FALSE;
.=FALSE;
return TRUE;
}
}
}
int i=0;
int ;
for(;i<5;i++){
= .*5+i;
if(.titledata[].flg)
{
PutTitleText(380-.titledata[].len/2,43+i*0x20,FONT_PRIO_FRONT,.titledata[],0);
char [128];
sprintf_s(,"%03d",+1);
StockFontBufferExt(0x130,0x2D+i*0x20,1,FONT_PAL_GREEN,,0,19);
if(!.){
if(MakeHitBox(0x124,0x26+i*0x20,0x1B8,0x44+i*0x20,0x6D)==1){
StockFontBuffer(0x123,0xD1,2,0,.[],0);
if(mouse.onceState & MOUSE_LEFT_CRICK>0){
.=.[ ];
.=TRUE;
}
}
}
}else break;
}
if(.){
StockFontBuffer(0x123,0xD1,2,0,.[.],0);
StockFontBuffer(0x130,0x118,2,0,"确定使用该称号吗?",0);
StockDispBuffer(0x16D,0x130,0x6C,55253,1);//确定窗口底图
ID = StockDispBuffer(0x194,0x148,109,55252,2);//关闭
if(mouse.onceState & MOUSE_LEFT_CRICK>0){
if(ID == HitDispNo){
.=FALSE;
.=0;
}
}
ID = StockDispBuffer(0x148,0x148,109,55254,2);//确定
if(mouse.onceState & MOUSE_LEFT_CRICK>0){
if(ID == HitDispNo){
int checksum=0;
char buf[1024*4];
memset(buf,0,1024*4);
checksum += util_mkint(buf, .);
util_mkint(buf, checksum);
util_SendMesg(sockfd, LSSPROTO_CHARTITLE_SEND, buf);
.=FALSE;
.=0;
}
}
}
return FALSE;
}
extern void getCharTitleSplit( char *str,TITLE_STR* title);
void (char *)
{
char [126],[1024],[1024],[4000],[126];
memset(,0,126);
memset(,0,1024);
memset(,0,1024);
memset(,0,4000);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",1,,126);
getStringFromIndexWithDelim_body((char *) ,(char *)"|",1,,126);
int titleindex = atoi();
extern char* FreeGetTitleStr(int id);
if(titleindex>0) getCharTitleSplit(FreeGetTitleStr(titleindex),&.title);
else memset(&.title,0,sizeof(TITLE_STR));
getStringFromIndexWithDelim_body((char *) ,(char *)"|",2,,126);
int = atoi();
if(!=0){
memset(&.titledata,0,sizeof(.titledata[0])*100);
memset(&.,0,sizeof(int)*100);
memset(&.,0,32*100);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",2,,1024);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",3,,4000);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",4,,1024);
int i=0;
extern char* FreeGetTitleStr(int id);
for(i;i<;i++){
getStringFromIndexWithDelim_body((char *),(char *)"|",i+1,,126);
titleindex = atoi();
getCharTitleSplit(FreeGetTitleStr(titleindex),&.titledata[i]);
getStringFromIndexWithDelim_body((char *),(char *)"|",i+1,,126);
.[i]=atoi();
getStringFromIndexWithDelim_body((char *),(char *)"|",i+1,,126);
sprintf_s(.[i],32,"%s",);
}
}
}
void ()
{
memset(&,0,sizeof());
}
#endif
#ifdef _CHARTITLE_
extern unsigned int sockfd;
typedef struct{
int ;
ACTION *[5];
ACTION * ;
int ;
BOOL ;
int [100];
int [100];
char [100][32];
int ;
BOOL ;
int ;
};
;
void ()
{
int i=0;
for(i;i<5;i++){
if(.[i]){
if(.[i]) DeathAction(.[i]);
.[i]=0;
}
}
}
void ()
{
if(.){
();
.=FALSE;
.=FALSE;
}else{
.=0;
.=TRUE;
.=FALSE;
}
}
void ()
{
if(.)
if(!.){
if(. < 100000){
. = 0;
StockDispBuffer(0x7F,0x40,109,.,0);
}else{
. = MakeAnimDisp(0x7F,0x59,.,0);
}
}else if(*(int *)(.+0x140)!= .){
DeathAction(.);
if(. < 100000){
. = 0;
StockDispBuffer(0x7F,0x40,109,.,0);
}else{
. = MakeAnimDisp(0x7F,0x59,.,0);
}
}
}
BOOL (ACTION * pct)
{
int x,y;
x = pct->x;
y = pct->y + 133;
int =-1;
int =-1;
int =-1;
int ID;
= StockDispBuffer( x -55, y + 7, DISP_PRIO_IME3, 55250, 2 );
= StockDispBuffer( x -20, y + 7, DISP_PRIO_IME3, 55251, 2 );
= StockDispBuffer( x+40, y + 7, DISP_PRIO_IME3, 55252, 2 );
if( mouse.onceState & MOUSE_LEFT_CRICK ){
if(!.){
if( == HitDispNo){
if(.){
.--;
();
}
}
if( == HitDispNo){
if(.!=19 && .[(.+1)*5]){
.++;
();
}
}
if( == HitDispNo){
DeathAction(pct);
();
.=FALSE;
.=FALSE;
return TRUE;
}
}
}
int i=0;
int ;
for(;i<5;i++){
= .*5+i;
if(.[]){
if(!.[i]){
if(.[] < 100000){
.[i] = 0;
StockDispBuffer(0x16D+20,0x35+i*0x20,109,.[],0);
}else{
.[i] = MakeAnimDisp(0x16D+20,0x35+i*0x20,.[],0);
}
}else if(.==0) StockDispBuffer(0x16D,0x35+i*0x20,109,.[],0);
char [128];
sprintf_s(,"%03d",+1);
StockFontBufferExt(0x130,0x2D+i*0x20,1,FONT_PAL_GREEN,,0,16);
if(!.){
if(MakeHitBox(0x124,0x26+i*0x20,0x1B8,0x44+i*0x20,0x6D)==1){
StockFontBuffer(0x123,0xD1,2,0,.[],0);
if(mouse.onceState & MOUSE_LEFT_CRICK>0){
.=.[ ];
.=TRUE;
}
}
}
}else break;
}
if(.){
StockFontBuffer(0x123,0xD1,2,0,.[.],0);
StockFontBuffer(0x130,0x118,2,0,"确定使用该称号吗?",0);
StockDispBuffer(0x16D,0x130,0x6C,55253,1);//确定窗口底图
ID = StockDispBuffer(0x194,0x148,109,55252,2);//关闭
if(mouse.onceState & MOUSE_LEFT_CRICK>0){
if(ID == HitDispNo){
.=FALSE;
.=0;
}
}
ID = StockDispBuffer(0x148,0x148,109,55254,2);//确定
if(mouse.onceState & MOUSE_LEFT_CRICK>0){
if(ID == HitDispNo){
int checksum=0;
char buf[1024*4];
memset(buf,0,1024*4);
checksum += util_mkint(buf, .);
util_mkint(buf, checksum);
util_SendMesg(sockfd, LSSPROTO_CHARTITLE_SEND, buf);
.=FALSE;
.=0;
}
}
}
return FALSE;
}
void (ACTION* ID)//结束显示动画
{
.=FALSE;
();
if(.) DeathAction(.);
.=0;
DeathAction(ID);
}
void (char *)
{
char [126],[1024],[1024],[4000],[126];
memset(,0,126);
memset(,0,1024);
memset(,0,1024);
memset(,0,4000);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",1,,126);
getStringFromIndexWithDelim_body((char *) ,(char *)"|",1,,126);
int = atoi();
if() .=;
getStringFromIndexWithDelim_body((char *) ,(char *)"|",2,,126);
int = atoi();
if(!=0){
memset(&.,0,sizeof(int)*100);
memset(&.,0,sizeof(int)*100);
memset(&.,0,32*100);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",2,,1024);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",3,,4000);
getStringFromIndexWithDelim_body((char *) ,(char *)"#@",4,,1024);
int i=0;
for(i;i<;i++){
getStringFromIndexWithDelim_body((char *),(char *)"|",i+1,,126);
.[i]=atoi();
getStringFromIndexWithDelim_body((char *),(char *)"|",i+1,,126);
.[i]=atoi();
getStringFromIndexWithDelim_body((char *),(char *)"|",i+1,,126);
sprintf_s(.[i],32,"%s",);
}
}
}
void ()
{
memset(&,0,sizeof());
}
#endif