-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmisc.agc
106 lines (89 loc) · 3.18 KB
/
misc.agc
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
/*------------------------------------------------------------------------------*\
Galaga - Arcade game remake
Created by Stefan Wessels.
Copyright (c) 2017 Wessels Consulting Ltd. All rights reserved.
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely.
\*------------------------------------------------------------------------------*/
//------------------------------------------------------------------------------
function SetStates(newState, newSubState)
gState = newState
gSubState = newSubState
gScratch1 = 0
gScratch2 = 0
gStateTimer# = 0
endfunction
//------------------------------------------------------------------------------
function SetSubState(newState)
gSubState = newState
gScratch1 = 0
gScratch2 = 0
gStateTimer# = 0
endfunction
//------------------------------------------------------------------------------
function AddCredit()
inc gNumCredits
if gNumCredits > 9 then visCredits = 9 else visCredits = gNumCredits
SetTextString(gText[TEXT_0], str(visCredits))
endfunction
//------------------------------------------------------------------------------
function UseCredits()
dec gNumCredits, gStart
SetTextString(gText[TEXT_0], str(gNumCredits))
gStart = 0
if gVirtualStick
SetVirtualButtonVisible(VB_CoinDrop, 0)
SetVirtualButtonVisible(VB_1P_START, 0)
SetVirtualButtonVisible(VB_2P_START, 0)
SetVirtualJoystickVisible(VJ_Stick, 1)
SetVirtualButtonVisible(VB_Fire, 1)
endif
endfunction
//------------------------------------------------------------------------------
function SetTextRangeVisible(rangeStart, rangeEnd, visState)
for i = rangeStart to rangeEnd
SetTextVisible(gText[i], visState)
next i
endfunction
//------------------------------------------------------------------------------
function SetSpriteRangeVisible(rangeStart, rangeEnd, visState)
for i = rangeStart to rangeEnd
SetSpriteVisible(gSprites[i], visState)
next i
endfunction
//------------------------------------------------------------------------------
function ShowLivesIcons()
SetSpriteRangeVisible(gSpriteOffsets[IMAGE_PLAYER]+2,gSpriteOffsets[IMAGE_PLAYER]+2+gPlayers[gCurrentPlayer].lives, 1)
SetSpriteRangeVisible(gSpriteOffsets[IMAGE_PLAYER]+2+gPlayers[gCurrentPlayer].lives, gSpriteOffsets[IMAGE_PLAYER]+gSpriteNumbers[IMAGE_PLAYER], 0)
endfunction
//------------------------------------------------------------------------------
// TODO - Make sure the scores show up correctly after adjusting the width here
function FormatValue(value)
str$ = right(" "+str(value),7)
endfunction(str$)
//------------------------------------------------------------------------------
function Clamp(a#, b#, value#)
//if a# < b#
//lo# = a#
//hi# = b#
//else
//lo# = b#
//hi# = a#
//endif
//if value# < lo#
//v# = lo#
//elseif value# > hi#
//v# = hi#
//else
//v# = value#
//endif
if value# < a#
v# = a#
elseif value# > b#
v# = b#
else
v# = value#
endif
endfunction(v#)