X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_playermodel.pas;h=6ffea1fbc3fc094fb714fb25df4ef20623235c4a;hb=38144a9b64580981ae76cd2e06e7c06bf0347e79;hp=5400de6b9b67c34df657353b8f7a09be33f382bd;hpb=4b6c50349b6b2c268faecbb7f4567cd4f5e0d835;p=d2df-sdl.git diff --git a/src/game/g_playermodel.pas b/src/game/g_playermodel.pas index 5400de6..6ffea1f 100644 --- a/src/game/g_playermodel.pas +++ b/src/game/g_playermodel.pas @@ -2,8 +2,7 @@ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * the Free Software Foundation, version 3 of the License ONLY. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,7 +20,7 @@ interface uses {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} - MAPDEF, g_textures, g_basic, g_weapons, e_graphics, utils, + MAPDEF, g_textures, g_basic, g_weapons, e_graphics, utils, g_gfx, ImagingTypes, Imaging, ImagingUtility; const @@ -65,6 +64,10 @@ type HaveWeapon: Boolean; end; + TModelBlood = record + R, G, B, Kind: Byte; + end; + TModelSound = record ID: DWORD; Level: Byte; @@ -88,6 +91,7 @@ type FName: String; FDirection: TDirection; FColor: TRGB; + FBlood: TModelBlood; FCurrentAnimation: Byte; FAnim: Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation; FMaskAnim: Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation; @@ -126,6 +130,7 @@ type public property Color: TRGB read FColor write FColor; + property Blood: TModelBlood read FBlood; end; procedure g_PlayerModel_LoadData(); @@ -133,6 +138,7 @@ 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; Anim: Byte; var _Anim, _Mask: TAnimation): Boolean; function g_PlayerModel_GetGibs(ModelName: String; var Gibs: TGibsArray): Boolean; @@ -141,11 +147,7 @@ function g_PlayerModel_GetGibs(ModelName: String; var Gibs: TGibsArray): Boolea implementation uses -{$IFDEF USE_NANOGL} - nanoGL, -{$ELSE} - GL, GLExt, -{$ENDIF} + {$INCLUDE ../nogl/noGLuses.inc} g_main, g_sound, g_console, SysUtils, g_player, CONFIG, e_sound, g_options, g_map, Math, e_log, wadreader; @@ -160,6 +162,7 @@ type PainSounds: TModelSoundArray; DieSounds: TModelSoundArray; SlopSound: Byte; + Blood: TModelBlood; end; const @@ -394,7 +397,7 @@ var prefix: string; ok, chk: Boolean; begin - e_WriteLog(Format('Loading player model: %s', [ExtractFileName(FileName)]), TMsgType.Notify); + e_WriteLog(Format('Loading player model "%s"...', [FileName]), TMsgType.Notify); Result := False; @@ -436,6 +439,20 @@ begin Description := config.ReadStr('Model', 'description', ''); end; + with PlayerModelsArray[ID] do + begin + Blood.R := MAX(0, MIN(255, config.ReadInt('Blood', 'R', 150))); + Blood.G := MAX(0, MIN(255, config.ReadInt('Blood', 'G', 0))); + Blood.B := MAX(0, MIN(255, config.ReadInt('Blood', 'B', 0))); + case config.ReadStr('Blood', 'Kind', 'NORMAL') of + 'NORMAL': Blood.Kind := BLOOD_NORMAL; + 'SPARKS': Blood.Kind := BLOOD_CSPARKS; + 'COMBINE': Blood.Kind := BLOOD_COMBINE; + else + Blood.Kind := BLOOD_NORMAL + end + end; + for b := A_STAND to A_LAST do begin aname := s+'_RIGHTANIM'+IntToStr(b); @@ -647,6 +664,7 @@ begin with PlayerModelsArray[a] do begin Result.FName := Info.Name; + Result.FBlood := Blood; for b := A_STAND to A_LAST do begin @@ -789,6 +807,24 @@ begin end; end; +function g_PlayerModel_GetBlood(ModelName: string): TModelBlood; +var + a: Integer; +begin + Result.R := 150; + Result.G := 0; + Result.B := 0; + Result.Kind := BLOOD_NORMAL; + if PlayerModelsArray = nil then Exit; + + for a := 0 to High(PlayerModelsArray) do + if PlayerModelsArray[a].Info.Name = ModelName then + begin + Result := PlayerModelsArray[a].Blood; + Break; + end; +end; + procedure g_PlayerModel_FreeData(); var i: DWORD;