X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_textures.pas;h=6417fa9363e9c9de5458dd57564c0017090fe997;hb=c5684c0c980bb96fd4fd0efae4d48cdeb469c8ff;hp=72b65b560c814875b020eb124a2e0068d419c9c8;hpb=f4fc3b435118e5d9e4085da37014436d2e063259;p=d2df-sdl.git diff --git a/src/game/g_textures.pas b/src/game/g_textures.pas index 72b65b5..6417fa9 100644 --- a/src/game/g_textures.pas +++ b/src/game/g_textures.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 SysUtils, Classes, {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} - e_graphics, MAPDEF, ImagingTypes, Imaging, ImagingUtility; + g_base, r_graphics, MAPDEF, ImagingTypes, Imaging, ImagingUtility; type TLevelTexture = record @@ -119,11 +118,7 @@ function g_Texture_Light (): Integer; implementation uses -{$IFDEF USE_NANOGL} - nanoGL, -{$ELSE} - GL, -{$ENDIF} + {$INCLUDE ../nogl/noGLuses.inc} g_game, e_log, g_basic, g_console, wadreader, g_language, utils, xstreams; @@ -226,13 +221,8 @@ begin if WAD.GetResource(g_ExtractFilePathName(Resource), TextureData, ResourceLength) then begin if e_CreateTextureMem(TextureData, ResourceLength, ID) then - begin result := true; - end - else - begin - FreeMem(TextureData); - end; + FreeMem(TextureData) end else begin @@ -277,11 +267,8 @@ begin e_GetTextureSize(texturesArray[find_id].ID, @texturesArray[find_id].width, @texturesArray[find_id].height); texturesArray[find_id].used := true; texturesArray[find_id].Name := textureName; - end - else - begin - FreeMem(TextureData); end; + FreeMem(TextureData) end else begin @@ -546,10 +533,12 @@ begin if not CreateFramesMem(TextureData, ResourceLength, ID, Name, mWidth, mHeight, mCount, BackAnimation) then begin + FreeMem(TextureData); WAD.Free(); exit; end; + FreeMem(TextureData); WAD.Free(); result := true; @@ -748,7 +737,13 @@ end; constructor TAnimation.Create (aframesID: LongWord; aloop: Boolean; aspeed: Byte); begin - if (aframesID >= Length(framesArray)) then raise Exception.Create('trying to create inexisting frame: something is very wrong here'); + if (aframesID >= Length(framesArray)) then + begin + //raise Exception.Create('trying to create inexisting frame: something is very wrong here'); + e_LogWritefln('trying to create inexisting frame %u of %u: something is very wrong here', [aframesID, LongWord(Length(framesArray))], TMsgType.Warning); + aframesID := 0; + if (Length(framesArray) = 0) then raise Exception.Create('trying to create inexisting frame: something is very wrong here'); + end; mId := aframesID; mMinLength := 0; mLoop := aloop;