unit g_Character_Load;

interface
uses
  g_Data,g_Types,
  GPAHeader,
  {$INCLUDE uses.inc};

procedure Character_Load(self : zCharacter);
implementation

procedure Character_Load(self : zCharacter);
var dir : string;
begin                           
  dir := iz_dir_local_data + 'monster.cfg';
  self^.size[0]:=Cfg_ReadInt(dir, self^.name+'_SIZE', 64);
  self^.size[1]:=self^.size[0];
  self^.Rad := self^.size[0] div 2;
  self^.Speed  :=Cfg_ReadInt(dir, self^.name+'_SPEED', 15);
  self^.Life   :=Cfg_ReadInt(dir, self^.name+'_LIFE', 50);
  self^.AniBodySpeed :=Cfg_ReadInt(dir, self^.name+'_AniBODYSPEED', 2);
  self^.AniBodyStart :=Cfg_ReadInt(dir, self^.name+'_AniBODYSTART', 0);
  self^.AniBodyEnd   :=Cfg_ReadInt(dir, self^.name+'_AniBODYEND', 31);
  self^.AniDeadSpeed :=Cfg_ReadInt(dir, self^.name+'_ANIDEADSPEED', 2);
  self^.AniDeadStart :=Cfg_ReadInt(dir, self^.name+'_ANIDEADSTART', 32);
  self^.AniDeadEnd   :=Cfg_ReadInt(dir, self^.name+'_ANIDEADEND', 47);
  self^.Move_end := false;
  self^.TexName := Cfg_ReadStr(dir, self^.name+'_TEX', 'zombie.tga');
  GPAExtractToFileByID(GPAGetIDByName(PChar(self^.TexName),false),PChar('temp\graphics\'+self^.TexName));
  self^.Tex := Gfx.TexMan.Load(iz_dir_local_temp_gfx+self^.TexName);
  self^.Spr := Gfx.SprMan.Add(Gfx.TexMan.GetSize(self^.Tex),self^.size);
  self^.CHARACTER_ANIM_BODY_MOVE := Gfx.SprMan.Add_Anim(self^.Spr,self^.AniBodyStart,self^.AniBodyEnd,self^.AniBodyStart,self^.AniBodySpeed);
  self^.CHARACTER_ANIM_DEAD := Gfx.SprMan.Add_Anim(self^.Spr,self^.AniDeadStart,self^.AniDeadEnd,self^.AniDeadStart,self^.AniDeadSpeed);
end;

end.
