Growlith1223 Posted October 29, 2012 Author Share Posted October 29, 2012 ok so i noticed that Deathbeam was making his as a custom version so im making mine into a tutorial ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)**OPTION 1**download the source[http://www.mediafire…r7g14cu4c0w0v7f](http://www.mediafire.com/?r7g14cu4c0w0v7f)**OPTION 2**Put the five classes from EN and add them into CS:DEthenin modDirectX8 Replace the the top with```Option Explicit' **********************' ** Renders graphics **' **********************' DirectX8 ObjectPublic dX As DirectX8 'The master DirectX object.Public D3D8 As Direct3D8 'Controls all things 3D.Public D3DDevice8 As Direct3DDevice8 'Represents the hardware rendering.Public Direct3DX8 As D3DX8'The 2D (Transformed and Lit) vertex format.Public Const FVF_TLVERTEX As Long = D3DFVF_XYZRHW Or D3DFVF_TEX1 Or D3DFVF_DIFFUSE'The 2D (Transformed and Lit) vertex format type.Public Type TLVERTEXX As Singley As SingleZ As SingleRHW As Singlecolor As LongTU As SingleTV As SingleEnd TypePrivate Vertex_List(3) As TLVERTEX '4 vertices will make a square.'Some color depth constants to help make the DX constants more readable.Private Const COLOR_DEPTH_16_BIT As Long = D3DFMT_R5G6B5Private Const COLOR_DEPTH_24_BIT As Long = D3DFMT_A8R8G8B8Private Const COLOR_DEPTH_32_BIT As Long = D3DFMT_X8R8G8B8Public RenderingMode As LongPublic D3DWindow As D3DPRESENT_PARAMETERS 'Backbuffer and viewport description.Public DispMode As D3DDISPLAYMODE' Graphics TexturesPublic Tex_Anim() As DX8TextureRec ' ArraysPublic Tex_Char() As DX8TextureRecPublic Tex_Face() As DX8TextureRecPublic Tex_GUI() As DX8TextureRecPublic Tex_Item() As DX8TextureRecPublic Tex_Paperdoll() As DX8TextureRecPublic Tex_Resource() As DX8TextureRecPublic Tex_Spellicon() As DX8TextureRecPublic Tex_Tileset() As DX8TextureRecPublic Tex_Buttons() As DX8TextureRecPublic Tex_Buttons_h() As DX8TextureRecPublic Tex_Buttons_c() As DX8TextureRecPublic Tex_Fog() As DX8TextureRecPublic Tex_Bars As DX8TextureRec ' SinglesPublic Tex_Blood As DX8TextureRecPublic Tex_Direction As DX8TextureRecPublic Tex_Misc As DX8TextureRecPublic Tex_Target As DX8TextureRecPublic Tex_Shadow As DX8TextureRecPublic Tex_Fader As DX8TextureRecPublic Tex_Tile As DX8TextureRec' SurfacesPublic Tex_Surface() As DX8TextureRecPublic Count_Surface As Long' Texture countPublic NumAnimations As LongPublic NumCharacters As LongPublic NumFaces As LongPublic NumGUIs As LongPublic numitems As LongPublic NumPaperdolls As LongPublic NumResources As LongPublic NumSpellIcons As LongPublic NumTileSets As LongPublic NumFogs As LongPublic NumButtons As LongPublic NumButtons_c As LongPublic NumButtons_h As Long'Public BackBuffer As Direct3DSurface8'Public Const FVF As Long = D3DFVF_XYZRHW Or D3DFVF_TEX1 Or D3DFVF_DIFFUSE'Public Const FVF_Size As Long = 28Public gTexture() As GlobaltextureRecPrivate Const TEXTURE_NULL As Long = 0Public Type DX8TextureRecTexture As Longwidth As Longheight As LongPath As StringTexWidth As LongTexHeight As LongImageData() As ByteHasData As BooleanEnd TypePrivate Type GlobaltextureRecTexture As Direct3DTexture8TexWidth As LongTexHeight As LongLoaded As BooleanUnloadTimer As LongPath As StringEnd TypePublic Type RECTTop As LongLeft As LongBottom As LongRight As LongEnd TypePrivate Type D3DXIMAGE_INFO_Awidth As Longheight As LongDepth As LongMipLevels As LongFormat As CONST_D3DFORMATResourceType As CONST_D3DRESOURCETYPEImageFileFormat As LongEnd TypePublic NumTextures As Long```Delete all the things that relate to InitDX8 with```' ********************' ** Initialization **' ********************Public Function InitDX8() As Boolean' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerSet dX = New DirectX8 'Creates the DirectX object.Set D3D8 = dX.Direct3DCreate() 'Creates the Direct3D object using the DirectX object.Set Direct3DX8 = New D3DX8D3D8.GetAdapterDisplayMode D3DADAPTER_DEFAULT, DispMode 'Use the current display mode that you 'are already on. Incase you are confused, I'm 'talking about your current screen resolution. ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)D3Dwindow.Windowed = True 'The app will be in windowed mode.D3Dwindow.SwapEffect = D3DSWAPEFFECT_DISCARD 'Refresh when the monitor does.D3Dwindow.BackBufferFormat = DispMode.Format 'Sets the format that was retrieved into the backbuffer.'Creates the rendering device with some useful info, along with the info'DispMode.Format = D3DFMT_X8R8G8B8D3Dwindow.SwapEffect = D3DSWAPEFFECT_COPYD3Dwindow.BackBufferCount = 1 '1 backbuffer onlyD3Dwindow.BackBufferWidth = 800 ' frmMain.picScreen.ScaleWidth 'Match the backbuffer width with the display widthD3Dwindow.BackBufferHeight = 600 'frmMain.picScreen.ScaleHeight 'Match the backbuffer height with the display heightD3Dwindow.hDeviceWindow = frmMain.hWnd 'Use frmMain as the device window.'we've already setup for Direct3D_window.If TryCreateDirectX8Device = False Then MsgBox "Unable to initialize DirectX8\. You may be missing dx8vb.dll or have incompatible hardware to use DirectX8." DestroyGameEnd IfWith D3DDevice8 .SetVertexShader D3DFVF_XYZRHW Or D3DFVF_TEX1 Or D3DFVF_DIFFUSE .SetRenderState D3DRS_LIGHTING, False .SetRenderState D3DRS_SRCBLEND, D3DBLEND_SRCALPHA .SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA .SetRenderState D3DRS_ALPHABLENDENABLE, True .SetRenderState D3DRS_FILLMODE, D3DFILL_SOLID .SetRenderState D3DRS_CULLMODE, D3DCULL_NONE .SetRenderState D3DRS_ZENABLE, False .SetRenderState D3DRS_ZWRITEENABLE, False .SetTextureStageState 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE .SetRenderState D3DRS_POINTSPRITE_ENABLE, 1 .SetRenderState D3DRS_POINTSCALE_ENABLE, 0 .SetTextureStageState 0, D3DTSS_MAGFILTER, D3DTEXF_POINT .SetTextureStageState 0, D3DTSS_MINFILTER, D3DTEXF_POINTEnd With' Initialise the surfacesEngineCacheTextures' We're doneInitDX8 = True' Error handlerExit FunctionErrorHandler:HandleError "InitDX8", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearInitDX8 = FalseExit FunctionEnd Function```add TryCreateDX8Device At the bottom```Function TryCreateDirectX8Device() As BooleanDim I As LongOn Error GoTo nextiFor I = 1 To 4 Select Case I Case 1 Set D3DDevice8 = D3D8.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, frmMain.hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, D3DWindow) TryCreateDirectX8Device = True Exit Function Case 2 Set D3DDevice8 = D3D8.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, frmMain.hWnd, D3DCREATE_MIXED_VERTEXPROCESSING, D3DWindow) TryCreateDirectX8Device = True Exit Function Case 3 Set D3DDevice8 = D3D8.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, frmMain.hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DWindow) TryCreateDirectX8Device = True Exit Function Case 4 TryCreateDirectX8Device = False Exit Function End Selectnexti:NextEnd Function```Replace EngineUnloadDirectX with```Public Sub EngineUnloadDirectX()UnloadTexturesSet Direct3DX8 = NothingSet D3DDevice8 = NothingSet D3D8 = NothingSet dX = NothingEnd Sub```Replace EngineCacheTextures```Public Sub EngineCacheTextures()Dim I As LongCall CheckTilesetsCall CheckCharactersCall CheckPaperdollsCall CheckAnimationsCall CheckItemsCall CheckResourcesCall CheckSpellIconsCall CheckFacesCall CheckFogsCall CheckGUIsCall CheckSurfacesCall CheckButtonsCall CheckButtons_hCall CheckButtons_cNumTextures = NumTextures + 7' Single TexturesReDim Preserve gTexture(NumTextures)Tex_Bars.Path = App.Path & Path_Graphics & "system\bars.png"Tex_Bars.Texture = NumTextures - 6Call LoadTexture(Tex_Bars)Tex_Direction.Path = App.Path & Path_Graphics & "system\direction.png"Tex_Direction.Texture = NumTextures - 5Call LoadTexture(Tex_Direction)Tex_Misc.Path = App.Path & Path_Graphics & "system\misc.png"Tex_Misc.Texture = NumTextures - 4Call LoadTexture(Tex_Misc)Tex_Target.Path = App.Path & Path_Graphics & "system\target.png"Tex_Target.Texture = NumTextures - 3Call LoadTexture(Tex_Target)Tex_Fader.Path = App.Path & Path_Graphics & "system\fader.png"Tex_Fader.Texture = NumTextures - 2Call LoadTexture(Tex_Fader)Tex_Shadow.Path = App.Path & Path_Graphics & "system\shadow.png"Tex_Shadow.Texture = NumTextures - 1Call LoadTexture(Tex_Shadow)EngineInitFontTexturesEnd Sub```Replace LoadTexture with```Function GetNearestPOT(Value As Long) As LongDim I As LongDo While 2 ^ I < Value I = I + 1LoopGetNearestPOT = 2 ^ IEnd FunctionPublic Sub LoadTexture(ByRef TextureRec As DX8TextureRec)Dim SourceBitmap As cGDIpImage, ConvertedBitmap As cGDIpImage, GDIGraphics As cGDIpRenderer, GDIToken As cGDIpToken, I As LongDim newWidth As Long, newHeight As Long, ImageData() As Byte, fn As LongIf Options.Debug = 1 Then On Error GoTo ErrorHandlerIf TextureRec.HasData = False Then Set GDIToken = New cGDIpToken If GDIToken.Token = 0& Then MsgBox "GDI+ failed to load, exiting game!": DestroyGame Set SourceBitmap = New cGDIpImage Call SourceBitmap.LoadPicture_FileName(TextureRec.Path, GDIToken) TextureRec.width = SourceBitmap.width TextureRec.height = SourceBitmap.height' newWidth = GetNearestPOT(TextureRec.width) newHeight = GetNearestPOT(TextureRec.height) If newWidth <> SourceBitmap.width Or newHeight <> SourceBitmap.height Then Set ConvertedBitmap = New cGDIpImage Set GDIGraphics = New cGDIpRenderer I = GDIGraphics.CreateGraphicsFromImageClass(SourceBitmap) Call ConvertedBitmap.LoadPicture_FromNothing(newHeight, newWidth, I, GDIToken) Call GDIGraphics.DestroyHGraphics(I) I = GDIGraphics.CreateGraphicsFromImageClass(ConvertedBitmap) Call GDIGraphics.AttachTokenClass(GDIToken) Call GDIGraphics.RenderImageClassToHGraphics(SourceBitmap, I) Call ConvertedBitmap.SaveAsPNG(ImageData) GDIGraphics.DestroyHGraphics (I) TextureRec.ImageData = ImageData Set ConvertedBitmap = Nothing Set GDIGraphics = Nothing Set SourceBitmap = Nothing Else Call SourceBitmap.SaveAsPNG(ImageData) TextureRec.ImageData = ImageData Set SourceBitmap = Nothing End IfElse ImageData = TextureRec.ImageDataEnd IfSet gTexture(TextureRec.Texture).Texture = Direct3DX8.CreateTextureFromFileInMemoryEx(D3DDevice8, _ ImageData(0), _ UBound(ImageData) + 1, _ newWidth, _ newHeight, _ D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_POINT, D3DX_FILTER_NONE, ByVal (0), ByVal 0, ByVal 0)gTexture(TextureRec.Texture).TexWidth = newWidthgTexture(TextureRec.Texture).TexHeight = newHeightgTexture(TextureRec.Texture).Loaded = TruegTexture(TextureRec.Texture).UnloadTimer = GetTickCountExit SubErrorHandler:HandleError "LoadTexture", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```replace UnloadTextures with```Public Sub UnloadTextures(Optional ByVal Complete As Boolean = False)Dim I As Long' If debug mode, handle error then exit outOn Error Resume NextIf Complete = False Then For I = 1 To NumTextures If gTexture(I).UnloadTimer > GetTickCount + 150000 Then Set gTexture(I).Texture = Nothing ZeroMemory ByVal VarPtr(gTexture(I)), LenB(gTexture(I)) gTexture(I).UnloadTimer = 0 gTexture(I).Loaded = False End If NextElseFor I = 1 To NumTextures Set gTexture(I).Texture = Nothing ZeroMemory ByVal VarPtr(gTexture(I)), LenB(gTexture(I))NextReDim gTexture(1)For I = 1 To NumTileSets Tex_Tileset(I).Texture = 0NextFor I = 1 To numitems Tex_Item(I).Texture = 0NextFor I = 1 To NumCharacters Tex_Char(I).Texture = 0NextFor I = 1 To NumPaperdolls Tex_Paperdoll(I).Texture = 0NextFor I = 1 To NumResources Tex_Resource(I).Texture = 0NextFor I = 1 To NumAnimations Tex_Anim(I).Texture = 0NextFor I = 1 To NumSpellIcons Tex_Spellicon(I).Texture = 0NextFor I = 1 To NumFaces Tex_Face(I).Texture = 0NextFor I = 1 To NumGUIs Tex_GUI(I).Texture = 0NextFor I = 1 To NumButtons Tex_Buttons(I).Texture = 0NextFor I = 1 To NumButtons_c Tex_Buttons_c(I).Texture = 0NextFor I = 1 To NumButtons_h Tex_Buttons_h(I).Texture = 0NextTex_Misc.Texture = 0Tex_Blood.Texture = 0Tex_Direction.Texture = 0Tex_Target.Texture = 0'Tex_Selection.Texture = 0Tex_Bars.Texture = 0'Tex_White.Texture = 0'Tex_Weather.Texture = 0Tex_Fader.Texture = 0Tex_Shadow.Texture = 0'UnloadFontTexturesEnd If' Error handlerExit SubErrorHandler:HandleError "UnloadTextures", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```Replace RenderTexture with```Public Sub RenderTexture(ByRef TextureRec As DX8TextureRec, ByVal dX As Single, ByVal dY As Single, ByVal sX As Single, ByVal sY As Single, ByVal dWidth As Single, ByVal dHeight As Single, ByVal sWidth As Single, ByVal sHeight As Single, Optional color As Long = -1)Dim TextureNum As LongDim textureWidth As Long, textureHeight As Long, sourceX As Single, sourceY As Single, sourceWidth As Single, sourceHeight As SingleSetTexture TextureRecTextureNum = TextureRec.TexturetextureWidth = gTexture(TextureNum).TexWidthtextureHeight = gTexture(TextureNum).TexHeightIf sY + sHeight > textureHeight Then Exit SubIf sX + sWidth > textureWidth Then Exit SubIf sX < 0 Then Exit SubIf sY < 0 Then Exit SubsX = sX - 0.5sY = sY - 0.5dY = dY - 0.5dX = dX - 0.5sWidth = sWidthsHeight = sHeightdWidth = dWidthdHeight = dHeightsourceX = (sX / textureWidth)sourceY = (sY / textureHeight)sourceWidth = ((sX + sWidth) / textureWidth)sourceHeight = ((sY + sHeight) / textureHeight)Vertex_List(0) = Create_TLVertex(dX, dY, 0, 1, color, 0, sourceX + 0.000003, sourceY + 0.000003)Vertex_List(1) = Create_TLVertex(dX + dWidth, dY, 0, 1, color, 0, sourceWidth + 0.000003, sourceY + 0.000003)Vertex_List(2) = Create_TLVertex(dX, dY + dHeight, 0, 1, color, 0, sourceX + 0.000003, sourceHeight + 0.000003)Vertex_List(3) = Create_TLVertex(dX + dWidth, dY + dHeight, 0, 1, color, 0, sourceWidth + 0.000003, sourceHeight + 0.000003)Call D3DDevice8.SetTexture(0, gTexture(TextureNum).Texture)D3DDevice8.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, Vertex_List(0), Len(Vertex_List(0))End Sub```Replace SetTexture with```Public Sub SetTexture(ByRef TextureRec As DX8TextureRec)If TextureRec.Texture > NumTextures Then TextureRec.Texture = NumTexturesIf TextureRec.Texture < 0 Then TextureRec.Texture = 0If Not TextureRec.Texture = 0 ThenIf Not gTexture(TextureRec.Texture).Loaded Then Call LoadTexture(TextureRec)End IfEnd IfEnd Sub```add```Public Sub CheckTilesets()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumTileSets = 1ReDim Tex_Tileset(1)While FileExist(GFX_PATH & "tilesets\" & I & GFX_EXT) ReDim Preserve Tex_Tileset(NumTileSets) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Tileset(NumTileSets).Path = App.Path & GFX_PATH & "tilesets\" & I & GFX_EXT Tex_Tileset(NumTileSets).Texture = NumTextures NumTileSets = NumTileSets + 1 I = I + 1WendNumTileSets = NumTileSets - 1For I = 1 To NumTileSets LoadTexture Tex_Tileset(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckTilesets", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckCharacters()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumCharacters = 1ReDim Tex_Char(1)While FileExist(GFX_PATH & "characters\" & I & GFX_EXT) ReDim Preserve Tex_Char(NumCharacters) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Char(NumCharacters).Path = App.Path & "\data files\graphics\characters\" & I & ".png" Tex_Char(NumCharacters).Texture = NumTextures NumCharacters = NumCharacters + 1 I = I + 1WendNumCharacters = NumCharacters - 1For I = 1 To NumCharacters LoadTexture Tex_Char(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckCharacters", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckPaperdolls()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumPaperdolls = 1ReDim Tex_Paperdoll(1)While FileExist(GFX_PATH & "paperdolls\" & I & GFX_EXT) ReDim Preserve Tex_Paperdoll(NumPaperdolls) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Paperdoll(NumPaperdolls).Path = App.Path & GFX_PATH & "paperdolls\" & I & GFX_EXT Tex_Paperdoll(NumPaperdolls).Texture = NumTextures NumPaperdolls = NumPaperdolls + 1 I = I + 1WendNumPaperdolls = NumPaperdolls - 1For I = 1 To NumPaperdolls LoadTexture Tex_Paperdoll(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckPaperdolls", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckAnimations()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumAnimations = 1ReDim Tex_Anim(1)ReDim AnimationTimer(1)While FileExist(GFX_PATH & "animations\" & I & GFX_EXT) ReDim Preserve Tex_Anim(NumAnimations) ReDim Preserve AnimationTimer(NumAnimations) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Anim(NumAnimations).Path = App.Path & GFX_PATH & "animations\" & I & GFX_EXT Tex_Anim(NumAnimations).Texture = NumTextures NumAnimations = NumAnimations + 1 I = I + 1WendNumAnimations = NumAnimations - 1For I = 1 To NumAnimations LoadTexture Tex_Anim(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckAnimations", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckItems()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1numitems = 1ReDim Tex_Item(1)While FileExist(GFX_PATH & "items\" & I & GFX_EXT) ReDim Preserve Tex_Item(numitems) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Item(numitems).Path = App.Path & GFX_PATH & "items\" & I & GFX_EXT Tex_Item(numitems).Texture = NumTextures numitems = numitems + 1 I = I + 1Wendnumitems = numitems - 1For I = 1 To numitems LoadTexture Tex_Item(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckItems", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckResources()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumResources = 1ReDim Tex_Resource(1)While FileExist(GFX_PATH & "resources\" & I & GFX_EXT) ReDim Preserve Tex_Resource(NumResources) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Resource(NumResources).Path = App.Path & GFX_PATH & "resources\" & I & GFX_EXT Tex_Resource(NumResources).Texture = NumTextures NumResources = NumResources + 1 I = I + 1WendNumResources = NumResources - 1For I = 1 To NumResources LoadTexture Tex_Resource(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckResources", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckSpellIcons()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumSpellIcons = 1ReDim Tex_Spellicon(1)While FileExist(GFX_PATH & "spellicons\" & I & GFX_EXT) ReDim Preserve Tex_Spellicon(NumSpellIcons) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Spellicon(NumSpellIcons).Path = App.Path & GFX_PATH & "spellicons\" & I & GFX_EXT Tex_Spellicon(NumSpellIcons).Texture = NumTextures NumSpellIcons = NumSpellIcons + 1 I = I + 1WendNumSpellIcons = NumSpellIcons - 1For I = 1 To NumSpellIcons LoadTexture Tex_Spellicon(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckSpellIcons", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckFaces()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumFaces = 1ReDim Tex_Face(1)While FileExist(GFX_PATH & "Faces\" & I & GFX_EXT) ReDim Preserve Tex_Face(NumFaces) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Face(NumFaces).Path = App.Path & GFX_PATH & "faces\" & I & GFX_EXT Tex_Face(NumFaces).Texture = NumTextures NumFaces = NumFaces + 1 I = I + 1WendNumFaces = NumFaces - 1For I = 1 To NumFaces LoadTexture Tex_Face(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckFaces", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckFogs()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumFogs = 1ReDim Tex_Fog(1)While FileExist(GFX_PATH & "fogs\" & I & GFX_EXT) ReDim Preserve Tex_Fog(NumFogs) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Fog(NumFogs).Path = App.Path & GFX_PATH & "fogs\" & I & GFX_EXT Tex_Fog(NumFogs).Texture = NumTextures NumFogs = NumFogs + 1 I = I + 1WendNumFogs = NumFogs - 1For I = 1 To NumFogs LoadTexture Tex_Fog(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckFogs", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckGUIs()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumGUIs = 1ReDim Tex_GUI(1)While FileExist(GFX_PATH & "gui\" & I & GFX_EXT) ReDim Preserve Tex_GUI(NumGUIs) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_GUI(NumGUIs).Path = App.Path & GFX_PATH & "gui\" & I & GFX_EXT Tex_GUI(NumGUIs).Texture = NumTextures NumGUIs = NumGUIs + 1 I = I + 1WendNumGUIs = NumGUIs - 1For I = 1 To NumGUIs LoadTexture Tex_GUI(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckGUIs", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckButtons()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumButtons = 1ReDim Tex_Buttons(1)While FileExist(GFX_PATH & "gui\buttons\" & I & GFX_EXT) ReDim Preserve Tex_Buttons(NumButtons) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Buttons(NumButtons).Path = App.Path & GFX_PATH & "gui\buttons\" & I & GFX_EXT Tex_Buttons(NumButtons).Texture = NumTextures NumButtons = NumButtons + 1 I = I + 1WendNumButtons = NumButtons - 1For I = 1 To NumButtons LoadTexture Tex_Buttons(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckButtons", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckButtons_c()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumButtons_c = 1ReDim Tex_Buttons_c(1)While FileExist(GFX_PATH & "gui\buttons\" & I & "_c" & GFX_EXT) ReDim Preserve Tex_Buttons_c(NumButtons_c) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Buttons_c(NumButtons_c).Path = App.Path & GFX_PATH & "gui\buttons\" & I & "_c" & GFX_EXT Tex_Buttons_c(NumButtons_c).Texture = NumTextures NumButtons_c = NumButtons_c + 1 I = I + 1WendNumButtons_c = NumButtons_c - 1For I = 1 To NumButtons_c LoadTexture Tex_Buttons_c(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckButtons_c", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckButtons_h()Dim I As Long' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo ErrorHandlerI = 1NumButtons_h = 1ReDim Tex_Buttons_h(1)While FileExist(GFX_PATH & "gui\buttons\" & I & "_h" & GFX_EXT) ReDim Preserve Tex_Buttons_h(NumButtons_h) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Buttons_h(NumButtons_h).Path = App.Path & GFX_PATH & "gui\buttons\" & I & "_h" & GFX_EXT Tex_Buttons_h(NumButtons_h).Texture = NumTextures NumButtons_h = NumButtons_h + 1 I = I + 1WendNumButtons_h = NumButtons_h - 1For I = 1 To NumButtons_h LoadTexture Tex_Buttons_h(I)Next' Error handlerExit SubErrorHandler:HandleError "CheckButtons_h", "modDatabase", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd SubPublic Sub CheckSurfaces()Dim I As LongI = 1Count_Surface = 1ReDim Tex_Surface(1)Do While FileExist(Path_Surface & Count_Surface & ".png") ReDim Preserve Tex_Surface(0 To Count_Surface) NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) Tex_Surface(Count_Surface).Path = App.Path & Path_Surface & I & ".png" Tex_Surface(Count_Surface).Texture = NumTextures Count_Surface = Count_Surface + 1 I = I + 1LoopCount_Surface = Count_Surface - 1For I = 1 To Count_Surface LoadTexture Tex_Surface(I)NextEnd Sub```on the bottom of modDatabaseGo into modText and replace the Public Type CustomFont with```Private Type CustomFontHeaderInfo As VFHTexture As DX8TextureRecRowPitch As IntegerRowFactor As SingleColFactor As SingleCharHeight As ByteEnd Type```Then replace EngineInitFontTextures with```Sub EngineInitFontTextures()' FONT DEFAULTNumTextures = NumTextures + 1ReDim Preserve gTexture(NumTextures)Font_Default.Texture.Texture = NumTexturesFont_Default.Texture.Path = App.Path & FONT_PATH & "texdefault.png"LoadTexture Font_Default.Texture' GeorgiaNumTextures = NumTextures + 1ReDim Preserve gTexture(NumTextures)Font_Georgia.Texture.Texture = NumTexturesFont_Georgia.Texture.Path = App.Path & FONT_PATH & "georgia.png"LoadTexture Font_Georgia.TextureEnd SubSub UnloadFontTextures()UnloadFont Font_DefaultUnloadFont Font_GeorgiaEnd SubSub UnloadFont(Font As CustomFont)Font.Texture.Texture = 0End Sub```let me know if i missed anything! ![^_^](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/happy.png)My next tutorial will be the trade system!! Link to comment Share on other sites More sharing options...
iSnow Posted October 29, 2012 Share Posted October 29, 2012 Nice work, CS:DE was always a good base besides the problems it has. Link to comment Share on other sites More sharing options...
tslusny Posted October 29, 2012 Share Posted October 29, 2012 This is not real fix. I fixed CS:DE in Eclipse Reborn, becouse its texture loading is alot faster and it isnt using GDI+. Otherwise i will stay with ENOne example what is describing what i am trying to say ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)> Put the **five classes** from EN and add them into CS:DE Link to comment Share on other sites More sharing options...
Valentine90 Posted October 29, 2012 Share Posted October 29, 2012 Could you tell what is being corrected? I was a little confused by this code, you mainly use```TryCreateDirectX8Device Function () As Boolean```Why The Function of CS is better than this new sub it is you saying to replace, since **TryCreateDirectX8Device** is not complete.You are saying to use **CheckTilesets, CheckCharacters** … besides others, but the way it is in the CS is faster because it loads the amount and puts in the DX8 memory only once. Link to comment Share on other sites More sharing options...
iSnow Posted October 29, 2012 Share Posted October 29, 2012 > This is not real fix. I fixed CS:DE in Eclipse Reborn, becouse its texture loading is alot faster and it isnt using GDI+. Otherwise i will stay with EN> > One example what is describing what i am trying to say ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)This is a real fix and possibly better. You know why? Because it restores the stable DX8 functionality EN has and throws it over the systems and decent features that CS:DE has, your Reborn edit is trying to completely restructure the same thing. This allows EN tutorials that requires graphic work to become compatible in CS:DE which is more of an upgrade than any custom version I've seen, because it gives you the engine at a stable state and nothing more. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 29, 2012 Author Share Posted October 29, 2012 > This is not real fix. I fixed CS:DE in Eclipse Reborn, becouse its texture loading is alot faster and it isnt using GDI+. Otherwise i will stay with EN> > One example what is describing what i am trying to say ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)Please, if you have something not retarded to say, please say otherwise please be quiet… Link to comment Share on other sites More sharing options...
or3o Posted October 29, 2012 Share Posted October 29, 2012 Good job zero. Link to comment Share on other sites More sharing options...
tslusny Posted October 29, 2012 Share Posted October 29, 2012 > Please, if you have something not retarded to say, please say otherwise please be quiet…Sorry if i said something wrong. This isn´t fix, this is replacement ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) But it is doing its job.> This is a real fix and possibly better. You know why? Because it restores the stable DX8 functionality EN has and throws it over the systems and decent features that CS:DE has, your Reborn edit is trying to completely restructure the same thing. This allows EN tutorials that requires graphic work to become compatible in CS:DE which is more of an upgrade than any custom version I've seen, because it gives you the engine at a stable state and nothing more.Why do you think that i started Reborn? Becouse i wanted to use CS:DE method of rendering, what is faster and cleaner, and it have alot less code. And CS:DE do not have many unique features. Only NPC spells and Spell Advancement is worth of mentioning (but there is tutorial on this forums for first one, and second can be done only with one sub server side and adding few lines of code ro UDTs). So idk what do you mean by "systems and decent features that CS:DE has" ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Guest Posted October 29, 2012 Share Posted October 29, 2012 > This is not real fix.That is the first decent thing he's ever said, too bad his explanation is off. The way you're handling rendering is still pretty bad, I recommend you check [this](http://www.touchofdeathforums.com/community/index.php?/topic/130272-clean-optimised-dx8/) out to see how clean optimised rendering is done. I admit mine still has problems but its an actual solution instead of a problem masker. Link to comment Share on other sites More sharing options...
Rob Janes Posted October 29, 2012 Share Posted October 29, 2012 Heh, I love how some people think less code means better performance, or that using 3rd party API decreases performance. Just my two copper. Link to comment Share on other sites More sharing options...
Guest Posted October 29, 2012 Share Posted October 29, 2012 > Heh, I love how some people think less code means better performanceIf you think about it, most of the time it does. If someone does one thing in 5 lines of code and you do the same exact thing in 50 then you're putting 45 wasted lines of code into it. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 29, 2012 Author Share Posted October 29, 2012 and you're doing the same thing Link to comment Share on other sites More sharing options...
Rob Janes Posted October 29, 2012 Share Posted October 29, 2012 @Sekaru; in some aspects yes, if those 5 lines are developed properly, not going to disagree there. But for the topic of loading textures and GDI+, it actually has better performance. Though I do agree, the rendering in CS:DE was horribly ugly.@Growlith, my comment wasn't directed at you, I actually like that you took CS:DE and added the EO3.0 functions into it, you get the convienence of CS:DE with solid texture handling. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 30, 2012 Author Share Posted October 30, 2012 > @Sekaru; in some aspects yes, if those 5 lines are developed properly, not going to disagree there. But for the topic of loading textures and GDI+, it actually has better performance. Though I do agree, the rendering in CS:DE was horribly ugly.> > @Growlith, my comment wasn't directed at you, I actually like that you took CS:DE and added the EO3.0 functions into it, you get the convienence of CS:DE with solid texture handling.lol my comment wasn't directed to you either, it was directed to Sekaru x3 Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2012 Share Posted October 30, 2012 > @Sekaru; in some aspects yes, if those 5 lines are developed properly, not going to disagree there. But for the topic of loading textures and GDI+, it actually has better performance. Though I do agree, the rendering in CS:DE was horribly ugly.Oh yeah I agree there. I was just generalising.> and you're doing the same thingLooking at that clusterfuck of code I can safely say, no, I'm not. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 30, 2012 Author Share Posted October 30, 2012 > Looking at that clusterfuck of code I can safely say, no, I'm not.different amount = same function Link to comment Share on other sites More sharing options...
Valentine90 Posted October 30, 2012 Share Posted October 30, 2012 Relmente I was grateful to see people interested in improving the desepenho DirectX8, is a good initiative. But this may not be the best, you'll probably have to redo, for some reason I quoted the above. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 30, 2012 Author Share Posted October 30, 2012 what this fix does is take the rendering system from EO 3.0 and replaces the CS:DE graphics module with that one. it's a better fix because you actually know you're going to have a solid system…not to mention that it's(Deathbeam this part is for you)**it's still the same speed**. Link to comment Share on other sites More sharing options...
Valentine90 Posted October 30, 2012 Share Posted October 30, 2012 It would be interesting to find out something that you can take to not limit the stay of DirectX8 using graphics potency of 2, I still could not do it, nor advise using GDI has loss of performance, but I know it is possible, I've seen engines that closed source creator had achieved it. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 30, 2012 Author Share Posted October 30, 2012 you mean have to graphics engines in one client? o3o Link to comment Share on other sites More sharing options...
tslusny Posted October 30, 2012 Share Posted October 30, 2012 > what this fix does is take the rendering system from EO 3.0 and replaces the CS:DE graphics module with that one. it's a better fix because you actually know you're going to have a solid system…not to mention that it's(Deathbeam this part is for you)**it's still the same speed**.Same **rendering** speed, but slower speed when loading textures to memory. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 30, 2012 Author Share Posted October 30, 2012 that doesn't rly matter as long as the program starts.and like Rob said, just because it's a different way doesn't mean it's bad, your arguement has been invalidated by that comment so leave please. Link to comment Share on other sites More sharing options...
tslusny Posted October 30, 2012 Share Posted October 30, 2012 > that doesn't rly matter as long as the program starts.and like Rob said, just because it's a different way doesn't mean it's bad, your arguement has been invalidated by that comment so leave please.If you wanna that slow loading on start, they yes it doesnt matter, but if you are using loading textures when needed, then it matters.And ok not gonna post anything here, but you stop posting stupid posts in ER thread. Link to comment Share on other sites More sharing options...
Growlith1223 Posted October 30, 2012 Author Share Posted October 30, 2012 lol this is like arguing with a little kid… Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2012 Share Posted October 30, 2012 I genuinely suggest you both be quiet before you embarrass yourselves even more. Sure, the thread is hilarious but neither of you have a clue about what you're on about. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now