📄 actor.pas
字号:
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;
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; //捞悼 阂啊
//msg
case msg.Ident of
CM_TURN,
CM_WALK,
CM_SITDOWN,
CM_RUN,
CM_HIT,
CM_HEAVYHIT,
CM_BIGHIT,
CM_POWERHIT,
CM_LONGHIT,
CM_WIDEHIT:
begin
RealActionMsg := msg; //泅犁 角青登绊 乐绰 青悼, 辑滚俊 皋技瘤甫 焊晨.
msg.Ident := msg.Ident - 3000; //SM_?? 栏肺 函券 窃
end;
CM_HORSERUN: begin
RealActionMsg:=msg;
msg.Ident:=SM_HORSERUN;
end;
CM_THROW: begin
if m_nFeature <> 0 then begin
m_nTargetX := TActor(msg.feature).m_nCurrX; //x 带瘤绰 格钎
m_nTargetY := TActor(msg.feature).m_nCurrY; //y
m_nTargetRecog := TActor(msg.feature).m_nRecogId;
end;
RealActionMsg := msg;
msg.Ident := SM_THROW;
end;
CM_FIREHIT: begin
RealActionMsg := msg;
msg.Ident := SM_FIREHIT;
end;
CM_CRSHIT: begin
RealActionMsg := msg;
msg.Ident := SM_CRSHIT;
end;
CM_TWINHIT: begin
RealActionMsg := msg;
msg.Ident := SM_TWINHIT;
end;
CM_3037: begin
RealActionMsg := msg;
msg.Ident := SM_41;
end;
CM_SPELL: begin
RealActionMsg := msg;
UseMagic := PTUseMagicInfo (msg.feature);
RealActionMsg.Dir := UseMagic.MagicSerial;
msg.Ident := msg.Ident - 3000; //SM_?? 栏肺 函券 窃
end;
end;
m_nOldx := m_nCurrX;
m_nOldy := m_nCurrY;
m_nOldDir := m_btDir;
end;
case msg.Ident of
SM_STRUCK:
begin
//Abil.HP := msg.x; {HP}
//Abil.MaxHP := msg.y; {maxHP}
//msg.dir {damage}
//饭骇捞 臭栏搁 嘎绰 矫埃捞 陋促.
m_nMagicStruckSound := msg.x; //1捞惑, 付过瓤苞
n := Round (200 - m_Abil.Level * 5);
if n > 80 then m_dwStruckFrameTime := n
else m_dwStruckFrameTime := 80;
m_dwLastStruckTime := GetTickCount;
end;
SM_SPELL:
begin
m_btDir := msg.dir;
//msg.x :targetx
//msg.y :targety
UseMagic := PTUseMagicInfo (msg.feature);
if UseMagic <> nil then begin
m_CurMagic := UseMagic^;
m_CurMagic.ServerMagicCode := -1; //FIRE 措扁
//CurMagic.MagicSerial := 0;
m_CurMagic.TargX := msg.x;
m_CurMagic.TargY := msg.y;
Dispose (UseMagic);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -