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

Chat draw on Screen DX8


Shasokais
 Share

Recommended Posts

Guys, please help.

I found a code only for DX7, but I need to DX8

[http://www.touchofdeathforums.com/community/index.php?/topic/117047-eochat-drawn-to-screen/page__hl__%2Bdraw+%2Bscreen](http://www.touchofdeathforums.com/community/index.php?/topic/117047-eochat-drawn-to-screen/page__hl__%2Bdraw+%2Bscreen) (need something like this)
Link to comment
Share on other sites

Replace:```

Call DrawText(TexthDC, Camera.left + 10, (Camera.Bottom - 20) - (i * 20), Chat(i).text, Chat(i).Colour)

```
with:```

RenderText Font_Default, Chat(i).text, Camera.left + 10, (Camera.Bottom - 20) - (i * 20), Chat(i).text, Chat(i).Colour

```
Link to comment
Share on other sites

As I understood it was necessary to insert DrawChat here, right?

(I instert it above BFPS)

```

Public Sub Render_Graphics()

Dim x As Long

Dim y As Long

Dim i As Long

Dim rec As RECT

Dim rec_pos As RECT, srcRect As D3DRECT

' If debug mode, handle error then exit out

On Error GoTo errorhandler

'Check for device lost.

If Direct3D_Device.TestCooperativeLevel = D3DERR_DEVICELOST Or Direct3D_Device.TestCooperativeLevel = D3DERR_DEVICENOTRESET Then HandleDeviceLost: Exit Sub

' don't render

If frmMain.WindowState = vbMinimized Then Exit Sub

If GettingMap Then Exit Sub

' update the viewpoint

UpdateCamera

Direct3D_Device.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorARGB(0, 0, 0, 0), 1#, 0

Direct3D_Device.BeginScene

' blit lower tiles

If NumTileSets > 0 Then

For x = TileView.Left To TileView.Right

For y = TileView.Top To TileView.Bottom

If IsValidMapPoint(x, y) Then

Call DrawMapTile(x, y)

End If

Next

Next

End If

' render the decals

For i = 1 To MAX_BYTE

Call DrawBlood(i)

Next

' Blit out the items

If numitems > 0 Then

For i = 1 To MAX_MAP_ITEMS

If MapItem(i).num > 0 Then

Call DrawItem(i)

End If

Next

End If

If Map.CurrentEvents > 0 Then

For i = 1 To Map.CurrentEvents

If Map.MapEvents(i).Position = 0 Then

DrawEvent i

End If

Next

End If

' draw animations

If NumAnimations > 0 Then

For i = 1 To MAX_BYTE

If AnimInstance(i).Used(0) Then

DrawAnimation i, 0

End If

Next

End If

' Y-based render. Renders Players, Npcs and Resources based on Y-axis.

For y = 0 To Map.MaxY

If NumCharacters > 0 Then

If Map.CurrentEvents > 0 Then

For i = 1 To Map.CurrentEvents

If Map.MapEvents(i).Position = 1 Then

If y = Map.MapEvents(i).y Then

DrawEvent i

End If

End If

Next

End If

' Players

For i = 1 To Player_HighIndex

If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then

If Player(i).y = y Then

Call DrawPlayer(i)

End If

End If

Next

' Npcs

For i = 1 To Npc_HighIndex

If MapNpc(i).y = y Then

Call DrawNpc(i)

End If

Next

End If

' Resources

If NumResources > 0 Then

If Resources_Init Then

If Resource_Index > 0 Then

For i = 1 To Resource_Index

If MapResource(i).y = y Then

Call DrawMapResource(i)

End If

Next

End If

End If

End If

Next

' animations

If NumAnimations > 0 Then

For i = 1 To MAX_BYTE

If AnimInstance(i).Used(1) Then

DrawAnimation i, 1

End If

Next

End If

' blit out upper tiles

If NumTileSets > 0 Then

For x = TileView.Left To TileView.Right

For y = TileView.Top To TileView.Bottom

If IsValidMapPoint(x, y) Then

Call DrawMapFringeTile(x, y)

End If

Next

Next

End If

If Map.CurrentEvents > 0 Then

For i = 1 To Map.CurrentEvents

If Map.MapEvents(i).Position = 2 Then

DrawEvent i

End If

Next

End If

DrawWeather

DrawFog

DrawTint

' blit out a square at mouse cursor

If InMapEditor Then

If frmEditor_Map.optBlock.value = True Then

For x = TileView.Left To TileView.Right

For y = TileView.Top To TileView.Bottom

If IsValidMapPoint(x, y) Then

Call DrawDirection(x, y)

End If

Next

Next

End If

Call DrawTileOutline

End If

' Render the bars

DrawBars

' Draw the target icon

If myTarget > 0 Then

If myTargetType = TARGET_TYPE_PLAYER Then

DrawTarget (Player(myTarget).x * 32) + Player(myTarget).xOffset, (Player(myTarget).y * 32) + Player(myTarget).yOffset

ElseIf myTargetType = TARGET_TYPE_NPC Then

DrawTarget (MapNpc(myTarget).x * 32) + MapNpc(myTarget).xOffset, (MapNpc(myTarget).y * 32) + MapNpc(myTarget).yOffset

End If

End If

' Draw the hover icon

For i = 1 To Player_HighIndex

If IsPlaying(i) Then

If Player(i).Map = Player(MyIndex).Map Then

If CurX = Player(i).x And CurY = Player(i).y Then

If myTargetType = TARGET_TYPE_PLAYER And myTarget = i Then

' dont render lol

Else

DrawHover TARGET_TYPE_PLAYER, i, (Player(i).x * 32) + Player(i).xOffset, (Player(i).y * 32) + Player(i).yOffset

End If

End If

End If

End If

Next

For i = 1 To Npc_HighIndex

If MapNpc(i).num > 0 Then

If CurX = MapNpc(i).x And CurY = MapNpc(i).y Then

If myTargetType = TARGET_TYPE_NPC And myTarget = i Then

' dont render lol

Else

DrawHover TARGET_TYPE_NPC, i, (MapNpc(i).x * 32) + MapNpc(i).xOffset, (MapNpc(i).y * 32) + MapNpc(i).yOffset

End If

End If

End If

Next

If DrawThunder > 0 Then RenderTexture Tex_White, 0, 0, 0, 0, frmMain.picScreen.ScaleWidth, frmMain.picScreen.ScaleHeight, 32, 32, D3DColorRGBA(255, 255, 255, 160): DrawThunder = DrawThunder - 1

' Get rec

With rec

.Top = Camera.Top

.Bottom = .Top + ScreenY

.Left = Camera.Left

.Right = .Left + ScreenX

End With

' rec_pos

With rec_pos

.Bottom = ScreenY

.Right = ScreenX

End With

With srcRect

.x1 = 0

.x2 = frmMain.picScreen.ScaleWidth

.y1 = 0

.y2 = frmMain.picScreen.ScaleHeight

End With

'Evilbunnie's drawnChat System

DrawChat

If BFPS Then

RenderText Font_Default, "FPS: " & CStr(GameFPS), 2, 39, Yellow, 0

End If

' draw cursor, player X and Y locations

If BLoc Then

RenderText Font_Default, Trim$("cur x: " & CurX & " y: " & CurY), 2, 1, Yellow, 0

RenderText Font_Default, Trim$("loc x: " & GetPlayerX(MyIndex) & " y: " & GetPlayerY(MyIndex)), 2, 15, Yellow, 0

RenderText Font_Default, Trim$(" (map #" & GetPlayerMap(MyIndex) & ")"), 2, 27, Yellow, 0

End If

' draw player names

For i = 1 To Player_HighIndex

If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then

Call DrawPlayerName(i)

End If

Next

For i = 1 To Map.CurrentEvents

If Map.MapEvents(i).Visible = 1 Then

If Map.MapEvents(i).ShowName = 1 Then

DrawEventName (i)

End If

End If

Next

' draw npc names

For i = 1 To Npc_HighIndex

If MapNpc(i).num > 0 Then

Call DrawNpcName(i)

End If

Next

' draw the messages

For i = 1 To MAX_BYTE

If chatBubble(i).active Then

DrawChatBubble i

End If

Next

For i = 1 To Action_HighIndex

Call DrawActionMsg(i)

Next i

' Draw map name

RenderText Font_Default, Map.name, DrawMapNameX, DrawMapNameY, DrawMapNameColor, 0

If InMapEditor And frmEditor_Map.optEvent.value = True Then DrawEvents

If InMapEditor Then Call DrawMapAttributes

If FadeAmount > 0 Then RenderTexture Tex_Fade, 0, 0, 0, 0, frmMain.picScreen.ScaleWidth, frmMain.picScreen.ScaleHeight, 32, 32, D3DColorRGBA(255, 255, 255, FadeAmount)

If FlashTimer > GetTickCount Then RenderTexture Tex_White, 0, 0, 0, 0, frmMain.picScreen.ScaleWidth, frmMain.picScreen.ScaleHeight, 32, 32, -1

Direct3D_Device.EndScene

If Direct3D_Device.TestCooperativeLevel = D3DERR_DEVICELOST Or Direct3D_Device.TestCooperativeLevel = D3DERR_DEVICENOTRESET Then

HandleDeviceLost

Exit Sub

Else

If InShop = False And InBank = False Then Direct3D_Device.Present srcRect, ByVal 0, 0, ByVal 0

DrawGDI

End If

' Error handler

Exit Sub

errorhandler:

If Direct3D_Device.TestCooperativeLevel = D3DERR_DEVICELOST Or Direct3D_Device.TestCooperativeLevel = D3DERR_DEVICENOTRESET Then

HandleDeviceLost

Exit Sub

Else

If Options.Debug = 1 Then

HandleError "Render_Graphics", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

End If

MsgBox "Unrecoverable DX8 error."

DestroyGame

End If

End Sub

```
Link to comment
Share on other sites

  • 4 months later...
its due to the color, i changed

```

RenderText Font_Default, Chat(i).text, Camera.Left + 10, (Camera.Bottom - 20) - (i * 20), Chat(i).Colour

```

to

```

RenderText Font_Default, Chat(i).text, Camera.Left + 10, (Camera.Bottom - 20) - (i * 20), White

```

and it works.
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...