1 | if (vtext) |
2 | myx = writingxend - vspacing; |
3 | else |
4 | myx = writingx; |
5 | myy = writingy; |
6 | var halfsize = 0; |
7 | for (var n = 1; n <= stringpos; n++) |
8 | { |
9 | var ch = string_char_at(originalstring, n); |
10 | var myletter = ""; |
11 | if (ch == "^" && string_char_at(originalstring, n + 1) != "0") |
12 | { |
13 | n++; |
14 | } |
15 | else if (ch == "\") |
16 | { |
17 | n++; |
18 | ch = string_char_at(originalstring, n); |
19 | if (ch == "R") |
20 | { |
21 | mycolor = 255; |
22 | } |
23 | else if (ch == "G") |
24 | { |
25 | mycolor = 65280; |
26 | } |
27 | else if (ch == "W") |
28 | { |
29 | mycolor = 16777215; |
30 | } |
31 | else if (ch == "Y") |
32 | { |
33 | mycolor = 65535; |
34 | } |
35 | else if (ch == "X") |
36 | { |
37 | mycolor = 0; |
38 | } |
39 | else if (ch == "B") |
40 | { |
41 | mycolor = 16711680; |
42 | } |
43 | else if (ch == "O") |
44 | { |
45 | mycolor = 4235519; |
46 | } |
47 | else if (ch == "L") |
48 | { |
49 | mycolor = 16629774; |
50 | } |
51 | else if (ch == "P") |
52 | { |
53 | mycolor = 16711935; |
54 | } |
55 | else if (ch == "p") |
56 | { |
57 | mycolor = 13941759; |
58 | } |
59 | else if (ch == "C") |
60 | { |
61 | event_user(1); |
62 | } |
63 | else if (ch == "M") |
64 | { |
65 | n++; |
66 | ch = string_char_at(originalstring, n); |
67 | global.flag[20 animation_index] = real(ch); |
68 | } |
69 | else if (ch == "E") |
70 | { |
71 | n++; |
72 | ch = string_char_at(originalstring, n); |
73 | global.faceemotion = real(ch); |
74 | } |
75 | else if (ch == "F") |
76 | { |
77 | n++; |
78 | ch = string_char_at(originalstring, n); |
79 | global.facechoice = real(ch); |
80 | global.facechange = 1; |
81 | } |
82 | else if (ch == "S") |
83 | { |
84 | n++; |
85 | } |
86 | else if (ch == "T") |
87 | { |
88 | n++; |
89 | var newtyper = string_char_at(originalstring, n); |
90 | if (newtyper == "-") |
91 | { |
92 | halfsize = 1; |
93 | } |
94 | else if (newtyper == "+") |
95 | { |
96 | halfsize = 0; |
97 | } |
98 | else |
99 | { |
100 | if (newtyper == "T") |
101 | global.typer = 4; |
102 | if (newtyper == "t") |
103 | global.typer = 48; |
104 | if (newtyper == "0") |
105 | global.typer = 5; |
106 | if (newtyper == "S") |
107 | global.typer = 10; |
108 | if (newtyper == "F") |
109 | global.typer = 16; |
110 | if (newtyper == "s") |
111 | global.typer = 17; |
112 | if (newtyper == "P") |
113 | global.typer = 18; |
114 | if (newtyper == "M") |
115 | global.typer = 27; |
116 | if (newtyper == "U") |
117 | global.typer = 37; |
118 | if (newtyper == "A") |
119 | global.typer = 47; |
120 | if (newtyper == "a") |
121 | global.typer = 60; |
122 | if (newtyper == "R") |
123 | global.typer = 76; |
124 | SCR_TEXTTYPE |
125 | global.facechange = 1; |
126 | } |
127 | } |
128 | else if (ch == "z") |
129 | { |
130 | n++; |
131 | var sym = real(string_char_at(originalstring, n)); |
132 | if (sym == 4) |
133 | { |
134 | var sym_s = 862; |
135 | draw_sprite_ext(sym_s, 0, myx + (random(shake) - (shake / 2)), myy + 10 + (random(shake) - (shake / 2)), 2, 2, 0, c_white, 1); |
136 | } |
137 | } |
138 | else if (ch == "*") |
139 | { |
140 | n++; |
141 | ch = string_char_at(originalstring, n); |
142 | var icontype = 0; |
143 | if (myfont == fnt_papyrus || myfont == fnt_ja_papyrus_btl) |
144 | icontype = 1; |
145 | var sprite = scr_getbuttonsprite |
146 | if (sprite != -4) |
147 | { |
148 | var spritex = myx; |
149 | var spritey = myy; |
150 | if (shake > 38) |
151 | { |
152 | if (shake == 39) |
153 | { |
154 | direction += 10; |
155 | spritex += hspeed; |
156 | spritey += vspeed; |
157 | } |
158 | else if (shake == 40) |
159 | { |
160 | spritex += hspeed; |
161 | spritey += vspeed; |
162 | } |
163 | else if (shake == 41) |
164 | { |
165 | direction += (10 * n); |
166 | spritex += hspeed; |
167 | spritey += vspeed; |
168 | direction -= (10 * n); |
169 | } |
170 | else if (shake == 42) |
171 | { |
172 | direction += (20 * n); |
173 | spritex += hspeed; |
174 | spritey += vspeed; |
175 | direction -= (20 * n); |
176 | } |
177 | else if (shake == 43) |
178 | { |
179 | direction += (30 * n); |
180 | spritex += ((hspeed * 0.7) + 10); |
181 | spritey += (vspeed * 0.7); |
182 | direction -= (30 * n); |
183 | } |
184 | } |
185 | else if (!instance_exists(obj_papdate)) |
186 | { |
187 | spritex += (random(shake) - (shake / 2)); |
188 | spritey += (random(shake) - (shake / 2)); |
189 | } |
190 | var icon_scale = 1; |
191 | if (myfont == fnt_main || myfont == fnt_ja_main) |
192 | icon_scale = 2; |
193 | if (myfont == fnt_main || myfont == fnt_maintext) |
194 | spritey += (1 * icon_scale); |
195 | if (myfont == fnt_ja_papyrus_btl) |
196 | spritex -= 1; |
197 | if (myfont == fnt_papyrus && icontype == 1) |
198 | spritey += floor((16 - sprite_get_height(sprite)) / 2); |
199 | if (vtext) |
200 | { |
201 | draw_sprite_ext(sprite, 0, spritex - sprite_get_width(sprite), spritey, icon_scale, icon_scale, 0, c_white, 1); |
202 | myy += ((sprite_get_height(sprite) + 1) * icon_scale); |
203 | } |
204 | else |
205 | { |
206 | draw_sprite_ext(sprite, 0, spritex, spritey, icon_scale, icon_scale, 0, c_white, 1); |
207 | myx += ((sprite_get_width(sprite) + 1) * icon_scale); |
208 | } |
209 | } |
210 | } |
211 | else if (ch == ">") |
212 | { |
213 | n++; |
214 | var choiceindex = real(string_char_at(originalstring, n)); |
215 | if (choiceindex == 1) |
216 | { |
217 | myx = 196; |
218 | } |
219 | else |
220 | { |
221 | myx = 100; |
222 | if (myfont == fnt_ja_comicsans_big) |
223 | myx += 11; |
224 | } |
225 | if (view_wview[view_current] == 640) |
226 | myx *= 2; |
227 | myx += view_xview[view_current]; |
228 | } |
229 | } |
230 | else if (ch == "&") |
231 | { |
232 | script_execute(SCR_NEWLINE); |
233 | } |
234 | else if (ch == "/") |
235 | { |
236 | halt = 1; |
237 | var nextch = string_char_at(originalstring, n + 1); |
238 | if (nextch == "%") |
239 | halt = 2; |
240 | else if (nextch == "^" && string_char_at(originalstring, n + 2) != "0") |
241 | halt = 4; |
242 | else if (nextch == "*") |
243 | halt = 6; |
244 | break; |
245 | } |
246 | else if (ch == "%") |
247 | { |
248 | if (string_char_at(originalstring, n + 1) == "%") |
249 | { |
250 | instance_destroy(); |
251 | break; |
252 | } |
253 | stringno++; |
254 | originalstring = scr_replace_buttons_pc |
255 | stringpos = 0; |
256 | myx = writingx; |
257 | myy = writingy; |
258 | alarm[0] = textspeed; |
259 | break; |
260 | } |
261 | else |
262 | { |
263 | myletter = string_char_at(originalstring, n); |
264 | if (myletter == "^") |
265 | n++; |
266 | if (!vtext && myx > writingxend) |
267 | script_execute(SCR_NEWLINE); |
268 | var letterx = myx; |
269 | var offsetx = 0; |
270 | var offsety = 0; |
271 | var halfscale = 1; |
272 | if (halfsize) |
273 | { |
274 | halfscale = 0.5; |
275 | if (vtext) |
276 | offsetx += (vspacing * 0.33); |
277 | else |
278 | offsety += (vspacing * 0.33); |
279 | } |
280 | if (global.language == "en") |
281 | { |
282 | if (global.typer == 18) |
283 | { |
284 | if (myletter == "l" || myletter == "i") |
285 | letterx += 2; |
286 | if (myletter == "I") |
287 | letterx += 2; |
288 | if (myletter == "!") |
289 | letterx += 2; |
290 | if (myletter == ".") |
291 | letterx += 2; |
292 | if (myletter == "S") |
293 | letterx += 1; |
294 | if (myletter == "?") |
295 | letterx += 2; |
296 | if (myletter == "D") |
297 | letterx += 1; |
298 | if (myletter == "A") |
299 | letterx += 1; |
300 | if (myletter == "'") |
301 | letterx += 1; |
302 | } |
303 | } |
304 | else if (global.language == "ja") |
305 | { |
306 | if (vtext && (myfont == fnt_ja_papyrus || myfont == fnt_ja_papyrus_btl)) |
307 | { |
308 | if (myy == writingy && (myletter == "「" || myletter == "『")) |
309 | myy -= round((string_width(myletter) / 2) * htextscale * halfscale); |
310 | } |
311 | else if (myfont == fnt_ja_maintext || myfont == fnt_ja_main) |
312 | { |
313 | var unit = htextscale * halfscale; |
314 | if (myfont == fnt_ja_main) |
315 | unit *= 2; |
316 | if (ord(myletter) < 1024 || ord(myletter) == 8211) |
317 | { |
318 | if (n > 1) |
319 | { |
320 | var lastch = ord(string_char_at(originalstring, n - 1)); |
321 | if (lastch >= 1024 && lastch < 65281 && lastch != 8211 && lastch != 12288) |
322 | letterx += unit; |
323 | } |
324 | } |
325 | } |
326 | } |
327 | scr_setfont |
328 | draw_set_color(mycolor); |
329 | var angle; |
330 | if (vtext) |
331 | angle = -90; |
332 | else |
333 | angle = 0; |
334 | if (shake > 38) |
335 | { |
336 | if (shake == 39) |
337 | { |
338 | direction += 10; |
339 | offsetx += hspeed; |
340 | offsety += vspeed; |
341 | } |
342 | else if (shake == 40) |
343 | { |
344 | offsetx += hspeed; |
345 | offsety += vspeed; |
346 | } |
347 | else if (shake == 41) |
348 | { |
349 | direction += (10 * n); |
350 | offsetx += hspeed; |
351 | offsety += vspeed; |
352 | direction -= (10 * n); |
353 | } |
354 | else if (shake == 42) |
355 | { |
356 | direction += (20 * n); |
357 | offsetx += hspeed; |
358 | offsety += vspeed; |
359 | direction -= (20 * n); |
360 | } |
361 | else if (shake == 43) |
362 | { |
363 | direction += (30 * n); |
364 | offsetx += ((hspeed * 0.7) + 10); |
365 | offsety += (vspeed * 0.7); |
366 | direction -= (30 * n); |
367 | } |
368 | } |
369 | else |
370 | { |
371 | offsetx += (random(shake) - (shake / 2)); |
372 | offsety += (random(shake) - (shake / 2)); |
373 | } |
374 | var display_scale = surface_get_width(application_surface) / view_wview[view_current]; |
375 | var finalx = round((letterx + offsetx) * display_scale) / display_scale; |
376 | var finaly = round((myy + offsety) * display_scale) / display_scale; |
377 | draw_text_transformed(finalx, finaly, myletter, htextscale * halfscale, vtextscale * halfscale, angle); |
378 | letterx += spacing; |
379 | if (global.language == "en") |
380 | { |
381 | if (myfont == fnt_comicsans) |
382 | { |
383 | if (myletter == "w") |
384 | letterx += 2; |
385 | if (myletter == "m") |
386 | letterx += 2; |
387 | if (myletter == "i") |
388 | letterx -= 2; |
389 | if (myletter == "l") |
390 | letterx -= 2; |
391 | if (myletter == "s") |
392 | letterx -= 1; |
393 | if (myletter == "j") |
394 | letterx -= 1; |
395 | } |
396 | else if (myfont == fnt_papyrus) |
397 | { |
398 | if (myletter == "D") |
399 | letterx += 1; |
400 | if (myletter == "Q") |
401 | letterx += 3; |
402 | if (myletter == "M") |
403 | letterx += 1; |
404 | if (myletter == "L") |
405 | letterx -= 1; |
406 | if (myletter == "K") |
407 | letterx -= 1; |
408 | if (myletter == "C") |
409 | letterx += 1; |
410 | if (myletter == ".") |
411 | letterx -= 3; |
412 | if (myletter == "!") |
413 | letterx -= 3; |
414 | if (myletter == "O" || myletter == "W") |
415 | letterx += 2; |
416 | if (myletter == "I") |
417 | letterx -= 6; |
418 | if (myletter == "T") |
419 | letterx -= 1; |
420 | if (myletter == "P") |
421 | letterx -= 2; |
422 | if (myletter == "R") |
423 | letterx -= 2; |
424 | if (myletter == "A") |
425 | letterx += 1; |
426 | if (myletter == "H") |
427 | letterx += 1; |
428 | if (myletter == "B") |
429 | letterx += 1; |
430 | if (myletter == "G") |
431 | letterx += 1; |
432 | if (myletter == "F") |
433 | letterx -= 1; |
434 | if (myletter == "?") |
435 | letterx -= 3; |
436 | if (myletter == "'") |
437 | letterx -= 6; |
438 | if (myletter == "J") |
439 | letterx -= 1; |
440 | } |
441 | } |
442 | else if (global.language == "ja") |
443 | { |
444 | if (vtext) |
445 | { |
446 | myy += round(string_width(myletter) * htextscale * halfscale); |
447 | } |
448 | else if (myletter == " " || ord(myletter) >= 65377) |
449 | { |
450 | letterx -= floor(spacing / 2); |
451 | } |
452 | else if (ord(myletter) < 1024 || ord(myletter) == 8211) |
453 | { |
454 | if (myfont == fnt_ja_comicsans || myfont == fnt_ja_comicsans_big) |
455 | letterx -= floor(spacing * 0.3); |
456 | else |
457 | letterx -= floor(spacing * 0.4); |
458 | } |
459 | } |
460 | if (!vtext) |
461 | { |
462 | if (halfsize) |
463 | myx = round(myx + ((letterx - myx) / 2)); |
464 | else |
465 | myx = letterx; |
466 | } |
467 | } |
468 | } |