Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,188 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form frmPics
|
||||
Caption = "PicForm"
|
||||
ClientHeight = 4035
|
||||
ClientLeft = 60
|
||||
ClientTop = 345
|
||||
ClientWidth = 7485
|
||||
LinkTopic = "Form2"
|
||||
ScaleHeight = 4035
|
||||
ScaleWidth = 7485
|
||||
StartUpPosition = 3 'Windows Default
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 0
|
||||
Left = 240
|
||||
Picture = "PicForm.frx":0000
|
||||
Stretch = -1 'True
|
||||
Top = 120
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 1
|
||||
Left = 1440
|
||||
Picture = "PicForm.frx":018A
|
||||
Stretch = -1 'True
|
||||
Top = 120
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 2
|
||||
Left = 2640
|
||||
Picture = "PicForm.frx":0314
|
||||
Stretch = -1 'True
|
||||
Top = 120
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 6
|
||||
Left = 240
|
||||
Picture = "PicForm.frx":049E
|
||||
Stretch = -1 'True
|
||||
Top = 1440
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 7
|
||||
Left = 1440
|
||||
Picture = "PicForm.frx":0628
|
||||
Stretch = -1 'True
|
||||
Top = 1440
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 8
|
||||
Left = 2640
|
||||
Picture = "PicForm.frx":07B2
|
||||
Stretch = -1 'True
|
||||
Top = 1440
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 9
|
||||
Left = 3840
|
||||
Picture = "PicForm.frx":093C
|
||||
Stretch = -1 'True
|
||||
Top = 1440
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 10
|
||||
Left = 5040
|
||||
Picture = "PicForm.frx":0AC6
|
||||
Stretch = -1 'True
|
||||
Top = 1440
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 11
|
||||
Left = 6240
|
||||
Picture = "PicForm.frx":0C50
|
||||
Stretch = -1 'True
|
||||
Top = 1440
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 5
|
||||
Left = 6240
|
||||
Picture = "PicForm.frx":0DDA
|
||||
Stretch = -1 'True
|
||||
Top = 120
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 4
|
||||
Left = 5040
|
||||
Picture = "PicForm.frx":0F64
|
||||
Stretch = -1 'True
|
||||
Top = 120
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 3
|
||||
Left = 3840
|
||||
Picture = "PicForm.frx":10EE
|
||||
Stretch = -1 'True
|
||||
Top = 120
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 12
|
||||
Left = 240
|
||||
Picture = "PicForm.frx":1278
|
||||
Stretch = -1 'True
|
||||
Top = 2760
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 13
|
||||
Left = 1440
|
||||
Picture = "PicForm.frx":1402
|
||||
Stretch = -1 'True
|
||||
Top = 2760
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 14
|
||||
Left = 2640
|
||||
Picture = "PicForm.frx":158C
|
||||
Stretch = -1 'True
|
||||
Top = 2760
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 15
|
||||
Left = 3840
|
||||
Picture = "PicForm.frx":1716
|
||||
Stretch = -1 'True
|
||||
Top = 2760
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 16
|
||||
Left = 5040
|
||||
Picture = "PicForm.frx":18A0
|
||||
Stretch = -1 'True
|
||||
Top = 2760
|
||||
Width = 1005
|
||||
End
|
||||
Begin VB.Image Image1
|
||||
Height = 1005
|
||||
Index = 17
|
||||
Left = 6240
|
||||
Picture = "PicForm.frx":1A2A
|
||||
Stretch = -1 'True
|
||||
Top = 2760
|
||||
Width = 1005
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "frmPics"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
|
||||
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
'
|
||||
' Copyright (C) 1999-2001 Microsoft Corporation. All Rights Reserved.
|
||||
'
|
||||
' File: picForm.frm
|
||||
'
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,98 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form frmIntro
|
||||
BorderStyle = 3 'Fixed Dialog
|
||||
Caption = "VB Memory - A DirectPlay Sample"
|
||||
ClientHeight = 1515
|
||||
ClientLeft = 45
|
||||
ClientTop = 330
|
||||
ClientWidth = 2745
|
||||
Icon = "frmIntro.frx":0000
|
||||
LinkTopic = "Form1"
|
||||
MaxButton = 0 'False
|
||||
MinButton = 0 'False
|
||||
ScaleHeight = 1515
|
||||
ScaleWidth = 2745
|
||||
StartUpPosition = 3 'Windows Default
|
||||
Begin VB.CommandButton cmdSingle
|
||||
Caption = "Solitaire"
|
||||
Height = 375
|
||||
Left = 315
|
||||
TabIndex = 2
|
||||
Top = 1020
|
||||
Width = 975
|
||||
End
|
||||
Begin VB.CommandButton cmdMulti
|
||||
Caption = "Multiplayer"
|
||||
Default = -1 'True
|
||||
Height = 375
|
||||
Left = 1455
|
||||
TabIndex = 0
|
||||
Top = 1020
|
||||
Width = 975
|
||||
End
|
||||
Begin VB.Label lbl
|
||||
BackStyle = 0 'Transparent
|
||||
Caption = "This sample will show a developer a simplistic game (Memory). Please choose how you would like to play this game."
|
||||
Height = 1035
|
||||
Left = 60
|
||||
TabIndex = 1
|
||||
Top = 60
|
||||
Width = 2475
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "frmIntro"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
'
|
||||
' Copyright (C) 1999-2001 Microsoft Corporation. All Rights Reserved.
|
||||
'
|
||||
' File: frmIntro.frm
|
||||
'
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
Private Sub cmdMulti_Click()
|
||||
|
||||
Dim StagingArea As New frmStage
|
||||
'Oh good, we want to play a multiplayer game.
|
||||
'First lets get the dplay connection started
|
||||
|
||||
'Here we will init our DPlay objects
|
||||
InitDPlay
|
||||
Set DPlayEventsForm = New DPlayConnect
|
||||
Load StagingArea
|
||||
EnableButtons False
|
||||
'We only want to have a maximum of 4 players
|
||||
If Not DPlayEventsForm.StartConnectWizard(dx, dpp, AppGuid, 4, StagingArea) Then
|
||||
Cleanup
|
||||
EnableButtons True
|
||||
Else 'We did choose to play a game
|
||||
gsUserName = DPlayEventsForm.UserName
|
||||
Me.Hide
|
||||
StagingArea.Show vbModeless
|
||||
gfHost = DPlayEventsForm.IsHost
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cmdSingle_Click()
|
||||
'We don't want to use DPlay, close down our objects
|
||||
Cleanup
|
||||
gbNumPlayers = 1
|
||||
EnableButtons False
|
||||
Me.Hide
|
||||
frmGameBoard.Show
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Unload(Cancel As Integer)
|
||||
Cleanup
|
||||
End
|
||||
End Sub
|
||||
|
||||
Public Sub EnableButtons(ByVal fEnable As Boolean)
|
||||
cmdMulti.Enabled = fEnable
|
||||
cmdSingle.Enabled = fEnable
|
||||
End Sub
|
||||
Binary file not shown.
@@ -0,0 +1,274 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form frmStage
|
||||
BorderStyle = 3 'Fixed Dialog
|
||||
Caption = "VB Memory Staging Area..."
|
||||
ClientHeight = 1575
|
||||
ClientLeft = 45
|
||||
ClientTop = 330
|
||||
ClientWidth = 3060
|
||||
Icon = "frmStage.frx":0000
|
||||
LinkTopic = "Form1"
|
||||
MaxButton = 0 'False
|
||||
MinButton = 0 'False
|
||||
ScaleHeight = 1575
|
||||
ScaleWidth = 3060
|
||||
StartUpPosition = 3 'Windows Default
|
||||
Begin VB.Frame Frame1
|
||||
Caption = "Session Status"
|
||||
Height = 735
|
||||
Left = 120
|
||||
TabIndex = 2
|
||||
Top = 120
|
||||
Width = 2775
|
||||
Begin VB.Label Label1
|
||||
BackStyle = 0 'Transparent
|
||||
Caption = "Current number of players:"
|
||||
Height = 195
|
||||
Left = 120
|
||||
TabIndex = 4
|
||||
Top = 300
|
||||
Width = 1935
|
||||
End
|
||||
Begin VB.Label lblPlayer
|
||||
BorderStyle = 1 'Fixed Single
|
||||
Height = 315
|
||||
Left = 2160
|
||||
TabIndex = 3
|
||||
Top = 240
|
||||
Width = 495
|
||||
End
|
||||
End
|
||||
Begin VB.CommandButton cmdLeave
|
||||
Cancel = -1 'True
|
||||
Caption = "Leave"
|
||||
Height = 435
|
||||
Left = 600
|
||||
TabIndex = 1
|
||||
Top = 960
|
||||
Width = 1095
|
||||
End
|
||||
Begin VB.CommandButton cmdStart
|
||||
Caption = "Start"
|
||||
Default = -1 'True
|
||||
Enabled = 0 'False
|
||||
Height = 435
|
||||
Left = 1800
|
||||
TabIndex = 0
|
||||
Top = 960
|
||||
Width = 1095
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "frmStage"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
'
|
||||
' Copyright (C) 1999-2001 Microsoft Corporation. All Rights Reserved.
|
||||
'
|
||||
' File: frmStage.frm
|
||||
'
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
Implements DirectPlay8Event
|
||||
Private fStartGame As Boolean
|
||||
|
||||
Private Sub cmdLeave_Click()
|
||||
'We don't want to play. Exit
|
||||
frmIntro.Visible = True
|
||||
frmIntro.EnableButtons True
|
||||
Unload Me
|
||||
End Sub
|
||||
|
||||
Private Sub cmdStart_Click()
|
||||
|
||||
Dim oSendBuffer() As Byte
|
||||
Dim lCount As Long, lOffset As Long
|
||||
Dim lClient As Long
|
||||
'Dim oPBuf() As Byte
|
||||
|
||||
'Ok we're ready to start the game now.
|
||||
'First how many players do we have?
|
||||
gbNumPlayers = dpp.GetCountPlayersAndGroups(DPNENUM_PLAYERS)
|
||||
|
||||
' Initialize game state
|
||||
SetupBoard
|
||||
|
||||
lOffset = NewBuffer(oSendBuffer)
|
||||
AddDataToBuffer oSendBuffer, CByte(MSG_SETUPBOARD), SIZE_BYTE, lOffset
|
||||
AddDataToBuffer oSendBuffer, CByte(gbNumPlayers), SIZE_BYTE, lOffset
|
||||
'Add each player's id now (this will determine the order of play)
|
||||
For lCount = 1 To gbNumPlayers
|
||||
lClient = dpp.GetPlayerOrGroup(lCount)
|
||||
AddDataToBuffer oSendBuffer, lClient, LenB(lClient), lOffset
|
||||
'Keep track of the order ourselves
|
||||
glPlayerIDs(lCount - 1) = lClient
|
||||
Next
|
||||
|
||||
'Keep track of the offset in our byte array of where the data for the board starts
|
||||
For lCount = 1 To NumCells
|
||||
AddDataToBuffer oSendBuffer, gbPicArray(lCount - 1), LenB(gbPicArray(lCount - 1)), lOffset
|
||||
Next lCount
|
||||
|
||||
'Now that we've created our byte array of data to start the game
|
||||
'We can actually send that msg, and start the game
|
||||
SendMessage oSendBuffer
|
||||
fStartGame = True
|
||||
Unload Me
|
||||
frmGameBoard.Show vbModeless
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Load()
|
||||
Dim lCount As Long
|
||||
Dim lFlags As Long
|
||||
|
||||
If dpp Is Nothing Then Exit Sub
|
||||
|
||||
'Register me as the message handler
|
||||
DPlayEventsForm.RegisterCallback Me
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Unload(Cancel As Integer)
|
||||
|
||||
If Not fStartGame Then
|
||||
'make sure the intro form is visible again
|
||||
frmIntro.Visible = True
|
||||
frmIntro.EnableButtons True
|
||||
If Not (DPlayEventsForm Is Nothing) Then DPlayEventsForm.DoSleep 50
|
||||
Cleanup
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_AddRemovePlayerGroup(ByVal lMsgID As Long, ByVal lPlayerID As Long, ByVal lGroupID As Long, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_AppDesc(fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_AsyncOpComplete(dpnotify As DxVBLibA.DPNMSG_ASYNC_OP_COMPLETE, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_ConnectComplete(dpnotify As DxVBLibA.DPNMSG_CONNECT_COMPLETE, fRejectMsg As Boolean)
|
||||
If dpnotify.hResultCode = DPNERR_HOSTREJECTEDCONNECTION Then
|
||||
MsgBox "The host would not allow you to join the game. The game has already started.", vbOKOnly Or vbInformation, "Started"
|
||||
DPlayEventsForm.CloseForm Me
|
||||
ElseIf dpnotify.hResultCode <> 0 Then
|
||||
'For some reason we could not connect. All available slots must be closed.
|
||||
MsgBox "Connect Failed. Error: 0x" & CStr(Hex$(dpnotify.hResultCode)) & " - This sample will now close.", vbOKOnly Or vbCritical, "Closing"
|
||||
DPlayEventsForm.CloseForm Me
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_CreateGroup(ByVal lGroupID As Long, ByVal lOwnerID As Long, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_CreatePlayer(ByVal lPlayerID As Long, fRejectMsg As Boolean)
|
||||
Dim lCount As Long
|
||||
|
||||
gbNumPlayers = gbNumPlayers + 1
|
||||
lblPlayer.Caption = CStr(gbNumPlayers)
|
||||
If gbNumPlayers > 1 Then
|
||||
cmdStart.Enabled = gfHost
|
||||
Else
|
||||
cmdStart.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_DestroyGroup(ByVal lGroupID As Long, ByVal lReason As Long, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_DestroyPlayer(ByVal lPlayerID As Long, ByVal lReason As Long, fRejectMsg As Boolean)
|
||||
gbNumPlayers = gbNumPlayers - 1
|
||||
lblPlayer.Caption = CStr(gbNumPlayers)
|
||||
If gbNumPlayers > 1 Then
|
||||
cmdStart.Enabled = gfHost
|
||||
Else
|
||||
cmdStart.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_EnumHostsQuery(dpnotify As DxVBLibA.DPNMSG_ENUM_HOSTS_QUERY, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_EnumHostsResponse(dpnotify As DxVBLibA.DPNMSG_ENUM_HOSTS_RESPONSE, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_HostMigrate(ByVal lNewHostID As Long, fRejectMsg As Boolean)
|
||||
Dim dpPeer As DPN_PLAYER_INFO
|
||||
dpPeer = dpp.GetPeerInfo(lNewHostID)
|
||||
If (dpPeer.lPlayerFlags And DPNPLAYER_LOCAL) = DPNPLAYER_LOCAL Then 'I am the new host
|
||||
gfHost = True
|
||||
MsgBox "Congratulations, You are the new host.", vbOKOnly Or vbInformation, "New host."
|
||||
End If
|
||||
If gbNumPlayers > 1 Then
|
||||
cmdStart.Enabled = gfHost
|
||||
Else
|
||||
cmdStart.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_IndicateConnect(dpnotify As DxVBLibA.DPNMSG_INDICATE_CONNECT, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_IndicatedConnectAborted(fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_InfoNotify(ByVal lMsgID As Long, ByVal lNotifyID As Long, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_Receive(dpnotify As DxVBLibA.DPNMSG_RECEIVE, fRejectMsg As Boolean)
|
||||
Dim lCount As Long, lOffset As Long
|
||||
Dim bMsg As Byte, lNumPlayers As Byte
|
||||
|
||||
'Here we will go through the messages
|
||||
'The first item in our byte array is the MSGID we passed in
|
||||
With dpnotify
|
||||
GetDataFromBuffer .ReceivedData, bMsg, LenB(bMsg), lOffset
|
||||
Select Case bMsg
|
||||
Case MSG_SETUPBOARD
|
||||
|
||||
' Number of players
|
||||
GetDataFromBuffer .ReceivedData, gbNumPlayers, LenB(gbNumPlayers), lOffset
|
||||
' Play IDs, in play order. Unused players have ID of 0.
|
||||
For lCount = 0 To gbNumPlayers - 1
|
||||
GetDataFromBuffer .ReceivedData, glPlayerIDs(lCount), LenB(glPlayerIDs(lCount)), lOffset
|
||||
'If glPlayerIDs(lCount) = gMyPlayerID Then gMyTurn = lCount
|
||||
Next lCount
|
||||
' Tile arrangment
|
||||
For lCount = 0 To NumCells - 1
|
||||
GetDataFromBuffer .ReceivedData, gbPicArray(lCount), LenB(gbPicArray(lCount)), lOffset
|
||||
Next lCount
|
||||
' Show the game board. The scoreboard is initialized in the Load method.
|
||||
fStartGame = True
|
||||
Unload Me
|
||||
frmGameBoard.Show vbModeless
|
||||
End Select
|
||||
End With
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_SendComplete(dpnotify As DxVBLibA.DPNMSG_SEND_COMPLETE, fRejectMsg As Boolean)
|
||||
'VB requires that we must implement *every* member of this interface
|
||||
End Sub
|
||||
|
||||
Private Sub DirectPlay8Event_TerminateSession(dpnotify As DxVBLibA.DPNMSG_TERMINATE_SESSION, fRejectMsg As Boolean)
|
||||
If dpnotify.hResultCode = DPNERR_HOSTTERMINATEDSESSION Then
|
||||
MsgBox "The host has terminated this session. This sample will now exit.", vbOKOnly Or vbInformation, "Exiting"
|
||||
Else
|
||||
MsgBox "This session has been lost. This sample will now exit.", vbOKOnly Or vbInformation, "Exiting"
|
||||
End If
|
||||
DPlayEventsForm.CloseForm Me
|
||||
End Sub
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,98 @@
|
||||
Attribute VB_Name = "modDPlay"
|
||||
Option Explicit
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
'
|
||||
' Copyright (C) 1999-2001 Microsoft Corporation. All Rights Reserved.
|
||||
'
|
||||
' File: modDplay.bas
|
||||
'
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
'Here are our msgs
|
||||
Public Enum Const_MemoryMsgs
|
||||
MSG_SETUPBOARD
|
||||
MSG_SHOWPIECE
|
||||
MSG_HIDEPIECES
|
||||
MSG_TURNEND
|
||||
MSG_CHAT
|
||||
MSG_MATCHED
|
||||
End Enum
|
||||
|
||||
'Constants
|
||||
Public Const NumCells = 36
|
||||
Public Const MaxPlayers = 4
|
||||
Public Const AppGuid = "{31368C80-341E-4365-BD80-66D203D367BE}"
|
||||
|
||||
Public dx As DirectX8
|
||||
Public dpp As DirectPlay8Peer
|
||||
|
||||
'App vars
|
||||
Public gbNumPlayers As Byte
|
||||
Public gsUserName As String
|
||||
Public gbPicArray(NumCells) As Byte
|
||||
Public gfMatchedCells(NumCells) As Boolean
|
||||
Public glCurrentPlayer As Long
|
||||
Public gbPlayerScores(MaxPlayers) As Byte
|
||||
Public glPlayerIDs(MaxPlayers) As Long ' Indexed by order of play
|
||||
Public glMyPlayerID As Long
|
||||
Public gfHost As Boolean
|
||||
|
||||
Public DPlayEventsForm As DPlayConnect
|
||||
|
||||
Public Sub InitDPlay()
|
||||
Set dx = New DirectX8
|
||||
Set dpp = dx.DirectPlayPeerCreate
|
||||
End Sub
|
||||
|
||||
Public Sub Cleanup()
|
||||
'Terminate our session if there is one
|
||||
gbNumPlayers = 0
|
||||
If Not (DPlayEventsForm Is Nothing) Then
|
||||
'Turn off our message handler
|
||||
If Not (dpp Is Nothing) Then dpp.UnRegisterMessageHandler
|
||||
'Close down our session
|
||||
If Not (dpp Is Nothing) Then dpp.Close
|
||||
'Lose references to peer and dx objects
|
||||
Set dpp = Nothing
|
||||
Set dx = Nothing
|
||||
'Get rid of our message pump
|
||||
DPlayEventsForm.GoUnload
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' Assign pieces to cells and initialize the state. Done only by the host
|
||||
' in the multiplayer game. In single-player, can be called to restart.
|
||||
|
||||
Public Sub SetupBoard()
|
||||
|
||||
Dim lCount As Integer
|
||||
Dim Pic As Integer
|
||||
Dim PicInstance As Integer
|
||||
Dim RandCell As Integer
|
||||
|
||||
' Empty the image index array
|
||||
For lCount = 0 To NumCells - 1
|
||||
gbPicArray(lCount) = 0
|
||||
Next lCount
|
||||
|
||||
' Assign pictures to cells
|
||||
|
||||
' For every picture except #0, find two empty cells. The two leftover cells
|
||||
' have picture #0 by default.
|
||||
' PicArray indexes the play cells into the image cells stored on the invisible form.
|
||||
|
||||
For Pic = 1 To NumCells \ 2 - 1
|
||||
For PicInstance = 1 To 2
|
||||
Randomize
|
||||
Do
|
||||
RandCell = Fix(Rnd * NumCells)
|
||||
Loop Until gbPicArray(RandCell) = 0
|
||||
gbPicArray(RandCell) = Pic
|
||||
Next PicInstance
|
||||
Next Pic
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub SendMessage(oBuf() As Byte)
|
||||
dpp.SendTo DPNID_ALL_PLAYERS_GROUP, oBuf, 0, DPNSEND_NOLOOPBACK Or DPNSEND_GUARANTEED
|
||||
End Sub
|
||||
@@ -0,0 +1,54 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: VB Memory Sample
|
||||
//
|
||||
// Copyright (C) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
Memory is a simple game in which you match 'tiles' and try to score the most
|
||||
points.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\VBSamples\DirectPlay\Memory
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\VBSamples\DirectPlay\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
Choose Multiplayer or Solitaire, and then just select images and try to
|
||||
get a match. Score one point for every match. In multiplayer mode try to
|
||||
get more matches than your opponent(s). In solitaire mode, try to clear the
|
||||
board in as few attempts as possible.
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
The Memory sample is very similar in form to the SimplePeer sample. For
|
||||
detailed programming notes on the basics this sample, refer to Programming
|
||||
Notes section of the SimplePeer sample.
|
||||
|
||||
* An image is clicked.
|
||||
1. If it's your turn, show the picture.
|
||||
2. Fills out a byte array telling everyone else to show the picture.
|
||||
3. Calls DirectPlay8Peer.SendTo with the byte array. It passes
|
||||
DPNID_ALL_PLAYERS_GROUP so this message goes to everyone.
|
||||
|
||||
|
||||
* Handle DirectPlay system messages. See implemented DirectPlay8Event interfaces
|
||||
|
||||
The Chat sample handles the typical messages as described in the
|
||||
SimplePeer programming notes, and in addition:
|
||||
|
||||
- Upon Receive event:
|
||||
*Checks the type of this message.
|
||||
*Selects off of the message type.
|
||||
*If MSG_SETUPBOARD, retreive board information and udpate local state.
|
||||
*If MSG_SHOWPIECE, show the indicated piece.
|
||||
*If MSG_HIDEPIECES, hide all pieces that aren't currently matched.
|
||||
*If MSG_TURNEND, advance to the next players turn.
|
||||
*If MSG_CHAT, receive a text string, and update the UI.
|
||||
*If MSG_MATCHED, set the state so these two pictures are matched.
|
||||
@@ -0,0 +1,35 @@
|
||||
Type=Exe
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#stdole2.tlb#OLE Automation
|
||||
Reference=*\G{E1211242-8E94-11D1-8808-00C04FC2C603}#1.0#0#dx8vb.dll#DirectX 8 for Visual Basic Type Library
|
||||
Form=frmIntro.frm
|
||||
Module=modDPlay; modDPlay.bas
|
||||
Form=PicForm.frm
|
||||
Form=PlayForm.frm
|
||||
Form=..\..\common\DplayCon.frm
|
||||
Form=frmStage.frm
|
||||
Startup="frmIntro"
|
||||
ExeName32="vb_Memory.exe"
|
||||
Command32=""
|
||||
Name="vbMemory"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="0"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionCompanyName="Microsoft"
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=0
|
||||
Unattended=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
Reference in New Issue
Block a user