/
frm_game.frm
7433 lines (5941 loc) · 240 KB
/
frm_game.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VERSION 5.00
Begin VB.Form frm_game
AutoRedraw = -1 'True
BackColor = &H00808080&
BorderStyle = 1 'Fixed Single
Caption = "TakeDown"
ClientHeight = 8415
ClientLeft = 45
ClientTop = 330
ClientWidth = 11280
Icon = "frm_game.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 561
ScaleMode = 3 'Pixel
ScaleWidth = 752
StartUpPosition = 2 'CenterScreen
Begin VB.PictureBox pic_mech
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 1800
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 150
TabIndex = 17
Top = 4320
Visible = 0 'False
Width = 2310
End
Begin VB.PictureBox pic_deadm
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 5520
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 150
TabIndex = 12
Top = 720
Visible = 0 'False
Width = 2310
End
Begin VB.PictureBox pic_effectm
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 1920
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 240
TabIndex = 11
Top = 2880
Visible = 0 'False
Width = 3660
End
Begin VB.PictureBox pic_effect
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 1920
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 240
TabIndex = 10
Top = 2280
Visible = 0 'False
Width = 3660
End
Begin VB.CommandButton cmdExit
BackColor = &H00000000&
Cancel = -1 'True
Caption = "Exit to Menu"
Height = 375
Left = 9240
TabIndex = 9
Top = 7800
Width = 1695
End
Begin VB.PictureBox pic_shotm
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 5760
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 150
TabIndex = 8
Top = 2880
Visible = 0 'False
Width = 2310
End
Begin VB.PictureBox Pic_shot
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 5760
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 150
TabIndex = 7
Top = 2280
Visible = 0 'False
Width = 2310
End
Begin VB.PictureBox pic_dead
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 5520
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 150
TabIndex = 5
Top = 120
Visible = 0 'False
Width = 2310
End
Begin VB.PictureBox pic_groundm
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 840
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 300
TabIndex = 4
Top = 600
Visible = 0 'False
Width = 4560
End
Begin VB.PictureBox pic_ground
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 840
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 300
TabIndex = 3
Top = 120
Visible = 0 'False
Width = 4560
End
Begin VB.PictureBox pic_human
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 4110
Left = 8520
ScaleHeight = 270
ScaleMode = 3 'Pixel
ScaleWidth = 120
TabIndex = 2
Top = 840
Visible = 0 'False
Width = 1860
End
Begin VB.PictureBox pic_humanm
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 8520
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 120
TabIndex = 1
Top = 240
Visible = 0 'False
Width = 1860
End
Begin VB.PictureBox Pic_decM
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 1440
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 360
TabIndex = 15
Top = 1800
Visible = 0 'False
Width = 5460
End
Begin VB.PictureBox Pic_dec
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 2040
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 360
TabIndex = 14
Top = 960
Visible = 0 'False
Width = 5460
End
Begin VB.PictureBox PicScreen
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 7695
Left = 0
MousePointer = 2 'Cross
ScaleHeight = 513
ScaleMode = 3 'Pixel
ScaleWidth = 752
TabIndex = 13
Top = 0
Width = 11280
Begin VB.PictureBox pic_mechm
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Left = 1800
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 150
TabIndex = 18
Top = 4920
Visible = 0 'False
Width = 2310
End
Begin VB.Label Labinit
BackColor = &H00000000&
BackStyle = 0 'Transparent
Caption = "LOADING"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 825
Left = 120
TabIndex = 16
Top = 120
Visible = 0 'False
Width = 6735
End
End
Begin VB.Label lblMis
BackColor = &H00000000&
BackStyle = 0 'Transparent
Caption = "Mission information Trooper:_The_enemy_is_approaching. Commander:_See_that_he_does_not_escape"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 195
Index = 2
Left = 120
TabIndex = 20
Top = 8190
UseMnemonic = 0 'False
Width = 7095
End
Begin VB.Label lblMis
BackColor = &H00000000&
BackStyle = 0 'Transparent
Caption = "Mission information Trooper:_The_enemy_is_approaching. Commander:_See_that_he_does_not_escape"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 195
Index = 1
Left = 120
TabIndex = 19
Top = 7995
UseMnemonic = 0 'False
Width = 7095
End
Begin VB.Label lblMis
BackColor = &H00000000&
BackStyle = 0 'Transparent
Caption = "Mission information Trooper:_The_enemy_is_approaching. Commander:_See_that_he_does_not_escape"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 195
Index = 0
Left = 120
TabIndex = 6
Top = 7800
UseMnemonic = 0 'False
Width = 7095
End
Begin VB.Label labheat
Alignment = 1 'Right Justify
BackColor = &H00000000&
BackStyle = 0 'Transparent
Caption = "0% Heat"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 7320
TabIndex = 0
Top = 7800
Width = 1815
End
Begin VB.Shape healthbar
BackColor = &H0000C000&
BackStyle = 1 'Opaque
BorderWidth = 5
FillStyle = 5 'Downward Diagonal
Height = 495
Left = 4080
Top = 7800
Width = 2250
End
Begin VB.Shape Shape2
BackColor = &H000000FF&
BackStyle = 1 'Opaque
BorderWidth = 5
FillStyle = 5 'Downward Diagonal
Height = 495
Left = 4080
Top = 7800
Width = 2250
End
Begin VB.Shape shootlight
BackColor = &H0000FFFF&
BackStyle = 1 'Opaque
BorderWidth = 3
Height = 495
Left = 6480
Shape = 2 'Oval
Top = 7800
Width = 615
End
End
Attribute VB_Name = "frm_game"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Function\Sub catagories
'
' Engine - Core functions. Playsound
' Game - Main game functions. Newlev
' Ph - ingame Physics information. Cansee, Canmove
' action - Such as firing.
' info - stored information
Option Explicit
'============= type definitions (and some consts)
''Declarations for the WaveMix32.dll library
Private Declare Function WaveMixInit Lib "WAVMIX32.DLL" () As Long
Private Declare Function WaveMixConfigureInit Lib "WAVMIX32.DLL" (NewConfig As MIXCONFIG) As Long
Private Declare Function WaveMixActivate Lib "WAVMIX32.DLL" (ByVal MixSession As Long, ByVal Activate As Integer) As Long
Private Declare Function WaveMixOpenWave Lib "WAVMIX32.DLL" (ByVal MixSession As Long, WaveFilename As Any, ByVal hInst As Long, ByVal Flags As Long) As Long
Private Declare Function WaveMixOpenChannel Lib "WAVMIX32.DLL" (ByVal MixSession As Long, ByVal Channel As Long, ByVal Flags As Long) As Long
Private Declare Function WaveMixPlay Lib "WAVMIX32.DLL" (PlayParameters As MIXPLAYPARAMS) As Integer
Private Declare Function WaveMixFlushChannel Lib "WAVMIX32.DLL" (ByVal MixSession As Long, ByVal Channel As Long, ByVal Flags As Long) As Integer
Private Declare Function WaveMixCloseChannel Lib "WAVMIX32.DLL" (ByVal MixSession As Long, ByVal Channel As Long, ByVal Flags As Long) As Integer
Private Declare Function WaveMixFreeWave Lib "WAVMIX32.DLL" (ByVal MixSession As Long, ByVal MixWave As Long) As Integer
Private Declare Function WaveMixCloseSession Lib "WAVMIX32.DLL" (ByVal MixSession As Long) As Integer
Private Declare Sub WaveMixPump Lib "WAVMIX32.DLL" ()
Private Declare Function WaveMixGetInfo Lib "WAVMIX32.DLL" (WaveMixInfo As WaveMixInfo) As Integer
'Types for the WaveMix32.dll library
Private Type WaveMixInfo
Size As Integer
VersionMajor As Byte
VersionMinor As Byte
Date(12) As String
Formats As Long
End Type
'
Private Type MIXCONFIG
Size As Integer
Flags As Long
Channels As Integer
SamplingRate As Integer
End Type
Private Type networktype
bhost As Boolean
bclient As Boolean
state As String
End Type
Private Type MIXPLAYPARAMS
Size As Integer
MixSessionLo As Integer
MixSessionHi As Integer
ChannelLo As Integer
ChannelHi As Integer
MixWaveLo As Integer
MixWaveHi As Integer
hWndNotifyLo As Integer
hWndNotifyHi As Integer
FlagsLo As Integer
FlagsHi As Integer
wLoops As Integer
End Type
'Configurable consts
Private Const pathlinktop = 9
Private Const TileSize = 30
Private Const ShotTop = 29
Private Const ExpTop = 19
Private Const EnemyTop = 29
Private Const TeamsTop = 2 ' plus the player
'timertop = 9 - not a const, check in code
Private Const ObjTop = 511 '139
Private Const decTop = 79
Private Const TrigTop = 39
Private Const MaxHeat = 120
Private Const PathTop = 99
Private Const keysqTop = 99
Private Const PatrolSqTop = 19
Private Const patchTop = 31
Private Const speakDur = 5 ' How long (in frames) an icon appears on speaking enemy
Private Const behindMult = 0.2 'how hard is it to see things behind you (for enemies)
Private Const pathDepth = 20
Private Const screenHeight = 16
Private Const screenWidth = 24
Private Const maxViewDist = 22 'used for PH_Cansee - how far anyone can see
Private Const misSoundsTop = 9 'How many special mission sounds
Private Type positionType
x(1 To 4) As Integer
y(1 To 4) As Integer
angle(1 To 4) As Single
End Type
Private Type pointType
x As Integer
y As Integer
End Type
Private Enum eAttitude
At_Agressive = 0 'Seek player
At_Cautious = 1 'Fight only if you can see him
at_defensive = 2 'Fight but never seek.
at_cowardly = 3 'Flee from player (not complete!)
End Enum
Private Type eCheckType
bFriends As Boolean 'Do we alert friends?
FriendTag As String
FriendNum As Integer
bCheck As Boolean 'Do we check at all?
bHome As Boolean 'Do we return home after a check?
End Type
'Unaware role, Suspect role, Aware role.
Private Enum eSuspect
Cl_wander = 1 'wander around
Cl_stand = 2 'stand still
Cl_patrol = 3 'follow patrol route X; report to commander Y.
Cl_hide = 4 'go and hide
cl_guard = 5 'Guard this space
Cl_command = 6 'accept patrol reports
End Enum
Private Type enemytype
'basic vars
x As Integer
y As Integer
health As Integer
moved As Integer 'Movement timer
shot As Integer 'Shooting timer
face As Integer 'Direction we are facing
live As Boolean 'does the enemy actually exist
mspeed As Integer 'movement speed
sspeed As Integer 'shooting speed
skin As Byte 'graphical appearance
shottype As Byte 'shot type
goaldie As Boolean 'counts on the kill count
material As Integer 'how much material for killing it? (not really used)
tag As String 'tag for triggers to use
'AI
skill As Integer '1 to 100. intelligence\skill
lastmove As Integer 'Last direction we moved, for ai.
oldface As Integer 'last face, for ai
Attitude As eAttitude 'Our combat attitude
actUnaware As eSuspect 'four vars govern our behaviour.
actSuspect As eSuspect
actAware As eSuspect
actFullAware As eSuspect
role As eSuspect 'our role - from 3 vars above.
action As String 'our action
actionV As Integer 'phase of the action.
actionT As Integer 'Action timer
' Action As String 'Action is a string of states, eg investigate a noise then return.
' ActionN As Integer
'stand, wander, patrol+, command+.
'patrol variables
'patrolb As Boolean 'Are we currently patrolling
patrolRoute As String 'patrol route we follow
patrolIndex As Integer 'next position on route
patrolbReport As Boolean 'have we reported in?
''commandb As Boolean 'Are we commanding?
'commandMax As Integer 'How many should report in? (long patrols can be doubled to make up for infrequent visits)
'commandNum As Integer 'How many have reported in
'commandTimeMax As Integer 'What's the longest we can wait to get them all?
'commandTime As Integer 'How long have we waited?
'investigate variables
' checkb As Boolean 'Are we investigating a suspicious thing?
checkpos(1) As pointType 'where is it?
checkscore As Integer
checktime As Integer
check As eCheckType
following As Integer
bfollowed As Boolean 'has someone followed us?
home As pointType 'where we go back to afterwards
guard As pointType ' Don't go too far from here
''NOT USED START
gethelpb As Boolean 'Do we get help?
gethelpWho As String 'what group do we call for help?
gethelpMax As Integer 'How many do we need in tow?
gethelpNum As Integer 'How many do we have in tow?
''Guard' position is used for gethelping too.
''when we've got them, we go to the check\hide state.
'
' hideb As Boolean 'Are we hiding?
' hideX As Integer 'where shall we hide?
' hideY As Integer
' 'we will go there and hide.
' 'NOT USED END
bStartled As Boolean
StartledT As Single
fightDisMax As Integer 'prefered combat distance
fightDisMin As Integer
bEngage As Boolean 'We are fighting\seeking player
cansee(-1 To EnemyTop) As Single 'Can we see the player? How well?
bAllAware As Boolean 'are we magically aware of everyone, always?
bAwareAll(2) As Boolean
bAware(-1 To EnemyTop, 2) As Boolean 'We know that the player is present
bAwareG As Boolean
'dimensions: 0 = aware exactly, 1 = aware but don't know where, 2 = suspicious, otherwise nothing
suspicion(-1 To EnemyTop) As Single 'I wonder if the player is here...
suspiciong As Single 'global, total suspicion
state As String 'AI state, eg Seeking or waiting.
tactictime As Single 'used (and controlled)in states
'for time remaining before
'abandoning a tactical move.
substate As Integer 'a special property for a state
nextstate As String 'In a runto, state to change to
'after arriving at destination.
finaldest As pointType 'In a runto, where we're aiming
orderpriority As Integer 'in a runto, can it be interrupted?
counter As Single 'Count down timer
'used in states and for death anim.
t As Integer 'who we are fighting - enemy number or -1 is the player
team As Byte 'our team
randval As Integer '0 or 1, randomly.
End Type
Private Type teamtype
rel(-1 To TeamsTop) As Byte
'relationships:
'0 = Hostile - Attack on sight
'1 = Neutral - ignore\return fire
'2 = friendly - Help in combat - shots don't affect
End Type
Private Type guntype
projtype As Integer
special As Integer
heatinc As Single 'heat increase per shot
sspeed As Integer 'refire rate
kick As Integer 'Stops you moving for this long after firing.
stealth As Integer
selfhurt As Integer 'How much does it hurt its owner per shot
'proj_speed As Integer 'move delay of projectile
'proj_damage As Integer 'damage of projectile
'Upgrade(0 To 4) As Integer
End Type
Private Type patchtype
x(0 To 1) As Integer
y(0 To 1) As Integer
type As Integer
live As Boolean
offset As Single
End Type
Private Type tripnettype
live As Boolean
triggered As Boolean
rel(-1 To TeamsTop) As Byte
'Hostile0, Neutral1, friendly2
'0 means it detects. All others do not.
x As Integer 'where it was last triggered
y As Integer
tag As String ' the tag of the response team who will check out this tripwire
'leave it blank to send none, if the tripwire sets a trigger instead
End Type
Private Type tripwiretype
face As Integer
net As Integer
live As Boolean
group As Integer
x As Integer
y As Integer
End Type
Private Type playertype
x As Integer
y As Integer
health As Integer
moved As Integer
shot As Integer
heat As Single
face As Integer
kills As Integer
mspeed As Integer
lastmove As Integer
material As Integer
gunMod(wepTop, upgTop) As Integer
gun(0 To 2) As guntype
cGun(0 To 1) As Integer 'Guns we are carrying
'cInv(0 To 1) As Integer 'Inv we are carrying
'inv(9) As integer 'amount of this item
cmd As Integer 'Command we gave
End Type
Private Type shottype
x As Integer
y As Integer
oldx As Integer
oldy As Integer
moved As Integer
face As Integer
live As Boolean
own As Integer
mspeed As Integer
damage As Integer
skin As Byte
shottype As Integer
special As Byte
stealth As Integer
bHasHurt As Boolean
shotfrom As pointType
End Type
Private Type objtype
x As Integer
y As Integer
xw As Integer
yw As Integer
live As Boolean
type As Byte
bVisOnly As Boolean 'don't draw its full size, only first square, it's for los only
bDrawOnly As Boolean 'don't use in LOS, it's for drawing only.
End Type
Private Type decoType
x As Single 'not ints for decorations!
y As Single
live As Boolean
type As Byte
End Type
Private Type keySqType
x As Integer
y As Integer
live As Boolean
nametag As String
End Type
Private Type PatrolSqType
live As Boolean
x As Integer
y As Integer
group As String 'name of patrol route
Index As Integer 'when do I go to this square
report As String 'Report to this commander.
End Type
Private Type exptype
x As Single
y As Single 'not ints for explosions!
face As Integer
frame As Single
endframe As Integer
live As Boolean
skin As Byte
own As Integer
shotfrom As pointType
End Type
Private Type Triggertype
repeating As Integer
live As Boolean
actwhen As String 'And, Or
Condtype(0 To 1) As String 'What kind of condition
CondVal(0 To 1, 0 To 2) As Variant 'parameter for condition
ActType(0 To 1) As String ' What kind of action
ActVal(0 To 1, 0 To 2) As Variant
End Type
Private Type pathtype
live As Boolean
x As Integer
y As Integer
links(0 To pathlinktop) As Integer
rating(-1 To PathTop) As Integer
range As Integer
End Type
Private Type speechType
live As Boolean
speaker As Integer 'enemy speaker, -1 = none
soundType As Byte 'seen, taunt, mission sound
number As Byte 'which variation of that sound
solo As Boolean 'is this a solo line or said to someone?
priority As Integer
End Type
'=================end of type definitions
' SOUND STUFF START
'Constants for the WaveMix32.dll library
Const WMIX_QUEUEWAVE As Long = &H0
Const WMIX_CLEARQUEUE As Long = &H1
Const WMIX_USELRUCHANNEL As Long = &H2
Const WMIX_HIGHPRIORITY As Long = &H4
Const WMIX_WAIT As Long = &H8
Const WMIX_CONFIG_CHANNELS As Long = &H1
Const WMIX_CONFIG_SAMPLINGRATE As Long = &H2
Const WMIX_FILE As Long = &H0
Const WMIX_RESOURCE As Long = &H2
Const WMIX_OPENSINGLE As Long = &H0
Const WMIX_OPENALL As Long = &H1
Const WMIX_OPENCOUNT As Long = &H2
Const WMIX_ALL As Long = &H1
Const WMIX_NOREMIX As Long = &H2
Const WMIX_ACTIVATE As Integer = 1
Const WMIX_DEACTIVATE As Integer = 0
''''''''''''''''''''''''''''''''''''''''''''''
'End of sound stuff.
Dim Session As Long
Dim ChannelOne As Long
Dim ChannelTwo As Long
Dim ChannelThree As Long
Dim ChannelFour As Long
Dim ChannelFive As Long
Dim ChannelSix As Long
Dim ChannelSeven As Long
Dim ChannelEight As Long
Dim SoundDead(0) As Long 'shot hits enemy and kills
Dim SoundShot(4) As Long 'one for each shottype
Dim SoundExp(3) As Long 'shot hits a surface, one per shottype
Dim SoundThud(1) As Long '0 = hit enemy
'1 = hit player
Dim soundoverheat As Long
Dim soundmsg As Long
Dim soundTrip As Long
Dim SoundSeen(1) As Long
'Dim SoundTaunt(1) As Long 'soundgoodshot
Dim SoundCheck(1) As Long
Dim SoundCheckF(1) As Long
Dim SoundYesCheck(1) As Long
Dim soundCheckStop(1) As Long
Dim soundSeekF(1) As Long
Dim soundSeekYes(1) As Long
Dim soundGatherFail(1) As Long
Dim soundGatherWork(1) As Long
Dim soundGatherF(1) As Long
Dim soundGatherYes(1) As Long
Dim soundManDown(1) As Long
Dim soundGotHurt(1) As Long
Dim soundGotHurtF(1) As Long
Dim soundGoodShot(1) As Long
Dim soundGoodShotF(1) As Long
Dim SoundMusic(4) As Long
Dim soundMis(misSoundsTop) As Long
'SOUND STUFF END
Dim gamespeed As Single '1
Private Type recentTextType
txt As String
time As Integer
End Type
Dim RecentText(0 To 7) As recentTextType
Const misTxtDelay = 50
Dim countdown As Single 'Countdown until the new level.
Dim nextmission As Integer 'number of next mission
Private Type cdTimerType
val As Single
bDown As Boolean
bActive As Boolean
End Type
Dim cdTimer(9) As cdTimerType 'Countdown timers
Dim speech(4) As speechType 'spoken lines
Dim speakTime As Integer 'frame number to start next line
Dim LastSpeakTime As Integer
Dim lastSpeaker As Integer
Dim multimode As Boolean 'is this match with multiple teams, not just player vs enemies?
Dim p As playertype: Dim e(0 To EnemyTop) As enemytype: Dim s(0 To ShotTop) As shottype
Dim O(0 To ObjTop) As objtype
Dim ex(0 To ExpTop) As exptype
Dim Dec(0 To decTop) As decoType
Dim keysq(0 To keysqTop) As keySqType: Dim team(0 To TeamsTop) As teamtype
Dim psq(0 To PatrolSqTop) As PatrolSqType
Dim patch(0 To patchTop) As patchtype
Dim t(0 To TrigTop) As Triggertype
Dim tripnet(0 To 4) As tripnettype
Dim tripwire(0 To 11) As tripwiretype
Dim gamewidth As Integer, gameheight As Integer
Dim screenX As Single
Dim screenY As Single
Dim screenXd As Single
Dim screenYd As Single
Dim danger() As Integer 'Is this square dangerous? (about to have a shot enter it)
Dim walkable() As Boolean 'Is a square empty of impassible terrain?
Dim path(0 To PathTop) As pathtype
Dim flag(0 To flagTop) As Integer
Dim groundstyle As Integer
Dim alarm As Boolean
Dim bFailed As Boolean 'the player has stuffed up the misson
Dim notesPage As Integer
Dim randval As Integer 'For assigning a randval to enemies
Dim timepast As Single
Dim SoundSlot As Integer
Dim lowestFreeDec As Integer 'how many decs does the level use
' and how many can be used for scorchmarks
Dim scorchDec As Integer ' what are we up to?
Dim exiting As Boolean
Dim gameon As Boolean
Dim keydir(1 To 4) As Boolean 'Direction keys that are being pressed
Dim LastTick As Long
Dim CurrentTick As Long
Public TickDifference As Long
'Editor dims
Dim editorX As Integer, editorY As Integer
''Demo (under construction
'Dim bDemoRec As Boolean
'Dim bDemoPlay As Boolean
'Dim demo() As demoframe
Dim net As networktype
Private Declare Function GetTickCount Lib "kernel32" () As Long
Sub game_loop()
Dim escaped As Boolean
Dim pface As Integer
Dim scrollRate As Integer
'Dim frameskip As Boolean 'DEBUG frameskip monitor, part 1
'If running = True Then Exit Sub
'running = True
Do 'Here is the big monster game loop
If gameon = True Then
CurrentTick = GetTickCount()
If CurrentTick - LastTick > TickDifference Then
'If frameskip = False Then 'DEBUG frameskip monitor, part 2
'p.heat = 99
'Else