?? mousecursor.cpp
字號:
#include "stdafx.h"
#include <windows.h>
#include <windowsx.h>
#include <ddraw.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <Io.h>
#include "Dragon.h"
#include "Char.h"
#include "Tool.h"
#include "GameProc.h"
#include "Map.h"
#include "Hangul.h"
#include "DirectSound.h"
#include "Hong_Sprite.h"
#include "Hong_Light.h"
#include "Hong_Sub.h"
#include "Convert565to555.h"
#include "Skill.h"
#include "Item.h"
#define __MOUSE_CURSOR_H__
#include "MouseCursor.h"
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////
///// extern variables...
/////
extern SMENU SMenu[ MAX_MENU]; // menustart.cpp
extern Spr *SkillIcon;
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////
///// user variables...
/////
//////////// 0527 lkh 眠啊 ////////////
t_queue g_queue;
int CurMouseCursorNo = 1;
static int CurMouseCursorSpotX = 18, CurMouseCursorSpotY = 10;
static int CurMouseCursorStart, CurMouseCursorEnd, CurMouseCursorAni;
static int OldMouseCursorNo;
static int PushPopMoueCursor;
unsigned char *McBuf;
Spr mc[ MAX_MOUSE_CURSOR][20];
/* = {
{1,11},
{1,5},
{1,2},
{0,0},
{0,0},
{0,0},
{0,0},
{1,1},
{1,1},
{1,1}, // 10
{1,1},
{1,1},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0}, // 20
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{1,5},
{1,4},
{1,5}, // 30
{1,5},
{0,0},
{1,4},
{1,4},
{1,3},
{1,4},
{1,3},
{1,4},
{1,4},
{1,3}, // 40
{1,2},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0},
{0,0}}; // 49*/
void CursorNo( int no );
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
/////
///// user functions..
/////
void LoadCursorAni( void )
{
FILE *fp;
int i;
char temp[ FILENAME_MAX];
fp = Fopen( "./data/CursorAni.txt", "rt" );
if( fp )
{
for( i = 0 ; i < MAX_MOUSE_CURSOR ; i ++)
{
fgets( temp, FILENAME_MAX, fp );
sscanf( temp, "%d %d %d %d ", &cursorani[i].start,
&cursorani[i].end,
&cursorani[i].offx,
&cursorani[i].offy
);
}
fclose(fp);
fp = Fopen( "./data/CursorAni.b", "wb" );
if( fp )
{
fwrite( cursorani, sizeof(t_cursorani), MAX_MOUSE_CURSOR, fp );
fclose(fp);
}
}
else
{
fp = Fopen("./data/CursorAni.b", "rb" );
if( fp )
{
fread( cursorani, sizeof(t_cursorani), MAX_MOUSE_CURSOR, fp );
fclose(fp);
}
}
}
// 0810 KHS
void CurMouseCursorFrameCounter( void )
{
static int del;
del ++;
if( tool_MouseCursorBlock )
{
if( ++del >= 2 ) { CurMouseCursorAni ++; del = 0; }
if( CurMouseCursorAni > CurMouseCursorEnd )
CurMouseCursorAni = CurMouseCursorStart;
return;
}
switch( CurMouseCursorNo )
{
// 老館目輯.
case 1 : if( ++del >= 2 ) { CurMouseCursorAni ++; del = 0; }
if( CurMouseCursorAni > CurMouseCursorEnd )
CurMouseCursorAni = CurMouseCursorStart;
break;
// 老館棱扁難輯.
case 2 : if( ++del >= 2 ) { CurMouseCursorAni ++; del = 0; }
if( CurMouseCursorAni > CurMouseCursorEnd ) CurMouseCursorAni = CurMouseCursorEnd;
break;
// 付快膠狼 撈悼器牢飄
case 3 : if( ++del >= 2 ) { CurMouseCursorAni ++; del = 0; }
if( CurMouseCursorAni > CurMouseCursorEnd )
{
CursorNo( 1 );
}
break;
case 53 : CurMouseCursorAni ++;
if( CurMouseCursorAni > CurMouseCursorEnd )
{
CursorNo( 1 );
}
break;
default : CurMouseCursorAni = CurMouseCursorStart;
break;
}
}
void GetImageBox( char *backbuf, char *ground, int sx, int sy, int ex, int ey )
{
int xl = (ex - sx + 1) * 2;
int c=0;
for( ; sy <= ey ; sy ++)
{
memcpy( backbuf + c * xl, ground + sx * 2 + sy * dDxSize, xl );
c++;
}
}
void PutImageBox( char *backbuf, char *ground, int sx, int sy, int ex, int ey )
{
int xl = (ex - sx + 1) * 2;
int c=0;
for( ; sy <= ey ; sy ++)
{
memcpy( ground + sx * 2 + sy * dDxSize, backbuf + c * xl, xl );
c++;
}
}
/*
// 1撈 狼固竅綽巴籃 乞惑矯甫 富茄促.
// 1撈 甸絹擱 竊薦郴俊輯 傈捧惑怕,
// 扁夯惑怕俊 蝶扼 付快膠甫 官差霖促.
1 11 25 36 // 1 : 老館目輯
1 10 22 37 // 2 : 老館棱扁目輯
1 3 22 37 // 3 : 撈悼 Point 瓤苞
0 0 -7 0 // 4 : 老館 磐摹目輯
0 0 0 0 // 5 : 傈捧目輯
0 0 0 0 // 6 : 傈捧磐摹目輯1
1 1 -19 23 // 7 : 付過 目輯1
1 5 -24 2 // 8 : 拳擱 膠農費 目輯1
1 5 2 4 // 9 : 拳擱 膠農費 目輯2
1 5 20 15 // 10 : 拳擱 膠農費 目輯3
1 5 17 26 // 11 : 拳擱 膠農費 目輯4
1 8 -12 33 // 12 : 拳擱 膠農費 目輯5
1 5 -44 48 // 13 : 拳擱 膠農費 目輯6
1 5 -62 3 // 14 : 拳擱 膠農費 目輯7
1 5 -53 13 // 15 : 拳擱 膠農費 目輯8
1 10 22 20 // 16 : 膠懦老館目輯1
1 6 89 17 // 17 : 膠懦磐摹目輯1
1 8 -17 21 // 18 : 膠懦 稠磐摹 目輯
1 8 10 25 // 19 : 膠懦detect目輯1
1 4 25 31 // 20 : 膠懦OBPoint目輯
1 6 25 31 // 21 : 膠懦OBPoint磐摹目輯
1 10 23 20 // 22 : 膠懦Identified目輯
1 10 23 20 // 23 : 膠懦Identified磐摹目輯
1 10 23 20 // 24 : 膠懦瀾廄目輯
1 10 23 20 // 25 : 膠懦瀾廄磐摹
0 0 0 0 // 26 : 膠懦Hide目輯
1 8 -17 20 // 27 : 膠懦Hide 磐摹目輯
1 10 18 12 // 28 : 膠懦 火目輯
1 8 25 20 // 29 : 膠懦 炒目輯
1 8 7 21 // 30 : 膠懦 邦豹撈目輯
1 18 89 17 // 31 : 膠懦 超矯措目輯
1 6 -12 14 // 32 : 膠懦 累籃漠目輯
1 11 -37 -9 // 33 : 膠懦 弊股目輯
1 8 61 -27 // 34 : 膠懦 檔嘗目輯
1 5 44 14 // 35 : 膠懦 砰目輯
1 7 53 -6 // 36 : 膠懦 檔混漠目輯
1 7 0 0 // 37 : 膠懦 齲固目輯
1 5 78 37 // 38 : 膠懦 阜措扁目輯
1 9 -18 8 // 39 : 膠懦 快蠟烹目輯
1 5 0 11 // 40 : 膠懦 快蠟烹努腐目輯
1 4 -6 23 // 41 : 膠懦 啊困磐摹目輯
1 10 23 20 // 42 : 膠懦 鰓傅
1 10 23 20 // 43 : 膠懦 鰓傅 磐摹目輯
1 10 22 37 // 44 : 老館目輯拋滴府弧埃禍
1 10 22 37 // 45 : 老館棱扁目輯拋滴府弧埃禍
1 3 22 37 // 46 : 老館 磐摹目輯拋滴府弧埃禍
1 10 22 37 // 47 : 老館目輯檬廢禍
1 10 22 37 // 48 : 老館棱扁目輯檬廢禍
1 3 22 37 // 49 : 老館 磐摹目輯檬廢禍
1 9 -1 18 // 50 : 何剿倒
1 8 -17 21 // 51 : 撈悼器牢飄
0 0 0 0 // 52 : 付過 某膠潑 瓤苞
0 0 0 0 // 53 :
0 0 0 0 // 54 :
0 0 0 0 // 55 :
0 0 0 0 // 56 :
0 0 0 0 // 57 :
0 0 0 0 // 58 :
0 0 0 0 // 59 :
0 0 0 0 // 60 :
*/
void CursorStatus( void )
{
return;
static int cursor= -1, oldcursor;
oldcursor = cursor;
if( PushPopMoueCursor == 0 )
if( SkillStatus == SKILL_OFF || CurMouseCursorNo == 1 ) // 惑炔撈 嘎眠絹 免仿竅扼..
{
if( Hero->peacests == 0 )
{
if( g_GameInfo.lpcharacter )
{
switch( g_GameInfo.nSelectedSpriteType )
{
case SPRITETYPE_ON_THE_CEILING_CHAR :
case SPRITETYPE_MONSTER :
case SPRITETYPE_NPC :
case SPRITETYPE_CHARACTER : cursor = 4; // 老館 磐摹目輯
break;
}
}
else
{
cursor = 1;
}
}
else
{
if( g_GameInfo.lpcharacter )
{
switch( g_GameInfo.nSelectedSpriteType )
{
case SPRITETYPE_ON_THE_CEILING_CHAR :
case SPRITETYPE_MONSTER :
case SPRITETYPE_NPC :
case SPRITETYPE_CHARACTER : cursor = 6; // 傈捧磐摹目輯
break;
}
}
else
{
cursor = 5;
}
}
if( CursorCheckedItem ) cursor = 2; // 老館棱扁目輯
// 付過撈 難廉樂欄擱
if( Hero )
if( Hero->ready_Magic == 2 || Hero->ready_Magic == 3 ) cursor = 7; //付過 目輯1
if( TileMap[Mox / TILE_SIZE][ Moy/TILE_SIZE].attr_dont )
{
cursor = 44; // 44 : 老館目輯拋滴府弧埃禍
}
// BBD 031114 撈犯霸 登擱 g_MouseInMenu俊 皋春鍋齲甫 持籃 狼固啊 絕絹嚨
// 拌牢 PM 叢撈 狼檔茄 內靛甫 阜綽淀竅咯 烙矯肺 林籍貿府
/*
if( g_MouseInMenu == true )
{
}
*/
}
if( oldcursor != cursor ) // 付快膠目寂啊 官差菌欄擱....
{
CursorNo( cursor );
}
}
// 0810 KHS
void CursorNo( int no )
{
int x = 0, y = 0;
if( no == 0 ) return;
switch( no )
{
case 53 :
break;
default : if( no >=16 ) no /= 10;
break;
}
CurMouseCursorNo = no;
CurMouseCursorStart = cursorani[no-1].start;
CurMouseCursorEnd = cursorani[no-1].end;
CurMouseCursorSpotX = cursorani[no-1].offx;
CurMouseCursorSpotY = cursorani[no-1].offy;
CurMouseCursorAni = CurMouseCursorStart;
}
void PushMouseCursor( void )
{
if( 8 <= CurMouseCursorNo && CurMouseCursorNo <= 15 )
{
return;
}
if( PushPopMoueCursor ) return;
PushPopMoueCursor =1;
OldMouseCursorNo = CurMouseCursorNo;
}
void PopMouseCursor( void )
{
if( SMenu[MN_MAININTERFACE].bActive == FALSE ) return;
if( PushPopMoueCursor )
{
CursorNo( OldMouseCursorNo );
PushPopMoueCursor = 0;
}
}
extern void PutItemIcon(int x, int y, int item_number, int delay=0, int effect = 2, int is_not_equip = 0 );
extern POINT MouseItemInRect;
extern ItemAttr InvItemAttr[3][3][8];
extern ItemAttr EquipItemAttr[8];
extern ItemAttr QuickItemAttr[7];
void withSkillItem( void )
{
int x, y;
DWORD no;
if( SkillStatus != SKILL_READY ) return;
switch( SkillNo )
{
// Sow
case 22 : break;
default : return;
}
x = g_pointMouseX + CurMouseCursorSpotX;
y = g_pointMouseY + CurMouseCursorSpotY;
PutItemIcon( x, y + 20, SkillItemNo );
switch( SkillItemPOS.type )
{
case QUICK : no = QuickItemAttr[ SkillItemPOS.p3].attr[ IATTR_MUCH]; break;
case INV : no = InvItemAttr[ SkillItemPOS.p1][ SkillItemPOS.p2][ SkillItemPOS.p3].attr[ IATTR_MUCH]; break;
case EQUIP : no = EquipItemAttr[ SkillItemPOS.p3].attr[ IATTR_MUCH]; break;
default : return;
}
HprintBold( x, y+30, 0xffff, 0, "%2d", no );
}
void CursorDisplayBack( void )
{
if( MouseCursorOnOff == false ) return;// 扁賤矯傈吝.
if( SMenu[MN_LOGO_START].bActive==true ) return;
PmcSx = SCREEN_WIDTH;
PmcSy = SCREEN_HEIGHT;
PmcEx = PmcEy = 0;
Spr *s = &mc[ CurMouseCursorNo-1][ CurMouseCursorAni];
/* switch(CurMouseCursorNo)
{
case 1://sa
{
// s = FieldTypeNomalPut(int mx, int my, int x,int y,int nImageNumber, int type);
}break;
default :
{
s = &mc[ CurMouseCursorNo-1][ CurMouseCursorAni];
}break;
}*/
int sx = g_pointMouseX + CurMouseCursorSpotX - s->ox;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -