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

7's Upgraded Minimap System.


Carim123
 Share

Recommended Posts

This is based on a tutorial I found a while ago by some guy named Briaton (sp?). Credits obviously go to him, but as it was for EE, all I did was make it functional.

Here'll be the result…

![](http://www.freemmorpgmaker.com/files/imagehost/pics/cf636db5db57fd59c87020e53a80046a.png)

This is a washed down version of my own one in IP, as I have purposely removed my extra modifications, etc. This blts the blocked tiles, walkable tiles, and player and npc locations. Don't expect me to hand over any more functions, and make them yourself. It's fairly easy to add to.

```
Public DDS_MiniMap As DirectDrawSurface7
``````
Public DDSD_MiniMap As DDSURFACEDESC2
```
If I need to tell you where that goes, you need to have a good read on some of the basic EO modules.

In InitSurfaces, add…

```
If FileExist(App.Path & "\data files\graphics\minimap.bmp", True) Then Call InitDDSurf("minimap", DDSD_MiniMap, DDS_MiniMap)
```
DestroyDirectDraw:

```
    Set DDS_MiniMap = Nothing
    ZeroMemory ByVal VarPtr(DDSD_MiniMap), LenB(DDSD_MiniMap)
```
Now, anywhere in modDD7…

```
Sub BltMiniMap()
Dim X As Integer
Dim Y As Integer
Dim i As Long
Dim Direction As Byte

Dim MMx As Long
Dim MMy As Long

Dim BLOCKrect As RECT
Dim PLAYERrect As RECT
Dim NPCrect As RECT
Dim WALKrect As RECT
Dim BLANKrect As RECT

Dim MapNum As Long
Dim XX As Long
Dim YY As Long

    Call DDS_BackBuffer.SetForeColor(RGB(255, 255, 255))

    MapNum = Player(MyIndex).Map
    XX = Map.MaxX
    YY = Map.MaxY

    With BLOCKrect
        .Top = 8
        .Bottom = .Top + 4
        .Left = 0
        .Right = .Left + 4
    End With

    With PLAYERrect
        .Top = 0
        .Bottom = .Top + 4
        .Left = 4
        .Right = .Left + 4
    End With

    With NPCrect
        .Top = 4
        .Bottom = .Top + 4
        .Left = 0
        .Right = .Left + 4
    End With

    With WALKrect
        .Top = 4
        .Bottom = .Top + 4
        .Left = 4
        .Right = .Left + 4
    End With

    With BLANKrect
        .Top = 0
        .Bottom = .Top + 4
        .Left = 0
        .Right = .Left + 4
    End With

    ' ALWAYS render the tiles before players.
    ' ALWAYS render blocked AFTER the tiles...
                    ' walkable

        'Have the blank first...
    For X = 0 To XX
        For Y = 0 To YY
            Select Case Map.Tile(X, Y).Type
                Case TILE_TYPE_BLANK
                    MMx = Camera.Left + 5 + (X * 4)
                    MMy = Camera.Top + 25 + (Y * 4)
                    Engine_BltFast MMx, MMy, DDS_MiniMap, BLANKrect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
                Case TILE_TYPE_WALKABLE, TILE_TYPE_NPCAVOID
                    MMx = Camera.Left + 5 + (X * 4)
                    MMy = Camera.Top + 25 + (Y * 4)
                    If Map.Tile(X, Y).Type <> TILE_TYPE_BLANK Then Engine_BltFast MMx, MMy, DDS_MiniMap, WALKrect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
                Case TILE_TYPE_BLOCKED
                    MMx = Camera.Left + 5 + (X * 4)
                    MMy = Camera.Top + 25 + (Y * 4)
                    Engine_BltFast MMx, MMy, DDS_MiniMap, BLOCKrect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
            End Select
        Next Y
    Next X

    For X = 0 To XX
        For Y = 0 To YY
            If Map.Tile(X, Y).Type = Map.Tile(X, Y).DirBlock >= 1 Then
                MMx = Camera.Left + 5 + (X * 4)
                MMy = Camera.Top + 25 + (Y * 4)
                Engine_BltFast MMx, MMy, DDS_MiniMap, BLOCKrect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
            End If
        Next Y
    Next X

    ' -------------------------------------------
        'Players...
    For i = 1 To MAX_PLAYERS
        If Player(i).Vital(1) > 0 Then
            X = Player(i).X
            Y = Player(i).Y
            MMx = Camera.Left + 5 + (X * 4)
            MMy = Camera.Top + 25 + (Y * 4)
            Call DDS_BackBuffer.BltFast(MMx, MMy, DDS_MiniMap, PLAYERrect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    Next i

        'NPCs.
    For i = 1 To MAX_MAP_NPCS
        If MapNpc(i).num > 0 Then
            X = MapNpc(i).X
            Y = MapNpc(i).Y
            MMx = Camera.Left + 5 + (X * 4)
            MMy = Camera.Top + 25 + (Y * 4)
                Select Case Npc(MapNpc(i).num).Behaviour
                        Call DDS_BackBuffer.BltFast(MMx, MMy, DDS_MiniMap, NPCrect, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
                End Select
        End If
    Next i
End Sub
```
In RenderGraphics, above the TexthDC backbuffer stuff, add

```
If Minimap = True Then BltMiniMap
```
In modGlobals

```
Public Minimap As Boolean
```
Now, in modInput, HandleKeyPresses, within the case stuff…

```
                Case "/minimap"
                    Minimap = Not Minimap
```
This concludes the minimap side of things.

Now, open frmEditor_Map, and in fraAttributes, add an option button called optBlank. We're going to add a blank tile type.

In MapEditorMouseDown, above the End With, add;

```
If frmEditor_Map.optBlank.value Then .Type = TILE_TYPE_BLANK
```
Now, in modConstants, add;

```
Public Const TILE_TYPE_BLANK As Byte = 16
```
Change the 16 to whatever your constant is.

This concludes the client-edits.

Now, in server-side, add the same constant as above, and that's it. Although I have added a few checks, it's fairly strewn about, but this should be sufficient, shouldn't cause errors, and act as a completely blank, walkable tile. The purpose of this is to make the Minimap square clear, as if you leave the border, outside the walkable zone, etc, it will show up with a white square. If there are any errors, tell me, and I'll do my best to compile what I can.

Now, save this in your graphics folder, and enjoy your new minimaps!

![](http://www.freemmorpgmaker.com/files/imagehost/pics/b09903069db1c888cfaccfb02f45f22a.bmp)

Please tell me if anything's missing, I'm fairly sure this is complete.

NOTE: As with any form of Blting, you will be prone to FPS drops while this is in use. I haven't tested exactly how much of a drop occurs extensively, but I went from a previous of 143 to 132\. Go use however you want.
Link to comment
Share on other sites

Yeah, sorry, forgot to remove the case around the NPC, as I removed the npc difference purposefully.

Also, you should change it to "Engine_BltFast", not "DDS_BackBuffer.BltFast". I forgot about that.

I should also note that the graphics are for demonstration purposes only, even if they're 4x4 squares, they're still mine.
Link to comment
Share on other sites

Looks great actually… But mind if you put an optional tutorial for this
awesome system... Like putting a button perhaps? Much easier than typing.

    -Kindly,
    Night~
Link to comment
Share on other sites

@Night~:

> Looks great actually… But mind if you put an optional tutorial for this
> awesome system... Like putting a button perhaps? Much easier than typing.
>
>     -Kindly,
>     Night~

Yeah, no.

It's not difficult to add what's under /minimap in a new image/picture/button control.
Link to comment
Share on other sites

@Ne[o:

> x link=topic=75443.msg809748#msg809748 date=1317332322]
> This is for EE or EO?
> o.0

Why would I make a tutorial for EE?

@Whackeddie99:

> Yeah, and if you don't want a command heres what you do.
>
> in Sub LoadMap
>
> ```
> Minimap = Minimap
> ```
> place near the bottom, before the error handler. and just delete the case for the /minimap command. Now it should be visible on start up.

Well…it's a way..albeit bad.
Link to comment
Share on other sites

As expected :)

Well I have been started to read the script, I don't wanna copy+paste something without understanding it, so here comes the first question:

In this block of code
```
Call DDS_BackBuffer.SetForeColor(RGB(255, 255, 255))

    MapNum = Player(MyIndex).Map
    XX = Map.MaxX
    YY = Map.MaxY

    With BLOCKrect
        .Top = 8
        .Bottom = .Top + 4
        .Left = 0
        .Right = .Left + 4
    End With

    With PLAYERrect
        .Top = 0
        .Bottom = .Top + 4
        .Left = 4
        .Right = .Left + 4
    End With

    With NPCrect
        .Top = 4
        .Bottom = .Top + 4
        .Left = 0
        .Right = .Left + 4
    End With

    With WALKrect
        .Top = 4
        .Bottom = .Top + 4
        .Left = 4
        .Right = .Left + 4
    End With

    With BLANKrect
        .Top = 0
        .Bottom = .Top + 4
        .Left = 0
        .Right = .Left + 4
    End With
```
You tell to the client(?) from where to read(?) that dots from the minimap.bmp ??

*I hope you understand what I mean*
Also even if I'm a noob when come to scripting (0/100 <- my lvl) I need to say that I like how clean is your script.
Link to comment
Share on other sites

  • 1 month later...
My map isn't showing up.

This line is never true.
           ```
If Map.Tile(X, Y).Type = Map.Tile(X, Y).DirBlock >= 1 Then
```other than that all the Engine_BltFast subs are called.

In Engine_BltFast
```
    If Not ddS Is Nothing Then
```never passes either.

What was the blank tile option for?
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...