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

Characters PAPERDOLL show in Menu Screen


DarkDino
 Share

Recommended Posts

Hi eclipse!, Some time ago I decided to add multiple characters in my engine (from Eclipse DAWN to my version of EFF), now I would like to render the items (Paperdoll) of the characters in the menu screen, I will show below codes to use to show the SPRITE.

This my actually character Screen, Display solo Sprites.

![](http://i1070.photobucket.com/albums/u492/darkdino2d/colorxd_zpsf44a563c.png)

I use this code to render CHARS Sprites ( from Prospekt SRC )

```
Sub DrawCharacters()
Dim i As Long, Sprite As Long
Dim srcRect As D3DRECT, destRect As D3DRECT
Dim sRECT As RECT
Dim dRect As RECT
Dim Width As Long, Height As Long, color As Long

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
' Forgot this in 1.4.0! Fixed in 1.4.2\. My bad.
If NumCharacters = 0 Then Exit Sub

For i = 1 To MAX_PLAYER_CHARACTERS
If LenB(Trim(CharData(i).Name)) > 0 And CharData(i).Level > 0 Then
' get the face we need to use.
If i = SelectedChar Then
color = -1
Else
color = D3DColorARGB(230, 200, 200, 200)
End If
Sprite = CharData(i).Sprite

If Sprite > 0 Or Sprite <= NumCharacters Then
SetTexture Tex_Character(Sprite)

Width = Tex_Character(Sprite).Width / 4
Height = Tex_Character(Sprite).Height / 5

sRECT.Top = 0
sRECT.Bottom = sRECT.Top + Height
sRECT.Left = 0
sRECT.Right = sRECT.Left + Width

dRect.Top = 30
dRect.Bottom = dRect.Top + Height
dRect.Left = 37 + (120 * (i - 1))
dRect.Right = dRect.Left + Width

Direct3D_Device.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorRGBA(0, 0, 0, 0), 1#, 0
Direct3D_Device.BeginScene
RenderTextureByRects Tex_Character(Sprite), sRECT, dRect, color

With srcRect
.y1 = 30
.y2 = .y1 + Height
.x1 = 37 + (120 * (i - 1))
.x2 = .x1 + Width
End With

With destRect
.y1 = 30
.y2 = .y1 + Height
.x1 = 37 + (120 * (i - 1))
.x2 = .x1 + Width
End With

Direct3D_Device.EndScene
Direct3D_Device.Present srcRect, destRect, frmMenu.picFaces.hwnd, ByVal (0)
End If
End If
Next i
' Error handler
Exit Sub
errorhandler:
HandleError "DrawCharacters", "modGraphics", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub

```
In my Handle CHARDATA

```
Private Sub HandleCharData(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim i As Long

Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
For i = 1 To MAX_PLAYER_CHARACTERS
CharData(i).Name = Buffer.ReadString
CharData(i).Level = Buffer.ReadLong
CharData(i).Class = Buffer.ReadLong
CharData(i).Sex = Buffer.ReadLong
CharData(i).Sprite = Buffer.ReadLong
Next

Set Buffer = Nothing
frmLoad.Visible = False
frmMenu.Visible = True
frmMenu.picCredits.Visible = False
frmMenu.picCharacter.Visible = False
frmMenu.picRegister.Visible = False
frmMenu.picCharacters.Visible = True
frmLoad.Visible = False

SelectedChar = 1

If LenB(Trim(CharData(SelectedChar).Name)) > 0 Then
If CharData(SelectedChar).Sex = SEX_MALE Then
frmMenu.lblCharDesc.Caption = "#" & SelectedChar & " " & Trim(CharData(SelectedChar).Name) & ", Level " & CharData(SelectedChar).Level & " Male " & Class(CharData(SelectedChar).Class).Name
Else
frmMenu.lblCharDesc.Caption = "#" & SelectedChar & " " & Trim(CharData(SelectedChar).Name) & ", Level " & CharData(SelectedChar).Level & " Female " & Class(CharData(SelectedChar).Class).Name
End If
Else
frmMenu.lblCharDesc.Caption = "Empty Character Slot"
End If
End Sub

```
CharRec modTypes

```
Public Type CharDataRec
Name As String * NAME_LENGTH
Level As Long
Class As Long
Sex As Long
Sprite As Long
End Type

```
**–-------- SERVER SIDE**

In my SendChar

```
Sub SendCharacterData(ByVal index As Long)
Dim buffer As clsBuffer
Dim i As Long

Set buffer = New clsBuffer
buffer.WriteLong SCharData
For i = 1 To MAX_PLAYER_CHARACTERS
buffer.WriteString Player(index).Char(i).Name
buffer.WriteLong Player(index).Char(i).Level
buffer.WriteLong Player(index).Char(i).Class
buffer.WriteLong Player(index).Char(i).Sex
buffer.WriteLong Player(index).Char(i).Sprite
Next

SendDataTo index, buffer.ToArray()

Set buffer = Nothing
End Sub

```
Please help me to Render PAPERDOLLS of all my chars :( in my Menu screen, THANKS!.
**I tried adding .Char(i).Equipment(VarHere) in my server. And my client also declaring Char (i). Equipment in my CharData. But render other Paperdolls, is not the equipped. **
Link to comment
Share on other sites

You can guide me a little more D:? i can't understand how to this

```
Public Sub DrawEquipment()
Dim x As Long, y As Long, i As Long
Dim itemnum As Long, itempic As DX8TextureRec

For i = 1 To Equipment.Equipment_Count - 1
itemnum = GetPlayerEquipment(MyIndex, i)

' get the item sprite
If itemnum > 0 Then
itempic = Tex_Item(Item(itemnum).pic)
Else
' no item equiped - use blank image
itempic = Tex_GUI(8 + i)
End If

y = GUIWindow(GUI_CHARACTER).y + EqTop + ((EqOffsetY + 32) * ((i - 1) \ EqColumns))
x = GUIWindow(GUI_CHARACTER).x + EqLeft + ((EqOffsetX + 32) * (((i - 1) Mod EqColumns)))

'EngineRenderRectangle itempic, x, y, 0, 0, 32, 32, 32, 32, 32, 32
RenderTexture itempic, x, y, 0, 0, 32, 32, 32, 32
Next
End Sub

```
use in my draw characters D:!. / thanks for answer :)!.
Link to comment
Share on other sites

ok, well do you have it so the client is actually recieving what that character's equipment is when you click login(not use character)?

if so, just add a new render line under the line that renders the character sprite.

```
RenderTexture Tex_Paperdoll(Player(MyIndex).Equipment(1)), x, y, 0,0, 32, 32, 32, 32

```

Go from there, if you need anymore help, let me know :P
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...