📄 gameproc.cpp
字号:
// 崔府绰档吝 500ms傈俊 付快胶啊 努腐登搁
temptime = ::timeGetTime();//::timeGetTime();
if( temptime - Movetime < 300 )
{
return;
}
if( Moveoldx == mx && Moveoldy == my )
{
if( mx != Hero->x/ TILE_SIZE || my != Hero->y/TILE_SIZE )
return;
}
//
// if( oldmovetype == 1 )
// {
// movetype = 1;
// if( oldx == mx && oldy == my ) return;
// }
// else
// {
// }
Movetime = temptime;
Moveoldx = mx;
Moveoldy = my;
memcpy( &t, Hero, sizeof( CHARACTER ) );
t.moveFlag = TRUE;
t.movetype = movetype;
t.gox = x;
t.goy = y;
t.destx = mx, t.desty = my;
if ( PathBuild( &t ) )
{
SettingDestPoint( x, y );
PathBuildSuccess = 1;
if( Hero )
// if( SysInfo.notconectserver )
{
Hero->moveFlag = TRUE;
Hero->gox = x;
Hero->goy = y;
Hero->movetype = movetype;
memcpy( Hero, &t, sizeof( CHARACTER ) );
if( movetype == 0 )
if( Hero->pathcount > 5 ) movetype = 1;
switch( movetype )
{
case 0 : if ( Hero->nCurrentAction != Hero->basicWalk )
{
Hero->nCurrentAction = Hero->basicWalk;
Hero->nCurrentFrame = 0;
}
break;
case 1 : if ( Hero->nCurrentAction != ACTION_RUN )
{
Hero->nCurrentAction = ACTION_RUN;
Hero->nCurrentFrame = 0;
}
break;
}
SendMoveData( &t );
}
else
{
t.moveFlag = FALSE;
t.gox = x;
t.goy = y;
SendMoveData( &t );
}
}
else
{
if( Hero->x != x || Hero->y != y ) // 促弗 磊府肺 捞悼窍妨 茄促搁.
if( Hero->x /TILE_SIZE == mx && Hero->y /TILE_SIZE == my )
{
Hero->gox = x;
Hero->goy = y;
Hero->moveFlag = TRUE;
Hero->movetype = 1;
if ( Hero->nCurrentAction != ACTION_RUN )
{
Hero->nCurrentAction = ACTION_RUN;
Hero->nCurrentFrame = 0;
}
}
if(!Hero->sex) //咯磊
PlayListAutoSounds( 80,0,0,0 ); // 捞悼角菩.
else
PlayListAutoSounds( 81,0,0,0 ); // 捞悼角菩.
}
}
else
{
if( Hero->x != x || Hero->y != y ) // 促弗 磊府肺 捞悼窍妨 茄促搁.
if( Hero->x /TILE_SIZE == mx && Hero->y /TILE_SIZE == my )
{
Hero->gox = x;
Hero->goy = y;
Hero->moveFlag = TRUE;
Hero->movetype = 1;
if ( Hero->nCurrentAction != ACTION_RUN )
{
Hero->nCurrentAction = ACTION_RUN;
Hero->nCurrentFrame = 0;
}
}
if(!Hero->sex) //咯磊
PlayListAutoSounds( 80,0,0,0 ); // 捞悼角菩.
else
PlayListAutoSounds( 81,0,0,0 ); // 捞悼角菩.
}
if(!IsHeroDead()) CheckNpcTalk(); // 0923 YGI 眠啊
}
/*
GetItemAttr( itemno, ITEM_KIND );
*/
void DoHeroAttack( int x, int y )
{
int minrange, maxrange, range;
int minormax;
int dx, dy;
int destx, desty;
LPCHARACTER d;
LPITEMGROUND i;
CHARACTER t;
AutoAttackx = x;
AutoAttacky = y;
if( IsDead( Hero) || Hero->nCurrentAction == ACTION_DIE )
{
PlayListAutoSounds( 82,0,0,0 ); // 捞悼角菩.
AddCurrentStatusMessage( 255,100,100,lan->OutputMessage(9,4) );
return;
}
if( SCharacterData.nCharacterSP == 0 )
{
PlayListAutoSounds( 82,0,0,0 ); // 捞悼角菩.
AddCurrentStatusMessage( 255,100,100,lan->OutputMessage(9,5) );//010215 lsw
return;
}
if( g_GameInfo.lpcharacter == NULL ) return;
minrange = AttackRangeTable[Hero->sprno][ Hero->accessory[ 2]][0];
maxrange = AttackRangeTable[Hero->sprno][ Hero->accessory[ 2]][1];
switch( g_GameInfo.nSelectedSpriteType )
{
case SPRITETYPE_ITEM : i = (LPITEMGROUND )(g_GameInfo.lpcharacter);
destx = i->x + i->offx;
desty = i->y + i->offy;
minormax = IsAttackRange( &minrange, &maxrange, Hero, destx, desty );
if( minormax == ATTACKRANGE_IN_AREA_ )
{
if( i->type == ITEMTYPE_COLOSSUS_STONE )
{
if( IsPossibleAttackColossusStone( i ) )
{
SendAttackColossusItem( i );
}
break;
}
else
{
if( Hero->sprno == 0 ) //咯磊捞搁.
{
switch( Hero->accessory[2] )
{
case 76 :case 77:case 78: case 79: // 劝捞唱 厚八牢版快肺 捞公扁绰 Magic贸府俊辑 Send窍霸等促.
Send_CMD_JUST_ATTACK_ANIMATION( i );
break;
default :
Send_CMD_ITEM_BOX_BREAK( i );
break;
}
}
else
{
switch( Hero->accessory[2] )
{
case 78: case 79:case 80 :case 81: // 劝捞唱 厚八牢版快肺 捞公扁绰 Magic贸府俊辑 Send窍霸等促.
Send_CMD_JUST_ATTACK_ANIMATION( i );
break;
default :
{
Send_CMD_ITEM_BOX_BREAK( i );
break;
}
}
}
}
return;
}
break;
case SPRITETYPE_ON_THE_CEILING_CHAR :
case SPRITETYPE_CHARACTER :
case SPRITETYPE_MONSTER :
case SPRITETYPE_NPC :
if( IsDead( g_GameInfo.lpcharacter ) ) return;
if( Hero == g_GameInfo.lpcharacter ) return;
if( g_GameInfo.lpcharacter->sprno == 100 ||
g_GameInfo.lpcharacter->sprno == 101 )
{
return;
}
d = g_GameInfo.lpcharacter;
destx = d->x;
desty = d->y;
////////////////////// 0609 lkh 眠啊(寒.厘局拱 第俊辑 傍拜窍绰 惑炔 阜扁困秦) ////////////////////////
minormax = IsAttackRange( &minrange, &maxrange, Hero, destx, desty );
if( TileLineCheck(destx, desty, Hero->x, Hero->y) ) //厘局拱捞 绝绰 版快
{
if (minormax == ATTACKRANGE_IN_AREA_)
{
CursorNo(53);
g_mgrBattle.SendPcAttack(Hero, g_GameInfo.lpcharacter);
return;
}
}
else
{
return;
}
break;
default : return;
}
switch( minormax )
{
//////////////////////// 0614 lkh 眠啊 /////////////////////
case ATTACKRANGE_IN_MIN_ : range = minrange + 16; break; //0525 lkh 荐摹 荐沥
case ATTACKRANGE_OUT_MAX_ : range = maxrange - 16; break; // "
case ATTACKRANGE_IN_AREA_ :
default : range = (minrange + maxrange)/2; break;
}
// if( ReturnAccesablePosition( Hero, destx, desty, Hero->x, Hero->y, range, &dx, &dy ) )
int ttt = 0;
if( DontMoveAttackFlag == FALSE )
if( Hero->nCurrentAction != Hero->basicWalk )
if ( ReturnXYNearPosition( &x, &y, &dx, &dy, range, Hero, destx, desty ) )
{
ttt = 1;
memcpy( &t, Hero, sizeof( CHARACTER ) );
t.moveFlag = TRUE;
t.movetype = 1;
//////////////////////// 0625 lkh 眠啊 ////////////////////////////
if(GetIndexOfCondition(SCharacterData.condition)==CC_DAZE) return;//去鄂惑怕
t.gox = x;
t.goy = y;
if( Hero->destx == dx && Hero->desty == dy ) return;
t.destx = dx, t.desty = dy;
if( PathBuild( &t ))
{
ttt = 2;
if( Hero )
{
memcpy( Hero, &t, sizeof( CHARACTER ) );
Hero->moveFlag = TRUE;
Hero->gox = x;
Hero->goy = y;
Hero->movetype = 1;
if( Hero->nCurrentAction != ACTION_RUN )
{
Hero->nCurrentAction = ACTION_RUN;
Hero->nCurrentFrame = 0;
}
SendMoveData( Hero );
}
else
{
t.moveFlag = FALSE;
t.gox = x;
t.goy = y;
SendMoveData( &t );
}
}
else
{
if( Hero->x != x || Hero->y != y ) // 促弗 磊府肺 捞悼窍妨 茄促搁.
{
if( (Hero->x - x)*(Hero->x - x)+(Hero->y - y)*(Hero->y - y) < 2048 ) // 鸥老窍唱 焊促 累篮 农扁 裹困.
{
//if( Hero->x /TILE_SIZE == dx && Hero->y /TILE_SIZE == dy )
Hero->gox = x;
Hero->goy = y;
Hero->moveFlag = TRUE;
Hero->movetype = 1;
if ( Hero->nCurrentAction != ACTION_RUN )
{
Hero->nCurrentAction = ACTION_RUN;
Hero->nCurrentFrame = 0;
}
}
}
}
}
}
int CheckLeftControlKey() // LTS ACTION
{
if (g_aCurrentKeys[DIK_LCONTROL] & 0x80) return true;
return false;
}
void DoHeroEvent( int x, int y )
{
int range = 100;
if (CheckLeftControlKey()) range=32; // LTS DRAGON MODIFY
int sx, sy, ex, ey;
int dx, dy;
if( Hero == NULL ) return;
if( IsDead( Hero ) ) return;
ex = ((LPCHARACTER)(Hero->lpAttacked))->x;
ey = ((LPCHARACTER)(Hero->lpAttacked))->y;
sx = Hero->x;
sy = Hero->y;
if( (ex-sx)*(ex-sx)+(ey-sy)*(ey-sy) > 20000 ) goto ACCESS_;
if( Hero == (LPCHARACTER)(Hero->lpAttacked) ) return;
if( CheckEventWith_NPC( Hero, (LPCHARACTER)(Hero->lpAttacked) ) == FALSE )
{
ACCESS_:
if ( ReturnXYNearNPC( &x, &y, &dx, &dy, range, Hero, (LPCHARACTER)(Hero->lpAttacked) ) )
{
g_ActionAnger=TRUE; // LTS ACTION
Hero->destx = dx, Hero->desty = dy;
if ( PathBuild( Hero ) )
{
// ### 辑滚俊 焊辰促.
if( SysInfo.notconectserver )
{
if ( Hero->nCurrentAction != Hero->basicWalk )
{
Hero->moveFlag = TRUE;
Hero->gox = x;
Hero->goy = y;
Hero->movetype = 0;
Hero->nCurrentAction = Hero->basicWalk;
Hero->nCurrentFrame = 0;
}
}
else
{
if(GetIndexOfCondition(SCharacterData.condition)==CC_DAZE) return;//去鄂惑怕
Hero->moveFlag = TRUE;
Hero->gox = x;
Hero->goy = y;
if( Hero->peacests )
{
Hero->movetype = 1;
}
else
{
if( Hero->pathcount > 5 ) Hero->movetype = 1;
else Hero->movetype = 0;
}
switch( Hero->movetype )
{
case 0 :
if ( Hero->nCurrentAction != Hero->basicWalk )
{
if (Hero->nCurrentAction!=ACTION_SITDOWN) // 011213 LTS
{
Hero->nCurrentAction = Hero->basicWalk;
Hero->nCurrentFrame = 0;
}
}
break;
case 1 :
if ( Hero->nCurrentAction != ACTION_RUN )
{
if (Hero->nCurrentAction!=ACTION_SITDOWN) // 011214 LTS
{
Hero->nCurrentAction = ACTION_RUN;
Hero->nCurrentFrame = 0;
}
}
break;
}
if (CheckLeftControlKey()) // LTS DRAGON MODIFY
{
LPCHARACTER tempch=(LPCHARACTER)(Hero->lpAttacked);
if (abs(tempch->x-Hero->x)<50&&abs(tempch->y-Hero->y)<50) //酒林啊鳖款 芭府俊 乐绢辑 菩胶呼靛啊 角菩茄版快
{
ChangeDirection(&Hero->direction,Hero->x,Hero->y,tempch->x,tempch->y);
SendAction(ACTION_ANGER,Hero->direction); // LTS ACTION
}
else
{
SendMoveData( Hero );
}
}
else
{
SendMoveData( Hero );
}
if( (LPCHARACTER)(Hero->lpAttacked) )
{
if( ((LPCHARACTER)(Hero->lpAttacked))->id < 10000 )
{
SendChatData( GreetingStr );
}
}
}
}
else
{
}
}
}
}
int NotNeededMouseLButtonClick( void )
{
if( Hero == NULL ) return 1;
if( g_StartMenuOn == TRUE ) return 1;
if( g_pointMouseY > GAME_SCREEN_YSIZE ) return 1;
if( g_MouseInMenu ) return 1; // 0306 YGI
return 0;
}
//////////////////////////////
//////////////////////////////// 0313 lkh 荐沥 ////////////////////////////////
///////////////////////// 捞痹绕 1220 /////////////////////////////
// 付快胶甫 努腐茄镑狼 Map谅钎甫 掘绰促.
// 父距 贱俊 秒窍搁 钧蹲茄镑狼 谅钎甫 霖促.
void MouseClickPosition( int *mx, int *my )
{
int distance_X=0;
int temp_Dist_X=0;
int distance_Y=0;
int temp_Dist_Y=0;
if(GetIndexOfCondition(SCharacterData.condition)==CC_DAZE) //去鄂惑怕 // 0116 YGI
{
////////////////////// 0331 lkh 荐沥 ////////////////////////
temp_Dist_X = abs(Hero->x - Mox);
temp_Dist_Y = abs(Hero->y - Moy);
if( temp_Dist_X < 32 ) temp_Dist_X=32;
if( temp_Dist_Y < 32 ) temp_Dist_Y=32;
distance_X = (temp_Dist_X*2) + ( ( rand() % temp_Dist_X / 2 ) - (temp_Dist_X/4) );
distance_Y = (temp_Dist_Y*2) + ( ( rand() % temp_Dist_Y / 2 ) - (temp_Dist_Y/4) );
switch(rand()%4)
{
case 0: //x 措莫
if(Hero->x > Mox)
Mox += distance_X;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -