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

[EE 2.7] Adding a "Primitive" Minimap


Braiton
 Share

Recommended Posts

**Features:**
*Green = Finished
*Yellow = Started
*Red = Not Started

*Basic Minimap that shows: Blocked Tiles, Warp tiles, NPCs, you/other players (and pkers), dropped items, shops and makes the walkable tiles transparent.

*Works with Scrolling and Non-Scrolling Maps

*Change Minimap Size

*Advanced Minimap. Contains tiles like Doors, houses, locked doors, signs, scripted tiles, notices, banks, heals, etc. (Make sure you update the graphics file with the new one at the end)

*Disabling Minimap in certain maps (like mazes, etc.)

*Differenciating Friendly NPCs from Aggressive and others.

Any other features/adds on for the minimap you want post 'em here.

Ok, ok. First of all: I DID not make this. I found it on the web (back in 2006/07) made for another engine (Evidence points to Elysium) which apparently doesn't exist anymore. What i did was modify and port it so it would be fully working with Eclipse since the original wouldnt work. Im also expanding it more to contain more features and be more useful (Read Above). Also, those who helped are credited in the code comments. Kudos to Dark Dragon for making the basics of this.

Now, on with how to set it up:
Sidenote: I know i tend to explain things in depth but im on a hurry, maybe ill update the post later. Any bugs or error you encounter, post 'em here.

BEFORE STARTING: MAKE A BACKUP OF YOUR SOURCE.

It's all done client side

First download the file attached on the bottom, and place it in your GFX folder.

Now moving to the source. Add this under ModDirectX
```
Public DDSD_MiniMap As DDSURFACEDESC2
Public DD_MiniMap As DirectDrawSurface7
```
Now Look for your Sub InitSurfaces and add this
```
Or Not FileExists("\GFX\minimap.bmp") Then
```on the code that searchs for existing files.

Still in ModDirectX - in your InitSurface sub add this to where the rest of the bitmaps are loaded:
       ```
' Init minimap ddsd type and load the bitmap
    DDSD_MiniMap.lFlags = DDSD_CAPS
    DDSD_MiniMap.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_SYSTEMMEMORY
    Set DD_MiniMap = DD.CreateSurfaceFromFile(App.Path & "\GFX\minimap.bmp", DDSD_MiniMap)
    SetMaskColorFromPixel DD_MiniMap, 0, 0
```
Look for your sub that destroys DirectX and add this with the rest

```
Set DD_MiniMap = Nothing
```
Now add this sub

