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

Map name on a label off the game screen


dao
 Share

Recommended Posts

No, I know what you want Zultar.

Create a new Label on your frmMirage. Call it lblZone

then in ModGameLogic.bas, in Sub GameLoop put this code anywhere:

```
frmMirage.lblZone.Caption = Trim(Map(GetPlayerMap(MyIndex)).Name)
frmMirage.lblZone.ForeColor = QBColor(BrightRed)
```
Link to comment
Share on other sites

I don't see why everyone's having such a problem with this. It's common knowledge that the map name is rendered on screen. Moving this to be drawn to a label is simple. Perhaps you should look at your sources before posting.

One of the main problems I've found people have with adding this, is that they don't understand the differences between drawing text to a label and rendering it on screen. I've seen a lot of sources which re-set the caption of a label every loop. Terrible.

Anyway, here we go.

Find this in the gameloop:

```
' Draw map name
```
Remove all of this:

```
' Draw map name
If Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NONE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BRIGHTRED))
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_HOUSE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(YELLOW))
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_SAFE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(WHITE))
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NO_PENALTY Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BLACK))
End If

```
That was the code which rendered the map name on-screen.

Now, we need to draw it to a label. So, make a label in frmMirage, call it "lblMapName" or something appropriate, and then find this code in modHandleData:

```
If GameWeather = WEATHER_RAINING Then
    Call PlayBGS("rain.wav")
End If
If GameWeather = WEATHER_THUNDER Then
    Call PlayBGS("thunder.wav")
End If

```
And underneath it, add this:

```
' Draw map name
With frmMirage.lblMapName
    Select Case Map(GetPlayerMap(MyIndex)).Moral
        Case MAP_MORAL_NONE
            .Caption = Trim$(Map(GetPlayerMap(MyIndex)).Name)
            .ForeColor = QBColor(BRIGHTRED)

        Case MAP_MORAL_HOUSE
            .Caption = Trim$(Map(GetPlayerMap(MyIndex)).Name)
            .ForeColor = QBColor(YELLOW)

        Case MAP_MORAL_SAFE
            .Caption = Trim$(Map(GetPlayerMap(MyIndex)).Name)
            .ForeColor = QBColor(WHITE)

        Case MAP_MORAL_NO_PENALTY
            .Caption = Trim$(Map(GetPlayerMap(MyIndex)).Name)
            .ForeColor = QBColor(BLACK)
    End Select
End With
```
Enjoy.
Link to comment
Share on other sites

@[G2D:

> УV☼ link=topic=46192.msg469858#msg469858 date=1244789668]
> Wow… and I achieved the same result in just 1 lines of code... i must be a genius.

Nope. Read my post. Re-writing to a label every loop is _not_ something a genius would do.
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...