08-06-2007, 07:08 PM
So... I added a guild system to my source. Rather, expanded on the one that is already started on each vanilla source. I also added an alignment system that blt's the name's of players in another color, depending on their alignment. For some reason, when testing with two clients, i could only see MY name color and guild name. Everyone elses appears white, and the guild names don't show at all.
Here's my bltplayer sub, anything wrong with it? Access/PK checking was commented out on purpose.
and the gameloop:
I can't see anything noticably wrong, unless the server is sending the wrong info.
Here's my bltplayer sub, anything wrong with it? Access/PK checking was commented out on purpose.
Code:
Sub BltPlayerName(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
' ' Check access level
' If GetPlayerPK(index) = NO Then
' Select Case GetPlayerAccess(index)
' Case 0
' Color = QBColor(White)
' Case 1
' Color = QBColor(Grey)
' Case 2
' Color = QBColor(Cyan)
' Case 3
' Color = QBColor(Yellow)
' Case 4
' Color = QBColor(BrightGreen)
' End Select
' Else
' Color = QBColor(BrightRed)
' End If
Select Case GetPlayerAlign(Index)
Case 0
Color = QBColor(White)
Case Is > 0
Color = QBColor(Yellow)
Case Is < 0
Color = QBColor(Red)
End Select
' Draw name
TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + Int(PIC_X / 2) - ((Len(Trim(GetPlayerName(Index))) / 2) * 8)
TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - Int(PIC_Y / 2) - 20
Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), Color)
If GetPlayerGuild(Index) > 0 Then
If Guild(GetPlayerGuild(Index)).Founder = GetPlayerName(Index) Then
Color = QBColor(BrightRed)
Else
Color = QBColor(Brown)
End If
' Draw guild name
TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + Int(PIC_X / 2) - ((Len(Trim(GetPlayerGuildName(Index))) / 2) * 8)
TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - Int(PIC_Y / 2) - 4
Call DrawText(TexthDC, TextX, TextY, GetPlayerGuildName(Index), Color)
End If
End Sub
and the gameloop:
Code:
...
' Blit out tile layer fringe
For y = 0 To MAX_MAPY
For x = 0 To MAX_MAPX
Call BltFringeTile(x, y)
Next x
Next y
' Blit out tile layer2 fringe
For y = 0 To MAX_MAPY
For x = 0 To MAX_MAPX
Call BltFringe2Tile(x, y)
Next x
Next y
' Lock the backbuffer so we can draw text and names
TexthDC = DD_BackBuffer.GetDC
For i = 1 To MAX_PLAYERS
If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
Call BltPlayerName(i)
End If
Next i
' Blit out attribs if in editor
If InEditor Then
For y = 0 To MAX_MAPY
...
I can't see anything noticably wrong, unless the server is sending the wrong info.