```
'Modified to work with EE by Braiton
Sub BltMiniMap()
Dim i As Long
Dim x As Integer
Dim y As Integer
Dim MMx As Long
Dim MMy As Integer

    ' Tiles Layer
    ' Select MM Tile to Use for Tiles Layer
    rec.Top = 8
    rec.Bottom = 16
    rec.Left = 0
    rec.right = 8

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(x, y).Type = TILE_TYPE_BLOCKED Then
                MMx = 400 + (x * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next x
    Next y

    ' Player Layer
    ' Select MM Tile to Use for Players Layer
    rec.Top = 16
    rec.Bottom = 24
    rec.Left = 0
    rec.right = 8

    For i = 1 To MAX_PLAYERS
        If Player(i).Map = Player(MyIndex).Map Then
            x = Player(i).x
            y = Player(i).y
            MMx = 400 + (x * 8)
            MMy = 32 + (y * 8)
            If Not i = MyIndex Then
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        End If
    Next i

    ' MyPlayer Layer
    rec.Top = 32
    rec.Bottom = 40
    rec.Left = 0
    rec.right = 8
    x = Player(MyIndex).x
    y = Player(MyIndex).y
    MMx = 400 + (x * 8)
    MMy = 32 + (y * 8)
    Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

    ' NPC Layer
    ' Select the MM Tile to use for the NPC Layer
    rec.Top = 24
    rec.Bottom = 32
    rec.Left = 0
    rec.right = 8

    For i = 1 To MAX_MAP_NPCS
        If MapNpc(i).num > 0 Then
            x = MapNpc(i).x
            y = MapNpc(i).y
            MMx = 400 + (x * 8)
            MMy = 32 + (y * 8)
            Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    Next i

    'Shops (Thanks to NexSteve)
    rec.Top = 40
    rec.Bottom = 48
    rec.Left = 0
    rec.right = 8
    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(x, y).Type = TILE_TYPE_SHOP Then
                MMx = 400 + (x * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next x
    Next y

    'Walkable tiles (Thanks to Me)

    rec.Top = 48
    rec.Bottom = 56
    rec.Left = 0
    rec.right = 8

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(x, y).Type = TILE_TYPE_WALKABLE Then
                MMx = 400 + (x * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next x
    Next y

    'Warps (Thanks to Me)

    rec.Top = 56
    rec.Bottom = 64
    rec.Left = 0
    rec.right = 8

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(x, y).Type = TILE_TYPE_WARP Then
                MMx = 400 + (x * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next x
    Next y

'Dropped item (Thanks to Aranshada)

    rec.Top = 64
    rec.Bottom = 72
    rec.Left = 0
    rec.right = 8

    For i = 1 To MAX_MAP_ITEMS
        If MapItem(i).num > 0 Then
            x = MapItem(i).x
            y = MapItem(i).y
            MMx = 400 + (x * 8)
            MMy = 32 + (y * 8)
            Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        End If
    Next i

    ' PKers(Thanks to me)
    rec.Top = 104
    rec.Bottom = 112
    rec.Left = 0
    rec.right = 8

    For i = 1 To MAX_PLAYERS
        If Player(i).Map = Player(MyIndex).Map Then
            If Player(i).PK = YES Then
                x = Player(i).x
                y = Player(i).y
                MMx = 400 + (x * 8)
                MMy = 32 + (y * 8)
                If Not i = MyIndex Then
                    Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
                End If
            End If
        End If
    Next i

'Signs (Thanks to Braiton)

    rec.Top = 112
    rec.Bottom = 120
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_SIGN Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

            'Key Doors (Thanks to Braiton)

    rec.Top = 120
    rec.Bottom = 128
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_KEY Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                'Doors (Thanks to Braiton)

    rec.Top = 128
    rec.Bottom = 136
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_DOOR Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                    'Scripted Tile (Thanks to Braiton)

    rec.Top = 136
    rec.Bottom = 144
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_SCRIPTED Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                        'Bank (Thanks to Braiton)

    rec.Top = 144
    rec.Bottom = 152
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_BANK Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                            'Heal (Thanks to Braiton)

    rec.Top = 152
    rec.Bottom = 160
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_HEAL Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                                'Notice (Thanks to Braiton)

    rec.Top = 160
    rec.Bottom = 168
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_NOTICE Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                                    'Arena (Thanks to Braiton)

    rec.Top = 168
    rec.Bottom = 176
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_ARENA Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                                        'Player House (Thanks to Braiton)

    rec.Top = 176
    rec.Bottom = 184
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_HOUSE Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

                                            'Grapple (Thanks to Braiton)

    rec.Top = 184
    rec.Bottom = 192
    rec.Left = 0
    rec.Right = 8

    For y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            If Map(Player(MyIndex).Map).Tile(X, y).Type = TILE_TYPE_HOOKSHOT Then
                MMx = 400 + (X * 8)
                MMy = 32 + (y * 8)
                Call DD_BackBuffer.BltFast(MMx, MMy, DD_MiniMap, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
        Next X
    Next y

End Sub
```

Now, in ModGlobals, search for 'Damage variables and below
```
Public ii As Long, iii As Long
Public sx As Long
```declare this:
```
Public Minimap As Boolean
```
In ModGeneral look for Public Sub Main and
above
```
frmMainMenu.lblVersion.Caption = "Version: " & App.Major & "." & App.Minor
```add this:
```
Minimap = False
```
In ModGameLogic, in the GameLoop search for
           ```
' Release DC
            Call DD_BackBuffer.ReleaseDC(TexthDC)
```
and below that add
```
' Blit out MiniMap
        If Minimap = True Then
            Call BltMiniMap
        End If
```
Now, in the same module, search for where the commands are and put this there. Make sure its put with the commands where all users can use it.:

         ```
'Choose to see or not to see minimap
                        If LCase(Mid(MyText, 1, 8)) = "/minimap" Then
            If Minimap = True Then
                Minimap = False
            Else
                Minimap = True
            End If
            Exit Sub
        End If

```
Still in the same module, at the end add:

```
Sub MiniMapOff(Index)
Minimap = False
If Minimap = True Then
            Call BltMiniMap
        Else
        End If
End Sub

Sub MiniMapOn(Index)
Minimap = True
If Minimap = True Then
            Call BltMiniMap
        End If
End Sub
```
And thats the end.

**Optional: How to change minimap size.**

