summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e2092b6)
raw | patch | inline | side by side (parent: e2092b6)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 16 Jan 2022 17:43:52 +0000 (20:43 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 07:51:50 +0000 (10:51 +0300) |
src/game/g_menu.pas | patch | blob | history | |
src/game/g_playermodel.pas | patch | blob | history | |
src/game/opengl/r_playermodel.pas | patch | blob | history |
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index f81733b599449751196d0a1c5081663a0e02f259..c83a8fa0d78e9577085fecbd707d82750bf45606 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
procedure ProcOptionsPlayersMIMenu();
var
s, a: string;
- b: TModelInfo;
+ i: Integer;
begin
if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2';
if a = '' then Exit;
- b := g_PlayerModel_GetInfo(a);
-
+ i := g_PlayerModel_GetIndex(a);
with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
begin
- TGUILabel(GetControl('lbName')).Text := b.Name;
- TGUILabel(GetControl('lbAuthor')).Text := b.Author;
- TGUIMemo(GetControl('meComment')).SetText(b.Description);
+ TGUILabel(GetControl('lbName')).Text := PlayerModelsArray[i].Name;
+ TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray[i].Author;
+ TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray[i].Description);
- if b.HaveWeapon then
+ if PlayerModelsArray[i].HaveWeapon then
TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_YES]
else
TGUILabel(GetControl('lbWeapon')).Text := _lc[I_MENU_NO];
index 393e07d6fa7f426cfad03d5b3f83f82033ed89bf..ca4b6dc6c4fc92ae6e1ef9eab5f6171cc5c36cd4 100644 (file)
R, G, B, Kind: Byte;
end;
- TModelInfo = record
- Name: String;
- Author: String;
- Description: String;
- HaveWeapon: Boolean;
- end;
-
TModelSound = record
ID: DWORD;
Level: Byte;
procedure g_PlayerModel_FreeData();
function g_PlayerModel_Load(FileName: String): Boolean;
function g_PlayerModel_GetNames(): SSArray;
-function g_PlayerModel_GetInfo(ModelName: String): TModelInfo;
function g_PlayerModel_GetBlood(ModelName: String): TModelBlood;
function g_PlayerModel_Get(ModelName: String): TPlayerModel;
function g_PlayerModel_GetAnim(ModelName: String; AnimTyp: Byte; var _Anim, _Mask: TAnimation): Boolean;
function g_PlayerModel_GetGibs(ModelName: String; var Gibs: TGibsArray): Boolean;
+function g_PlayerModel_GetIndex (ModelName: String): Integer;
+
(* --- private data --- *)
type
TPlayerModelInfo = record
- Info: TModelInfo;
+ Name: String;
+ Author: String;
+ Description: String;
+ HaveWeapon: Boolean;
ModelSpeed: Array [A_STAND..A_PAIN] of Byte;
FlagPoint: TDFPoint;
FlagAngle: SmallInt;
WeapNames: Array [WP_FIRST + 1..WP_LAST] of String =
('csaw', 'hgun', 'sg', 'ssg', 'mgun', 'rkt', 'plz', 'bfg', 'spl', 'flm');
+ function g_PlayerModel_GetIndex (ModelName: String): Integer;
+ var i: Integer;
+ begin
+ Result := -1;
+ if PlayerModelsArray <> nil then
+ begin
+ i := 0;
+ while (i < Length(PlayerModelsArray)) and (PlayerModelsArray[i].Name <> ModelName) do
+ Inc(i);
+ if i < Length(PlayerModelsArray) then
+ Result := i
+ end
+ end;
+
function GetPoint(var str: String; var point: TDFPoint): Boolean;
var
a, x, y: Integer;
prefix := FileName+':TEXTURES\';
- with PlayerModelsArray[ID].Info do
- begin
- Name := s;
- Author := config.ReadStr('Model', 'author', '');
- Description := config.ReadStr('Model', 'description', '');
- end;
-
+ PlayerModelsArray[ID].Name := s;
+ PlayerModelsArray[ID].Author := config.ReadStr('Model', 'author', '');
+ PlayerModelsArray[ID].Description := config.ReadStr('Model', 'description', '');
PlayerModelsArray[ID].FileName := FileName;
with PlayerModelsArray[ID] do
begin
end;
{if ok then g_Console_Add(Info.Name+' weapon points ok')
else g_Console_Add(Info.Name+' weapon points fail');}
- Info.HaveWeapon := ok;
+ PlayerModelsArray[ID].HaveWeapon := ok;
s := config.ReadStr('Model', 'flag_point', '');
if not GetPoint(s, FlagPoint) then
Result := True;
end;
-function g_PlayerModel_Get(ModelName: String): TPlayerModel;
+function g_PlayerModel_Get (ModelName: String): TPlayerModel;
var a: Integer;
begin
Result := nil;
for a := 0 to High(PlayerModelsArray) do
begin
- if AnsiLowerCase(PlayerModelsArray[a].Info.Name) = AnsiLowerCase(ModelName) then
+ if AnsiLowerCase(PlayerModelsArray[a].Name) = AnsiLowerCase(ModelName) then
begin
Result := TPlayerModel.Create;
if PlayerModelsArray = nil then Exit;
for a := 0 to High(PlayerModelsArray) do
- if PlayerModelsArray[a].Info.Name = ModelName then
+ if PlayerModelsArray[a].Name = ModelName then
with PlayerModelsArray[a] do
begin
if AnimTyp in [A_STAND, A_WALK] then c := True else c := False;
- if not g_Frames_Get(ID, Info.Name+'_RIGHTANIM'+IntToStr(AnimTyp)) then
- if not g_Frames_Get(ID, Info.Name+'_LEFTANIM'+IntToStr(AnimTyp)) then Exit;
+ if not g_Frames_Get(ID, Name + '_RIGHTANIM' + IntToStr(AnimTyp)) then
+ if not g_Frames_Get(ID, Name + '_LEFTANIM' + IntToStr(AnimTyp)) then Exit;
_Anim := TAnimation.Create(ID, c, ModelSpeed[AnimTyp]);
_Anim.Speed := ModelSpeed[AnimTyp];
- if not g_Frames_Get(ID, Info.Name+'_RIGHTANIM'+IntToStr(AnimTyp)+'_MASK') then
- if not g_Frames_Get(ID, Info.Name+'_LEFTANIM'+IntToStr(AnimTyp)+'_MASK') then Exit;
+ if not g_Frames_Get(ID, Name + '_RIGHTANIM' + IntToStr(AnimTyp) + '_MASK') then
+ if not g_Frames_Get(ID, Name + '_LEFTANIM' + IntToStr(AnimTyp) + '_MASK') then
+ Exit;
_Mask := TAnimation.Create(ID, c, ModelSpeed[AnimTyp]);
_Mask.Speed := ModelSpeed[AnimTyp];
SetLength(Gibs, gGibsCount);
for a := 0 to High(PlayerModelsArray) do
- if PlayerModelsArray[a].Info.Name = ModelName then
+ if PlayerModelsArray[a].Name = ModelName then
begin
for i := 0 to High(Gibs) do
begin
for i := 0 to High(PlayerModelsArray) do
begin
SetLength(Result, Length(Result)+1);
- Result[High(Result)] := PlayerModelsArray[i].Info.Name;
+ Result[High(Result)] := PlayerModelsArray[i].Name;
end;
end;
-function g_PlayerModel_GetInfo(ModelName: string): TModelInfo;
-var
- a: Integer;
-begin
- FillChar(Result, SizeOf(Result), 0);
- if PlayerModelsArray = nil then Exit;
-
- for a := 0 to High(PlayerModelsArray) do
- if PlayerModelsArray[a].Info.Name = ModelName then
- begin
- Result := PlayerModelsArray[a].Info;
- Break;
- end;
-end;
-
function g_PlayerModel_GetBlood(ModelName: string): TModelBlood;
var
a: Integer;
if PlayerModelsArray = nil then Exit;
for a := 0 to High(PlayerModelsArray) do
- if PlayerModelsArray[a].Info.Name = ModelName then
+ if PlayerModelsArray[a].Name = ModelName then
begin
Result := PlayerModelsArray[a].Blood;
Break;
function TPlayerModel.GetName (): String;
begin
- Result := PlayerModelsArray[FID].Info.Name
+ Result := PlayerModelsArray[FID].Name
end;
procedure TPlayerModel.Update;
index 0914bd007798e7991277bddd9ee3c43cae32b4cc..f17be32d3e1ed99f8a1a6e9cd70761cb9ba0f0ac 100644 (file)
prefix := PlayerModelsArray[i].FileName + ':TEXTURES\';
for b := A_STAND to A_LAST do
begin
- aname := PlayerModelsArray[i].Info.Name + '_RIGHTANIM' + IntToStr(b);
+ aname := PlayerModelsArray[i].Name + '_RIGHTANIM' + IntToStr(b);
with PlayerModelsArray[i].Anim[TDirection.D_RIGHT, b] do
begin
if not (g_Frames_CreateWAD(@ID1, aname, prefix + Resource, 64, 64, Frames, Back) and
begin
if b > A_LASTBASE then
begin
- ExtAnimFromBaseAnim(PlayerModelsArray[i].Info.Name, b);
+ ExtAnimFromBaseAnim(PlayerModelsArray[i].Name, b);
continue
end
end;
begin
if (Resource <> '') and (Mask <> '') then
begin
- aname := PlayerModelsArray[i].Info.Name + '_LEFTANIM' + IntToStr(b);
+ aname := PlayerModelsArray[i].Name + '_LEFTANIM' + IntToStr(b);
g_Frames_CreateWAD(@ID1, aname, prefix + Resource, 64, 64, Frames, Back);
g_Frames_CreateWAD(@ID2, aname + '_MASK', prefix + Mask, 64, 64, Frames, Back);
Models[i].Frames[TDirection.D_LEFT, b].base := ID1;
begin
for a := A_STAND to A_LAST do
begin
- g_Frames_DeleteByName(Info.Name+'_LEFTANIM'+IntToStr(a));
- g_Frames_DeleteByName(Info.Name+'_LEFTANIM'+IntToStr(a)+'_MASK');
- g_Frames_DeleteByName(Info.Name+'_RIGHTANIM'+IntToStr(a));
- g_Frames_DeleteByName(Info.Name+'_RIGHTANIM'+IntToStr(a)+'_MASK');
+ g_Frames_DeleteByName(Name + '_LEFTANIM' + IntToStr(a));
+ g_Frames_DeleteByName(Name + '_LEFTANIM' + IntToStr(a) + '_MASK');
+ g_Frames_DeleteByName(Name + '_RIGHTANIM' + IntToStr(a));
+ g_Frames_DeleteByName(Name + '_RIGHTANIM' + IntToStr(a) + '_MASK');
end;
if Gibs <> nil then
begin
else
Mirror := TMirrorType.Horizontal;
- if PlayerModelsArray[pm.id].Info.HaveWeapon and (not (pm.CurrentAnimation in [A_DIE1, A_DIE2, A_PAIN])) and (pm.CurrentWeapon in [WP_FIRST + 1..WP_LAST]) then
+ if PlayerModelsArray[pm.id].HaveWeapon and (not (pm.CurrentAnimation in [A_DIE1, A_DIE2, A_PAIN])) and (pm.CurrentWeapon in [WP_FIRST + 1..WP_LAST]) then
begin
if pm.CurrentAnimation in [A_SEEUP, A_ATTACKUP] then
pos := W_POS_UP