-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgriffon.bas
9983 lines (6894 loc) · 227 KB
/
griffon.bas
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
'
' If you're using fbc 0.17 or later, compile with:
' fbc griffon.bas -x build/griffon.exe -lang fblite
'
' in game scripts
' 2 - find master key
' 3 - find crystal
' 4 - find shield - obj 8
' 5 - find sword - obj 9
' 6 - regular key chest
' 7 - blue flask
' 8 - garden's master key
' 9 - lightning bomb
' 10 - blue flask chest
' 11 - lightning chest
' 12 - armour chest
' 13 - citadel master key
' 14 - end of game
' 15 - get sword3
' 16 - shield3
' 17 - armour3
' 20 key chest 1
' 60-lever
'
'
' monsters
' 1 - baby dragon
' 2 - one wing
' 3 - boss 1
' 4 - black knight
' 5 - fire hydra
' 6 - red dragon
' 7 - priest
' 8 - yellow fire dragon
' 9 - two wing
'10 - dragon2
'11 - final boss
'12 - bat kitty
' chests
' 0 - regular flask
' 11 - key chest
' 14 - blue flask chest
' 15 - lightning chest
' 16 - armour chest
' 17 - citadel master key
' 18 - sword3
' 19 - shield3
' 20 - armour3
DEFINT A-Z
'$include: 'windows.bi'
'$include: 'SDL\SDL.bi'
'$include: 'SDL\SDL_image.bi'
'$include: 'win\mmsystem.bi'
'$INCLUDE: 'fmod.bi'
Randomize Timer
CONST maxnpc = 32, maxfloat = 32, maxspell = 32
const ice = 0, steel = 1, wood = 2, rock = 3, fire = 4
'inventory items
const flask = 0, doubleflask = 1, shock = 2, normalkey = 3, masterkey = 4
const sndbite = 0, sndcrystal = 1, snddoor = 2, sndenemyhit = 3, sndice = 4, sndlever = 5, sndlightning = 6
const sndmetalhit = 7, sndpowerup = 8, sndrocks = 9, sndswordhit = 10, sndthrow = 11, sndchest = 12, sndfire = 13, sndbeep = 14
type playertype
px as single
py as single
opx as single
opy as single
walkdir as integer
walkframe as single
walkspd as single
attackframe as single
attackspd as single
hp as integer
maxhp as integer
hpflash as single
hpflashb as integer
level as integer
sword as integer
shield as integer
armour as integer
foundspell(5) as integer
spellcharge(5) as single
flasks as integer
foundcrystal as integer
crystalcharge as single
attackstrength as single
spellstrength as single
spelldamage as integer
sworddamage as integer
masterkey as integer
exp as integer
nextlevel as integer
windowloc as integer
pause as integer
itemselshade as single
ysort as integer
end type
type bodysectiontype
x as single
y as single
parentID as integer
isbase as integer
sprite as integer
bonelength as integer 'the 'bone' that connects the body sections
end type
type npctype
x as single
y as single
spriteset as integer
x1 as integer 'patrol area
y1 as integer
x2 as integer
y2 as integer
attitude as integer
hp as integer
maxhp as integer
item1 as integer
item2 as integer
item3 as integer
script as integer
frame as single
frame2 as single 'end boss specific
cframe as integer
onmap as integer 'is this npc set to be genned in the mapfile
ticks as integer
pause as integer
shake as integer
movementmode as integer
walkdir as integer
walkspd as single
movingdir as integer
moving as integer
attacking as integer
attackframe as single
cattackframe as integer
attackspd as single
attackdelay as integer
attacknext as integer
attackattempt as integer
spelldamage as integer
attackdamage as integer
'onewing and firehydra specific
bodysection(30) as bodysectiontype
swayangle as single
swayspd as single
headtargetx(3) as single
headtargety(3) as single
castpause as integer
'firehydra specific
attacknext2(3) as integer
attacking2(3) as integer
attackframe2(3) as integer
'dragon2 specific
floating as single
end type
type spelltype
spellnum as integer
homex as single
homey as single
enemyx as single
enemyy as single
frame as single
damagewho as integer '0 = npc, 1 = player
'for earthslide
rocky(8) as single
rockimg(8) as integer
rockdeflect(8) as integer
strength as single
'fire
legalive(4) as integer
'spell 6 specific
fireballs(6,3) as single
'x,y,targetx, targety
nfballs as integer
ballon(6) as integer
npc as integer
end type
type animset2type
x as integer 'xyloc on spriteimageset
y as integer
xofs as integer 'the actual place to paste the sprite in reference to the bodypart loc on screen
yofs as integer
w as integer 'w/h of the sprite in the imageset
h as integer
end type
declare sub game_addFloatIcon (ico, xloc!, yloc!)
declare sub game_addFloatText (stri$, xloc!, yloc!, col%)
declare sub game_attack ()
declare sub game_castspell (spellnum%, homex!, homey!, enemyx!, enemyy!, damagewho%)
declare sub game_checkhit ()
declare sub game_checkinputs ()
declare sub game_configmenu()
declare sub game_damagenpc (npcnum%, damage%, spell%)
declare sub game_damageplayer (damage%)
declare sub game_drawanims (Layer%)
declare sub game_drawhud ()
declare sub game_drawnpcs (mode%)
declare sub game_drawover (modx%, mody%)
declare sub game_drawplayer ()
declare sub game_drawview ()
declare sub game_endofgame ()
declare sub game_eventtext (stri$)
declare sub game_handlewalking ()
declare sub game_loadmap (mapnum%)
declare sub game_main ()
declare sub game_newgame ()
declare sub game_playgame ()
declare sub game_processtrigger (trignum%)
declare sub game_saveloadnew ()
declare sub game_showlogos ()
declare sub game_swash ()
declare sub game_theend ()
declare sub game_title (mode%)
declare sub game_updanims ()
declare sub game_updatey()
declare sub game_updmusic ()
declare sub game_updnpcs ()
declare sub game_updspells ()
declare sub game_updspellsunder ()
declare sub sys_customLoad ()
declare sub sys_Initialize ()
declare sub sys_line (byval buffer as SDL_Surface ptr, x1%, y1%, x2%, y2%, col%)
declare sub sys_LoadAnims ()
declare sub sys_LoadFont ()
declare sub sys_LoadItemImgs ()
declare sub sys_LoadTiles ()
declare sub sys_loadTriggers()
declare sub sys_print (byval buffer as SDL_Surface ptr, stri$, xloc%, yloc%, col%)
declare sub sys_progress (w%, wm%)
declare sub sys_LoadObjectDB ()
declare sub sys_setupAudio ()
declare sub sys_update ()
'system
dim shared video as SDL_Surface ptr, videobuffer as SDL_Surface ptr, videobuffer2 as SDL_Surface ptr, videobuffer3 as SDL_Surface ptr
dim shared titleimg as SDL_Surface ptr, titleimg2 as SDL_Surface ptr, inventoryimg as SDL_Surface ptr
dim shared logosimg as SDL_Surface ptr, theendimg as SDL_Surface ptr
dim shared event as SDL_Event
dim shared SCR_WIDTH, SCR_HEIGHT, SCR_BITS, SCR_TOPX, SCR_TOPY
dim shared ticks, tickspassed, nextticks
dim shared fp, fps, fpsr as single
dim shared mapbg as SDL_Surface ptr, clipbg as SDL_Surface ptr, clipsurround(3,3) as uinteger, clipbg2 as SDL_Surface ptr
dim shared fullscreen
dim shared walklimits(6) = {5 * 16, 5 * 16, 14 * 16, 9 * 16, 320, 144}
dim shared keys as Uint8 ptr
dim shared animspd as single, rampdata(40,24)
dim shared joystickinfo as JOYINFO
dim shared curmap, fontchr(224, 4) as SDL_Surface ptr
dim shared itemimg(20) as SDL_Surface ptr, windowimg as SDL_Surface ptr
dim shared spellimg as SDL_Surface ptr
dim shared itemselon, curitem, itemticks, itemyloc as single
dim shared selenemyon, curenemy, forcepause
dim shared roomlock ' set to disable any room jumps while inthe room
dim shared scriptflag (99, 9), saveslot
'script, flag
dim shared secsingame, secstart
dim shared story$(37), mapimg(3) as SDL_Surface ptr, invmap(3,13,7), story2$(37)
'options
dim shared opfullscreen, opmusic, opeffects, opmusicvol, opeffectsvol
dim shared rc2 as SDL_Rect, rc as SDL_Rect, rcSrc as SDL_Rect, rcDest as SDL_Rect, rcSrc2 as SDL_Rect
dim shared HWACCEL, HWSURFACE, maxlevel
'inventory
dim shared inventoryalpha, inventory(5)
'-----------special case
dim shared dontdrawover
' used in map24 so that the candles dont draw over the boss, default set to 0
'saveload info
dim shared saveloadimg as SDL_Surface ptr
'post info
dim shared postinfo(20,2) as single, nposts
'cloud info
dim shared cloudimg as SDL_Surface ptr, clouddeg as single, cloudson
'spell info
dim shared spellinfo(maxspell) as spelltype
'player info
dim shared movingup, movingdown, movingleft, movingright
dim shared player as playertype, attacking, playera as playertype
'tile info
dim shared tiles(4) as SDL_Surface ptr
dim shared tileinfo(3, 40, 24, 2)
'maplayer, x, y, tiledata (tile, tilelayer)
dim shared elementmap(20,15)
'animation info
dim shared anims(99) as SDL_Surface ptr
'id number 0&1 = players
dim shared animsa(99) as SDL_Surface ptr
'attack anims
dim shared playerattackofs(4, 16, 3) as single
'[dir] [frame] [x,y ofs, completed(0/1)]
dim shared floattext(maxfloat, 3) as single, floatstri$(maxfloat)
'[id] [framesleft, x, y, col]
dim shared floaticon(maxfloat, 3) as single
'[id] [framesleft, x, y, ico]
'special for animset2
dim shared animset2(6) as animset2type, animset9(6) as animset2type
'object info
dim shared objectframe(255, 1) AS SINGLE, lastobj
'frame!, curframe
dim shared objectinfo(32, 6)
'nframes,xtiles,ytiles,speed,type,script, update?
dim shared objecttile(32, 8, 2, 2, 1)
'[objnum] [frame] [x] [y] [tile/layer]
dim shared objmap(20, 14)
dim shared objmapf(999, 20, 14)
'[mapnum] x, y set to 1 to make this objmap spot stay at -1
'trigger info
dim shared triggers(9999,9)
'[map#][index], [var]
'map#,x,y
dim shared triggerloc(320,240), ntriggers
'npc info
dim shared npcinfo(maxnpc) as npctype, lastnpc
'music info
dim shared mgardens as integer, mgardens2 as integer, mgardens3 as integer, mgardens4 as integer, mboss as integer
dim shared menabled as integer, musicchannel, mendofgame as integer, menuchannel, mmenu as integer
dim shared pgardens as integer, pboss as integer
dim shared loopseta
loopseta = 0
dim shared sfx(20) as integer
'room locks
dim shared roomlocks(200), saidlocked, canusekey, locktype, roomtounlock, saidjammed
'set to 1 for normal key, set to 2 for master, set to 0 if unlocked
'dialog
dim shared dialogflags(999)
'ysort
dim shared ysort(2400), lasty, firsty
sys_initialize
game_showlogos
game_main
'element tile locations
data 2, 2, 2, 2,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1
data 2,-1,-1,-1,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1
data 2,-1, 2, 2,-1,-1,-1, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1
data 2,-1, 2,-1, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data 2, 2, 2, 2, 2,-1,-1,-1, 2,-1,-1, 2,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1, 2,-1, 0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1, 0, 0, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
data "Ever since I was a child"
data "I remember being told the"
data "Legend of the Griffon Knights,"
data "who rid the world of the"
data "Dragon Empire. These great"
data "heroes inspired us to become"
data "knights as well."
data " "
data "Now, 500 years after the war"
data "ended, the Dragons have"
data "returned. Cities are falling"
data "from the lack of knights to"
data "protect them."
data " "
data "We never saw it coming."
data " "
data "And now, here I am, making"
data "my way into the lower town"
data "of Fidelis, a small city on"
data "the main continent. The rest"
data "of my men have died over"
data "the last couple days from"
data "aerial attacks."
data " "
data "We believed we could find"
data "shelter here, only to find"
data "every last griffon dead,"
data "the town burned to the ground,"
data "and transformed into a garrison"
data "for the Dragon forces."
data " "
data "In these dark times, I try to"
data "draw strength from the stories"
data "of those knights that risked"
data "everything to protect their homeland,"
data " "
data "and hope that I can die"
data "with that honor as well."
data "After the fall of Margrave Gradius,"
data "All the dragons, struck with panic,"
data "evacuated the city immediately."
data " "
data "It's funny how without a leader"
data "everyone is so weak."
data " "
data " "
data "But yet another leader will rise,"
data "and another city will fall."
data " "
data " "
data "I should return home to Asherton"
data "It's time to leave this place"
data "and cleanse this blood stained"
data "life of mine."
data " "
data "No one should have to see as much"
data "death as I have."
data " "
data " "
data "Before, I said that I wanted"
data "to die an honorable death."
data " "
data "Now I say that I have lived an"
data "honorable life,"
data "and I am free to die as I please."
'map in inventory menu
'map 0
data 0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,43,44,45,46,0,0,0,0
data 0,0,0,0,0,42,0,0,0,0,0,0,0
data 0,0,0,0,3,2,0,0,0,0,0,0,0
data 0,0,0,0,4,5,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0
'map 1
data 0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,24,0,0,0,0,0,0,0,0,0
data 0,0,19,20,21,22,0,0,0,27,0,0,0
data 0,0,16,17,18,0,0,0,29,30,31,0,0
data 0,0,12,0,13,14,0,32,33,34,35,36,0
data 0,8,7,6,9,10,0,37,38,39,40,41,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0
'map 2
data 0,0,0,0,0,0,67,0,0,0,0,0,0
data 0,0,0,0,0,0,66,0,0,0,0,0,0
data 0,0,0,0,0,63,64,65,0,0,0,0,0
data 0,0,0,0,58,59,60,61,62,0,0,0,0
data 0,0,0,0,0,55,56,57,0,0,0,0,0
data 0,0,0,0,50,51,52,53,54,0,0,0,0
data 0,0,0,0,0,48,47,49,0,0,0,0,0
'map 3
data 0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,82,0,0,0,0,0,0,0,0,0
data 0,0,0,79,80,81,0,74,72,0,0,0,0
data 0,0,0,78,0,0,0,73,70,69,68,0,0
data 0,0,77,76,75,0,0,0,71,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0
sub game_addFloatIcon (ico, xloc!, yloc!)
i = 0
do
if floaticon(i, 0) = 0 then
floaticon(i, 0) = 32
floaticon(i, 1) = xloc!
floaticon(i, 2) = yloc!
floaticon(i, 3) = ico
exit sub
end if
i = i + 1
if i = maxfloat+1 then exit do
loop
end sub
sub game_addFloatText (stri$, xloc!, yloc!, col)
i = 0
do
if floattext(i, 0) = 0 then
floattext(i, 0) = 32
floattext(i, 1) = xloc!
floattext(i, 2) = yloc!
floattext(i, 3) = col
floatstri$(i) = stri$
exit sub
end if
i = i + 1
if i = maxfloat+1 then exit do
loop
end sub
sub game_attack ()
dim npx as single, npy as single
npx = player.px + 12
npy = player.py + 20
lx = (npx - (npx MOD 16)) / 16
ly = (npy - (npy MOD 16)) / 16
if player.walkdir = 0 then
if ly > 0 then
o = objmap (lx, ly - 1)
if ly > 1 and curmap = 58 then o2 = objmap(lx, ly - 2)
if ly > 1 and curmap = 54 then o2 = objmap(lx, ly - 2)
'cst
if (objectinfo(o, 4) = 1 and (o = 0 or o > 4)) or (objectinfo(o2, 4) = 0 and o2 = 10) then
if o2 = 10 then o = 10
oscript = objectinfo(o, 5)
if oscript = 0 and inventory(0) < 9 then
inventory(0) = inventory(0) + 1
if inventory(0) > 9 then inventory(0) = 9
game_addFloatIcon 6, lx * 16, (ly - 1) * 16
objmapf (curmap, lx, ly - 1) = 1
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found Flask!"
itemticks = ticks + 215
exit sub
end if
if oscript = 0 and inventory(0) = 9 then
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndchest))
FSOUND_setVolume(snd, opeffectsvol)
end if
game_eventtext "Cannot Carry any more Flasks!"
itemticks = ticks + 215
exit sub
end if
if oscript = 2 then
inventory(4) = inventory(4) + 1
game_addFloatIcon 14, lx * 16, (ly - 1) * 16
itemticks = ticks + 215
if curmap = 34 then scriptflag(2,0) = 2
if curmap = 62 then scriptflag(8,0) = 2
if curmap = 81 then scriptflag(13,0) = 2
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Temple Key!"
exit sub
end if
if oscript = 3 then
player.foundcrystal = 1
player.crystalcharge = 0
game_addFloatIcon 7, lx * 16, (ly - 1) * 16
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Infinite Crystal!"
itemticks = ticks + 215
exit sub
end if
if oscript = 4 and player.shield = 1 then
player.shield = 2
game_addFloatIcon 4, lx * 16, (ly - 1) * 16
itemticks = ticks + 215
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Obsidian Shield!"
objmapf (4, 1, 2) = 1
exit sub
end if
if oscript = 5 and player.sword = 1 then
player.sword = 2
game_addFloatIcon 3, lx * 16, (ly - 1) * 16
itemticks = ticks + 215
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Fidelis Sword!"
exit sub
end if
if oscript = 6 then
if inventory(3) < 9 then
inventory(3) = inventory(3) + 1
for s = 20 to 23
if scriptflag(s, 0) = 1 then
scriptflag(s, 0) = 2
end if
next
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
objmapf (curmap, lx, ly - 1) = 1
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found Key"
game_addFloatIcon 16, lx * 16, (ly - 1) * 16
else
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndchest))
FSOUND_setVolume(snd, opeffectsvol)
end if
game_eventtext "Cannot Carry Any More Keys"
end if
end if
if oscript = 7 and inventory(1) < 9 then
inventory(1) = inventory(1) + 1
if inventory(1) > 9 then inventory(1) = 9
game_addFloatIcon 12, lx * 16, (ly - 1) * 16
objmapf (curmap, lx, ly - 1) = 1
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found Mega Flask!"
itemticks = ticks + 215
exit sub
end if
if oscript = 7 and inventory(1) = 9 then
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndchest))
FSOUND_setVolume(snd, opeffectsvol)
end if
game_eventtext "Cannot Carry any more Mega Flasks!"
itemticks = ticks + 215
exit sub
end if
if oscript = 10 and inventory(1) < 9 then
inventory(1) = inventory(1) + 1
if inventory(1) > 9 then inventory(1) = 9
game_addFloatIcon 12, lx * 16, (ly - 1) * 16
objmapf (curmap, lx, ly - 1) = 1
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found Mega Flask!"
itemticks = ticks + 215
exit sub
end if
if oscript = 10 and inventory(1) = 9 then
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndchest))
FSOUND_setVolume(snd, opeffectsvol)
end if
game_eventtext "Cannot Carry any more Mega Flasks!"
itemticks = ticks + 215
exit sub
end if
if oscript = 11 and inventory(2) < 9 then
inventory(2) = inventory(2) + 1
if inventory(2) > 9 then inventory(2) = 9
game_addFloatIcon 17, lx * 16, (ly - 1) * 16
objmapf (curmap, lx, ly - 1) = 1
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found Lightning Bomb!"
itemticks = ticks + 215
exit sub
end if
if oscript = 11 and inventory(2) = 9 then
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndchest))
FSOUND_setVolume(snd, opeffectsvol)
end if
game_eventtext "Cannot Carry any more Lightning Bombs!"
itemticks = ticks + 215
exit sub
end if
if oscript = 12 and player.armour = 1 then
player.armour = 2
game_addFloatIcon 5, lx * 16, (ly - 1) * 16
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Fidelis Mail!"
itemticks = ticks + 215
exit sub
end if
if oscript = 60 then
if curmap = 58 and scriptflag(60,0) = 0 then
scriptflag(60,0) = 1
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndlever))
FSOUND_setVolume(snd, opeffectsvol)
end if
elseif curmap = 58 and scriptflag(60,0) > 0 then
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(snddoor))
FSOUND_setVolume(snd, opeffectsvol)
end if
game_eventtext "It's stuck!"
end if
if curmap = 54 and scriptflag(60,0) = 1 then
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndlever))
FSOUND_setVolume(snd, opeffectsvol)
end if
scriptflag(60,0) = 2
elseif curmap = 54 and scriptflag(60,0) > 1 then
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(snddoor))
FSOUND_setVolume(snd, opeffectsvol)
end if
game_eventtext "It's stuck!"
end if
end if
if oscript = 15 and player.sword < 3 then
player.sword = 3
game_addFloatIcon 18, lx * 16, (ly - 1) * 16
itemticks = ticks + 215
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Blood Sword!"
objmapf (4, 1, 2) = 1
exit sub
end if
if oscript = 16 and player.shield < 3 then
player.shield = 3
game_addFloatIcon 19, lx * 16, (ly - 1) * 16
itemticks = ticks + 215
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Entropy Shield!"
objmapf (4, 1, 2) = 1
exit sub
end if
if oscript = 17 and player.armour < 3 then
player.armour = 3
game_addFloatIcon 20, lx * 16, (ly - 1) * 16
itemticks = ticks + 215
if menabled = 1 and opeffects = 1 then
snd = FSOUND_PlaySound(FSOUND_FREE, sfx(sndpowerup))
FSOUND_setVolume(snd, opeffectsvol)
end if
if objectinfo(o, 4) = 1 then objmap (lx, ly - 1) = 3
game_eventtext "Found the Rubyscale Armour!"
objmapf (4, 1, 2) = 1
exit sub
end if
end if
end if
end if
attacking = 1
player.attackframe = 0
movingup = 0
movingdown = 0
movingleft = 0
movingright = 0
for i = 0 to 15
for a = 0 to 3
playerattackofs (a, i, 2) = 0
next
next
end sub
sub game_castspell (spellnum, homex!, homey!, enemyx!, enemyy!, damagewho)
'spellnum 7 = sprite 6 spitfire
i = 0
do
if spellinfo(i).frame = 0 then
spellinfo(i).homex = homex!
spellinfo(i).homey = homey!
spellinfo(i).enemyx = enemyx!
spellinfo(i).enemyy = enemyy!
spellinfo(i).spellnum = spellnum
dw = 0
npc = 0
if damagewho > 0 then
dw = 1
npc = damagewho
end if
spellinfo(i).damagewho = dw
spellinfo(i).npc = npc
spellinfo(i).frame = 32
if damagewho = 0 then
spellinfo(i).strength = player.spellstrength / 100
if player.spellstrength = 100 then spellinfo(i).strength = 1.5
end if
'set earthslide vars