1) Find Sub BltMiniMap and find this line of code
```
                MMx = 400 + (x * 8)
                MMy = 32 + (y * 8)
```
Now change that too

```
                MMx = 400 + (x * X)
                MMy = 32 + (y * X)
```
Where X is the size. I advise no larger than 10 and not less than 3 or 4.

2)Those lines should be in every different layer so make sure you change them all.

**Instructions:**
1-Boot your sever
2-Join your game
3-In chat type /minimap to activate it. If you wanna turn it off, type /minimap again.

*******+Known Issues+********
*X=0 and Y=0 will always show a blue dot (Fixed - Thanks to Balli/Derrick)
*Only Admins can use minimap - normal users can't (Fixed)

If done correctly you should see this (PS: Don't biatch at me for the zelda themed map, it was an old project where i experimented with different themes :D. But anyway, heres a screenshot of a "primitive minimap")

OLD (Basic Version)
![](http://i40.tinypic.com/i4r77k.jpg)

NEW (Advanced Version) with Minimap resize (Excuse the crappy quality)
![](http://i42.tinypic.com/21143sz.jpg)

-The grey tiles represent the "solid" objects represented by the Blocked attribute
-The blue tiles represent Warp attributes.
-The Yellow circle is you.
-The blue circle is an npc
-The ! is a notice/special event
-The board/sign icon is a sign

There are many more tiles that represent other things like: Shops, Pkers, items dropped in the floor, locked doors, grapple stones, banks, heal tiles, etc. But are not shown in the above screenshot.

Also, dont forget to download the file attached!
I made the graphics below the red person (The sign, onwards), i take no credit for the rest.

EDIT: The original icons disappeared, and i no longer have them, but i leave you a template instead. Each icon is 8x8\. Look through the code to see in what order they are.

TIP: When editing the template below, leave the first 8x8 square black since its the "Walkable" tile and it should be transparent. The second 8x8 square should be the other players icon. The third 8x8 square the npc icon and the 4th 8x8 square the icon that will show the current player. Im not going to flood you with another huge wall of text, so look through the code (as i said before) to see the order the icons go in.

And finally, enjoy!
Link to comment
Share on other sites

  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

Ok, thanks. I think it was in Elysium too, since it doesn't "quite" exist anymore. Ill add him to the credits for the time being.

I used it for a previous game i had made but i deleted the game. I tried searching for the code again but i had no luck finding it since it doesnt exist any more. Luckly, i had a CD with a copy of my previous game so i was able to extract the code.
Link to comment
Share on other sites

lol i think i may of found the error. in the command hes checking to see if its already seen and if it is =false idk but ima check this. still nothing but wouldnt this be the right code:

> 'Choose to see or not to see minimap
>                         If LCase(Mid(MyText, 1, 8)) = "/minimap" Then
>             If Minimap = False Then
>                 Minimap = True
>             Else
>                 Minimap = False
>             End If
>             Exit Sub
>         End If

im still having trouble but im looking thru the codes atm. if anyone has this set up please tell lol
Link to comment
Share on other sites

Make sure you also placed each portion of code where it needs to go.
Also make sure you downloaded the image attached and placed it in your GFX folder under the name minimap.bmp.

And this:
```
'Choose to see or not to see minimap
                        If LCase(Mid(MyText, 1, 8)) = "/minimap" Then
            If Minimap = False Then
                Minimap = True
            Else
                Minimap = False
            End If
            Exit Sub
        End If
```
is perfectly fine. Im checking if the minimap CANT be seen first. If it cant be seen first and you type the command you will be able to see it. And to save coding another line, else its false.
Link to comment
Share on other sites

Hmmm…try reinstalling it following the steps carefully. I tested it in EE 2.3 and 2.7 and it works fine. You might have missed a piece of code. Also make sure you place it correctly. I think those that dont know much about VB might not know where to place certain parts. I might re-make the steps expalining more in-depth later.
Link to comment
Share on other sites

@Zultar: Just tested it with the screen larger and it works. It must be an error with the way you installed it. Try installing it again in your last backup.

@Robin: Lol yeah, that works too ^_^ Im used to doing it like that heh.
Link to comment
Share on other sites

@♪♫♪:

> As for the blue dot at (0, 0):
>
> ```
> If Map(MyIndex).Npc(i) & MapNpc(i).HP > 0 Then
> ```
> Should just be:
>
> ```
> If MapNpc(i).Num > 0
> ```

Yup, thats it. Seems that slipped from me lol. Thanks for saving me 20 mins of looking through the code ^_^
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...