-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cb
83 lines (65 loc) · 1.98 KB
/
main.cb
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
// Window init
Const sw = 960 //640
Const sh = 540 //360
swra# = sw / 960.0
shra# = sh / 540.0
Smooth2D ON
SCREEN sw, sh
defaultFont = LoadFont("Courier New")
Global multiplier As Float
multiplier = 1 // Change this if the intro starts to stutter. :u
Randomize 1337
Include "customfunctions.cb"
// Music sync
bpm = 210
space = 60000 / bpm
// Timings -- Remember, changing these will most likely break the effects. :P
Const EFFECT_FOG = 40000
Const EFFECT_TITLE = 55000
Const EFFECT_EXPLOSIONS = 92000
Const INTRO_END = 130000
// Effect init / precalc
Gosub InitFogs
Gosub InitSparks
Gosub InitTitle
// Start!
PlaySound "Chipz4end.xm"
startTime = Timer() '- 38000 // Skip to the end of the fog
lastUpdate = Timer()
t = Timer()
Repeat
runTime = Timer() - startTime
While t < Timer()
wisku1 = isku1
isku1 = (runTime / space) / 4
wisku2 = isku2
isku2 = (runTime / space) / 2
// Adjust to song
If runTime < 18000 Then isku1 = ((runTime - 300) / space) / 4
// Simulate effects
If runTime < EFFECT_FOG + 4000 Then Gosub CalcFogs
If runTime > EFFECT_FOG And runTime < EFFECT_TITLE Then Gosub CalcTitle
If runTime > EFFECT_TITLE And runTime < EFFECT_EXPLOSIONS Then Gosub CalcSparks
t = t + multiplier * 10
Wend
// Drawing
If runTime < EFFECT_FOG + 4000 Then Gosub DrawFogs
If runTime > EFFECT_FOG And runTime < EFFECT_TITLE Then Gosub DrawTitle
If runTime > EFFECT_TITLE And runTime < EFFECT_EXPLOSIONS Then Gosub DrawSparks
If runTime > EFFECT_EXPLOSIONS Then Goto Ending
cbeSetBlendMode(CBE_BLEND_RESET)
SetFont defaultFont
Color 255, 255, 255
Text 0, 0, "FPS: "+FPS()
DrawScreen
Forever
Function smooth#(_new#,_old#,_smooth#)
Return _old + (_new - _old) * (1.0 / _smooth) * multiplier
EndFunction
Global LsIP_x#
Global LsIP_y#
// Include the effect sub-routines.
Include "balls.cb"
Include "title.cb"
Include "explosion.cb"
Include "ending.cb"