DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
clsmes.cpp
1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 821
4
5#include "clsmes.hpp"
6
7#include <libpkt.h>
8
9#include <cmath>
10#include <cstdio>
11#include <cstdlib>
12#include <cstring>
13
14#include "character.hpp"
15#include "editpartsdata.hpp"
16#include "editpartsinfo.hpp"
17#include "gameutil.hpp"
18#include "mglib.hpp"
19#include "rect.hpp"
20#include "savedata.hpp"
21#include "snd.hpp"
22#include "texture.hpp"
23
24/* The external-character code of every letter of each registered name. */
25s16 NameRegistTbl[8][11];
26
27/* Random tables the message window shakes its text with. */
28float RandTbl[64];
29float RandTbl2[64];
30
31/* Every pass of the outline the message window draws behind its text. The
32 * last entry's alpha ends the run. */
33MES_FUCHI FuchiTbl_E[] = {
34 {0, -2, 0, 0, 0, 128},
35 {0, 2, 0, 0, 0, 128},
36 {2, 0, 0, 0, 0, 128},
37 {-2, 0, 0, 0, 0, 128},
38 {0, 0, 0, 0, 0, -1 },
39};
40
42enum {
43 GAIJI_CODE,
44 GAIJI_U,
45 GAIJI_V,
46 GAIJI_WIDTH,
47 GAIJI_HEIGHT,
48 GAIJI_X_OFF,
49 GAIJI_Y_OFF,
50 GAIJI_CELLS,
51};
52
57struct GIFTAG {
58 u32 word[4];
59} __attribute__((aligned(16)));
60
61STATIC_ASSERT(sizeof(GIFTAG) == 0x10);
62
63s16 ClsMes::GetGaijiW(int code) {
64#ifdef PAL
65 if (code >= -0x300 && code < -0x251) {
66#else
67 if (code >= -0x300 && code < -0x263) {
68#endif
69 if (this->narrow_gaiji != 0) {
70 if (code == -0x2BD) {
71 return 5;
72 }
73
74 if (code == -0x2BA) {
75 return 5;
76 }
77
78 if (code == -0x2AB) {
79 return 5;
80 }
81 }
82
83 EDIT_GAIJI *table = (EDIT_GAIJI *) &EditPartsData[0x491C];
84 EDIT_GAIJI *gaiji = &EditGaijiTbl[code];
85 s16 width = this->char_width;
86
87 return width * gaiji->width;
88 }
89
90 return this->char_width;
91}
92
93int ClsMes::GetNameLen(int chara) {
94 if (chara < 0) {
95 return -1;
96 }
97
98 if (chara >= 6) {
99 return -1;
100 }
101
102 short *name = (short *) SaveData->GetCharaName(chara);
103
104 for (int i = 0; i < 11; i++) {
105 if ((u16) name[i] == 0) {
106 return i;
107 }
108 }
109
110 return -1;
111}
112
113int ClsMes::GetNameWidth(int chara) {
114 if (chara < 0) {
115 return -1;
116 }
117
118 if (chara >= 6) {
119 return -1;
120 }
121
122 u16 *name = (u16 *) SaveData->GetCharaName(chara);
123 s16 width = 0;
124
125 for (int i = 0; i < 11; i++) {
126 if (name[i] == 0) {
127 return width;
128 }
129
130 int code = NameRegistCodeJtoE(name[i] - 1);
131
132#ifdef PAL
133 if (code >= -0x300 && code < -0x250) {
134#else
135 if (code >= -0x300 && code < -0x262) {
136#endif
137 width += this->GetGaijiW(code);
138 } else {
139 width += this->char_width;
140 }
141 }
142
143 return -1;
144}
145
146void Myset2DSprite(sceVif1Packet *packet, CTexture *texture, const CRect_i_ &src, const CRect_i_ &dst, u8 r, u8 g, u8 b, u8 a) {
147 float one = 1.0f;
148
149 sceVif1PkCnt(packet, 0);
150 sceVif1PkOpenDirectCode(packet, 0);
151 sceVif1PkOpenGifTag(packet, *(u_long128 *) &GiftagAD);
152 sceVif1PkAddGsAD(packet, 0x14, 0x61);
153 sceVif1PkAddGsAD(packet, 0, 0x1D6);
154
155 sceGsZbuf depth = mgZBuffer;
156
157 sceVif1PkAddGsAD(packet, 0x4E, *(unsigned long *) &depth);
158 sceVif1PkAddGsAD(packet, 1, (unsigned long) r | (unsigned long) g << 8 | (unsigned long) b << 16 | (unsigned long) a << 24 | (unsigned long) *(u32 *) &one << 32);
159 sceVif1PkAddGsAD(packet, 6, *(unsigned long *) &texture->tex0);
160 sceVif1PkAddGsAD(packet, 3, (unsigned long) (dst.x << 4) | (unsigned long) (dst.y << 4) << 16);
161 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((src.x << 4) + 0x6C00) | (unsigned long) ((src.y << 3) + GS_Y_OFFSET) << 16);
162 sceVif1PkAddGsAD(packet, 3, (unsigned long) ((dst.x + dst.width) << 4) | (unsigned long) ((dst.y + dst.height) << 4) << 16);
163 sceVif1PkAddGsAD(packet, 4, (unsigned long) (((src.x + src.width) << 4) + 0x6BFF) | (unsigned long) (((src.y + src.height) << 3) + GS_Y_OFFSET) << 16);
164 sceVif1PkCloseGifTag(packet);
165 sceVif1PkCloseDirectCode(packet);
166}
167
168void ClsMes::AutoSetSub(CCharacter *first, CCharacter *second, int *out_pos) {
169 GetScrPosFromChar(first, out_pos);
170 GetScrPosFromChar(second, &out_pos[2]);
171}
172
173void ClsMes::AutoSet(int *pos) {
174 RECT candidate[3][3];
175 int outside[3][3];
176 float clearance[3][3];
177 int speaker_x;
178 int speaker_y;
179 int other_x;
180 int other_y;
181 int width;
182 int height;
183 int col;
184 int row;
185 int best_col;
186 int best_row;
187
188 speaker_x = pos[0];
189 speaker_y = pos[1];
190 other_x = pos[2];
191 other_y = pos[3];
192
193 width = 0xCA;
194 height = 0x8A;
195
196 if (this->win_width > 0xCA) {
197 width = this->win_width;
198 }
199
200 if (this->win_height > 0x8A) {
201 height = this->win_height;
202 }
203
204 for (row = 0; row < 3; row++) {
205 for (col = 0; col < 3; col++) {
206 candidate[row][col].height = height;
207
208 if (col == 0) {
209 candidate[row][col].x = 0;
210 } else {
211 candidate[row][col].x = col * (0x260 - width) >> 1;
212 candidate[row][col].x += 0x10;
213 }
214
215 if (row == 0) {
216 candidate[row][col].y = 0;
217 } else {
218 candidate[row][col].y = row * (0x1A0 - height) >> 1;
219 candidate[row][col].y += 0x10;
220 }
221
222 if (col == 0 || col == 2) {
223 candidate[row][col].width = width + 0x10;
224 } else {
225 candidate[row][col].width = width;
226 }
227
228 if (row == 0 || row == 2) {
229 candidate[row][col].height = height + 0x10;
230 } else {
231 candidate[row][col].height = height;
232 }
233 }
234 }
235
236 best_col = 0;
237 best_row = 0;
238
239 if (this->auto_pos == MES_POS_AUTO) {
240 for (row = 0; row < 3; row++) {
241 for (col = 0; col < 3; col++) {
242 RECT *rect = &candidate[row][col];
243
244 outside[row][col] = CheckPosInOutForRect(rect, speaker_x, speaker_y);
245
246 if (outside[row][col] == 0) {
247 outside[row][col] = CheckPosInOutForRect(rect, other_x, other_y);
248 }
249 }
250 }
251
252 for (row = 0; row < 3; row++) {
253 for (col = 0; col < 3; col++) {
254 if (outside[row][col] != 0) {
255 clearance[row][col] = -1.0f;
256 }
257
258 RECT *rect = &candidate[row][col];
259
260 clearance[row][col] = GetDisPosToRect(rect, speaker_x, speaker_y);
261
262 float other_clearance = GetDisPosToRect(rect, other_x, other_y);
263
264 if (other_clearance < clearance[row][col]) {
265 clearance[row][col] = other_clearance;
266 }
267 }
268 }
269
270 float best_clearance = 0.0f;
271
272 for (row = 0; row < 3; row++) {
273 for (col = 0; col < 3; col++) {
274 if (clearance[row][col] >= 0.0f && best_clearance < clearance[row][col]) {
275 best_col = col;
276 best_row = row;
277 best_clearance = clearance[row][col];
278 }
279 }
280 }
281 } else {
282 best_col = (this->auto_pos - 1) % 3;
283 best_row = (this->auto_pos - 1) / 3;
284 }
285
286 this->win_x = candidate[best_row][best_col].x;
287 this->win_y = candidate[best_row][best_col].y;
288
289 if (this->win_width < 0xCA) {
290 this->win_x += (0xCA - this->win_width) >> 1;
291 }
292
293 if (this->win_height < 0x8A) {
294 this->win_y += (0x8A - this->win_height) >> 1;
295 }
296
297 if (best_col == 0) {
298 this->win_x += 0x10;
299 }
300
301 if (best_row == 0) {
302 this->win_y += 0x10;
303 }
304
305#ifdef PAL
306 this->text_x = this->win_x + (int) (3.0f * this->char_width);
307#else
308 this->text_x = this->win_x + (int) (5.0f * this->char_width);
309#endif
310 this->text_y = this->win_y + (int) (1.5f * this->char_height);
311
312 if (this->tail_on != 0) {
313 this->tail_to_x = speaker_x;
314 this->tail_to_y = speaker_y;
315 }
316
317 this->grow_x = this->win_x + (this->win_width >> 1);
318 this->grow_y = this->win_y + (this->win_height >> 1);
319
320 if (this->tail_on != 0) {
321 if (this->tail_to_x <= this->win_x + (int) (this->win_width >> 2)) {
322 this->tail_x = this->win_x + (int) (this->win_width >> 2);
323 } else if (this->win_x + (int) (this->win_width * 3 >> 2) <= this->tail_to_x) {
324 this->tail_x = this->win_x + (int) (this->win_width * 3 >> 2);
325 } else {
326 this->tail_x = this->tail_to_x;
327 }
328
329 if (this->tail_to_y <= this->win_y + (int) (this->win_height >> 2)) {
330 this->tail_y = this->win_y + (int) (this->win_height >> 2);
331 } else if (this->win_y + (int) (this->win_height * 3 >> 2) <= this->tail_to_y) {
332 this->tail_y = this->win_y + (int) (this->win_height * 3 >> 2);
333 } else {
334 this->tail_y = this->tail_to_y;
335 }
336 }
337}
338
340 if (this->win_x < 0x10) {
341 this->win_x = 0x10;
342#ifdef PAL
343 this->text_x = this->win_x + (int) (3.0f * this->char_width);
344#else
345 this->text_x = this->win_x + (int) (5.0f * this->char_width);
346#endif
347 } else if (this->win_x + this->win_width >= 0x270) {
348 this->win_x = 0x270 - this->win_width;
349#ifdef PAL
350 this->text_x = this->win_x + (int) (3.0f * this->char_width);
351#else
352 this->text_x = this->win_x + (int) (5.0f * this->char_width);
353#endif
354 }
355
356 if (this->win_y < 0x10) {
357 this->win_y = 0x10;
358 this->text_y = this->win_y + (int) (1.5f * this->char_height);
359 } else if (this->win_y + this->win_height >= 0x1B0) {
360 this->win_y = 0x1B0 - this->win_height;
361 this->text_y = this->win_y + (int) (1.5f * this->char_height);
362 }
363}
364
366 this->text_x = 0x64;
367 this->text_y = 0x32;
368 this->char_width = 0xB;
369 this->char_height = 0x14;
370 this->columns = MES_WIN_COLUMNS;
371 this->rows = 0xA;
372 this->text_columns = MES_WIN_COLUMNS;
373 this->text_rows = 0xA;
374 this->text_len = 0;
375 this->text_width = 0;
376 this->text_height = 0;
377 this->unk_02C = 0x10;
378 this->init_030 = 0x10;
379 this->fukidashi = true;
380 this->fukidashi_shape = 0;
381 this->grow_x = 0x140;
382 this->grow_y = SCREEN_HALF_HEIGHT;
383 this->win_x = this->text_x;
384 this->win_y = this->text_y;
385 this->win_width = this->char_width * this->columns;
386 this->win_height = this->char_height * this->rows;
387 this->auto_pos = MES_POS_AUTO;
388 this->tail_on = true;
389 this->tail_x = 0x12C;
390 this->tail_y = 0xC8;
391 this->tail_to_x = 0x140;
392 this->tail_to_y = 0xC8;
393 this->tail_half_width = 8;
394 this->tail_length = 0x40;
395 this->stay_frame = false;
396 this->stay_width = 0;
397 this->stay_height = 0;
398 this->text_rate = 0.5f;
399 this->text_rate_set = 0.5f;
400 this->waiting = false;
401 this->auto_page = false;
402 this->fade_speed = 0.01f;
403 this->fade = 0.0f;
404 this->fade_in = true;
405 this->text_at = 0.0f;
406 this->text_no = 0;
407 this->text_from = 0;
408 this->page_from = 0;
409 this->clut_default = 1;
410 this->clut_now = this->clut_default;
411 this->wait = 0;
412 this->blink = 0;
413 this->auto_page_wait = 0;
414 this->mes_made = -1;
415 this->style = MES_EDGE_DOUBLE;
416 this->page_arrow = true;
417 this->end_mark = false;
418 this->centre_rows = true;
419 this->page_mark_style = true;
420 this->edge_alpha = 0x80;
421 this->narrow_gaiji_set = 0;
422 this->narrow_gaiji = false;
423
424 for (int i = 0; i < 10; i++) {
425 this->mes_no[i] = -1;
426 }
427
428 for (int i = 0; i < 8; i++) {
429 this->values[i] = 0;
430 }
431
432 this->value = 0;
433 this->value_signed = false;
434 this->value_show = true;
435 this->value_narrow = false;
436 this->space_width = -1;
437 this->space_area = -1;
438 this->cursor_row = -1;
439 this->cursor_y = 0;
440 this->cursor_lit = false;
441 this->tex_block = 0;
442
443 for (int i = 0; i < 10; i++) {
444 this->line_pos[i].x = -1;
445 this->line_pos[i].y = -1;
446 }
447
448 this->buff = NULL;
449 this->buff_system = NULL;
450 this->text = NULL;
451 this->text_system = NULL;
452 this->tex_buff = NULL;
453 this->clut = MesWinClut;
454}
455
456void ClsMes::SetBuff(short *buff) {
457 this->buff = buff;
458 this->text = (char *) this->buff;
459 this->text += (u16) this->buff[1];
460}
461
463 this->buff_system = buff;
464 this->text_system = (char *) this->buff_system;
465 this->text_system += (u16) this->buff_system[1];
466}
467
469 switch (style) {
470 case MES_PRESET_SYSTEM:
471 this->fukidashi = false;
472 this->text_rate = 0.0f;
473 this->text_rate_set = 0.0f;
474 this->clut_default = Color2Clut(FONT_COLOR_WHITE) & 0xFF;
475 this->clut_now = this->clut_default;
476 this->style = MES_EDGE_BLACK;
477 this->page_arrow = false;
478 this->centre_rows = true;
479 this->page_mark_style = false;
480 break;
481 case MES_PRESET_FUKIDASHI:
482 this->fukidashi = true;
483 this->clut_default = Color2Clut(FONT_COLOR_BROWN) & 0xFF;
484 this->clut_now = this->clut_default;
485 this->style = MES_EDGE_WHITE;
486 this->page_arrow = true;
487 this->centre_rows = true;
488 this->page_mark_style = true;
489 break;
490 case MES_PRESET_AUTO_PAGE:
491 this->style = MES_EDGE_NONE;
492 this->page_arrow = false;
493 this->centre_rows = true;
494 this->auto_page = true;
495 break;
496 case MES_PRESET_NAME:
497 this->fukidashi = false;
498 this->text_rate = 0.0f;
499 this->text_rate_set = 0.0f;
500 this->clut_default = Color2Clut(FONT_COLOR_GOLD) & 0xFF;
501 this->clut_now = this->clut_default;
502 this->style = MES_EDGE_TABLE;
503 this->page_arrow = false;
504 this->page_mark_style = false;
505 break;
506 case MES_PRESET_NONE:
507 break;
508 }
509}
510
512 switch (style) {
513 case MES_FUKIDASHI_LARGE_BLACK_EDGE:
514 this->char_width = 0xD;
515 this->char_height = 0x14;
516 this->fukidashi = false;
517 this->stay_frame = false;
518 this->clut_default = 1;
519 this->clut_now = this->clut_default;
520 this->page_arrow = true;
521 this->style = MES_EDGE_BLACK;
522 this->page_mark_style = true;
523 break;
524 case MES_FUKIDASHI_LARGE_TABLE_EDGE:
525 this->char_width = 0xD;
526 this->char_height = 0x14;
527 this->fukidashi = false;
528 this->stay_frame = false;
529 this->clut_default = Color2Clut(FONT_COLOR_WHITE) & 0xFF;
530 this->clut_now = this->clut_default;
531 this->page_arrow = true;
532 this->style = MES_EDGE_TABLE;
533 this->page_mark_style = true;
534 break;
535 case MES_FUKIDASHI_SMALL_FRAMED:
536 this->char_width = 0xB;
537 this->char_height = 0x14;
538 this->fukidashi = false;
539 this->stay_frame = true;
540 this->clut_default = Color2Clut(FONT_COLOR_WHITE) & 0xFF;
541 this->clut_now = this->clut_default;
542 this->page_arrow = false;
543 this->style = MES_EDGE_BLACK;
544 this->page_mark_style = false;
545 break;
546 case MES_FUKIDASHI_SMALL_DOUBLE_EDGE:
547 this->char_width = 0xB;
548 this->char_height = 0x14;
549 this->fukidashi = false;
550 this->stay_frame = false;
551 this->clut_default = Color2Clut(FONT_COLOR_WHITE) & 0xFF;
552 this->clut_now = this->clut_default;
553 this->page_arrow = true;
554 this->style = MES_EDGE_DOUBLE;
555 this->page_mark_style = true;
556 break;
557 case MES_FUKIDASHI_NO_BUBBLE:
558 this->fukidashi = false;
559 this->page_arrow = false;
560 break;
561 default:
562 this->char_width = 0xB;
563 this->char_height = 0x14;
564 this->fukidashi = true;
565 this->stay_frame = false;
566 this->clut_default = 1;
567 this->clut_now = this->clut_default;
568 this->page_arrow = true;
569 this->style = MES_EDGE_NONE;
570 this->page_mark_style = true;
571 break;
572 }
573}
574
576 if (this->fukidashi == 0) {
577 this->fade = 1.0f;
578 return;
579 }
580
581 if (this->fade_in != 0) {
582 if (this->fade < 1.0f) {
583 this->fade = this->fade + this->fade_speed;
584 }
585
586 if (1.0f < this->fade) {
587 this->fade = 1.0f;
588 }
589 } else {
590 if (0.0f < this->fade) {
591 this->fade = this->fade - this->fade_speed;
592 }
593
594 if (this->fade < 0.0f) {
595 this->fade = 0.0f;
596 }
597 }
598
599 if (this->tail_on == 0) {
600 return;
601 }
602
603 float centre[2];
604 float left[2];
605 float left_out[2];
606 float right[2];
607 float right_out[2];
608
609 centre[0] = this->tail_x;
610 centre[1] = this->tail_y;
611
612 float angle = atan2((float) (this->tail_to_x - this->tail_x), (float) (this->tail_to_y - this->tail_y));
613
614 left[0] = this->tail_x - this->tail_half_width;
615 left[1] = this->tail_y;
616 RollPos(centre, left, angle, left_out);
617 this->tail_left_x = (int) left_out[0];
618 this->tail_left_y = (int) left_out[1];
619
620 right[0] = this->tail_x + this->tail_half_width;
621 right[1] = this->tail_y;
622 RollPos(centre, right, angle, right_out);
623 this->tail_right_x = (int) right_out[0];
624 this->tail_right_y = (int) right_out[1];
625
626 float dx = this->tail_to_x - this->tail_x;
627 float dy = this->tail_to_y - this->tail_y;
628 float length = sqrt(dx * dx + dy * dy);
629
630 float px = this->tail_length * dx / length;
631 float py = this->tail_length * dy / length;
632
633 this->tail_tip_x = (int) px + this->tail_x;
634 this->tail_tip_y = (int) py + this->tail_y;
635}
636
638 if (this->fade <= 0.0f) {
639 return CLSMES_CLOSED;
640 }
641
642 if (0.0f < this->fade && this->fade < 1.0f) {
643 return this->fade_in != 0 ? CLSMES_FADE_IN : CLSMES_FADE_OUT;
644 }
645
646 if (this->waiting != 0) {
647 return CLSMES_PAGE_WAIT;
648 }
649
650 if (this->text_no >= this->text_len) {
651 return CLSMES_SHOWN;
652 }
653
654 return CLSMES_REVEALING;
655}
656
658 if (this->tex_buff != NULL) {
659 memset(this->tex_buff, 0, 0x100);
660 }
661}
662
664 if (this->waiting != 0) {
665 this->waiting = false;
667 this->blink = 0;
668 this->text_from = this->page_from;
669 }
670}
671
673 int at = this->text_no;
674
675 this->text_no = at + 1;
676
677 short code = this->win_line[at].code;
678
679 int unused;
680
681 if (code >= 0x1000) {
682 unused = code;
683 }
684
685 switch (code) {
686 case MES_CODE_NEWLINE:
687 this->text_at += 1.0f;
688 return 0;
689 case MES_CODE_PAGE:
690 this->waiting = true;
691
692 if (this->auto_page != 0 && this->blink >= this->auto_page_wait) {
693 this->GoNextPage();
694 this->auto_page_wait = 0;
695 }
696
697 this->page_from = at;
698 return 1;
699 case MES_CODE_END:
700 this->text_at += 1.0f;
701 return 2;
702 case MES_CODE_SPACE:
703 this->text_at += 1.0f;
704 return 0;
705 }
706
707 if ((code >= -0x700 && code <= -0x601) || (code >= -0x800 && code <= -0x701) || (code >= -0x900 && code < -0x800)) {
708 this->text_at += 1.0f;
709 return 0;
710 }
711
712 this->wait = this->win_line[at].space;
713 return 0;
714}
715
717 if (this->waiting != 0) {
718 if (this->auto_page != 0 && this->blink >= this->auto_page_wait) {
719 this->GoNextPage();
720 this->auto_page_wait = 0;
721 }
722
723 return;
724 }
725
726 if (this->wait > 0) {
727 this->wait--;
728 } else if (this->text_rate > 0.0f) {
729 this->text_at += this->text_rate;
730 }
731
732 if (this->text_rate_set == 0.0f && this->text_no >= this->text_len) {
733 return;
734 }
735
736 if (this->text_at > this->text_len) {
737 this->text_at = this->text_len;
738 }
739
740 while (this->text_rate == 0.0f || this->text_at - this->text_no >= 1.0f) {
741 int made = this->MyTextureMake_sub();
742
743 if (made == 1 || made == 2) {
744 if (this->text_rate == 0.0f) {
745 this->text_rate = this->text_rate_set;
746 this->text_at = this->text_no;
747 }
748
749 return;
750 }
751
752 if (this->text_no >= this->text_len) {
753 this->text_rate = this->text_rate_set;
754 this->text_at = this->text_no;
755 return;
756 }
757
758 if (this->text_rate_set == 0.0f && this->text_no >= this->text_len) {
759 return;
760 }
761 }
762}
763
764short *SetAndGetNameRegistTbl(int chara) {
765 if (chara < 0) {
766 return NULL;
767 }
768
769 if (chara >= 6) {
770 return NULL;
771 }
772
773 for (int i = 0; i < 11; i++) {
774 NameRegistTbl[chara][i] = MES_CODE_NEWLINE;
775 }
776
777 u16 *name = (u16 *) SaveData->GetCharaName(chara);
778
779 for (int i = 0; i < 11; i++) {
780 if (name[i] == 0) {
781 NameRegistTbl[chara][i] = MES_CODE_NEWLINE;
782 } else {
783 NameRegistTbl[chara][i] = NameRegistCodeJtoE(name[i] - 1);
784 }
785 }
786
787 return NameRegistTbl[chara];
788}
789
790void ClsMes::MakeMesWinTbl_value(int *x, int *y) {
791 if (this->value_show == 0 && this->value == 0) {
792 return;
793 }
794
795 char text[128];
796
797 if (this->value_signed != 0 && this->value > 0) {
798 sprintf(text, "+%d\n", this->value);
799 } else {
800 sprintf(text, "%d\n", this->value);
801 }
802
803 int len = strlen(text);
804
805 for (int i = 0; i < len; i++) {
806 int code = -1;
807 char digit = text[i];
808
809 if (digit == '+') {
810 code = -0x2A4;
811 }
812
813 if (digit == '-') {
814 code = -0x2A3;
815 }
816
817 if (digit == '1') {
818 code = -0x290;
819 }
820
821 if (digit == '2') {
822 code = -0x28F;
823 }
824
825 if (digit == '3') {
826 code = -0x28E;
827 }
828
829 if (digit == '4') {
830 code = -0x28D;
831 }
832
833 if (digit == '5') {
834 code = -0x28C;
835 }
836
837 if (digit == '6') {
838 code = -0x28B;
839 }
840
841 if (digit == '7') {
842 code = -0x28A;
843 }
844
845 if (digit == '8') {
846 code = -0x289;
847 }
848
849 if (digit == '9') {
850 code = -0x288;
851 }
852
853 if (digit == '0') {
854 code = -0x291;
855 }
856
857 if (code == -1) {
858 continue;
859 }
860
861 if (this->value_narrow != 0) {
862 this->SetMesWinTbl(code, 0, *x, *y);
863 *x = *x + (this->char_width >> 2) * 3;
864 } else {
865 this->SetMesWinTbl(code, 0, *x, *y);
866 *x = *x + this->char_width;
867 }
868 }
869}
870
871void ClsMes::MakeMesWinTbl_value(int which, int *x, int *y) {
872 if (this->value_show == 0 && this->values[which] == 0) {
873 return;
874 }
875
876 char text[128];
877
878 if (this->value_signed != 0 && this->values[which] > 0) {
879 sprintf(text, "+%d\n", this->values[which]);
880 } else {
881 sprintf(text, "%d\n", this->values[which]);
882 }
883
884 int len = strlen(text);
885
886 for (int i = 0; i < len; i++) {
887 int code = -1;
888 char digit = text[i];
889
890 if (digit == '+') {
891 code = -0x2A4;
892 }
893
894 if (digit == '-') {
895 code = -0x2A3;
896 }
897
898 if (digit == '1') {
899 code = -0x290;
900 }
901
902 if (digit == '2') {
903 code = -0x28F;
904 }
905
906 if (digit == '3') {
907 code = -0x28E;
908 }
909
910 if (digit == '4') {
911 code = -0x28D;
912 }
913
914 if (digit == '5') {
915 code = -0x28C;
916 }
917
918 if (digit == '6') {
919 code = -0x28B;
920 }
921
922 if (digit == '7') {
923 code = -0x28A;
924 }
925
926 if (digit == '8') {
927 code = -0x289;
928 }
929
930 if (digit == '9') {
931 code = -0x288;
932 }
933
934 if (digit == '0') {
935 code = -0x291;
936 }
937
938 if (code == -1) {
939 continue;
940 }
941
942 if (this->value_narrow != 0) {
943 this->SetMesWinTbl(code, 0, *x, *y);
944 *x = *x + (this->char_width >> 2) * 3;
945 } else {
946 this->SetMesWinTbl(code, 0, *x, *y);
947 *x = *x + this->char_width;
948 }
949 }
950}
951
952int ClsMes::MakeMesWinTbl_system(int code, int *x, int *y) {
953 short *at;
954 int text_code;
955
956 if (code >= -0x500 && code < -0x400) {
957 code += 0x500;
958
959 if (code == 0xFF) {
960 return 0;
961 }
962
963 if (code == 0xFA) {
964 return 0;
965 }
966
967 if (code == 0xF9) {
968 return 0;
969 }
970
971 if (code == 0xF8) {
972 return 0;
973 }
974
975 if (code == 0xF7) {
976 return 0;
977 }
978
979 if (code == 0xF6) {
980 return 0;
981 }
982
983 if (code == 0xF5) {
984 return 0;
985 }
986
987 if (code == 0xF4) {
988 return 0;
989 }
990
991 if (code == 0xF3) {
992 return 0;
993 }
994
995 if (code == 0xFE) {
996 code = this->mes_no[0];
997 } else if (code == 0xFD) {
998 code = this->mes_no[1];
999 } else if (code == 0xFC) {
1000 code = this->mes_no[2];
1001 } else if (code == 0xFB) {
1002 code = this->mes_no[3];
1003 } else if (code == 0xF2) {
1004 code = this->mes_no[4];
1005 } else if (code == 0xF1) {
1006 code = this->mes_no[5];
1007 } else if (code == 0xF0) {
1008 code = this->mes_no[6];
1009 } else if (code == 0xEF) {
1010 code = this->mes_no[7];
1011 } else if (code == 0xEE) {
1012 code = this->mes_no[8];
1013 } else if (code == 0xED) {
1014 code = this->mes_no[9];
1015 }
1016 } else {
1017 return 0;
1018 }
1019
1020 if (this->buff_system == 0) {
1021 return 0;
1022 }
1023
1024 at = this->GetTextLineDataTop_system(code);
1025
1026 if (at == 0) {
1027 return 0;
1028 }
1029
1030 while (1) {
1031 text_code = *at;
1032 at++;
1033
1034 if (text_code >= -0x506 && text_code < -0x500) {
1035 short *name = SetAndGetNameRegistTbl(text_code + 0x506);
1036
1037 if (name != 0) {
1038 int name_code = *name;
1039
1040 while (name_code != MES_CODE_NEWLINE && name_code != MES_CODE_END) {
1041 this->SetMesWinTbl(name_code, 0, *x, *y);
1042 *x += this->char_width;
1043 name++;
1044 name_code = *name;
1045 }
1046 }
1047 } else {
1048 switch (text_code) {
1049 case MES_CODE_END:
1050 return 1;
1051
1052 case MES_CODE_SPACE:
1053 this->SetMesWinTbl(text_code, 0, *x, *y);
1054
1055 if (this->space_area >= 0 || this->space_width >= 0) {
1056 *x += this->space_width;
1057 } else {
1058 *x += this->char_width;
1059 }
1060
1061 break;
1062
1063 case MES_CODE_NEWLINE:
1064 this->SetMesWinTbl(text_code, 1, *x, *y);
1065 *x = 0;
1066 *y += this->char_height;
1067 break;
1068
1069#ifdef PAL
1070 default:
1071 if (text_code >= -0x300 && text_code < -0x250) {
1072#else
1073 default:
1074 if (text_code >= -0x300 && text_code < -0x262) {
1075#endif
1076 this->SetMesWinTbl(text_code, 0, *x, *y);
1077 *x += this->GetGaijiW(text_code);
1078 } else {
1079 this->SetMesWinTbl(text_code, 1, *x, *y);
1080 *x += this->char_width;
1081 }
1082
1083 break;
1084 }
1085 }
1086 }
1087}
1088
1090 int no;
1091
1092 if (mes_no >= -0x500 && mes_no < -0x400) {
1093 no = mes_no + 0x500;
1094
1095 if (no == 0xFF) {
1096 return -1;
1097 }
1098
1099 if (no == 0xFA) {
1100 return -1;
1101 }
1102
1103 if (no == 0xF9) {
1104 return -1;
1105 }
1106
1107 if (no == 0xF8) {
1108 return -1;
1109 }
1110
1111 if (no == 0xF7) {
1112 return -1;
1113 }
1114
1115 if (no == 0xF6) {
1116 return -1;
1117 }
1118
1119 if (no == 0xF5) {
1120 return -1;
1121 }
1122
1123 if (no == 0xF4) {
1124 return -1;
1125 }
1126
1127 if (no == 0xF3) {
1128 return -1;
1129 }
1130
1131 if (no == 0xFE) {
1132 no = this->mes_no[0];
1133 } else if (no == 0xFD) {
1134 no = this->mes_no[1];
1135 } else if (no == 0xFC) {
1136 no = this->mes_no[2];
1137 } else if (no == 0xFB) {
1138 no = this->mes_no[3];
1139 } else if (no == 0xF2) {
1140 no = this->mes_no[4];
1141 } else if (no == 0xF1) {
1142 no = this->mes_no[5];
1143 } else if (no == 0xF0) {
1144 no = this->mes_no[6];
1145 } else if (no == 0xEF) {
1146 no = this->mes_no[7];
1147 } else if (no == 0xEE) {
1148 no = this->mes_no[8];
1149 } else if (no == 0xED) {
1150 no = this->mes_no[9];
1151 }
1152 } else {
1153 return -1;
1154 }
1155
1156 if (this->buff_system == NULL) {
1157 return -1;
1158 }
1159
1160 short *at = this->GetTextLineDataTop_system(no);
1161
1162 if (at == NULL) {
1163 return -1;
1164 }
1165
1166 int len[2] = {0, 0};
1167 int line = 0;
1168
1169 while (1) {
1170 short code = *at++;
1171
1172 if (code >= -0x506 && code < -0x500) {
1173 len[line] += this->GetNameLen(code + 0x506);
1174 continue;
1175 }
1176
1177 switch (code) {
1178 case MES_CODE_NEWLINE:
1179 line++;
1180 continue;
1181 case MES_CODE_END:
1182 if (len[0] > len[1]) {
1183 return len[0];
1184 }
1185
1186 return len[1];
1187 }
1188
1189 len[line]++;
1190 }
1191}
1192
1194 if (this->buff_system == NULL) {
1195 return -1;
1196 }
1197
1198 short *at = this->GetTextLineDataTop_system(mes_no);
1199
1200 if (at == NULL) {
1201 return -1;
1202 }
1203
1204 int width[2] = {0, 0};
1205 int line = 0;
1206
1207 while (1) {
1208 short code = *at++;
1209
1210 if (code >= -0x506 && code < -0x500) {
1211 width[line] += this->GetNameWidth(code + 0x506);
1212 continue;
1213 }
1214
1215 switch (code) {
1216 case MES_CODE_NEWLINE:
1217 line++;
1218 continue;
1219 case MES_CODE_END:
1220 if (width[0] > width[1]) {
1221 return width[0];
1222 }
1223
1224 return width[1];
1225 }
1226
1227#ifdef PAL
1228 if (code >= -0x300 && code < -0x250) {
1229#else
1230 if (code >= -0x300 && code < -0x262) {
1231#endif
1232 width[line] += this->GetGaijiW(code);
1233 } else {
1234 width[line] += this->char_width;
1235 }
1236 }
1237}
1238
1240 int count = this->buff[0];
1241 short *body = &this->buff[1];
1242
1243 for (int i = 0; i < count; i++) {
1244 if (line == body[i * 2 + 1]) {
1245 return &body[count] + body[i * 2 + 2];
1246 }
1247 }
1248
1249 return NULL;
1250}
1251
1253 int count = this->buff_system[0];
1254 short *body = &this->buff_system[1];
1255
1256 for (int i = 0; i < count; i++) {
1257 if (line == body[i * 2 + 1]) {
1258 return &body[count] + body[i * 2 + 2];
1259 }
1260 }
1261
1262 return NULL;
1263}
1264
1266 for (int i = 0; i < MES_WIN_LINE_MAX; i++) {
1267 this->win_line[i].code = 0;
1268 this->win_line[i].x = 0;
1269 this->win_line[i].y = 0;
1270 this->win_line[i].clut = 0;
1271 this->win_line[i].space = 0;
1272 }
1273
1274 this->win_line_num = 0;
1275}
1276
1277int ClsMes::SetMesWinTbl(int code, int mode, short x, short y) {
1278 if (code >= -0x200 && code <= -0x101) {
1279 if (this->win_line_num > 0) {
1280 this->win_line[this->win_line_num - 1].space += code + 0x200;
1281 }
1282
1283 return 0;
1284 }
1285
1286 if (code >= -0x400 && code <= -0x301) {
1287 if (code + 0x400 == 0) {
1288 this->clut_now = this->clut_default;
1289 } else if (code == -0x301) {
1290 this->clut_now = 0xFF;
1291 } else {
1292 this->clut_now = code + 0x401;
1293 }
1294
1295 return 0;
1296 }
1297
1298 if (code >= -0xA00 && code <= -0x901) {
1299 this->fukidashi_shape = code + 0xA00;
1300 return 0;
1301 }
1302
1303 if (mode == 1) {
1304 this->win_line[this->win_line_num].code = code + 0x1000;
1305 this->win_line[this->win_line_num].x = x;
1306 this->win_line[this->win_line_num].y = y;
1307 this->win_line[this->win_line_num].clut = this->clut_now;
1308 this->win_line_num++;
1309 } else {
1310 this->win_line[this->win_line_num].code = code;
1311 this->win_line[this->win_line_num].x = x;
1312 this->win_line[this->win_line_num].y = y;
1313 this->win_line[this->win_line_num].clut = this->clut_now;
1314 this->win_line_num++;
1315 }
1316
1317 return 1;
1318}
1319
1320int ClsMes::CalcSpaceW(int width, int glyph_width, short *text) {
1321 short *at = text;
1322 int used = 0;
1323 int spaces = 0;
1324
1325 while (1) {
1326 short code = *at++;
1327
1328 switch (code) {
1329 case MES_CODE_NEWLINE:
1330 case MES_CODE_PAGE:
1331 case MES_CODE_END:
1332 if (spaces > 0) {
1333 return (width - used) / spaces;
1334 }
1335
1336 return -1;
1337 case MES_CODE_SPACE:
1338 spaces++;
1339 continue;
1340 }
1341
1342#ifdef PAL
1343 if (code >= -0x300 && code < -0x250) {
1344#else
1345 if (code >= -0x300 && code < -0x262) {
1346#endif
1347 used += this->GetGaijiW(code);
1348 } else if (code >= -0x700 && code < -0x600) {
1349 used += code + 0x700;
1350 } else {
1351 used += glyph_width;
1352 }
1353 }
1354}
1355
1357 short *at;
1358 int x;
1359 int y;
1360 int code;
1361
1362 if (this->buff == 0) {
1363 return 0;
1364 }
1365
1366 at = this->GetTextLineDataTop(mes_no);
1367
1368 if (at == 0) {
1369 return 0;
1370 }
1371
1372 this->InitMesWinTbl();
1373
1374 x = 0;
1375 y = 0;
1376
1377 while (1) {
1378 code = *at;
1379 at++;
1380
1381 if (code == MES_CODE_PAGE || code == MES_CODE_NEWLINE || code == MES_CODE_END) {
1382 this->space_width = -1;
1383 this->space_area = -1;
1384 }
1385
1386 switch (code) {
1387 case MES_CODE_END:
1388 this->SetMesWinTbl(code, 0, x, y);
1389 return 1;
1390
1391 case MES_CODE_NEWLINE:
1392 this->SetMesWinTbl(code, 0, x, y);
1393 x = 0;
1394 y += this->char_height;
1395 break;
1396
1397 case MES_CODE_PAGE:
1398 this->SetMesWinTbl(code, 0, x, y);
1399 x = 0;
1400 y = 0;
1401 break;
1402
1403 case MES_CODE_SPACE:
1404 this->SetMesWinTbl(code, 0, x, y);
1405
1406 if (this->space_area >= 0 || this->space_width >= 0) {
1407 x += this->space_width;
1408 } else {
1409 x += this->char_width;
1410 }
1411
1412 break;
1413
1414#ifdef PAL
1415 default:
1416 if (code >= -0x300 && code < -0x250) {
1417#else
1418 default:
1419 if (code >= -0x300 && code < -0x262) {
1420#endif
1421 this->SetMesWinTbl(code, 0, x, y);
1422 x += this->GetGaijiW(code);
1423 } else if (code >= -0x900 && code < -0x800) {
1424 this->space_area = (code + 0x900) * 4;
1425 this->space_width = this->CalcSpaceW(this->space_area, this->char_width, at - 1);
1426 } else if (code >= -0x800 && code < -0x700) {
1427 this->space_width = code + 0x800;
1428 } else if (code >= -0x700 && code < -0x600) {
1429 x += code + 0x700;
1430 } else if (code >= -0x506 && code < -0x500) {
1431 short *name = SetAndGetNameRegistTbl(code + 0x506);
1432
1433 if (name != 0) {
1434 int name_code = *name;
1435
1436 while (name_code != MES_CODE_NEWLINE && name_code != MES_CODE_END) {
1437 this->SetMesWinTbl(name_code, 0, x, y);
1438 x += this->char_width;
1439 name++;
1440 name_code = *name;
1441 }
1442 }
1443 } else if (code == -0x401) {
1444 this->MakeMesWinTbl_value(&x, &y);
1445 } else if (code >= -0x40D && code < -0x405) {
1446 this->MakeMesWinTbl_value(-0x406 - code, &x, &y);
1447 } else if (this->MakeMesWinTbl_system(code, &x, &y) == 0) {
1448 if (this->SetMesWinTbl(code, 0, x, y) != 0) {
1449 x += this->char_width;
1450 }
1451 }
1452
1453 break;
1454 }
1455 }
1456}
1457
1458void NeedMesWinWH_sub(int *len, int *max_len, int *width, int *max_width, int char_width, int count) {
1459 if (count <= 0) {
1460 return;
1461 }
1462
1463 *len += count;
1464
1465 if (*max_len < *len) {
1466 *max_len = *len;
1467 }
1468
1469 *width += count * char_width;
1470
1471 if (*max_width < *width) {
1472 *max_width = *width;
1473 }
1474}
1475
1476void ClsMes::NeedMesWinWH(int mes_no, int *out) {
1477 short *at;
1478 int *max_len;
1479 int *max_lines;
1480 int *max_width;
1481 int *max_height;
1482 int code;
1483 int len;
1484 int width;
1485 int lines;
1486 int height;
1487 int count;
1488
1489 if (this->buff == 0) {
1490 return;
1491 }
1492
1493 at = this->GetTextLineDataTop(mes_no);
1494
1495 if (at == 0) {
1496 return;
1497 }
1498
1499 max_len = &out[0];
1500 max_lines = &out[1];
1501 max_width = &out[2];
1502 max_height = &out[3];
1503
1504 *max_len = 0;
1505 *max_lines = 0;
1506 *max_width = 0;
1507 *max_height = 0;
1508 len = 0;
1509 lines = 0;
1510 width = 0;
1511 height = 0;
1512 count = 0;
1513
1514 while (1) {
1515 count++;
1516 code = *at;
1517 at++;
1518
1519 if (code == MES_CODE_PAGE || code == MES_CODE_NEWLINE || code == MES_CODE_END) {
1520 this->space_width = -1;
1521 this->space_area = -1;
1522 }
1523
1524 switch (code) {
1525 case MES_CODE_END:
1526 return;
1527
1528 case MES_CODE_SPACE:
1529 len++;
1530
1531 if (*max_len < len) {
1532 *max_len = len;
1533 }
1534
1535 if (this->space_area >= 0 || this->space_width >= 0) {
1536 width += this->space_width;
1537 } else {
1538 width += this->char_width;
1539 }
1540
1541 if (*max_width < width) {
1542 *max_width = width;
1543 }
1544
1545 break;
1546
1547 case MES_CODE_NEWLINE:
1548 len = 0;
1549 lines++;
1550
1551 if (*max_lines < lines) {
1552 *max_lines = lines;
1553 }
1554
1555 width = 0;
1556 height += this->char_height;
1557
1558 if (*max_height < height) {
1559 *max_height = height;
1560 }
1561
1562 break;
1563
1564 case MES_CODE_PAGE:
1565 len = 0;
1566 lines = 0;
1567 width = 0;
1568 height = 0;
1569 break;
1570
1571 default:
1572 if (code >= -0x200 && code <= -0x101) {
1573 continue;
1574 } else if (code >= -0x400 && code <= -0x301) {
1575 continue;
1576 } else if (code >= -0xA00 && code <= -0x901) {
1577 continue;
1578 } else if (code >= -0x900 && code < -0x800) {
1579 this->space_area = (code + 0x900) * 4;
1580 this->space_width = this->CalcSpaceW(this->space_area, this->char_width, at - 1);
1581 } else if (code >= -0x800 && code < -0x700) {
1582 this->space_width = code + 0x800;
1583 } else if (code >= -0x700 && code < -0x600) {
1584 len++;
1585
1586 if (*max_len < len) {
1587 *max_len = len;
1588 }
1589
1590 width += code + 0x700;
1591
1592 if (*max_width < width) {
1593 *max_width = width;
1594 }
1595 } else if (code == -0x401) {
1596 if (this->value_show != 0 || this->value != 0) {
1597 char text[128];
1598
1599 if (this->value_signed != 0 && this->value > 0) {
1600 sprintf(text, "+%d\n", this->value);
1601 } else {
1602 sprintf(text, "%d\n", this->value);
1603 }
1604
1605 if (this->value_narrow != 0) {
1606 NeedMesWinWH_sub(&len, max_len, &width, max_width, (this->char_width >> 2) * 3, strlen(text) - 1);
1607 } else {
1608 NeedMesWinWH_sub(&len, max_len, &width, max_width, this->char_width, strlen(text) - 1);
1609 }
1610 }
1611 } else if (code >= -0x40D && code < -0x405) {
1612 if (this->value_show != 0 || this->values[-0x406 - code] != 0) {
1613 char text[128];
1614
1615 if (this->value_signed != 0 && this->values[-0x406 - code] > 0) {
1616 sprintf(text, "+%d\n", this->values[-0x406 - code]);
1617 } else {
1618 sprintf(text, "%d\n", this->values[-0x406 - code]);
1619 }
1620
1621 if (this->value_narrow != 0) {
1622 NeedMesWinWH_sub(&len, max_len, &width, max_width, (this->char_width >> 2) * 3, strlen(text) - 1);
1623 } else {
1624 NeedMesWinWH_sub(&len, max_len, &width, max_width, this->char_width, strlen(text) - 1);
1625 }
1626 }
1627 } else if (code == -0x405 || code == -0x404 || code == -0x403 || code == -0x402 || code == -0x411 || code == -0x410 || code == -0x40F || code == -0x40E) {
1628 NeedMesWinWH_sub(&len, max_len, &width, max_width, this->char_width, this->GetMesLen_system(code));
1629 } else if (code >= -0x506 && code < -0x500) {
1630 NeedMesWinWH_sub(&len, max_len, &width, max_width, this->char_width, this->GetNameLen(code + 0x506));
1631#ifdef PAL
1632 } else if (code >= -0x300 && code < -0x251) {
1633#else
1634 } else if (code >= -0x300 && code < -0x263) {
1635#endif
1636 len += *(int *) &EditGaijiTbl[code];
1637 width += this->GetGaijiW(code);
1638
1639 if (*max_len < len) {
1640 *max_len = len;
1641 }
1642
1643 if (*max_width < width) {
1644 *max_width = width;
1645 }
1646 } else {
1647 NeedMesWinWH_sub(&len, max_len, &width, max_width, this->char_width, 1);
1648 }
1649
1650 break;
1651 }
1652 }
1653}
1654
1655void MakeRandTbl(float lo, float hi) {
1656 for (int i = 0; i < 64; i++) {
1657 RandTbl[i] = ((hi - lo) * (float) rand()) / 2147483648.0f;
1658 RandTbl[i] += lo;
1659 }
1660}
1661
1662void MakeRandTbl2(float lo, float hi) {
1663 for (int i = 0; i < 64; i++) {
1664 RandTbl2[i] = ((hi - lo) * (float) rand()) / 2147483648.0f;
1665 RandTbl2[i] += lo;
1666 }
1667}
1668
1670 if (this->mes_made == mes_no) {
1671 if (this->auto_page == 0) {
1672 this->fade = 1.0f;
1673 this->fade_in = true;
1674 GoNextPage();
1675 }
1676
1677 return 0;
1678 }
1679
1680 this->fukidashi_shape = 0;
1681 this->text_no = 0;
1682 this->text_from = 0;
1683 this->page_from = 0;
1684 this->text_at = 0.0f;
1685 MakeMesTexture(mes_no);
1686
1687 if (this->fukidashi_shape == 0) {
1688 MakeRandTbl(0.0f, 4.0f);
1689 } else if (this->fukidashi_shape == 1) {
1690 MakeRandTbl(2.0f, 6.0f);
1691 } else if (this->fukidashi_shape == 4) {
1692 MakeRandTbl(6.8f, 15.2f);
1693 MakeRandTbl2(0.42f, 0.58f);
1694 }
1695
1696 return 0;
1697}
1698
1700 int needed[4];
1701
1702 this->mes_made = mes_no;
1703
1704 if (this->fukidashi != 0) {
1705 this->fade = 0.0f;
1706 this->fade_in = true;
1707 }
1708
1709 this->waiting = false;
1710 this->blink = 0;
1712 NeedMesWinWH(mes_no, needed);
1713
1714 needed[1] += 1;
1715 needed[3] += this->char_height;
1716 this->text_columns = needed[0];
1717 this->text_rows = needed[1];
1718 this->text_width = needed[2];
1719 this->text_height = needed[3];
1720
1721 if (this->text_columns < 4) {
1722#ifdef PAL
1723 this->win_width = this->char_width * 10;
1724#else
1725 this->win_width = this->char_width * 14;
1726#endif
1727 } else {
1728#ifdef PAL
1729 this->win_width = this->char_width * (int) (3.0f + (3.0f + (float) this->text_columns));
1730#else
1731 this->win_width = this->char_width * (int) (5.0f + (5.0f + (float) this->text_columns));
1732#endif
1733 }
1734
1735 this->win_height = this->char_height * (int) (1.5f + (1.5f + (float) this->text_rows));
1736#ifdef PAL
1737 this->win_x = this->text_x - (int) (3.0f * (float) this->char_width);
1738#else
1739 this->win_x = this->text_x - (int) (5.0f * (float) this->char_width);
1740#endif
1741 this->win_y = this->text_y - (int) (1.5f * (float) this->char_height);
1742
1743 if (MakeMesWinTbl(mes_no) != 0) {
1744 this->text_len = this->win_line_num;
1745 }
1746}
1747
1748void ClsMes::Myset2DSprite_Fuchi(sceVif1Packet *packet, CTexture *texture, int x, int y, int width, int height, int u, int v, int u_width, int v_height) {
1749 switch (this->style) {
1750 case MES_EDGE_WHITE:
1751 set2DSprite_Core(packet, texture, CRect_i_(x + 1, y + 1, width, height), CRect_i_(u, v, u_width, v_height), 0xFF, 0xFF, 0xFF, this->edge_alpha < 0x40 ? this->edge_alpha : 0x40);
1752 break;
1753 case MES_EDGE_BLACK:
1754 set2DSprite_Core(packet, texture, CRect_i_(x + 1, y + 1, width, height), CRect_i_(u, v, u_width, v_height), 0, 0, 0, this->edge_alpha < 0x40 ? this->edge_alpha : 0x40);
1755 break;
1756 case MES_EDGE_TABLE:
1757 for (int i = 0; FuchiTbl_E[i].alpha > 0; i++) {
1758 set2DSprite_Core(packet, texture, CRect_i_(x + FuchiTbl_E[i].x, y + FuchiTbl_E[i].y, width, height), CRect_i_(u, v, u_width, v_height), FuchiTbl_E[i].r, FuchiTbl_E[i].g, FuchiTbl_E[i].b, this->edge_alpha < FuchiTbl_E[i].alpha ? this->edge_alpha : FuchiTbl_E[i].alpha);
1759 }
1760
1761 break;
1762 case MES_EDGE_DOUBLE:
1763 set2DSprite_Core(packet, texture, CRect_i_(x + 1, y + 1, width, height), CRect_i_(u, v, u_width, v_height), 0x40, 0x40, 0x40, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
1764 set2DSprite_Core(packet, texture, CRect_i_(x + 2, y + 2, width, height), CRect_i_(u, v, u_width, v_height), 0, 0, 0, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
1765 break;
1766 }
1767}
1768
1769void DrawMaru(sceVif1Packet *packet, int x, int y, int width, int height, int lift, int unused, int rough, int prim) {
1770 float across;
1771 float down;
1772 float turn;
1773 int px;
1774 int py;
1775 int step;
1776
1777 sceVif1PkAddGsAD(packet, 0, ((unsigned long) prim << 7) | 0x145);
1778 sceVif1PkAddGsAD(packet, 1, 0x80BFBFBF | ((unsigned long) 1 << 32));
1779
1780 px = x + (width >> 1);
1781 py = y + (height >> 1) - lift;
1782
1783 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((px << 4) + 0x6C00) | (unsigned long) ((py << 4) + GS_Y_OFFSET) << 16);
1784
1785 turn = 0.0f;
1786 step = 0;
1787
1788 while (turn < 128.0f) {
1789 float angle = TWO_PI * turn / 128.0f;
1790
1791 across = cosf(angle);
1792 down = sinf(angle);
1793
1794 if (rough == 1 && step % 2 == 1) {
1795 across *= 0.9f;
1796 down *= 0.85f;
1797 }
1798
1799 across += 1.0f;
1800 down += 1.0f;
1801 across *= width;
1802 down *= height;
1803 across /= 2.0f;
1804 down /= 2.0f;
1805
1806 px = (int) across;
1807 py = (int) down;
1808 px += x;
1809 py += y - lift;
1810
1811 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((px << 4) + 0x6C00) | (unsigned long) ((py << 4) + GS_Y_OFFSET) << 16);
1812
1813 if (rough == 1) {
1814 turn += RandTbl[step];
1815 } else {
1816 turn += 4.0f;
1817 }
1818
1819 step++;
1820 }
1821
1822 across = 1.0f;
1823 down = 0.0f;
1824
1825 if (rough == 1 && step % 2 == 1) {
1826 across *= 0.9f;
1827 down *= 0.85f;
1828 }
1829
1830 across += 1.0f;
1831 down += 1.0f;
1832 across *= width;
1833 down *= height;
1834 across /= 2.0f;
1835 down /= 2.0f;
1836
1837 px = (int) across;
1838 py = (int) down;
1839 px += x;
1840 py += y - lift;
1841
1842 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((px << 4) + 0x6C00) | (unsigned long) ((py << 4) + GS_Y_OFFSET) << 16);
1843}
1844
1845#pragma opt_propagation off
1846
1848 float grown_width;
1849 float grown_height;
1850 int x;
1851 int y;
1852 int top;
1853 int i;
1854 int mirror;
1855
1856 top = this->win_y;
1857
1858 if (this->grow_y < top) {
1859 top = this->grow_y;
1860 }
1861
1862 if (this->tail_on != 0) {
1863 if (this->tail_left_y < top) {
1864 top = this->tail_left_y;
1865 }
1866
1867 if (this->tail_right_y < top) {
1868 top = this->tail_right_y;
1869 }
1870
1871 if (this->tail_tip_y < top) {
1872 top = this->tail_tip_y;
1873 }
1874
1875 if (this->fukidashi_shape == 2) {
1876 if (this->tail_tip_y - 5 < top) {
1877 top = this->tail_tip_y - 5;
1878 }
1879 }
1880 }
1881
1882 grown_width = this->win_width * this->fade;
1883 grown_height = this->win_height * this->fade;
1884
1885 float shape[15][2] = {
1886 {0.5f, 0.5f },
1887 {0.02f, 0.29f},
1888 {0.22f, 0.03f},
1889 {0.51f, 0.06f},
1890 {0.73f, 0.0f },
1891 {0.92f, 0.1f },
1892 {0.98f, 0.36f},
1893 {0.98f, 0.74f},
1894 {0.9f, 0.91f},
1895 {0.7f, 0.99f},
1896 {0.43f, 0.91f},
1897 {0.2f, 0.97f},
1898 {0.03f, 0.8f },
1899 {0.0f, 0.52f},
1900 {0.02f, 0.29f},
1901 };
1902
1903 if (this->fukidashi_shape == 0) {
1904 sceVif1PkAddGsAD(packet, 0, ((unsigned long) prim << 7) | 0x145);
1905 sceVif1PkAddGsAD(packet, 1, 0x80BFBFBF | ((unsigned long) 1 << 32));
1906
1907 int base_x = (int) LinerInterpolation(this->grow_x, this->win_x, this->fade);
1908 int base_y = (int) LinerInterpolation(this->grow_y, this->win_y, this->fade);
1909
1910 mirror = (int) RandTbl[0];
1911
1912 for (i = 0; i < 15; i++) {
1913 if (mirror % 2 != 0) {
1914 x = (int) (grown_width * (1.0f - shape[i][0]));
1915 } else {
1916 x = (int) (grown_width * shape[i][0]);
1917 }
1918
1919 if (mirror > 1) {
1920 y = (int) (grown_height * (1.0f - shape[i][1]));
1921 } else {
1922 y = (int) (grown_height * shape[i][1]);
1923 }
1924
1925 x += base_x;
1926 y += base_y;
1927 y -= top;
1928
1929 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((x << 4) + 0x6C00) | (unsigned long) ((y << 4) + GS_Y_OFFSET) << 16);
1930 }
1931 } else if (this->fukidashi_shape == 1 || this->fukidashi_shape == 2) {
1932 x = (int) LinerInterpolation(this->grow_x, this->win_x, this->fade);
1933 y = (int) LinerInterpolation(this->grow_y, this->win_y, this->fade);
1934
1935 int bubble_shape = this->fukidashi_shape;
1936
1937 if (bubble_shape == 1) {
1938 DrawMaru(packet, x, y, (int) grown_width, (int) grown_height, top, 0x20, bubble_shape, prim);
1939 } else {
1940 int upper_width = (int) grown_width - this->char_width;
1941 int half_height = (int) grown_height >> 1;
1942 float half_height_float = (float) half_height;
1943
1944 DrawMaru(packet, x, y, upper_width, (int) (half_height_float + 1.5f * this->char_height), top, 0x20, 0, prim);
1945
1946 float pad = 1.5f * this->char_height;
1947 int indent = this->char_width;
1948
1949 y = (int) (y + half_height - pad);
1950 DrawMaru(packet, x + indent, y, (int) grown_width - indent, (int) (half_height + pad), top, 0x20, 0, prim);
1951 }
1952 } else {
1953 x = (int) LinerInterpolation(this->grow_x, this->win_x, this->fade);
1954 y = (int) LinerInterpolation(this->grow_y, this->win_y, this->fade);
1955
1956 sceVif1PkAddGsAD(packet, 0, ((unsigned long) prim << 7) | 0x145);
1957 sceVif1PkAddGsAD(packet, 1, 0x80BFBFBF | ((unsigned long) 1 << 32));
1958
1959 int oval_width = (int) grown_width;
1960 int oval_height = (int) grown_height;
1961 int px;
1962 int py;
1963
1964 px = x + (oval_width >> 1);
1965 py = y + (oval_height >> 1) - top;
1966
1967 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((px << 4) + 0x6C00) | (unsigned long) ((py << 4) + GS_Y_OFFSET) << 16);
1968
1969 float across;
1970 float down;
1971 float turn = 0.0f;
1972 int step = 0;
1973
1974 while (turn < 128.0f) {
1975 float angle = TWO_PI * turn / 128.0f;
1976
1977 across = cosf(angle);
1978 down = sinf(angle);
1979
1980 across = across * RandTbl2[step];
1981 down = down * RandTbl2[step];
1982 across += 0.5f;
1983 down += 0.5f;
1984 across = across * oval_width;
1985 down = down * oval_height;
1986
1987 px = (int) across;
1988 py = (int) down;
1989
1990 px += x;
1991 py += y - top;
1992
1993 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((px << 4) + 0x6C00) | (unsigned long) ((py << 4) + GS_Y_OFFSET) << 16);
1994
1995 turn += RandTbl[step];
1996 step++;
1997 }
1998
1999 across = 1.0f;
2000 down = 0.0f;
2001
2002 across = across * RandTbl2[0];
2003 down = down * RandTbl2[0];
2004 across += 0.5f;
2005 down += 0.5f;
2006 across = across * oval_width;
2007 down = down * oval_height;
2008
2009 px = (int) across;
2010 py = (int) down;
2011
2012 px += x;
2013 py += y - top;
2014
2015 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((px << 4) + 0x6C00) | (unsigned long) ((py << 4) + GS_Y_OFFSET) << 16);
2016 }
2017
2018 if (this->tail_on != 0) {
2019 if (this->fukidashi_shape == 2) {
2020 x = (int) LinerInterpolation(this->grow_x, (this->tail_x + this->tail_tip_x) >> 1, this->fade);
2021 y = (int) LinerInterpolation(this->grow_y, (this->tail_y + this->tail_tip_y) >> 1, this->fade);
2022 DrawMaru(packet, x - 10, y - 10, 20, 20, top, 0x20, 0, prim);
2023
2024 x = (int) LinerInterpolation(this->grow_x, this->tail_tip_x, this->fade);
2025 y = (int) LinerInterpolation(this->grow_y, this->tail_tip_y, this->fade);
2026 DrawMaru(packet, x - 5, y - 5, 10, 10, top, 0x20, 0, prim);
2027 } else {
2028 sceVif1PkAddGsAD(packet, 0, ((unsigned long) prim << 7) | 0x143);
2029 sceVif1PkAddGsAD(packet, 1, 0x80BFBFBF | ((unsigned long) 1 << 32));
2030
2031 x = (int) LinerInterpolation(this->grow_x, this->tail_tip_x, this->fade);
2032 y = (int) LinerInterpolation(this->grow_y, this->tail_tip_y, this->fade);
2033 y -= top;
2034 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((x << 4) + 0x6C00) | (unsigned long) ((y << 4) + GS_Y_OFFSET) << 16);
2035
2036 x = (int) LinerInterpolation(this->grow_x, this->tail_left_x, this->fade);
2037 y = (int) LinerInterpolation(this->grow_y, this->tail_left_y, this->fade);
2038 y -= top;
2039 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((x << 4) + 0x6C00) | (unsigned long) ((y << 4) + GS_Y_OFFSET) << 16);
2040
2041 x = (int) LinerInterpolation(this->grow_x, this->tail_right_x, this->fade);
2042 y = (int) LinerInterpolation(this->grow_y, this->tail_right_y, this->fade);
2043 y -= top;
2044 sceVif1PkAddGsAD(packet, 4, (unsigned long) ((x << 4) + 0x6C00) | (unsigned long) ((y << 4) + GS_Y_OFFSET) << 16);
2045 }
2046 }
2047}
2048
2049#pragma opt_propagation reset
2050
2052 sceGsTex0 frame;
2053 sceGsTex0 tex0;
2054 sceGsZbuf zbuf;
2055 sceGsTest test;
2056 CTexture *texture;
2057 int row;
2058 int col;
2059
2060 MGGetFBuffTex(&frame);
2061
2062 sceVif1PkCnt(packet, 0);
2063 sceVif1PkOpenDirectCode(packet, 0);
2064 sceVif1PkOpenGifTag(packet, *(u_long128 *) &GiftagAD);
2065 sceVif1PkAddGsAD(packet, 0x3F, 0);
2066
2067 tex0 = *(sceGsTex0 *) &TexManager.GetTexture("fukidashibase", -1)->tex0;
2068
2069 unsigned int tbp = tex0.bits.tbp0;
2070 int tbw = tex0.bits.tbw;
2071 unsigned int psm = tex0.bits.psm;
2072
2073 sceVif1PkAddGsAD(packet, 0x4C, (unsigned long) (tbp >> 5) | (unsigned long) (u32) tbw << 16 | (unsigned long) psm << 24);
2074
2075 sceVif1PkCloseGifTag(packet);
2076 sceVif1PkCloseDirectCode(packet);
2077 sceVif1PkTerminate(packet);
2078
2079 zbuf = mgZBuffer;
2080 test = mgPixelTest;
2081
2082 zbuf.bits.zmsk = 1;
2083 MGSetGsZBUF(&zbuf);
2084
2085 test.bits.ate = 0;
2086 test.bits.date = 0;
2087 test.bits.zte = 1;
2088 test.bits.ztst = 1;
2089 MGSetGsTEST(&test);
2090
2091 MGFillBox(CRect_i_(0, 0, 0x2800, (SCREEN_HALF_HEIGHT << 4)), 0, 0, 0, 0);
2092
2093 MGSetGsZBUF(&zbuf);
2094 MGSetGsTEST(&test);
2095
2096 sceVif1PkCnt(packet, 0);
2097 sceVif1PkOpenDirectCode(packet, 0);
2098 sceVif1PkOpenGifTag(packet, *(u_long128 *) &GiftagAD);
2099 this->MakeFukidashi_sub(packet, 1);
2100 this->MakeFukidashi_sub(packet, 0);
2101 sceVif1PkAddGsAD(packet, 0x3F, 0);
2102 sceVif1PkCloseGifTag(packet);
2103 sceVif1PkCloseDirectCode(packet);
2104 sceVif1PkTerminate(packet);
2105
2106 zbuf.bits.zmsk = 1;
2107 MGSetGsZBUF(&zbuf);
2108
2109 test.bits.ate = 0;
2110 test.bits.date = 1;
2111 test.bits.zte = 1;
2112 test.bits.ztst = 1;
2113 test.bits.datm = 1;
2114 MGSetGsTEST(&test);
2115
2116 texture = TexManager.GetTexture("fuki256", -1);
2117
2118 for (row = 0; row < 4; row++) {
2119 for (col = 0; col < 5; col++) {
2120 Myset2DSprite(Vif1Packet, texture, CRect_i_(col * 0x80, row * 0x80, 0x80, 0x80), CRect_i_(0, 0, 0x80, 0x80), 0x80, 0x80, 0x80, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
2121 }
2122 }
2123
2124 sceVif1PkCnt(packet, 0);
2125 sceVif1PkOpenDirectCode(packet, 0);
2126 sceVif1PkOpenGifTag(packet, *(u_long128 *) &GiftagAD);
2127 sceVif1PkAddGsAD(packet, 0x3F, 0);
2128 sceVif1PkAddGsAD(packet, 0x4C, (unsigned long) (frame.bits.tbp0 >> 5) | (unsigned long) frame.bits.tbw << 16 | (unsigned long) frame.bits.psm << 24);
2129 sceVif1PkAddGsAD(packet, 0x47, *(unsigned long *) &mgPixelTest);
2130 sceVif1PkAddGsAD(packet, 0x4E, *(unsigned long *) &mgZBuffer);
2131 sceVif1PkAddGsAD(packet, 0x42, *(unsigned long *) &mgAlpha);
2132 sceVif1PkCloseGifTag(packet);
2133 sceVif1PkCloseDirectCode(packet);
2134}
2135
2136void SetspRGBA(spRGBA *colour, int r, int g, int b, int a) {
2137 colour->r = r;
2138 colour->g = g;
2139 colour->b = b;
2140 colour->a = a;
2141}
2142
2143void ClsMes::DrawMesWin_sub(CTexture *texture, int dx, int dy, int frame) {
2144 int area[4];
2145 int pos[2];
2146 int tex_x;
2147 int tex_y;
2148 int screen_y;
2149 int draw_width;
2150 int draw_height;
2151 int screen_x;
2152 int top;
2153
2154 area[0] = this->win_x;
2155 area[1] = this->win_y;
2156 area[2] = this->win_x + this->win_width;
2157 area[3] = this->win_y + this->win_height;
2158 pos[0] = this->grow_x;
2159 pos[1] = this->grow_y;
2160 AreaAddPos(area, pos, area);
2161
2162 if (this->tail_on != 0) {
2163 pos[0] = this->tail_tip_x;
2164 pos[1] = this->tail_tip_y;
2165 AreaAddPos(area, pos, area);
2166 pos[0] = this->tail_left_x;
2167 pos[1] = this->tail_left_y;
2168 AreaAddPos(area, pos, area);
2169 pos[0] = this->tail_right_x;
2170 pos[1] = this->tail_right_y;
2171 AreaAddPos(area, pos, area);
2172
2173 if (this->fukidashi_shape == 2) {
2174 pos[0] = this->tail_tip_x - 5;
2175 pos[1] = this->tail_tip_y - 5;
2176 AreaAddPos(area, pos, area);
2177 pos[0] = this->tail_tip_x + 5;
2178 pos[1] = this->tail_tip_y + 5;
2179 AreaAddPos(area, pos, area);
2180 }
2181 }
2182
2183 int left = area[0];
2184 top = area[1];
2185 int right = area[2];
2186 int bottom = area[3];
2187 draw_width = right - left;
2188 int height = bottom - top;
2189 tex_x = (int) LinerInterpolation(this->grow_x, left, this->fade);
2190 tex_y = (int) LinerInterpolation(this->grow_y, top, this->fade);
2191 draw_width = (int) (draw_width * this->fade);
2192 draw_height = (int) (height * this->fade);
2193 screen_y = tex_y;
2194 tex_y -= top;
2195 screen_x = tex_x + dx;
2196 screen_y += dy;
2197
2198 if (frame != 0) {
2199 spRGBA bright;
2200 spRGBA dim;
2201 int outer_x;
2202 int core_x;
2203 int outer_y;
2204 int outer_w;
2205 int outer_h;
2206 int core_y;
2207 int core_w;
2208 int core_h;
2209 int core_screen_y;
2210 int upper_screen_y;
2211 int middle_screen_y;
2212 int lower_screen_y;
2213 int upper_h;
2214 int lower_h;
2215 int lower_tex_y;
2216 int upper_tex_h;
2217 int lower_tex_h;
2218 int right_x;
2219 int left_w;
2220 int right_w;
2221
2222 SetspRGBA(&bright, 0x80, 0x80, 0x80, 0x80);
2223 SetspRGBA(&dim, 0x60, 0x60, 0x60, 0x80);
2224
2225 if (MesAbsDrawOff == 0) {
2226 set2DSprite(Vif1Packet, texture, CRect_i_(screen_x, screen_y, draw_width, draw_height), CRect_i_(tex_x, tex_y, draw_width, draw_height), &dim, &dim, &dim, &dim, 1);
2227 }
2228
2229 float win_left = this->win_x;
2230 float win_top = this->win_y;
2231 float win_w = this->win_width;
2232 float win_h = this->win_height;
2233
2234 outer_x = (int) LinerInterpolation(this->grow_x, win_left, this->fade);
2235 outer_y = (int) LinerInterpolation(this->grow_y, win_top, this->fade);
2236 outer_w = (int) (win_w * this->fade);
2237 outer_h = (int) (win_h * this->fade);
2238
2239 float core_left = this->win_x + this->win_width / 6.0f;
2240 float core_top = this->win_y + this->win_height / 6.0f;
2241 float core_width = 2.0f * this->win_width / 3.0f;
2242 float core_height = 2.0f * this->win_height / 3.0f;
2243
2244 core_x = (int) LinerInterpolation(this->grow_x, core_left, this->fade);
2245 core_y = (int) LinerInterpolation(this->grow_y, core_top, this->fade);
2246 core_w = (int) (core_width * this->fade);
2247 core_h = (int) (core_height * this->fade);
2248
2249 right_x = core_x + core_w;
2250 upper_screen_y = outer_y;
2251 core_screen_y = core_y;
2252 lower_screen_y = core_y + core_h;
2253 left_w = core_x - outer_x;
2254 right_w = outer_x + outer_w - core_x - core_w;
2255 upper_h = core_y - outer_y;
2256 lower_h = outer_y + outer_h - core_y - core_h;
2257 outer_y -= top;
2258 core_y -= top;
2259 middle_screen_y = core_screen_y;
2260 lower_tex_y = core_y + core_h;
2261 upper_tex_h = core_y - outer_y;
2262 lower_tex_h = outer_y + outer_h - core_y - core_h;
2263
2264 if (MesAbsDrawOff == 0) {
2265 set2DSprite(Vif1Packet, texture, CRect_i_(outer_x, upper_screen_y, left_w, upper_h), CRect_i_(outer_x, outer_y, left_w, upper_tex_h), &dim, &dim, &dim, &bright, 1);
2266 set2DSprite(Vif1Packet, texture, CRect_i_(core_x, upper_screen_y, core_w, upper_h), CRect_i_(core_x, outer_y, core_w, upper_tex_h), &dim, &dim, &bright, &bright, 1);
2267 set2DSprite(Vif1Packet, texture, CRect_i_(right_x, upper_screen_y, right_w, upper_h), CRect_i_(right_x, outer_y, right_w, upper_tex_h), &dim, &dim, &bright, &dim, 0);
2268 set2DSprite(Vif1Packet, texture, CRect_i_(outer_x, middle_screen_y, left_w, core_h), CRect_i_(outer_x, core_y, left_w, core_h), &dim, &bright, &dim, &bright, 1);
2269 set2DSprite(Vif1Packet, texture, CRect_i_(core_x, middle_screen_y, core_w, core_h), CRect_i_(core_x, core_y, core_w, core_h), &bright, &bright, &bright, &bright, 1);
2270 set2DSprite(Vif1Packet, texture, CRect_i_(right_x, middle_screen_y, right_w, core_h), CRect_i_(right_x, core_y, right_w, core_h), &bright, &dim, &bright, &dim, 1);
2271 set2DSprite(Vif1Packet, texture, CRect_i_(outer_x, lower_screen_y, left_w, lower_h), CRect_i_(outer_x, lower_tex_y, left_w, lower_tex_h), &dim, &bright, &dim, &dim, 0);
2272 set2DSprite(Vif1Packet, texture, CRect_i_(core_x, lower_screen_y, core_w, lower_h), CRect_i_(core_x, lower_tex_y, core_w, lower_tex_h), &bright, &bright, &dim, &dim, 1);
2273 set2DSprite(Vif1Packet, texture, CRect_i_(right_x, lower_screen_y, right_w, lower_h), CRect_i_(right_x, lower_tex_y, right_w, lower_tex_h), &bright, &dim, &dim, &dim, 1);
2274 }
2275 } else if (MesAbsDrawOff == 0) {
2276 set2DSprite(Vif1Packet, texture, CRect_i_(screen_x, screen_y, draw_width, draw_height), CRect_i_(tex_x, tex_y, draw_width, draw_height), 0, 0, 0, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
2277 }
2278}
2279
2288void MyMenuHelpWinDraw(int x, int y, int width, int height, int shade, int u, int v, CTexture *texture) {
2289 int bar_width = width < 0x20 ? 0 : width - 0x20;
2290 int bar_height = height < 0x1C ? 0 : height - 0x1C;
2291 int alpha;
2292
2293 setbilinear(0);
2294
2295 set2DSprite(Vif1Packet, texture, CRect_i_(x, y, 0x10, 0xE), CRect_i_(u, v, 0x10, 0xE), alpha = (shade * 100) >> 7);
2296 set2DSprite(Vif1Packet, texture, CRect_i_(x, y + 0xE, 0x10, bar_height), CRect_i_(u, v + 0xE, 0x10, 0x24), alpha);
2297 set2DSprite(Vif1Packet, texture, CRect_i_(x, bar_height + (y + 0xE), 0x10, 0xE), CRect_i_(u, v + 0x32, 0x10, 0xE), alpha);
2298 set2DSprite(Vif1Packet, texture, CRect_i_(x + 0x10, y, bar_width, 0xE), CRect_i_(u + 0x10, v, 0x20, 0xE), alpha);
2299 set2DSprite(Vif1Packet, texture, CRect_i_(x + 0x10, y + 0xE, bar_width, bar_height), CRect_i_(u + 0x10, v + 0xE, 0x20, 0x24), alpha);
2300 set2DSprite(Vif1Packet, texture, CRect_i_(x + 0x10, bar_height + (y + 0xE), bar_width, 0xE), CRect_i_(u + 0x10, v + 0x32, 0x20, 0xE), alpha);
2301 set2DSprite(Vif1Packet, texture, CRect_i_(bar_width + (x + 0x10), y, 0x10, 0xE), CRect_i_(u + 0x30, v, 0x10, 0xE), alpha);
2302 set2DSprite(Vif1Packet, texture, CRect_i_(bar_width + (x + 0x10), y + 0xE, 0x10, bar_height), CRect_i_(u + 0x30, v + 0xE, 0x10, 0x24), alpha);
2303 set2DSprite(Vif1Packet, texture, CRect_i_(bar_width + (x + 0x10), bar_height + (y + 0xE), 0x10, 0xE), CRect_i_(u + 0x30, v + 0x32, 0x10, 0xE), alpha);
2304}
2305
2306void GetPos_AbsPosSet(int x, int y, int width, int height, int win_width, int win_height, int align, int *out_x, int *out_y) {
2307 switch (align) {
2308 case MES_POS_TOP_LEFT:
2309 case MES_POS_LEFT:
2310 case MES_POS_BOTTOM_LEFT:
2311 if (win_width < width / 3) {
2312 *out_x = x + width / 6 - (win_width >> 1);
2313 } else {
2314 *out_x = x;
2315 }
2316
2317 break;
2318 case MES_POS_TOP:
2319 case MES_POS_CENTRE:
2320 case MES_POS_BOTTOM:
2321 *out_x = x + (width >> 1) - (win_width >> 1);
2322 break;
2323 case MES_POS_TOP_RIGHT:
2324 case MES_POS_RIGHT:
2325 case MES_POS_BOTTOM_RIGHT:
2326 if (win_width < width / 3) {
2327 *out_x = x + width * 5 / 6 - (win_width >> 1);
2328 } else {
2329 *out_x = x + width - win_width;
2330 }
2331
2332 break;
2333 }
2334
2335 switch (align) {
2336 case MES_POS_TOP_LEFT:
2337 case MES_POS_TOP:
2338 case MES_POS_TOP_RIGHT:
2339 if (win_height < height / 3) {
2340 *out_y = y + height / 6 - (win_height >> 1);
2341 } else {
2342 *out_y = y;
2343 }
2344
2345 break;
2346 case MES_POS_LEFT:
2347 case MES_POS_CENTRE:
2348 case MES_POS_RIGHT:
2349 *out_y = y + (height >> 1) - (win_height >> 1);
2350 break;
2351 case MES_POS_BOTTOM_LEFT:
2352 case MES_POS_BOTTOM:
2353 case MES_POS_BOTTOM_RIGHT:
2354 if (win_height < height / 3) {
2355 *out_y = y + height * 5 / 6 - (win_height >> 1);
2356 } else {
2357 *out_y = y + height - win_height;
2358 }
2359
2360 break;
2361 }
2362}
2363
2364void ClsMes::DrawGaijiFont(CTexture *texture, int index, const CRect_i_ &texel, const CRect_i_ &screen, int wide, int dark) {
2365 u8 r;
2366 u8 g;
2367 u8 b;
2368 u8 alpha;
2369 u8 clut;
2370 int code;
2371 int u;
2372 int v;
2373
2374 code = this->win_line[index].code;
2375
2376 if (code >= -0x300 && code < -0x2DF) {
2377 set2DSprite_Core(Vif1Packet, texture, screen, texel, 0x80, 0x80, 0x80, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
2378 return;
2379 }
2380
2381 clut = this->win_line[index].clut;
2382
2383 switch (FontColorTbl[clut]) {
2384 case FONT_COLOR_WHITE:
2385 r = 0x5F;
2386 g = 0x5F;
2387 b = 0x5F;
2388 alpha = 0x80;
2389 break;
2390
2391 case FONT_COLOR_BROWN:
2392 r = 0x22;
2393 g = 0x20;
2394 b = 0x18;
2395 alpha = 0x80;
2396 break;
2397
2398 case FONT_COLOR_YELLOW:
2399 r = 0x5E;
2400 g = 0x5E;
2401 b = 0x20;
2402 alpha = 0x80;
2403 break;
2404
2405 case FONT_COLOR_CYAN:
2406 r = 0x20;
2407 g = 0x5E;
2408 b = 0x5E;
2409 alpha = 0x80;
2410 break;
2411
2412 case FONT_COLOR_GREEN:
2413 r = 0x20;
2414 g = 0x5E;
2415 b = 0x20;
2416 alpha = 0x80;
2417 break;
2418
2420 r = 0x22;
2421 g = 0x20;
2422 b = 0x18;
2423 alpha = 0x80;
2424 break;
2425
2426 case FONT_COLOR_GOLD:
2427 r = 0x73;
2428 g = 0x67;
2429 b = 0x33;
2430 alpha = 0x80;
2431 break;
2432
2433 case FONT_COLOR_GREY:
2434 r = 0x47;
2435 g = 0x47;
2436 b = 0x47;
2437 alpha = 0x80;
2438 break;
2439
2440 case FONT_COLOR_MAGENTA:
2441 r = 0x5F;
2442 g = 0x1F;
2443 b = 0x5F;
2444 alpha = 0x80;
2445 break;
2446
2447 default:
2448 r = 0x28;
2449 g = 0x28;
2450 b = 0x20;
2451 alpha = 0x80;
2452 break;
2453 }
2454
2455 if (clut == 0xFF) {
2456 if (dark != 0) {
2457 alpha = 0x80;
2458 b = 0x22;
2459 g = 0x22;
2460 r = 0x7F;
2461 } else {
2462 alpha = 0x80;
2463 b = 0x11;
2464 g = 0x11;
2465 r = 0x40;
2466 }
2467 }
2468
2469 if (wide == 1) {
2470 r = r * 2;
2471 g = g * 2;
2472 b = b * 2;
2473 }
2474
2475 set2DSprite_Core(Vif1Packet, texture, screen, texel, r, g, b, this->edge_alpha < alpha ? this->edge_alpha : alpha);
2476
2477#ifdef PAL
2478 switch (this->win_line[index].code) {
2479 case -0x284:
2480 case -0x280:
2481 case -0x27F:
2482 case -0x27A:
2483 case -0x275:
2484 case -0x271:
2485 case -0x26C:
2486 case -0x268:
2487 case -0x25E:
2488 case -0x258:
2489 u = 0xE2;
2490 v = 0xB4;
2491 break;
2492
2493 case -0x282:
2494 case -0x27D:
2495 case -0x278:
2496 case -0x274:
2497 case -0x26F:
2498 case -0x26B:
2499 case -0x260:
2500 case -0x25C:
2501 case -0x25A:
2502 case -0x256:
2503 u = 0xF0;
2504 v = 0xB4;
2505 break;
2506
2507 case -0x281:
2508 case -0x27C:
2509 case -0x277:
2510 case -0x273:
2511 case -0x26E:
2512 case -0x26A:
2513 case -0x267:
2514 case -0x266:
2515 case -0x264:
2516 case -0x25D:
2517 u = 0x80;
2518 v = 0xC8;
2519 break;
2520
2521 case -0x27B:
2522 case -0x276:
2523 case -0x272:
2524 case -0x26D:
2525 case -0x269:
2526 case -0x25F:
2527 case -0x25B:
2528 case -0x259:
2529 case -0x257:
2530 case -0x255:
2531 u = 0x9C;
2532 v = 0xC8;
2533 break;
2534
2535 case -0x270:
2536 case -0x254:
2537 u = 0x8E;
2538 v = 0xC8;
2539 break;
2540
2541 default:
2542 return;
2543 }
2544#else
2545 switch (this->win_line[index].code) {
2546 case -0x284:
2547 case -0x280:
2548 case -0x27F:
2549 case -0x27A:
2550 case -0x275:
2551 case -0x271:
2552 case -0x26C:
2553 case -0x268:
2554 u = 0xE2;
2555 v = 0xB4;
2556 break;
2557
2558 case -0x283:
2559 case -0x279:
2560 u = 0xAA;
2561 v = 0xC8;
2562 break;
2563
2564 case -0x27D:
2565 case -0x278:
2566 case -0x274:
2567 case -0x26F:
2568 case -0x26B:
2569 u = 0xF0;
2570 v = 0xB4;
2571 break;
2572
2573 case -0x281:
2574 case -0x27C:
2575 case -0x277:
2576 case -0x273:
2577 case -0x26E:
2578 case -0x26A:
2579 case -0x267:
2580 case -0x266:
2581 case -0x264:
2582 u = 0x80;
2583 v = 0xC8;
2584 break;
2585
2586 case -0x27B:
2587 case -0x276:
2588 case -0x272:
2589 case -0x26D:
2590 case -0x269:
2591 u = 0x9C;
2592 v = 0xC8;
2593 break;
2594
2595 case -0x270:
2596 u = 0x8E;
2597 v = 0xC8;
2598 break;
2599
2600 default:
2601 return;
2602 }
2603#endif
2604
2605 if (this->narrow_gaiji_set != 1) {
2606 if (this->narrow_gaiji_set == 2) {
2607 u += 0x80;
2608 } else if (this->char_width < 0xB) {
2609 u += 0x80;
2610 }
2611 }
2612
2613#ifdef PAL
2614 this->Myset2DSprite_Fuchi(Vif1Packet, texture, screen.x, screen.y, screen.width, screen.height, u, v, 14, 20);
2615#endif
2616 set2DSprite_Core(Vif1Packet, texture, screen, CRect_i_(u, v, 14, 20), r, g, b, this->edge_alpha < alpha ? this->edge_alpha : alpha);
2617}
2618
2620 CTexture *texture;
2621 int offset_x;
2622 int offset_y;
2623 int dark;
2624 int index;
2625
2626 if (this->mes_made < 0) {
2627 return;
2628 }
2629
2630 TexManager.ReloadTexture(Vif1Packet, this->tex_block);
2631
2632 offset_x = 0;
2633
2634 if (this->fukidashi != 0 && this->text_columns < 4) {
2635 offset_x = (4 - this->text_columns) * this->char_width >> 1;
2636 }
2637
2638 offset_y = 0;
2639
2640 if (this->fukidashi == 0 && this->centre_rows != 0) {
2641 offset_y = this->char_height * (this->rows - this->text_rows) >> 1;
2642 }
2643
2644 if (this->fukidashi != 0) {
2645 this->MakeFukidashi(Vif1Packet);
2646
2647 texture = TexManager.GetTexture("fukidashibase", -1);
2648 setbilinear(1);
2649 this->DrawMesWin_sub(texture, -1, -1, 0);
2650 this->DrawMesWin_sub(texture, 1, -1, 0);
2651 this->DrawMesWin_sub(texture, -1, 1, 0);
2652 this->DrawMesWin_sub(texture, 1, 1, 0);
2653 this->DrawMesWin_sub(texture, 5, 5, 0);
2654 this->DrawMesWin_sub(texture, 0, 0, 1);
2655
2656 if (this->fade_in != 0 && this->fade < 1.0f) {
2657 return;
2658 }
2659 } else {
2660 this->fade = 1.0f;
2661
2662 if (this->stay_frame != 0) {
2663 int px;
2664 int py;
2665 int width = this->char_width * this->text_columns + 0x20;
2666 int height = this->char_height * this->text_rows + 0x1C;
2667
2668 if (0 < this->stay_width) {
2669 width = this->stay_width;
2670 }
2671
2672 if (0 < this->stay_height) {
2673 height = this->stay_height;
2674 }
2675
2676 px = this->text_x + offset_x - 0x10;
2677 py = this->text_y + offset_y - 0xE;
2678
2679 if (0 < this->auto_pos) {
2680 GetPos_AbsPosSet(0x10, 0x10, 0x260, 0x1A0, width, height, this->auto_pos, &px, &py);
2681 this->text_x = px - offset_x + 0x10;
2682 this->text_y = py - offset_y + 0xE;
2683 }
2684
2685 if (MesAbsDrawOff == 0) {
2686 MyMenuHelpWinDraw(px, py, width, height, 0x80, 0, 0, TexManager.GetTexture("stayframe", -1));
2687 }
2688 }
2689 }
2690
2691 this->MyTextureMake();
2692
2693 GIFTAG tag = {
2694 {0x8000, 0x10000000, 0xE, 0}
2695 };
2696
2697 sceVif1PkCnt(Vif1Packet, 0);
2698 sceVif1PkOpenDirectCode(Vif1Packet, 0);
2699 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &tag);
2700 sceVif1PkAddGsAD(Vif1Packet, 0x3F, 0);
2701 sceVif1PkCloseGifTag(Vif1Packet);
2702 sceVif1PkCloseDirectCode(Vif1Packet);
2703
2704 texture = TexManager.GetTexture("fontbase", -1);
2705
2706 if (this->clut == 0) {
2707 return;
2708 }
2709
2710 if ((this->blink / 0x1C) % 2 != 0) {
2711 this->clut[100] = 0x80222280;
2712 dark = 0;
2713 } else {
2714 this->clut[100] = 0x804444FF;
2715 dark = 1;
2716 }
2717
2718 SetClut(Vif1Packet, texture, (i *) this->clut);
2719 this->blink++;
2720
2721 texture = TexManager.GetTexture("gaiji", -1);
2722 setbilinear(0);
2723 set2DSprite_Start(Vif1Packet, texture);
2724
2725 for (index = this->text_from; index < this->text_no; index++) {
2726 if (MesAbsDrawOff != 0) {
2727 continue;
2728 }
2729
2730 int code = this->win_line[index].code;
2731
2732#ifdef PAL
2733 if (code < -0x300 || code >= -0x251) {
2734#else
2735 if (code < -0x300 || code >= -0x263) {
2736#endif
2737 continue;
2738 }
2739
2740 int gaiji_index = code + 0x300;
2741 int u = GaijiDataTbl[gaiji_index][GAIJI_U];
2742
2743#ifdef PAL
2744 if (code >= -0x2DF && code < -0x251) {
2745#else
2746 if (code >= -0x2DF && code < -0x263) {
2747#endif
2748 if (this->narrow_gaiji_set != 1) {
2749 if (this->narrow_gaiji_set == 2) {
2750 u += 0x80;
2751 } else if (this->char_width < 0xB) {
2752 u += 0x80;
2753 }
2754 }
2755 }
2756
2757 int v = GaijiDataTbl[gaiji_index][GAIJI_V];
2758 int glyph_width = GaijiDataTbl[gaiji_index][GAIJI_WIDTH];
2759 int glyph_height = GaijiDataTbl[gaiji_index][GAIJI_HEIGHT];
2760 int dx = (this->char_width * GaijiDataTbl[gaiji_index][GAIJI_CELLS] - glyph_width) / 2;
2761 int dy = (this->char_height - glyph_height) / 2;
2762
2763 dx += GaijiDataTbl[gaiji_index][GAIJI_X_OFF];
2764
2765 if (this->narrow_gaiji != 0) {
2766 if (GaijiDataTbl[gaiji_index][GAIJI_CODE] == -0x2BD || GaijiDataTbl[gaiji_index][GAIJI_CODE] == -0x2BA) {
2767 dx -= 3;
2768 }
2769 }
2770
2771 dy += GaijiDataTbl[gaiji_index][GAIJI_Y_OFF];
2772
2773 if (this->char_height == 0x14) {
2774 dy += 1;
2775 }
2776
2777 int row = this->win_line[index].y / this->char_height;
2778
2779 if (this->line_pos[row].x < 0 || this->line_pos[row].y < 0) {
2780 int line_x = this->win_line[index].x + this->text_x;
2781 int line_y = this->win_line[index].y + this->text_y;
2782 int screen_x = offset_x + (line_x + dx);
2783 CRect_i_ screen;
2784 screen.x = screen_x;
2785 int screen_y = offset_y + (line_y + dy) - 3;
2786 screen.y = screen_y;
2787 screen.width = glyph_width;
2788 screen.height = glyph_height;
2789 CRect_i_ texel(u, v, glyph_width, glyph_height);
2790
2791 if (this->win_line[index].code >= -0x2DF) {
2792 this->Myset2DSprite_Fuchi(Vif1Packet, texture, screen_x, screen_y, glyph_width, glyph_height, u, v, glyph_width, glyph_height);
2793 }
2794
2795 if (this->cursor_row < 0) {
2796 this->DrawGaijiFont(texture, index, texel, screen, 0, dark);
2797 } else if (this->cursor_lit == 1) {
2798 if (row == this->cursor_row) {
2799 this->DrawGaijiFont(texture, index, texel, screen, 1, dark);
2800 } else {
2801 this->DrawGaijiFont(texture, index, texel, screen, 0, dark);
2802 }
2803 } else {
2804 if (row == this->cursor_row) {
2805 this->DrawGaijiFont(texture, index, texel, screen, 0, dark);
2806 } else {
2807 this->DrawGaijiFont(texture, index, texel, screen, 1, dark);
2808 }
2809 }
2810 } else {
2811 int screen_x = this->win_line[index].x + this->line_pos[row].x;
2812 int screen_y = this->win_line[index].y + this->line_pos[row].y;
2813 screen_y += dy;
2814 CRect_i_ screen(screen_x + dx, screen_y - row * this->char_height, glyph_width, glyph_height);
2815 CRect_i_ texel(u, v, glyph_width, glyph_height);
2816
2817 if (this->win_line[index].code >= -0x2DF) {
2818 this->Myset2DSprite_Fuchi(Vif1Packet, texture, screen_x + dx, screen_y - row * this->char_height, glyph_width, glyph_height, u, v, glyph_width, glyph_height);
2819 }
2820
2821 if (this->cursor_row < 0) {
2822 this->DrawGaijiFont(texture, index, texel, screen, 0, dark);
2823 } else if (this->cursor_lit == 1) {
2824 if (row == this->cursor_row) {
2825 this->DrawGaijiFont(texture, index, texel, screen, 1, dark);
2826 } else {
2827 this->DrawGaijiFont(texture, index, texel, screen, 0, dark);
2828 }
2829 } else {
2830 if (row == this->cursor_row) {
2831 this->DrawGaijiFont(texture, index, texel, screen, 0, dark);
2832 } else {
2833 this->DrawGaijiFont(texture, index, texel, screen, 1, dark);
2834 }
2835 }
2836 }
2837 }
2838
2839 set2DSprite_End(Vif1Packet, texture);
2840
2841 if (this->page_arrow != 0) {
2842 if (this->text_no >= this->text_len && this->cursor_row < 0 || this->waiting != 0) {
2843 if ((this->blink >> 4) % 2 != 0) {
2844 texture = TexManager.GetTexture("syst04", -1);
2845
2846 int screen_x = this->text_x + (this->char_width * this->text_columns >> 1) - 8;
2847 int screen_y = this->text_y + this->char_height * this->text_rows;
2848
2849 CRect_i_ screen(screen_x + offset_x, screen_y + offset_y, 0x10, 0x10);
2850 CRect_i_ texel(0, 0, 0x10, 0x10);
2851
2852 if (MesAbsDrawOff == 0) {
2853 set2DSprite(Vif1Packet, texture, screen, texel, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
2854 }
2855 }
2856 }
2857 }
2858
2859 if (this->end_mark != 0) {
2860 texture = TexManager.GetTexture("syst04", -1);
2861
2862 int screen_x = this->text_x + (this->char_width * this->text_columns >> 1) - 8;
2863 int screen_y = this->text_y + this->char_height * this->text_rows;
2864
2865 CRect_i_ screen(screen_x + offset_x, screen_y + offset_y, 0x10, 0x10);
2866 CRect_i_ texel(0, 0, 0x10, 0x10);
2867
2868 if (MesAbsDrawOff == 0) {
2869 set2DSprite(Vif1Packet, texture, screen, texel, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
2870 }
2871 }
2872
2873 if (this->cursor_row >= 0) {
2874 texture = TexManager.GetTexture("gaiji", -1);
2875
2876#ifdef PAL
2877 // The cursor stands two characters further left, clear of the choice text.
2878 int screen_x = this->text_x;
2879 screen_x -= 0xC;
2880 screen_x -= this->char_width * 2;
2881#else
2882 int screen_x = this->text_x;
2883#endif
2884
2885 this->cursor_y = (this->cursor_y + this->char_height * this->cursor_row) / 2;
2886
2887 int screen_y = this->cursor_y + this->text_y;
2888
2889#ifdef PAL
2890 CRect_i_ screen(screen_x + offset_x, screen_y - 4 + offset_y, 0x20, 0x20);
2891#else
2892 CRect_i_ screen(screen_x - 0xC + offset_x, screen_y - 4 + offset_y, 0x20, 0x20);
2893#endif
2894 CRect_i_ texel(0x60, 0x60, 0x20, 0x20);
2895
2896 if (MesAbsDrawOff == 0) {
2897 set2DSprite(Vif1Packet, texture, screen, texel, this->edge_alpha < 0x80 ? this->edge_alpha : 0x80);
2898 }
2899 } else {
2900 this->cursor_y = 0;
2901 }
2902}
s32 x
Definition rect.hpp:18
s32 width
Definition rect.hpp:20
s32 height
Definition rect.hpp:21
s32 y
Definition rect.hpp:19
s16 * GetCharaName(int chara_no)
Definition savedata.cpp:41
u_long tex0
Definition texture.hpp:57
s32 text_rows
Definition clsmes.hpp:158
s32 auto_pos
Definition clsmes.hpp:172
s32 text_y
Definition clsmes.hpp:152
s32 text_from
Definition clsmes.hpp:198
s32 cursor_y
Definition clsmes.hpp:225
s32 text_x
Definition clsmes.hpp:151
short * buff
Definition clsmes.hpp:229
s32 tail_left_x
Definition clsmes.hpp:180
s32 tail_on
Definition clsmes.hpp:173
s32 grow_y
Definition clsmes.hpp:167
float text_rate_set
Definition clsmes.hpp:193
void Myset2DSprite_Fuchi(sceVif1Packet *packet, CTexture *texture, int x, int y, int width, int height, int u, int v, int u_width, int v_height)
Definition clsmes.cpp:1748
void DrawMesWin()
Definition clsmes.cpp:2619
s32 tail_to_y
Definition clsmes.hpp:175
s32 tail_right_x
Definition clsmes.hpp:182
void DrawGaijiFont(CTexture *texture, int index, const CRect_i_ &texel, const CRect_i_ &screen, int wide, int dark)
Definition clsmes.cpp:2364
void AutoSetSub(CCharacter *first, CCharacter *second, int *out_pos)
Definition clsmes.cpp:168
void MakeFukidashi_sub(sceVif1Packet *packet, int prim)
Definition clsmes.cpp:1847
ClsMes()
Definition clsmes.cpp:365
short * GetTextLineDataTop(int line)
Definition clsmes.cpp:1239
s32 wait
Definition clsmes.hpp:204
s32 text_no
Definition clsmes.hpp:197
int GetMesWidth_system(int mes_no)
Definition clsmes.cpp:1193
s32 char_height
Definition clsmes.hpp:154
void Step()
Definition clsmes.cpp:575
s32 mes_no[10]
Definition clsmes.hpp:216
u32 * clut
Definition clsmes.hpp:234
void NeedMesWinWH(int mes_no, int *out)
Definition clsmes.cpp:1476
s32 page_from
Definition clsmes.hpp:199
s32 page_arrow
Definition clsmes.hpp:209
int MakeMesWinTbl(int mes_no)
Definition clsmes.cpp:1356
s32 narrow_gaiji_set
Definition clsmes.hpp:214
float fade_speed
Definition clsmes.hpp:186
s32 fukidashi
Definition clsmes.hpp:164
s32 end_mark
Definition clsmes.hpp:210
s32 tail_y
Definition clsmes.hpp:177
int GetMesLen_system(int mes_no)
Definition clsmes.cpp:1089
s32 text_height
Definition clsmes.hpp:161
void AbsFukidashiIn()
Definition clsmes.cpp:339
int GetNameWidth(int chara)
Definition clsmes.cpp:113
char * text
Definition clsmes.hpp:231
s32 text_width
Definition clsmes.hpp:160
s32 char_width
Definition clsmes.hpp:153
s32 text_columns
Definition clsmes.hpp:157
s32 win_y
Definition clsmes.hpp:169
s32 text_len
Definition clsmes.hpp:159
s32 value
Definition clsmes.hpp:218
void InitMesWinTbl()
Definition clsmes.cpp:1265
s32 tail_tip_x
Definition clsmes.hpp:184
int CalcSpaceW(int width, int glyph_width, short *text)
Definition clsmes.cpp:1320
s32 fukidashi_shape
Definition clsmes.hpp:165
void MyTextureMake_InitAll()
Definition clsmes.cpp:657
s32 waiting
Definition clsmes.hpp:194
s32 cursor_lit
Definition clsmes.hpp:226
s32 tail_length
Definition clsmes.hpp:179
s32 win_x
Definition clsmes.hpp:168
int SetMesWinTbl(int code, int mode, short x, short y)
Definition clsmes.cpp:1277
s32 win_width
Definition clsmes.hpp:170
s32 auto_page_wait
Definition clsmes.hpp:206
s32 centre_rows
Definition clsmes.hpp:211
s32 tail_to_x
Definition clsmes.hpp:174
s32 fade_in
Definition clsmes.hpp:188
void GoNextPage()
Definition clsmes.cpp:663
s32 space_width
Definition clsmes.hpp:222
s32 clut_now
Definition clsmes.hpp:203
void AutoSet(int *pos)
Definition clsmes.cpp:173
s32 tail_x
Definition clsmes.hpp:176
void DrawMesWin_sub(CTexture *texture, int dx, int dy, int frame)
Definition clsmes.cpp:2143
s32 tail_half_width
Definition clsmes.hpp:178
s32 blink
Definition clsmes.hpp:205
s32 narrow_gaiji
Definition clsmes.hpp:215
void * tex_buff
Definition clsmes.hpp:233
s32 cursor_row
Definition clsmes.hpp:224
s32 stay_width
Definition clsmes.hpp:190
s32 tail_left_y
Definition clsmes.hpp:181
float fade
Definition clsmes.hpp:187
MES_WIN_LINE win_line[MES_WIN_LINE_MAX]
Definition clsmes.hpp:200
void SetBuff(short *buff)
Definition clsmes.cpp:456
char * text_system
Definition clsmes.hpp:232
s32 columns
Definition clsmes.hpp:155
s32 mes_made
Definition clsmes.hpp:207
s32 values[8]
Definition clsmes.hpp:217
s32 win_height
Definition clsmes.hpp:171
int MyTextureMake_sub()
Definition clsmes.cpp:672
void MakeFukidashi(sceVif1Packet *packet)
Definition clsmes.cpp:2051
short * GetTextLineDataTop_system(int line)
Definition clsmes.cpp:1252
s32 style
Definition clsmes.hpp:208
s32 grow_x
Definition clsmes.hpp:166
s32 value_narrow
Definition clsmes.hpp:221
s32 tail_tip_y
Definition clsmes.hpp:185
int MakeMesWinTbl_system(int code, int *x, int *y)
Definition clsmes.cpp:952
s32 page_mark_style
Definition clsmes.hpp:212
s32 tex_block
Definition clsmes.hpp:227
s32 value_signed
Definition clsmes.hpp:219
void SetMesFukidashi(int style)
Definition clsmes.cpp:511
void MakeMesTexture(int mes_no)
Definition clsmes.cpp:1699
s16 GetGaijiW(int code)
Definition clsmes.cpp:63
float text_rate
Definition clsmes.hpp:192
void MyTextureMake()
Definition clsmes.cpp:716
s32 stay_frame
Definition clsmes.hpp:189
int GetNameLen(int chara)
Definition clsmes.cpp:93
s32 edge_alpha
Definition clsmes.hpp:213
s32 clut_default
Definition clsmes.hpp:202
MES_LINE_POS line_pos[10]
Definition clsmes.hpp:228
short * buff_system
Definition clsmes.hpp:230
void MakeMesWinTbl_value(int *x, int *y)
Definition clsmes.cpp:790
int MakeMesWin(int mes_no)
Definition clsmes.cpp:1669
s32 stay_height
Definition clsmes.hpp:191
s32 value_show
Definition clsmes.hpp:220
void SetBuff_system(short *buff)
Definition clsmes.cpp:462
int State()
Definition clsmes.cpp:637
s32 win_line_num
Definition clsmes.hpp:201
void Preset(int style)
Definition clsmes.cpp:468
s32 init_030
Definition clsmes.hpp:163
s32 tail_right_y
Definition clsmes.hpp:183
s32 rows
Definition clsmes.hpp:156
s32 auto_page
Definition clsmes.hpp:195
s32 space_area
Definition clsmes.hpp:223
float text_at
Definition clsmes.hpp:196
EDIT_GAIJI EditGaijiTbl[]
@ FONT_COLOR_BROWN
Definition gameutil.hpp:16
@ FONT_COLOR_GOLD
Definition gameutil.hpp:21
@ FONT_COLOR_CYAN
Definition gameutil.hpp:18
@ FONT_COLOR_GREEN
Definition gameutil.hpp:19
@ FONT_COLOR_WHITE
Definition gameutil.hpp:15
@ FONT_COLOR_GREY
Definition gameutil.hpp:22
@ FONT_COLOR_BROWN_OPAQUE
Definition gameutil.hpp:20
@ FONT_COLOR_YELLOW
Definition gameutil.hpp:17
@ FONT_COLOR_MAGENTA
Definition gameutil.hpp:23
s32 alpha
Definition clsmes.hpp:113
Definition title.cpp:61
s32 width
Definition rect.hpp:36
s32 height
Definition rect.hpp:37
int y
Definition title.cpp:63
int x
Definition title.cpp:62
u8 b
Definition rect.hpp:48
u8 g
Definition rect.hpp:47
u8 a
Definition rect.hpp:49
u8 r
Definition rect.hpp:46