Debian Codegraph @

src/pt2_posed.c

raw symbols SCIP
1 #cxx . . $ `<file>/src/pt2_posed.c`/include <stdint.h>
2 #include <stdbool.h>
3 #include <string.h>
4 #include "pt2_textout.h"cxx . . $ `<file>/src/pt2_textout.h`/
5 #include "pt2_visuals.h"cxx . . $ `<file>/src/pt2_visuals.h`/
6 #include "pt2_helpers.h"cxx . . $ `<file>/src/pt2_helpers.h`/
7 #include "pt2_replayer.h"cxx . . $ `<file>/src/pt2_replayer.h`/
8 #include "pt2_bmp.h"cxx . . $ `<file>/src/pt2_bmp.h`/
9 #include "pt2_mouse.h"cxx . . $ `<file>/src/pt2_mouse.h`/
10 #include "pt2_edit.h"cxx . . $ `<file>/src/pt2_edit.h`/
11 #include "pt2_textedit.h"cxx . . $ `<file>/src/pt2_textedit.h`/
12 #include "pt2_posed.h"cxx . . $ `<file>/src/pt2_posed.h`/
13
14 static char posEdNamescxx . . $ posEdNames.[MAX_PATTERNScxx . . $ `src/pt2_header.h:75:9`!][16];
15
16 void posEdScrollDowncxx . . $ posEdScrollDown(49f6e7a06ebc5aa8).(void)
17 {
18 const uint16_tcxx . . $ uint16_t# scrollAmount = mousecxx . . $ mouse..rightButtonPressedcxx . . $ mouse_t#rightButtonPressed. ? 10 : 1;
19
20 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. < songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1)
21 {
22 int16_tcxx . . $ int16_t# pos = songcxx . . $ song.->currPoscxx . . $ module_t#currPos. + scrollAmount;
23 if (pos > songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1)
24 pos = songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1;
25
26 modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(pos, DONT_SET_ROWcxx . . $ DONT_SET_ROW.);
27 }
28 }
29
30 void posEdScrollUpcxx . . $ posEdScrollUp(49f6e7a06ebc5aa8).(void)
31 {
32 const uint16_tcxx . . $ uint16_t# scrollAmount = mousecxx . . $ mouse..rightButtonPressedcxx . . $ mouse_t#rightButtonPressed. ? 10 : 1;
33
34 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. > 0)
35 {
36 int16_tcxx . . $ int16_t# pos = songcxx . . $ song.->currPoscxx . . $ module_t#currPos. - scrollAmount;
37 if (pos < 0)
38 pos = 0;
39
40 modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(pos, DONT_SET_ROWcxx . . $ DONT_SET_ROW.);
41 }
42 }
43
44 void posEdPageUpcxx . . $ posEdPageUp(49f6e7a06ebc5aa8).(void)
45 {
46 const uint16_tcxx . . $ uint16_t# scrollAmount = POSED_LIST_SIZEcxx . . $ `src/pt2_posed.h:3:9`!;
47
48 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. > 0)
49 {
50 int16_tcxx . . $ int16_t# pos = songcxx . . $ song.->currPoscxx . . $ module_t#currPos. - scrollAmount;
51 if (pos < 0)
52 pos = 0;
53
54 modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(pos, DONT_SET_ROWcxx . . $ DONT_SET_ROW.);
55 }
56 }
57
58 void posEdPageDowncxx . . $ posEdPageDown(49f6e7a06ebc5aa8).(void)
59 {
60 const uint16_tcxx . . $ uint16_t# scrollAmount = POSED_LIST_SIZEcxx . . $ `src/pt2_posed.h:3:9`!;
61
62 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. < songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1)
63 {
64 int16_tcxx . . $ int16_t# pos = songcxx . . $ song.->currPoscxx . . $ module_t#currPos. + scrollAmount;
65 if (pos > songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1)
66 pos = songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1;
67
68 modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(pos, DONT_SET_ROWcxx . . $ DONT_SET_ROW.);
69 }
70 }
71
72 void posEdScrollToTopcxx . . $ posEdScrollToTop(49f6e7a06ebc5aa8).(void)
73 {
74 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. > 0)
75 modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(0, DONT_SET_ROWcxx . . $ DONT_SET_ROW.);
76 }
77
78 void posEdScrollToBottomcxx . . $ posEdScrollToBottom(49f6e7a06ebc5aa8).(void)
79 {
80 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. < songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1)
81 modSetPoscxx . . $ modSetPos(af780a7c10c7990f).(songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1, DONT_SET_ROWcxx . . $ DONT_SET_ROW.);
82 }
83
84 void posEdClearNamescxx . . $ posEdClearNames(49f6e7a06ebc5aa8).(void)
85 {
86 memsetcxx . . $ memset(d1de1e4fb215f1c6).(posEdNamescxx . . $ posEdNames., 0, sizeof (posEdNamescxx . . $ posEdNames.));
87
88 if (uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown.)
89 uicxx . . $ ui..updatePosEdcxx . . $ ui_t#updatePosEd. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
90 }
91
92 void posEdEditNamecxx . . $ posEdEditName(49f6e7a06ebc5aa8).(void)
93 {
94 if (editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_IDLEcxx . . $ MODE_IDLE. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT.)
95 {
96 const uint8_tcxx . . $ uint8_t# pattern = (uint8_tcxx . . $ uint8_t#)songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[songcxx . . $ song.->currPoscxx . . $ module_t#currPos. & 0x7F];
97
98 textEditcxx . . $ textEdit..textStartPtrcxx . . $ textEdit_t#textStartPtr. = posEdNamescxx . . $ posEdNames.[pattern];
99 textEditcxx . . $ textEdit..textEndPtrcxx . . $ textEdit_t#textEndPtr. = posEdNamescxx . . $ posEdNames.[pattern] + 15;
100 textEditcxx . . $ textEdit..numBlockscxx . . $ textEdit_t#numBlocks. = 15;
101 textEditcxx . . $ textEdit..cursorStartXcxx . . $ textEdit_t#cursorStartX. = 184;
102 textEditcxx . . $ textEdit..cursorStartYcxx . . $ textEdit_t#cursorStartY. = 58;
103 textEditcxx . . $ textEdit..scrollablecxx . . $ textEdit_t#scrollable. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
104 enterTextEditModecxx . . $ enterTextEditMode(68e3ae50fe6578a9).(PTB_PE_PATTNAMEcxx . . $ PTB_PE_PATTNAME.);
105 }
106 }
107
108 void posEdInsertcxx . . $ posEdInsert(49f6e7a06ebc5aa8).(void)
109 {
110 if ((editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_IDLEcxx . . $ MODE_IDLE. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT.) && songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength. < 128)
111 {
112 for (int32_tcxx . . $ int32_t# i = 0; i < 127-songcxx . . $ song.->currPoscxx . . $ module_t#currPos.; i++)
113 songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[127-i] = songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[(127-i)-1];
114 songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[songcxx . . $ song.->currPoscxx . . $ module_t#currPos.] = 0;
115
116 songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.++;
117 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. > songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1)
118 editorcxx . . $ editor..currPosEdPattDispcxx . . $ editor_t#currPosEdPattDisp. = &songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1];
119
120 updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.);
121
122 uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
123 uicxx . . $ ui..updateSongLengthcxx . . $ ui_t#updateSongLength. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
124 uicxx . . $ ui..updateSongPatterncxx . . $ ui_t#updateSongPattern. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
125
126 if (uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown.)
127 uicxx . . $ ui..updatePosEdcxx . . $ ui_t#updatePosEd. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
128 }
129 }
130
131 void posEdDeletecxx . . $ posEdDelete(49f6e7a06ebc5aa8).(void)
132 {
133 if ((editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_IDLEcxx . . $ MODE_IDLE. || editorcxx . . $ editor..currModecxx . . $ editor_t#currMode. == MODE_EDITcxx . . $ MODE_EDIT.) && songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength. > 1)
134 {
135 for (int32_tcxx . . $ int32_t# i = 0; i < 128-songcxx . . $ song.->currPoscxx . . $ module_t#currPos.; i++)
136 songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[songcxx . . $ song.->currPoscxx . . $ module_t#currPos.+i] = songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[songcxx . . $ song.->currPoscxx . . $ module_t#currPos.+i+1];
137 songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[127] = 0;
138
139 songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.--;
140 if (songcxx . . $ song.->currPoscxx . . $ module_t#currPos. > songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1)
141 editorcxx . . $ editor..currPosEdPattDispcxx . . $ editor_t#currPosEdPattDisp. = &songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.-1];
142
143 updateWindowTitlecxx . . $ updateWindowTitle(b45ddcbc8423892c).(MOD_IS_MODIFIEDcxx . . $ MOD_IS_MODIFIED.);
144
145 uicxx . . $ ui..updateSongSizecxx . . $ ui_t#updateSongSize. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
146 uicxx . . $ ui..updateSongLengthcxx . . $ ui_t#updateSongLength. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
147 uicxx . . $ ui..updateSongPatterncxx . . $ ui_t#updateSongPattern. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
148
149 if (uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown.)
150 uicxx . . $ ui..updatePosEdcxx . . $ ui_t#updatePosEd. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
151 }
152 }
153
154 void posEdTogglecxx . . $ posEdToggle(49f6e7a06ebc5aa8).(void)
155 {
156 uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown. ^= 1;
157 if (uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown.)
158 {
159 renderPosEdScreencxx . . $ renderPosEdScreen(49f6e7a06ebc5aa8).();
160 uicxx . . $ ui..updatePosEdcxx . . $ ui_t#updatePosEd. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
161 }
162 else
163 {
164 displayMainScreencxx . . $ displayMainScreen(49f6e7a06ebc5aa8).();
165 }
166 }
167
168 void renderPosEdScreencxx . . $ renderPosEdScreen(49f6e7a06ebc5aa8).(void)
169 {
170 blit32cxx . . $ blit32(5f3dcb304cf8bfc1).(120, 0, 200, 99, posEdBMPcxx . . $ posEdBMP.);
171 uicxx . . $ ui..updatePosEdcxx . . $ ui_t#updatePosEd. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
172 }
173
174 static void drawPosEdNamecxx . . $ drawPosEdName(6908015b96d379c0).(int32_tcxx . . $ int32_t# entry, int32_tcxx . . $ int32_t# y, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! selected)
175 {
176 const uint8_tcxx . . $ uint8_t# pattern = (uint8_tcxx . . $ uint8_t#)songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[entry & 0x7F];
177 for (int32_tcxx . . $ int32_t# i = 0; i < 15; i++)
178 {
179 const int32_tcxx . . $ int32_t# x = 184 + (i * FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!);
180
181 char ch;
182
183 if (uicxx . . $ ui..editTextFlagcxx . . $ ui_t#editTextFlag.)
184 ch = posEdNamescxx . . $ posEdNames.[pattern][textEditcxx . . $ textEdit..scrollOffsetcxx . . $ textEdit_t#scrollOffset. + i];
185 else
186 ch = posEdNamescxx . . $ posEdNames.[pattern][i];
187
188 if (ch == '\0')
189 break;
190
191 if (selected)
192 charOutcxx . . $ charOut(e6c1e39bfc2b37).(x, y, ch, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.]);
193 else
194 charOutcxx . . $ charOut(e6c1e39bfc2b37).(x, y, ch, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.]);
195 }
196 }
197
198 void updatePosEdcxx . . $ updatePosEd(49f6e7a06ebc5aa8).(void)
199 {
200 if (!uicxx . . $ ui..updatePosEdcxx . . $ ui_t#updatePosEd. || !uicxx . . $ ui..posEdScreenShowncxx . . $ ui_t#posEdScreenShown. || uicxx . . $ ui..askBoxShowncxx . . $ ui_t#askBoxShown.)
201 return;
202
203 uicxx . . $ ui..updatePosEdcxx . . $ ui_t#updatePosEd. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
204
205 // clear entries first
206 fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(128, 23, (22*FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!)-1, ((FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!+1)*5)-1, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_BACKGRDcxx . . $ PAL_BACKGRD.]);
207 fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(128, 53, (22*FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!)-1, FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENBKGcxx . . $ PAL_GENBKG.]);
208 fillRectcxx . . $ fillRect(6fb2c7d311165c4f).(128, 59, (22*FONT_CHAR_Wcxx . . $ `src/pt2_header.h:70:9`!)-1, ((FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!+1)*6)-1, videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_BACKGRDcxx . . $ PAL_BACKGRD.]);
209
210 for (int32_tcxx . . $ int32_t# i = 0; i < POSED_LIST_SIZEcxx . . $ `src/pt2_posed.h:3:9`!; i++)
211 {
212 const int32_tcxx . . $ int32_t# entry = songcxx . . $ song.->currPoscxx . . $ module_t#currPos. - (5 - i);
213 if (entry < 0 || entry >= songcxx . . $ song.->headercxx . . $ module_t#header..songLengthcxx . . $ moduleHeader_t#songLength.)
214 continue;
215
216 const int32_tcxx . . $ int32_t# pattern = songcxx . . $ song.->headercxx . . $ module_t#header..patternTablecxx . . $ moduleHeader_t#patternTable.[entry];
217 const int32_tcxx . . $ int32_t# yPos = 23 + (i * (FONT_CHAR_Hcxx . . $ `src/pt2_header.h:71:9`!+1));
218 const boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! selected = (i == 5);
219 const uint32_tcxx . . $ uint32_t# textColor = selected ? videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_GENTXTcxx . . $ PAL_GENTXT.] : videocxx . . $ video..palettecxx . . $ video_t#palette.[PAL_QADSCPcxx . . $ PAL_QADSCP.];
220
221 printThreeDecimalscxx . . $ printThreeDecimals(eda338842932bf2b).(128, yPos, entry, textColor);
222 printTwoDecimalscxx . . $ printTwoDecimals(eda338842932bf2b).(160, yPos, selected ? *editorcxx . . $ editor..currPosEdPattDispcxx . . $ editor_t#currPosEdPattDisp. : pattern, textColor);
223 drawPosEdNamecxx . . $ drawPosEdName(6908015b96d379c0).(entry, yPos, selected);
224 }
225
226 // kludge to fix bottom part of text edit marker
227 if (uicxx . . $ ui..editTextFlagcxx . . $ ui_t#editTextFlag. && (textEditcxx . . $ textEdit..objectcxx . . $ textEdit_t#object. == PTB_PE_PATTcxx . . $ PTB_PE_PATT. || textEditcxx . . $ textEdit..objectcxx . . $ textEdit_t#object. == PTB_PE_PATTNAMEcxx . . $ PTB_PE_PATTNAME.))
228 renderTextEditCursorcxx . . $ renderTextEditCursor(49f6e7a06ebc5aa8).();
229 }