/[cvs]/rabit/r3/Module_Spectator.bas
ViewVC logotype

Annotation of /rabit/r3/Module_Spectator.bas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Tue Mar 12 21:29:10 2002 UTC (22 years, 8 months ago) by cvsrabit
Branch: NFO, MAIN
CVS Tags: v034a, HEAD
Changes since 1.1: +0 -0 lines
Initial project import

1 cvsrabit 1.1 Attribute VB_Name = "Module_Spectator"
2     Option Explicit
3     '
4    
5     Public Function CreatePlayerViewMatrix() As D3DMATRIX
6    
7     Dim X As Single
8     Dim Y As Single
9     Dim Z As Single
10    
11     Dim s As Single
12     Dim s2 As Single
13    
14     Dim clPlayer As Class_Player
15    
16     Dim tpVecCamPosition As D3DVECTOR
17     Dim tpVecCamLookAt As D3DVECTOR
18    
19     Set clPlayer = clGame.Col_clPlayers("p" & lLocalPlayerHandle)
20    
21     Select Case lCamMode
22    
23     Case 0:
24    
25     With clPlayer
26    
27     s = 4 + 6 * Abs(.sgSpeedRate)
28    
29     s2 = .sgAngleY * Const_sgDeg2Rad + Const_sgPi - 0.1 * .sgSteeringWheelPosition
30     X = s * -Sin(s2)
31     Z = s * Cos(s2)
32    
33     tpVecCamPosition = MakeVector(.GetPosition.X - X, .GetPosition.Y + 4, .GetPosition.Z - Z)
34     tpVecCamLookAt = MakeVector(.GetPosition.X, .GetPosition.Y, .GetPosition.Z)
35    
36     End With
37    
38     bShowPlayer = True
39    
40     Case 1:
41    
42     With clPlayer
43    
44     ' s = 20 ' + 0.1 * Abs(.sgSpeed)
45    
46     s2 = .sgAngleY * Const_sgDeg2Rad + Const_sgPi ' - 0.1 * .sgSteeringWheelPosition
47     X = 20 * -Sin(s2)
48     Z = 20 * Cos(s2)
49    
50     tpVecCamPosition = MakeVector(.GetPosition.X - X, .GetPosition.Y + 10, .GetPosition.Z - Z)
51     tpVecCamLookAt = MakeVector(.GetPosition.X, .GetPosition.Y, .GetPosition.Z)
52    
53     End With
54    
55     bShowPlayer = True
56    
57     Case 2:
58    
59     With clPlayer
60    
61     s2 = .sgAngleY * Const_sgDeg2Rad + Const_sgPi ' - 0.2 * .sgSteeringWheelPosition
62     X = 10 * -Sin(s2)
63     Z = 10 * Cos(s2)
64    
65     tpVecCamPosition = MakeVector(.GetPosition.X - X, .GetPosition.Y + 30, .GetPosition.Z - Z)
66     tpVecCamLookAt = MakeVector(.GetPosition.X + X, .GetPosition.Y, .GetPosition.Z + Z)
67    
68     End With
69    
70     bShowPlayer = True
71    
72     Case 3:
73    
74     With clPlayer
75    
76     s2 = .sgAngleY * Const_sgDeg2Rad + Const_sgPi - 0.1 * .sgSteeringWheelPosition
77     X = 5 * -Sin(s2)
78     Z = 5 * Cos(s2)
79    
80     tpVecCamPosition = MakeVector(.GetPosition.X - X, .GetPosition.Y + 40, .GetPosition.Z - Z)
81     tpVecCamLookAt = MakeVector(.GetPosition.X + X, .GetPosition.Y, .GetPosition.Z + Z)
82    
83     End With
84    
85     bShowPlayer = True
86    
87     Case 4:
88    
89     With clPlayer
90    
91     tpVecCamPosition = MakeVector(0, 15, 0)
92     tpVecCamLookAt = MakeVector(.GetPosition.X, .GetPosition.Y, .GetPosition.Z)
93    
94     End With
95    
96     bShowPlayer = True
97    
98     Case 5:
99    
100     With clPlayer
101    
102     s2 = .sgAngleY * Const_sgDeg2Rad + Const_sgPi + 0.1 * .sgSteeringWheelPosition
103     X = 10 * -Sin(s2)
104     Z = 10 * Cos(s2)
105    
106     tpVecCamPosition = MakeVector(.GetPosition.X, .GetPosition.Y + 1.2, .GetPosition.Z)
107     tpVecCamLookAt = MakeVector(.GetPosition.X + X, .GetPosition.Y, .GetPosition.Z + Z)
108    
109     End With
110    
111     bShowPlayer = False
112    
113     End Select
114    
115     clDSListener.SetPosition tpVecCamPosition.X, tpVecCamPosition.Y, tpVecCamPosition.Z, DS3D_IMMEDIATE
116     clDSListener.SetOrientation tpVecCamLookAt.X - tpVecCamPosition.X, tpVecCamLookAt.Y - tpVecCamPosition.Y, tpVecCamLookAt.Z - tpVecCamPosition.Z, 0, 1, 0, DS3D_IMMEDIATE
117    
118     D3DXMatrixLookAtLH CreatePlayerViewMatrix, tpVecCamPosition, tpVecCamLookAt, MakeVector(0, 1, 0)
119    
120     End Function

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed