📄 actor.pas
字号:
51: Result:=2880;
52: Result:=2960;
53: Result:=3020;
54..57: Result := (nAppr - 54) * 60 + 3070;
58: Result:=3270;
59: Result:=3290;
60: Result:=3330;
61..64: Result:=3350;
65: Result:=3430;
66: Result:=3450;
67: Result:=3500;
68: Result:=3570;
69..74: Result := (nAppr - 69) * 20 + 3610;
75: Result:=3730;
76: Result:=3810;
77..80: Result := (nAppr - 77) * 20 + 3850;
81: Result:=4070;
82: Result:=4110;
83: Result:=4150;
end;
end;
constructor TActor.Create;
begin
inherited Create;
FillChar(m_Abil,Sizeof(TAbility), 0);
FillChar(m_Action,SizeOf(m_Action),0);
m_MsgList := TGList.Create;
m_nRecogId := 0;
m_BodySurface := nil;
m_nGold := 0;
m_boVisible := TRUE;
m_boHoldPlace := TRUE;
//泅犁 柳青吝牢 悼累, 辆丰夌绢档 啊瘤绊 乐澜
//悼累狼 m_nCurrentFrame捞 m_nEndFrame阑 逞菌栏搁 悼累捞 肯丰等巴栏肺 航
m_nCurrentAction := 0;
m_boReverseFrame := FALSE;
m_nShiftX := 0;
m_nShiftY := 0;
m_nDownDrawLevel := 0;
m_nCurrentFrame := -1;
m_nEffectFrame := -1;
RealActionMsg.Ident := 0;
m_sUserName := '';
m_nNameColor := clWhite;
m_dwSendQueryUserNameTime := 0; //GetTickCount;
m_boWarMode := FALSE;
m_dwWarModeTime := 0; //War mode
m_boDeath := FALSE;
m_boSkeleton := FALSE;
m_boDelActor := FALSE;
m_boDelActionAfterFinished := FALSE;
m_nChrLight := 0;
m_nMagLight := 0;
m_boLockEndFrame := FALSE;
m_dwSmoothMoveTime := 0; //GetTickCount;
m_dwGenAnicountTime := 0;
m_dwDefFrameTime := 0;
m_dwLoadSurfaceTime := GetTickCount;
m_boGrouped := FALSE;
m_boOpenHealth := FALSE;
m_noInstanceOpenHealth := FALSE;
m_CurMagic.ServerMagicCode := 0;
//CurMagic.MagicSerial := 0;
m_nSpellFrame := DEFSPELLFRAME;
m_nNormalSound := -1;
m_nFootStepSound := -1; //绝澜 //林牢傍牢版快, CM_WALK, CM_RUN
m_nAttackSound := -1;
m_nWeaponSound := -1;
m_nStruckSound := s_struck_body_longstick; //嘎阑锭 唱绰 家府 SM_STRUCK
m_nStruckWeaponSound := -1;
m_nScreamSound := -1;
m_nDieSound := -1; //绝澜 //磷阑锭 唱绰 家府 SM_DEATHNOW
m_nDie2Sound := -1;
end;
destructor TActor.Destroy;
var
I: Integer;
Msg:pTChrMsg;
begin
for I := 0 to m_MsgList.Count - 1 do begin
Msg:=m_MsgList.Items[I];
Dispose(Msg);
end;
m_MsgList.Free;
inherited Destroy;
end;
//角色接收到的消息
procedure TActor.SendMsg(wIdent:Word; nX,nY, ndir,nFeature,nState:Integer;sStr:String;nSound:Integer);
var
Msg:pTChrMsg;
begin
New(Msg);
Msg.ident := wIdent;
Msg.x := nX;
Msg.y := nY;
Msg.dir := ndir;
Msg.feature := nFeature;
Msg.state := nState;
Msg.saying := sStr;
Msg.Sound := nSound;
m_MsgList.Lock;
try
m_MsgList.Add(Msg);
finally
m_MsgList.UnLock;
end;
end;
//用新消息更新(若已经存在)消息列表
procedure TActor.UpdateMsg(wIdent:Word; nX,nY, ndir,nFeature,nState:Integer;sStr:String;nSound:Integer);
var
I: integer;
Msg:pTChrMsg;
begin
m_MsgList.Lock;
try
I:= 0;
while TRUE do begin
if I >= m_MsgList.Count then break;
Msg:=m_MsgList.Items[I];
if ((Self = g_MySelf) and (Msg.Ident >= 3000) and (Msg.Ident <= 3099)) or (Msg.Ident = wIdent) then begin
Dispose(Msg);
m_MsgList.Delete(I);
Continue;
end;
Inc(I);
end;
finally
m_MsgList.UnLock;
end;
SendMsg (wIdent,nX,nY,nDir,nFeature,nState,sStr,nSound);
end;
//清除消息号在[3000,3099]之间的消息
procedure TActor.CleanUserMsgs;
var
I:Integer;
Msg:pTChrMsg;
begin
m_MsgList.Lock;
try
I:= 0;
while TRUE do begin
if I >= m_MsgList.Count then break;
Msg:=m_MsgList.Items[I];
if (Msg.Ident >= 3000) and //努扼捞攫飘俊辑 焊辰 皋技瘤绰
(Msg.Ident <= 3099) then begin
Dispose(Msg);
m_MsgList.Delete (I);
Continue;
end;
Inc(I);
end;
finally
m_MsgList.UnLock;
end;
end;
//计算动作的开始帧、帧数等
procedure TActor.CalcActorFrame;
var
haircount: integer;
begin
m_boUseMagic := FALSE;
m_nCurrentFrame := -1;
m_nBodyOffset := GetOffset (m_wAppearance);
m_Action := GetRaceByPM(m_btRace,m_wAppearance);
if m_Action = nil then exit;
case m_nCurrentAction of
SM_TURN:
begin
m_nStartFrame := m_Action.ActStand.start + m_btDir * (m_Action.ActStand.frame + m_Action.ActStand.skip);
m_nEndFrame := m_nStartFrame + m_Action.ActStand.frame - 1;
m_dwFrameTime := m_Action.ActStand.ftime;
m_dwStartTime := GetTickCount;
m_nDefFrameCount := m_Action.ActStand.frame;
Shift (m_btDir, 0, 0, 1);
end;
SM_WALK, SM_RUSH, SM_RUSHKUNG, SM_BACKSTEP:
begin
m_nStartFrame := m_Action.ActWalk.start + m_btDir * (m_Action.ActWalk.frame + m_Action.ActWalk.skip);
m_nEndFrame := m_nStartFrame + m_Action.ActWalk.frame - 1;
m_dwFrameTime := m_Action.ActWalk.ftime;
m_dwStartTime := GetTickCount;
m_nMaxTick := m_Action.ActWalk.UseTick;
m_nCurTick := 0;
m_nMoveStep := 1;
if m_nCurrentAction = SM_BACKSTEP then
Shift (GetBack(m_btDir), m_nMoveStep, 0, m_nEndFrame-m_nStartFrame+1)
else
Shift (m_btDir, m_nMoveStep, 0, m_nEndFrame-m_nStartFrame+1);
end;
{SM_BACKSTEP:
begin
startframe := pm.ActWalk.start + (pm.ActWalk.frame - 1) + Dir * (pm.ActWalk.frame + pm.ActWalk.skip);
m_nEndFrame := startframe - (pm.ActWalk.frame - 1);
m_dwFrameTime := pm.ActWalk.ftime;
m_dwStartTime := GetTickCount;
m_nMaxTick := pm.ActWalk.UseTick;
m_nCurTick := 0;
m_nMoveStep := 1;
Shift (GetBack(Dir), m_nMoveStep, 0, m_nEndFrame-startframe+1);
end;}
SM_HIT:
begin
m_nStartFrame := m_Action.ActAttack.start + m_btDir * (m_Action.ActAttack.frame + m_Action.ActAttack.skip);
m_nEndFrame := m_nStartFrame + m_Action.ActAttack.frame - 1;
m_dwFrameTime := m_Action.ActAttack.ftime;
m_dwStartTime := GetTickCount;
//WarMode := TRUE;
m_dwWarModeTime := GetTickCount;
Shift (m_btDir, 0, 0, 1);
end;
SM_STRUCK:
begin
m_nStartFrame := m_Action.ActStruck.start + m_btDir * (m_Action.ActStruck.frame + m_Action.ActStruck.skip);
m_nEndFrame := m_nStartFrame + m_Action.ActStruck.frame - 1;
m_dwFrameTime := m_dwStruckFrameTime; //pm.ActStruck.ftime;
m_dwStartTime := GetTickCount;
Shift (m_btDir, 0, 0, 1);
end;
SM_DEATH:
begin
m_nStartFrame := m_Action.ActDie.start + m_btDir * (m_Action.ActDie.frame + m_Action.ActDie.skip);
m_nEndFrame := m_nStartFrame + m_Action.ActDie.frame - 1;
m_nStartFrame := m_nEndFrame; //
m_dwFrameTime := m_Action.ActDie.ftime;
m_dwStartTime := GetTickCount;
end;
SM_NOWDEATH:
begin
m_nStartFrame := m_Action.ActDie.start + m_btDir * (m_Action.ActDie.frame + m_Action.ActDie.skip);
m_nEndFrame := m_nStartFrame + m_Action.ActDie.frame - 1;
m_dwFrameTime := m_Action.ActDie.ftime;
m_dwStartTime := GetTickCount;
end;
SM_SKELETON:
begin
m_nStartFrame := m_Action.ActDeath.start + m_btDir;
m_nEndFrame := m_nStartFrame + m_Action.ActDeath.frame - 1;
m_dwFrameTime := m_Action.ActDeath.ftime;
m_dwStartTime := GetTickCount;
end;
end;
end;
procedure TActor.ReadyAction (msg: TChrMsg);
var
n: integer;
UseMagic: PTUseMagicInfo;
begin
m_nActBeforeX := m_nCurrX;
m_nActBeforeY := m_nCurrY;
if msg.Ident = SM_ALIVE then begin
m_boDeath := FALSE;
m_boSkeleton := FALSE;
end;
if not m_boDeath then begin
case msg.Ident of
SM_TURN, SM_WALK, SM_BACKSTEP, SM_RUSH, SM_RUSHKUNG, SM_RUN, SM_HORSERUN, SM_DIGUP, SM_ALIVE:
begin
m_nFeature := msg.feature;
m_nState := msg.state;
//是否返回到出生地
if m_nState and STATE_OPENHEATH <> 0 then m_boOpenHealth := TRUE
else m_boOpenHealth := FALSE;
end;
end;
if msg.ident = SM_LIGHTING then
n := 0;
if g_MySelf = self then begin
if (msg.Ident = CM_WALK) then
if not PlayScene.CanWalk (msg.x, msg.y) then
exit; //不可行走
if (msg.Ident = CM_RUN) then
if not PlayScene.CanRun (g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, msg.x, msg.y) then
exit; //不能跑
if (msg.Ident = CM_HORSERUN) then
if not PlayScene.CanRun (g_MySelf.m_nCurrX, g_MySelf.m_nCurrY, msg.x, msg.y) then
exit; //捞悼 阂啊
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -