Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[CS:DE]MapEditor Fix and Extra Functionality


Rithy58
 Share

Recommended Posts

I found a problem with the map editor the first day I use CS:DE but Robin helped solved the problem.
The problem was, EngineDrawSquare didn't draw the Blue and Red boxes in the Map Editor if given Texture 0 so to solve this, Robin told me to make it use Tex_Blank, which is basically a blank PNG.

Client Side, modDirectX8:
**Under**
```
Public Tex_Fader As Long
```**Add**
```
Public Tex_Blank As Long
```
**Under**
```
Tex_Shadow = SetTexturePath(App.path & Path_Graphics & "shadow.png")
```**Add**
```
Tex_Blank = SetTexturePath(App.path & Path_Graphics & "blank.png")
```
**Replace**
```
Public Sub EngineDrawSquare(ByVal x As Long, ByVal y As Long, ByVal w As Long, ByVal h As Long, Optional ByVal colour As Long = 0, Optional lineWidth As Byte = 1)
```**With**
```
Public Sub EngineDrawSquare(ByVal x As Long, ByVal y As Long, ByVal w As Long, ByVal h As Long, Optional ByVal colour As Long = 0, Optional lineWidth As Byte = 1)
    ' Top line
    RenderTexture Tex_Blank, x, y, 0, 0, w, lineWidth, 0, 0, colour
    ' Left line
    RenderTexture Tex_Blank, x, y, 0, 0, lineWidth, h, 0, 0, colour
    ' Bottom line
    RenderTexture Tex_Blank, x, y + h - lineWidth, 0, 0, w, lineWidth, 0, 0, colour
    ' Right line
    RenderTexture Tex_Blank, x + w - lineWidth, y, 0, 0, lineWidth, h, 0, 0, colour
End Sub
```_Don't be an idiot and make a stupid move. Replace the WHOLE FUNCTION, not just that one line, with that new function._

I attached my 32 x 32 blank PNG for you to put in your CS:DE Client's graphic folder but you can always make your own. Just a 32 x 32 white PNG file.

This solved the problem. However, it wasn't 100% what I wanted. Only 50%. I wanted the selected box in the Map Editor and the TileOutLine in the Map, like how EO use Misc.bmp. I decided to do that, but instead of drawing a box, I render the texture selected instead.

Below is the code I converted from my own my game that use EO 2.0 Dx7 so it would work with CS:DE Dx8

```
Public Sub DrawTileOutLine()
Dim Tileset As Byte

    ' find tileset number
    Tileset = frmEditor_Map.scrlTileSet.value

    ' exit out if doesn't exist
    If Tileset <= 0 Or Tileset > Count_Tileset Then Exit Sub

    If frmEditor_Map.scrlAutotile.value = 0 Then
        RenderTexture Tex_Tileset(Tileset), CurX * PIC_X, CurY * PIC_Y, shpSelectedLeft, shpSelectedTop, shpSelectedWidth, shpSelectedHeight, shpSelectedWidth, shpSelectedHeight
    Else
        RenderTexture Tex_Tileset(Tileset), CurX * PIC_X, CurY * PIC_Y, shpSelectedLeft, shpSelectedTop, PIC_X, PIC_Y, PIC_X, PIC_Y
    End If

End Sub
```
Not gonna guide you through this. Just call that method in Render_Graphics. Make sure you check for InMapEditor.

Sincerely,
Rithy
Link to comment
Share on other sites

  • 8 months later...
Sorry to necro post, but theres a bit of an issue with this and scrolling maps.

in drawtileoutline use this sub  instead

Public Sub DrawTileOutLine()
Dim Tileset As Byte

    ' find tileset number
    Tileset = frmEditor_Map.scrlTileSet.value

    ' exit out if doesn't exist
    If Tileset <= 0 Or Tileset > Count_Tileset Then Exit Sub

    If frmEditor_Map.scrlAutotile.value = 0 Then
        RenderTexture Tex_Tileset(Tileset), CurX * PIC_X - (Camera.left + (TileView.left * 32)), CurY * PIC_Y - (Camera.top + (TileView.top * 32)), shpSelectedLeft, shpSelectedTop, shpSelectedWidth, shpSelectedHeight, shpSelectedWidth, shpSelectedHeight
    Else
        RenderTexture Tex_Tileset(Tileset), CurX * PIC_X - (Camera.left + (TileView.left * 32)), CurY * PIC_Y - (Camera.top + (TileView.top * 32)), shpSelectedLeft, shpSelectedTop, PIC_X, PIC_Y, PIC_X, PIC_Y
    End If

End Sub

this gets rid of the wandering tiles when you start moving around on a large map.
Link to comment
Share on other sites

  • 4 weeks later...
I did something wrong, because now when I open map editor it gives "Runtime error -2005529767  (88760b59) Automation error" and points at:

>! Public Sub LoadTexture(ByVal TextureNum As Long)
Dim Tex_Info As D3DXIMAGE_INFO_A
Dim path As String
>!     path = D3DT_TEXTURE(TextureNum).path

    Select Case D3DT_TEXTURE(TextureNum).Width
        Case 0
            **Set D3DT_TEXTURE(TextureNum).Texture = Direct3DX8.CreateTextureFromFileEx(D3DDevice8, path, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_POINT, D3DX_FILTER_NONE, RGB(255, 0, 255), Tex_Info, ByVal 0)**
            D3DT_TEXTURE(TextureNum).height = Tex_Info.height
            D3DT_TEXTURE(TextureNum).Width = Tex_Info.Width
        Case Is > 0
            Set D3DT_TEXTURE(TextureNum).Texture = Direct3DX8.CreateTextureFromFileEx(D3DDevice8, path, D3DT_TEXTURE(TextureNum).Width, D3DT_TEXTURE(TextureNum).height, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_FILTER_POINT, D3DX_FILTER_NONE, RGB(255, 0, 255), ByVal 0, ByVal 0)
    End Select

    D3DT_TEXTURE(TextureNum).UnloadTimer = GetTickCount
    D3DT_TEXTURE(TextureNum).loaded = True
End Sub
Could you help me please?
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...