-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMarch22_labels.lua
More file actions
162 lines (132 loc) · 4.95 KB
/
March22_labels.lua
File metadata and controls
162 lines (132 loc) · 4.95 KB
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
print("Loading March22_labels.lua");
dofile("app0:/LUA_CLASSES/Decision.lua");
dofile("app0:/scripts/LabelIndex.lua");
March22.MakingDecision = false;
-- These are the return values
-- For some reason it's just the number of the decision prefixed with 'm'
m1 = "decision1";
m2 = "decision2";
m3 = "decision3"; -- not used yet
-- Also init the _return value
_return = m1;
-- Load the graphic for decisions, as this is constant
decision_bar_graphic = Graphics.loadImage("app0:/graphics/bg-choice.png");
--[[
The function for making a decision
Hijacks the framebuffer to draw it
Parameter is just Decision.new() usually
]]
function MakeDecision(_decision)
madeDecision = false;
-- Set the dialogue to be the decision text
March22.ACTIVECHARACTER_NAME = _decision.speaker;
March22.ACTIVESPEECH = _decision.speech;
March22.ACTIVECHARACTER_COLOR = Color.new(255,255,255);
-- No typewriter effect so max it out
March22.TypeWriterFrame = 420;
-- Reset the controls to prevent overlap/leaking
if March22.BUTTON_X_PRESSED == 1 then
March22.BUTTON_X_PRESSED = 2;
end
if March22.BUTTON_SQUARE_PRESSED == 1 then
March22.BUTTON_SQUARE_PRESSED = 2;
end
if March22.BUTTON_TRIANGLE_PRESSED == 1 then
March22.BUTTON_TRIANGLE_PRESSED = 2;
end
-- A copy of the main loop from index.lua, with modifications
while madeDecision == false do
Graphics.initBlend();
Screen.clear();
March22.Render();
-- Draw the decision graphic + button markers
-- The co-ords are pre-calc'd for PSVita; will need editing for 3DS or other resolutions
Graphics.drawImage(178, 115, decision_bar_graphic);
Graphics.drawImage(178, 167, decision_bar_graphic);
Graphics.drawImage(185, 121, March22.TRIANGLE_BUTTON_GRAPHIC);
Graphics.drawImage(185, 174, March22.SQUARE_BUTTON_GRAPHIC);
-- Set pixel size to fit the graphic (determinent on the font) and print it
Font.setPixelSizes(March22.FONT , 18);
Font.print(March22.FONT, 210, 123, _decision.decision1, Color.new(145,135,121));
Font.print(March22.FONT, 210, 175, _decision.decision2, Color.new(145,135,121));
Font.setPixelSizes(March22.FONT , FONTSIZE);
Graphics.termBlend();
March22.UpdatePad();
-- Triangle = decision1
-- Square = decision2
-- Circle = decision3 (not added yet)
if March22.BUTTON_TRIANGLE_PRESSED == 1 then
_return = m1;
madeDecision = true;
end
if March22.BUTTON_SQUARE_PRESSED == 1 then
_return = m2;
madeDecision = true;
end
-- Flip the screen buffer
Screen.flip()
-- Reset the controls again
if March22.BUTTON_X_PRESSED == 1 then
March22.BUTTON_X_PRESSED = 2;
end
if March22.BUTTON_SQUARE_PRESSED == 1 then
March22.BUTTON_SQUARE_PRESSED = 2;
end
if March22.BUTTON_TRIANGLE_PRESSED == 1 then
March22.BUTTON_TRIANGLE_PRESSED = 2;
end
Screen.waitVblankStart();
end
March22.MakingDecision = false;
-- Re-reset the font size, just incase of leak
Font.setPixelSizes(March22.FONT , FONTSIZE);
-- Do the next label, because we now have the correct _return value
-- This means you can't have a decision be the last thing in a label, or it'll crash
March22.CURRENT_LABEL_POSITION = March22.CURRENT_LABEL_POSITION + 1;
LABELS[March22.CURRENT_LABEL][March22.CURRENT_LABEL_POSITION]();
end
-- Jumps out of the current label and executes the first command in the specified one
function jump_out(_label)
March22.CURRENT_LABEL = _label;
March22.CURRENT_LABEL_POSITION = 1;
LABELS[March22.CURRENT_LABEL][March22.CURRENT_LABEL_POSITION]();
end
-- Finds the scene in the loaded script and jumps to it
-- If the scene is not found in the loaded script then it loads the correct one first
function iscene(_scriptlabel)
if LABEL_POSITIONS[_scriptlabel] == nil then
if LABELINDEX[_scriptlabel] == nil then
March22.CURRENT_LABEL_POSITION = March22.CURRENT_LABEL_POSITION + 1;
LABELS[March22.CURRENT_LABEL][March22.CURRENT_LABEL_POSITION]();
return;
else
March22.ChangeScript(LABELINDEX[_scriptlabel]);
end
end
March22.CURRENTLINE = (LABEL_POSITIONS[_scriptlabel] + 1);
March22.ACTIVECHARACTER_NAME = ACTIVE_SCRIPT[March22.CURRENTLINE].speaker;
March22.ACTIVESPEECH = ACTIVE_SCRIPT[March22.CURRENTLINE].content;
March22.ACTIVECHARACTER_COLOR = ACTIVE_SCRIPT[March22.CURRENTLINE].color;
March22.SeenScenes[_scriptlabel] = true;
ACTIVE_SCRIPT[March22.CURRENTLINE].func();
end
-- This is supposed to play the act opening MKV file.
-- Not used yet
act_op = function(_filename)
end
-- Executes the decision at the specified script label
function imenu(_scriptlabel)
March22.MakingDecision = true;
March22.CURRENTLINE = (LABEL_POSITIONS[_scriptlabel] + 1);
ACTIVE_SCRIPT[March22.CURRENTLINE].func();
March22.SeenScenes[_scriptlabel] = true;
end
-- Returns true if player has seen the scene, false if not
function seen_scene(_scriptlabel)
return March22.SeenScenes[_scriptlabel];
end
-- Ends the path/game? Not sure yet.
path_end = function(_path)
end
-- Execute the imachine.lua file now that we've initialised all the function
dofile("app0:/scripts/imachine.lua");