diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 7bb2248c6d7ef5dad598c0fbc095cf03f019ff39..5a0d7d7cb525a27b2cd189e55c1ba8226efc592b 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
{$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
g_base, g_playermodel, g_basic, g_textures,
g_weapons, g_phys, g_sound, g_saveload, MAPDEF,
{$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
g_base, g_playermodel, g_basic, g_textures,
g_weapons, g_phys, g_sound, g_saveload, MAPDEF,
- g_panel;
+ g_panel, r_playermodel;
const
KEY_LEFT = 1;
const
KEY_LEFT = 1;
PGib = ^TGib;
TGib = record
alive: Boolean;
PGib = ^TGib;
TGib = record
alive: Boolean;
- ID: DWORD;
- MaskID: DWORD;
RAngle: Integer;
Color: TRGB;
Obj: TObj;
RAngle: Integer;
Color: TRGB;
Obj: TObj;
+ ModelID: Integer;
+ GibID: Integer;
+
procedure getMapBox (out x, y, w, h: Integer); inline;
procedure moveBy (dx, dy: Integer); inline;
procedure getMapBox (out x, y, w, h: Integer); inline;
procedure moveBy (dx, dy: Integer); inline;
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
- e_log, g_map, g_items, g_console, g_gfx, Math, r_textures, r_animations,
+ e_log, g_map, g_items, g_console, g_gfx, Math, r_textures, r_animations, r_gfx,
g_options, g_triggers, g_menu, g_game, g_grid, e_res,
wadreader, g_monsters, CONFIG, g_language,
g_net, g_netmsg,
g_options, g_triggers, g_menu, g_game, g_grid, e_res,
wadreader, g_monsters, CONFIG, g_language,
g_net, g_netmsg,
if not ok then
find_id := Random(Length(gCorpses));
if not ok then
find_id := Random(Length(gCorpses));
- gCorpses[find_id] := TCorpse.Create(FObj.X, FObj.Y, FModel.Name, FHealth < -20);
+ gCorpses[find_id] := TCorpse.Create(FObj.X, FObj.Y, FModel.GetName(), FHealth < -20);
gCorpses[find_id].FColor := FModel.Color;
gCorpses[find_id].FObj.Vel := FObj.Vel;
gCorpses[find_id].FObj.Accel := FObj.Accel;
gCorpses[find_id].FColor := FModel.Color;
gCorpses[find_id].FObj.Vel := FObj.Vel;
gCorpses[find_id].FObj.Accel := FObj.Accel;
else
g_Player_CreateGibs(FObj.X + PLAYER_RECT_CX,
FObj.Y + PLAYER_RECT_CY,
else
g_Player_CreateGibs(FObj.X + PLAYER_RECT_CX,
FObj.Y + PLAYER_RECT_CY,
- FModel.Name, FModel.Color);
+ FModel.GetName(), FModel.Color);
end;
end;
end;
end;
procedure g_Player_CreateGibs(fX, fY: Integer; ModelName: string; fColor: TRGB);
var
procedure g_Player_CreateGibs(fX, fY: Integer; ModelName: string; fColor: TRGB);
var
- a: Integer;
+ a, mid: Integer;
GibsArray: TGibsArray;
Blood: TModelBlood;
begin
if (gGibs = nil) or (Length(gGibs) = 0) then
Exit;
GibsArray: TGibsArray;
Blood: TModelBlood;
begin
if (gGibs = nil) or (Length(gGibs) = 0) then
Exit;
- if not g_PlayerModel_GetGibs(ModelName, GibsArray) then
+ mid := g_PlayerModel_GetIndex(ModelName);
+ if mid = -1 then
+ Exit;
+ if not g_PlayerModel_GetGibs(mid, GibsArray) then
Exit;
Exit;
- Blood := g_PlayerModel_GetBlood(ModelName);
+ Blood := PlayerModelsArray[mid].Blood;
for a := 0 to High(GibsArray) do
with gGibs[CurrentGib] do
begin
for a := 0 to High(GibsArray) do
with gGibs[CurrentGib] do
begin
+ ModelID := mid;
+ GibID := GibsArray[a];
Color := fColor;
Color := fColor;
- ID := GibsArray[a].ID;
- MaskID := GibsArray[a].MaskID;
alive := True;
g_Obj_Init(@Obj);
alive := True;
g_Obj_Init(@Obj);
- Obj.Rect := GibsArray[a].Rect;
- Obj.X := fX-GibsArray[a].Rect.X-(GibsArray[a].Rect.Width div 2);
- Obj.Y := fY-GibsArray[a].Rect.Y-(GibsArray[a].Rect.Height div 2);
+ Obj.Rect := r_PlayerModel_GetGibRect(ModelID, GibID);
+ Obj.X := fX - Obj.Rect.X - (Obj.Rect.Width div 2);
+ Obj.Y := fY - Obj.Rect.Y - (Obj.Rect.Height div 2);
g_Obj_PushA(@Obj, 25 + Random(10), Random(361));
positionChanged(); // this updates spatial accelerators
RAngle := Random(360);
g_Obj_PushA(@Obj, 25 + Random(10), Random(361));
positionChanged(); // this updates spatial accelerators
RAngle := Random(360);
end;
procedure TPlayer.MakeBloodSimple(Count: Word);
end;
procedure TPlayer.MakeBloodSimple(Count: Word);
+ var Blood: TModelBlood;
begin
begin
+ Blood := SELF.FModel.GetBlood();
g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)+8,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2),
Count div 2, 3, -1, 16, (PLAYER_RECT.Height*2 div 3),
g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)+8,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2),
Count div 2, 3, -1, 16, (PLAYER_RECT.Height*2 div 3),
- FModel.Blood.R, FModel.Blood.G, FModel.Blood.B, FModel.Blood.Kind);
+ Blood.R, Blood.G, Blood.B, Blood.Kind);
g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-8,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2),
Count div 2, -3, -1, 16, (PLAYER_RECT.Height*2) div 3,
g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-8,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2),
Count div 2, -3, -1, 16, (PLAYER_RECT.Height*2) div 3,
- FModel.Blood.R, FModel.Blood.G, FModel.Blood.B, FModel.Blood.Kind);
+ Blood.R, Blood.G, Blood.B, Blood.Kind);
end;
procedure TPlayer.MakeBloodVector(Count: Word; VelX, VelY: Integer);
end;
procedure TPlayer.MakeBloodVector(Count: Word; VelX, VelY: Integer);
+ var Blood: TModelBlood;
begin
begin
+ Blood := SELF.FModel.GetBlood();
g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2),
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2),
Count, VelX, VelY, 16, (PLAYER_RECT.Height*2) div 3,
g_GFX_Blood(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2),
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2),
Count, VelX, VelY, 16, (PLAYER_RECT.Height*2) div 3,
- FModel.Blood.R, FModel.Blood.G, FModel.Blood.B, FModel.Blood.Kind);
+ Blood.R, Blood.G, Blood.B, Blood.Kind);
end;
procedure TPlayer.ProcessWeaponAction(Action: Byte);
end;
procedure TPlayer.ProcessWeaponAction(Action: Byte);
var
RespawnPoint: TRespawnPoint;
a, b, c: Byte;
var
RespawnPoint: TRespawnPoint;
a, b, c: Byte;
- Anim: TAnimation;
- ID: DWORD;
begin
FSlopeOld := 0;
FIncCamOld := 0;
begin
FSlopeOld := 0;
FIncCamOld := 0;
// Анимация возрождения:
if (not gLoadGameMode) and (not Silent) then
// Анимация возрождения:
if (not gLoadGameMode) and (not Silent) then
- if g_Frames_Get(ID, 'FRAMES_TELEPORT') then
- begin
- Anim := TAnimation.Create(ID, False, 3);
- g_GFX_OnceAnim(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
- FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, Anim);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(
+ R_GFX_TELEPORT_FAST,
+ FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
+ FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32
+ );
FSpectator := False;
FGhost := False;
FSpectator := False;
FGhost := False;
end;
function TPlayer.TeleportTo(X, Y: Integer; silent: Boolean; dir: Byte): Boolean;
end;
function TPlayer.TeleportTo(X, Y: Integer; silent: Boolean; dir: Byte): Boolean;
-var
- Anim: TAnimation;
- ID: DWORD;
begin
Result := False;
begin
Result := False;
FJustTeleported := True;
FJustTeleported := True;
- Anim := nil;
if not silent then
begin
if not silent then
begin
- if g_Frames_Get(ID, 'FRAMES_TELEPORT') then
- begin
- Anim := TAnimation.Create(ID, False, 3);
- end;
-
g_Sound_PlayExAt('SOUND_GAME_TELEPORT', FObj.X, FObj.Y);
g_Sound_PlayExAt('SOUND_GAME_TELEPORT', FObj.X, FObj.Y);
- g_GFX_OnceAnim(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
- FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, Anim);
+ r_GFX_OnceAnim(
+ R_GFX_TELEPORT_FAST,
+ FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
+ FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32
+ );
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_Effect(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, 1,
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_Effect(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, 1,
end;
end;
end;
end;
- if not silent and (Anim <> nil) then
+ if not silent then
begin
begin
- g_GFX_OnceAnim(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
- FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, Anim);
- Anim.Free();
-
+ r_GFX_OnceAnim(
+ R_GFX_TELEPORT_FAST,
+ FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
+ FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32
+ );
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_Effect(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, 0,
if g_Game_IsServer and g_Game_IsNet then
MH_SEND_Effect(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32, 0,
if (FActionAnim = A_PAIN) and (FModel.Animation <> A_PAIN) then
begin
FModel.ChangeAnimation(FActionAnim, FActionForce);
if (FActionAnim = A_PAIN) and (FModel.Animation <> A_PAIN) then
begin
FModel.ChangeAnimation(FActionAnim, FActionForce);
- FModel.GetCurrentAnimation.MinLength := i;
- FModel.GetCurrentAnimationMask.MinLength := i;
+ FModel.AnimState.MinLength := i;
end else FModel.ChangeAnimation(FActionAnim, FActionForce and (FModel.Animation <> A_STAND));
end else FModel.ChangeAnimation(FActionAnim, FActionForce and (FModel.Animation <> A_STAND));
- if (FModel.GetCurrentAnimation.Played or ((not FActionChanged) and (FModel.Animation = A_WALK)))
+ if (FModel.AnimState.Played or ((not FActionChanged) and (FModel.Animation = A_WALK)))
then SetAction(A_STAND, True);
then SetAction(A_STAND, True);
- if not ((FModel.Animation = A_WALK) and (Abs(FObj.Vel.X) < 4) and not FModel.Fire) then FModel.Update;
+ if not ((FModel.Animation = A_WALK) and (Abs(FObj.Vel.X) < 4) and not FModel.GetFire()) then FModel.Update;
for b := Low(FKeys) to High(FKeys) do
if FKeys[b].Time = 0 then FKeys[b].Pressed := False else Dec(FKeys[b].Time);
for b := Low(FKeys) to High(FKeys) do
if FKeys[b].Time = 0 then FKeys[b].Pressed := False else Dec(FKeys[b].Time);
// Время до повторного респауна, смены оружия, исользования, захвата флага
for i := T_RESPAWN to T_FLAGCAP do utils.writeInt(st, LongWord(FTime[i]));
// Название модели
// Время до повторного респауна, смены оружия, исользования, захвата флага
for i := T_RESPAWN to T_FLAGCAP do utils.writeInt(st, LongWord(FTime[i]));
// Название модели
- utils.writeStr(st, FModel.Name);
+ utils.writeStr(st, FModel.GetName());
// Цвет модели
utils.writeInt(st, Byte(FColor.R));
utils.writeInt(st, Byte(FColor.G));
// Цвет модели
utils.writeInt(st, Byte(FColor.R));
utils.writeInt(st, Byte(FColor.G));
end;
procedure TPlayer.FlySmoke(Times: DWORD = 1);
end;
procedure TPlayer.FlySmoke(Times: DWORD = 1);
-var
- id, i: DWORD;
- Anim: TAnimation;
+ var i: DWORD;
begin
if (Random(5) = 1) and (Times = 1) then
Exit;
begin
if (Random(5) = 1) and (Times = 1) then
Exit;
Exit;
end;
Exit;
end;
- if g_Frames_Get(id, 'FRAMES_SMOKE') then
+ for i := 1 to Times do
begin
begin
- for i := 1 to Times do
- begin
- Anim := TAnimation.Create(id, False, 3);
- Anim.Alpha := 150;
- g_GFX_OnceAnim(Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(Anim.Width div 2),
- Obj.Y+Obj.Rect.Height-4+Random(8+Times*2), Anim, ONCEANIM_SMOKE);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(
+ R_GFX_SMOKE_TRANS,
+ Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_SMOKE_WIDTH div 2),
+ Obj.Y+Obj.Rect.Height-4+Random(8+Times*2)
+ );
end;
end;
procedure TPlayer.OnFireFlame(Times: DWORD = 1);
end;
end;
procedure TPlayer.OnFireFlame(Times: DWORD = 1);
-var
- id, i: DWORD;
- Anim: TAnimation;
+ var i: DWORD;
begin
if (Random(10) = 1) and (Times = 1) then
Exit;
begin
if (Random(10) = 1) and (Times = 1) then
Exit;
- if g_Frames_Get(id, 'FRAMES_FLAME') then
+ for i := 1 to Times do
begin
begin
- for i := 1 to Times do
- begin
- Anim := TAnimation.Create(id, False, 3);
- Anim.Alpha := 0;
- g_GFX_OnceAnim(Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(Anim.Width div 2),
- Obj.Y+8+Random(8+Times*2), Anim, ONCEANIM_SMOKE);
- Anim.Free();
- end;
+ r_GFX_OnceAnim(
+ R_GFX_FLAME,
+ Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_FLAME_WIDTH div 2),
+ Obj.Y+8+Random(8+Times*2)
+ );
end;
end;
end;
end;