From 80f3f5fe438a48b94a2ec9c70e6ff8475ede4ff3 Mon Sep 17 00:00:00 2001 From: b1indy Date: Fri, 23 Nov 2007 21:32:44 +0000 Subject: checking for delta=0 in col2h git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@652 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UTexture.pas | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Game') diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 7b537840..445c7d4f 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -427,6 +427,8 @@ procedure TTextureUnit.ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal); clr[2]:=(Color and $ff)/255; hls[1]:=maxvalue(clr); delta:=hls[1]-minvalue(clr); + // this is for safety reasons + if delta = 0.0 then delta:=0.000000000001; if clr[0]=hls[1] then hls[0]:=(clr[1]-clr[2])/delta else if clr[1]=hls[1] then hls[0]:=2.0+(clr[2]-clr[0])/delta else if clr[2]=hls[1] then hls[0]:=4.0+(clr[0]-clr[1])/delta; -- cgit v1.2.3