DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
chararead.cpp
1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 775
4
5#include <cstdio>
6#include <cstdlib>
7#include <cstring>
8
9#include "character.hpp"
10#include "cloth.hpp"
11#include "dataalloc.hpp"
12#include "dataread.hpp"
13#include "frame.hpp"
14#include "framevu1.hpp"
15#include "gameutil.hpp"
16#include "mds.hpp"
17#include "scriptinterpreter.hpp"
18#include "sysmes.hpp"
19#include "texture.hpp"
20
22
27 char *name;
28 int arg_types[16];
29};
30
31u_int *GetPackFile(u_int *pack, char *name, int *size = 0);
32void *InitCloth(CFrameVu1 *frame, input_str &input, CDataAlloc2<1> *alloc);
33
34static void CommandVERTEX_ANIME(void **argv);
35static void CommandSHADOW_VERTEX_ANIME(void **argv);
36static void CommandMODEL(void **argv);
37static void CommandSHADOW_MODEL(void **argv);
38static void CommandMOTION(void **argv);
39static void CommandSHADOW_MOTION(void **argv);
40static void CommandKEY_START(void **argv);
41static void CommandKEY(void **argv);
42static void CommandMOTION_END(void **argv);
43static void CommandCLOTH(void **argv);
44static void CommandBODY_SIZE(void **argv);
45static void CommandALLOC_MDT(void **argv);
46static void CommandALLOC_DBUFF(void **argv);
47static void CommandALLOC_SHADOW_MDT(void **argv);
48static void CommandALLOC_SHADOW_DBUFF(void **argv);
49static void CommandIMG(void **argv);
50static void CommandIMG_END(void **argv);
51static void CommandFOOT(void **argv);
52static void CommandEVENT(void **argv);
53static int GetArg(input_str &input, int *arg_types, void **argv);
54static int SearchCommand(input_str &input, int *command);
55static int SkipSpace(input_str &input);
56static int CheckChar(char ch);
57static void PreProcess(input_str &input);
58
59static CDataAlloc2<1> *mds_buffer;
60static CDataAlloc2<1> *buffer;
61static CDataAlloc2<1> *exbuffer;
62static CDataAlloc2<1> *img_buffer;
63static int texture_block;
64static CCharacter *character;
65static int vertex_anime;
66static int def_vtype;
67static int shadow_vertex_anime;
68static u_int *pack_data;
69static int motion_info_num;
70static int key_start;
71static int key_no;
72static tagMOTION_KEY *motion_info;
73static int cloth_cnt;
74static int now_motion_data;
75static int shadow_motion;
76static int dont_delete_texb;
77static int alloc_mdt_list;
78static int alloc_dbuff_list;
79static int alloc_smdt_list;
80static int alloc_sdbuff_list;
81static int fsound_num;
82static int tex_anime_list;
83static char *config_file;
84static int config_file_size;
85
86static char alloc_mdt[9][16];
87static char alloc_dbuff[9][16];
88static char alloc_smdt[9][16];
89static char alloc_sdbuff[9][16];
90static u_int *load_img[4];
91
92static COMMAND_INFO Command[19] = {
93 {"VERTEX_ANIME", {SCRIPT_ARGUMENT_INTEGER, -1} },
94 {"SHADOW_VERTEX_ANIME", {SCRIPT_ARGUMENT_INTEGER, -1} },
95 {"MODEL", {SCRIPT_ARGUMENT_STRING, -1} },
96 {"SHADOW_MODEL", {SCRIPT_ARGUMENT_STRING, -1} },
97 {"MOTION", {SCRIPT_ARGUMENT_INTEGER, SCRIPT_ARGUMENT_STRING, SCRIPT_ARGUMENT_STRING, SCRIPT_ARGUMENT_STRING, -1}},
98 {"SHADOW_MOTION", {SCRIPT_ARGUMENT_STRING, SCRIPT_ARGUMENT_STRING, SCRIPT_ARGUMENT_STRING, -1} },
99 {"KEY", {SCRIPT_ARGUMENT_INTEGER, SCRIPT_ARGUMENT_INTEGER, SCRIPT_ARGUMENT_FLOAT, -1} },
100 {"KEY_START", {SCRIPT_ARGUMENT_INTEGER, -1} },
101 {"MOTION_END", {-1} },
102 {"CLOTH", {SCRIPT_ARGUMENT_STRING, -1} },
103 {"BODY_SIZE", {SCRIPT_ARGUMENT_FLOAT, SCRIPT_ARGUMENT_FLOAT, SCRIPT_ARGUMENT_FLOAT, -1} },
104 {"ALLOC_MDT", {SCRIPT_ARGUMENT_STRING, -1} },
105 {"ALLOC_DBUFF", {SCRIPT_ARGUMENT_STRING, -1} },
106 {"ALLOC_SHADOW_MDT", {SCRIPT_ARGUMENT_STRING, -1} },
107 {"ALLOC_SHADOW_DBUFF", {SCRIPT_ARGUMENT_STRING, -1} },
108 {"IMG", {SCRIPT_ARGUMENT_INTEGER, SCRIPT_ARGUMENT_STRING, -1} },
109 {"IMG_END", {-1} },
110 {"FOOT", {SCRIPT_ARGUMENT_FLOAT, SCRIPT_ARGUMENT_FLOAT, -1} },
111 {"EVENT", {SCRIPT_ARGUMENT_FLOAT, SCRIPT_ARGUMENT_INTEGER, SCRIPT_ARGUMENT_INTEGER, -1} }
112};
113
114static void (*CommandExe[19])(void **) = {
115 CommandVERTEX_ANIME,
116 CommandSHADOW_VERTEX_ANIME,
117 CommandMODEL,
118 CommandSHADOW_MODEL,
119 CommandMOTION,
120 CommandSHADOW_MOTION,
121 CommandKEY,
122 CommandKEY_START,
123 CommandMOTION_END,
124 CommandCLOTH,
125 CommandBODY_SIZE,
126 CommandALLOC_MDT,
127 CommandALLOC_DBUFF,
128 CommandALLOC_SHADOW_MDT,
129 CommandALLOC_SHADOW_DBUFF,
130 CommandIMG,
131 CommandIMG_END,
132 CommandFOOT,
133 CommandEVENT};
134
135void ReadInfo(CCharacter *chara, u_int *pack, char *name, CDataAlloc2<1> *model_alloc, CDataAlloc2<1> *motion_alloc, CDataAlloc2<1> *extra_alloc, int texture_block_no, CDataAlloc2<1> *image_alloc, int visual_type, int keep_textures) {
136 char arg_storage[16][256];
137 char *argv[18];
138 int file_size;
139 int command;
140
141 def_vtype = visual_type;
142 mds_buffer = model_alloc;
143 buffer = motion_alloc;
144 exbuffer = extra_alloc;
145 img_buffer = image_alloc;
146 character = chara;
147 pack_data = pack;
148 vertex_anime = 0;
149 shadow_vertex_anime = 0;
150 motion_info_num = 0;
151 key_start = 0;
152 key_no = 0;
153 motion_info = 0;
154 cloth_cnt = 0;
155 now_motion_data = 0;
156 shadow_motion = 0;
157 texture_block = texture_block_no;
158 alloc_mdt[0][0] = 0;
159 alloc_dbuff[0][0] = 0;
160 alloc_smdt[0][0] = 0;
161 alloc_sdbuff[0][0] = 0;
162 alloc_mdt_list = 0;
163 alloc_dbuff_list = 0;
164 alloc_smdt_list = 0;
165 alloc_sdbuff_list = 0;
166 fsound_num = 0;
167 dont_delete_texb = keep_textures;
168
169 for (int i = 0; i < 4; i++) {
170 load_img[i] = 0;
171 }
172
173 tex_anime_list = 0;
174
175 if (chara != 0) {
176 char *config_text = (char *) GetPackFile(pack, name, &file_size);
177
178 if (config_text == 0) {
179 printf("not found %s\n", name);
180 } else {
181 config_file = config_text;
182 config_file_size = file_size;
183 input_str input;
184 input.data = config_file;
185 input.size = file_size;
186 input.pos = 0;
187 PreProcess(input);
188 SkipSpace(input);
189
190 for (int i = 0; i < 16; i++) {
191 argv[i] = arg_storage[i];
192 }
193
194 while (SearchCommand(input, &command)) {
195 if (command < 19 && command >= 0) {
196 int arg_status = GetArg(input, Command[command].arg_types, (void **) argv);
197
198 if (arg_status == 0) {
199 return;
200 }
201
202 if (arg_status < 0) {
203 printf("error!! at %s\n", Command[command].name);
204 }
205
206 CommandExe[command]((void **) argv);
207 }
208 }
209 }
210 }
211}
212
213static void CommandVERTEX_ANIME(void **argv) {
214 vertex_anime = *(int *) argv[0];
215}
216
217static void CommandSHADOW_VERTEX_ANIME(void **argv) {
218 shadow_vertex_anime = *(int *) argv[0];
219}
220
221static void CommandMODEL(void **argv) {
222 character->Initialize();
223 int visual_type = def_vtype;
224
225 if (vertex_anime != 0) {
226 visual_type = 6;
227 }
228
229 if ((def_vtype & 16) != 0) {
230 visual_type = 18;
231 }
232
233 u_int *mds_file = GetPackFile(pack_data, (char *) argv[0]);
234
235 if (mds_file == 0) {
236 char *missing_name = (char *) argv[0];
237 printf("not found %s\n", missing_name);
238 } else {
239 if (alloc_dbuff_list > 0 || alloc_mdt_list > 0) {
240 char *mdt_names[12];
241 char *dbuff_names[12];
242 int i;
243
244 for (i = 0; i < alloc_mdt_list; i++) {
245 mdt_names[i] = alloc_mdt[i];
246 }
247
248 mdt_names[i] = 0;
249
250 for (i = 0; i < alloc_dbuff_list; i++) {
251 dbuff_names[i] = alloc_dbuff[i];
252 }
253
254 dbuff_names[i] = 0;
255 character->frame = LoadMDSFile(mds_file, mds_buffer, 0, dbuff_names, mdt_names);
256 } else {
257 character->frame = LoadMDSFile(mds_file, mds_buffer, visual_type, 0, 0);
258 }
259
260 character->config = (char *) mds_buffer->Alloc((config_file_size >> 4) + 1);
261 character->config_size = config_file_size;
262 memcpy(character->config, config_file, config_file_size);
263 }
264}
265
266static void CommandSHADOW_MODEL(void **argv) {
267 int visual_type = 8;
268
269 if (shadow_vertex_anime != 0) {
270 visual_type = 14;
271 }
272
273 u_int *mds_file = GetPackFile(pack_data, (char *) argv[0]);
274
275 if (mds_file == 0) {
276 char *missing_name = (char *) argv[0];
277 printf("not found %s\n", missing_name);
278 } else {
279 character->shadow_frame = LoadMDSFile(mds_file, mds_buffer, visual_type, 0, 0);
280 }
281}
282
283static void CommandMOTION(void **argv) {
284 if (character->frame == 0) {
285 return;
286 }
287
288 now_motion_data = *(int *) argv[0];
289 character->ClearEvent(now_motion_data);
290
291 if (now_motion_data < 0 || now_motion_data >= 8) {
292 return;
293 }
294
295 if (now_motion_data > 0) {
296 character->motion[now_motion_data] = (tagMOTION_TYPE *) character->motion_storage[now_motion_data].storage;
297 }
298
299 tagMOTION_TYPE *motion = character->motion[now_motion_data];
300 memset(motion, 0, sizeof(tagMOTION_TYPE));
301 char *motion_name = (char *) argv[1];
302 char *bone_name = (char *) argv[2];
303 char *weight_name = (char *) argv[3];
304 MOTION_FILE_INFO files[3];
305 files[1].name = motion_name;
306 files[0].name = bone_name;
307 files[2].name = weight_name;
308 files[0].size = 0;
309 files[1].size = 0;
310 files[2].size = 0;
311 files[0].data = GetPackFile(pack_data, bone_name, &files[0].size);
312 files[1].data = GetPackFile(pack_data, motion_name, &files[1].size);
313 files[2].data = GetPackFile(pack_data, weight_name, &files[2].size);
314
315 if (files[0].size == 0) {
316 files[0].name = 0;
317 }
318
319 if (files[1].size == 0) {
320 files[1].name = 0;
321 }
322
323 if (files[2].size == 0) {
324 files[2].name = 0;
325 }
326
327 CreateAnimeDataEX(motion, buffer, files);
328
329 if (character->frame_info == 0) {
330 AnimeDataInit(character->frame, motion, mds_buffer, &character->frame_info);
331 }
332
333 motion->frame_info = character->frame_info;
334 motion_info_num = 0;
335 key_no = 0;
336 motion_info = 0;
337}
338
339static void CommandSHADOW_MOTION(void **argv) {
340 if (character->shadow_frame == 0) {
341 return;
342 }
343
344 if (now_motion_data < 0 || now_motion_data >= 8) {
345 return;
346 }
347
348 if (now_motion_data > 0) {
349 character->shadow_motion[now_motion_data] = (tagMOTION_TYPE *) character->shadow_motion_storage[now_motion_data].storage;
350 }
351
352 tagMOTION_TYPE *motion = character->shadow_motion[now_motion_data];
353 memset(motion, 0, sizeof(tagMOTION_TYPE));
354 shadow_motion = 1;
355 char *motion_name = (char *) argv[0];
356 char *bone_name = (char *) argv[1];
357 char *weight_name = (char *) argv[2];
358 MOTION_FILE_INFO files[3];
359 files[0].size = 0;
360 files[1].size = 0;
361 files[2].size = 0;
362 files[1].name = motion_name;
363 files[0].name = bone_name;
364 files[2].name = weight_name;
365 files[0].data = GetPackFile(pack_data, bone_name, &files[0].size);
366 files[1].data = GetPackFile(pack_data, motion_name, &files[1].size);
367 files[2].data = GetPackFile(pack_data, weight_name, &files[2].size);
368
369 if (bone_name[0] == 0) {
370 files[0].name = 0;
371 }
372
373 if (weight_name[0] == 0) {
374 files[2].name = 0;
375 }
376
377 if (files[0].data == 0 && files[1].data == 0 && files[2].data == 0) {
378 return;
379 }
380
381 CreateAnimeDataEX(motion, buffer, files);
382
383 if (character->shadow_frame_info == 0) {
384 AnimeDataInit(character->shadow_frame, motion, mds_buffer, &character->shadow_frame_info);
385 }
386
387 motion->frame_info = character->shadow_frame_info;
388}
389
390static void CommandKEY_START(void **argv) {
391 if (now_motion_data < 0 || now_motion_data >= 8) {
392 return;
393 }
394
395 key_start = *(int *) argv[0];
396 character->motion_start[now_motion_data] = key_start;
397}
398
399static void CommandKEY(void **argv) {
400 if (motion_info == 0) {
401 motion_info = (tagMOTION_KEY *) (buffer->base + buffer->used * 16);
402 }
403
404 tagMOTION_KEY *key = motion_info + key_no;
405 key->start = *(int *) argv[0];
406 key->end = *(int *) argv[1];
407 key->speed = *(float *) argv[2];
408#ifdef PAL_TIMING
409 key->speed = 6.0f * key->speed / 5.0f;
410#endif
411 key_no++;
412 motion_info_num = key_no;
413}
414
415static void CommandMOTION_END(void **argv) {
416 if (now_motion_data < 0 || now_motion_data >= 8 || motion_info == 0) {
417 return;
418 }
419
420 tagMOTION_TYPE *motion = character->motion[now_motion_data];
421 buffer->Alloc((((unsigned int) (motion_info_num + 1) << 4) >> 4) + 1);
422 motion_info[motion_info_num].start = -1;
423 motion_info[motion_info_num].end = -1;
424 motion_info[motion_info_num].speed = -1.0f;
425 motion->motion_info = motion_info;
426 motion->state.time = (float) motion->motion_info->start;
427 motion->state.blend_step = 0.1f;
428 motion->state.motion_no = 0;
429 motion->state.playing_no = 0;
430 motion->state.blending = false;
431
432 if (shadow_motion != 0) {
433 tagMOTION_TYPE *shadow_motion_type = character->shadow_motion[now_motion_data];
434 shadow_motion_type->motion_info = motion_info;
435 shadow_motion_type->state.time = (float) shadow_motion_type->motion_info->start;
436 shadow_motion_type->state.blend_step = 0.1f;
437 shadow_motion_type->state.motion_no = 0;
438 shadow_motion_type->state.playing_no = 0;
439 shadow_motion_type->state.blending = false;
440 }
441
442 character->motion_end[now_motion_data] = key_start + key_no;
443}
444
445static void CommandCLOTH(void **argv) {
446 int size;
447 u_int *cloth_file = GetPackFile(pack_data, (char *) argv[0], &size);
448
449 if (cloth_file != 0) {
450 input_str input;
451 input.data = (char *) cloth_file;
452 input.size = size;
453 input.pos = 0;
454 character->cloth[cloth_cnt] = (CCloth *) InitCloth((CFrameVu1 *) character->frame, input, buffer);
455 cloth_cnt++;
456 }
457}
458
459static void CommandBODY_SIZE(void **argv) {
460 character->body_height = *(float *) argv[0];
461 character->body_width = *(float *) argv[1];
462 character->body_depth = *(float *) argv[2];
463}
464
465static void CommandALLOC_MDT(void **argv) {
466 if (alloc_mdt_list < 8) {
467 strcpy(alloc_mdt[alloc_mdt_list++], (char *) argv[0]);
468 }
469}
470
471static void CommandALLOC_DBUFF(void **argv) {
472 if (alloc_dbuff_list < 8) {
473 strcpy(alloc_dbuff[alloc_dbuff_list++], (char *) argv[0]);
474 }
475}
476
477static void CommandALLOC_SHADOW_MDT(void **argv) {
478 if (alloc_smdt_list < 8) {
479 strcpy(alloc_smdt[alloc_smdt_list++], (char *) argv[0]);
480 }
481}
482
483static void CommandALLOC_SHADOW_DBUFF(void **argv) {
484 if (alloc_sdbuff_list < 8) {
485 strcpy(alloc_sdbuff[alloc_sdbuff_list++], (char *) argv[0]);
486 }
487}
488
489static void CommandIMG(void **argv) {
490 if (img_buffer == 0) {
491 return;
492 }
493
494 int slot = *(int *) argv[0];
495
496 if (slot < 0 || slot >= 4) {
497 return;
498 }
499
500 int size;
501 u_int *image_file = GetPackFile(pack_data, (char *) argv[1], &size);
502
503 if (image_file != 0) {
504 load_img[slot] = (u_int *) img_buffer->Alloc((size >> 4) + 1);
505 memcpy(load_img[slot], image_file, size);
506 }
507}
508
509static void CommandIMG_END(void **argv) {
510 LOADTEXTURE_INFO2 textures[5];
511 textures[0].block_no = 0;
512 textures[0].mipmap = false;
513 textures[0].name = 0;
514 int i;
515 int texture_count = 0;
516
517 if (character->images[0] != 0 && load_img[0] == 0) {
518 load_img[0] = character->images[0];
519 }
520
521 for (i = 0; i < 4; i++) {
522 character->images[i] = load_img[i];
523
524 if (load_img[i] != 0) {
525 textures[texture_count].block_no = texture_block;
526 textures[texture_count].mipmap = false;
527 textures[texture_count].name = (char *) load_img[i];
528 texture_count++;
529 }
530 }
531
532 textures[texture_count].block_no = 0;
533 textures[texture_count].mipmap = false;
534 textures[texture_count].name = 0;
535
536 if (texture_count > 0) {
537 if (dont_delete_texb == 0) {
538 TexManager.DeleteTextureBlock(texture_block);
539 }
540
541 TexManager.LoadTextureBlockEX(texture_block, textures);
542 }
543
544 if (config_file != 0) {
545 character->tex_anime.LoadCFGFile(config_file, config_file_size);
546 }
547}
548
549static void CommandFOOT(void **argv) {
550 character->SetFootSound(*(float *) argv[0], *(float *) argv[1], now_motion_data);
551}
552
553static void CommandEVENT(void **argv) {
554 if (*(int *) argv[1] >= 0) {
555 character->SetEvent(*(float *) argv[0], *(int *) argv[1], *(int *) argv[2], now_motion_data);
556 }
557}
558
559static int GetArg(input_str &input, int *arg_types, void **argv) {
560 char word[256];
561
562 if (arg_types[0] < 0) {
563 return 1;
564 }
565
566 if (!SkipSpace(input)) {
567 return 0;
568 }
569
570 int arg_count = 0;
571
572 while (arg_types[arg_count++] >= 0)
573 ;
574
575 int ch;
576
577 for (int i = 0; i < arg_count - 1; i++) {
578 int length = 0;
579
580 if (!SkipSpace(input)) {
581 return 0;
582 }
583
584 while (1) {
585 if (input.get(&ch) == 0) {
586 return 0;
587 }
588
589 if (ch == ',' || !CheckChar(ch)) {
590 break;
591 }
592
593 word[length++] = ch;
594 }
595
596 word[length] = 0;
597
598 if (arg_types[i] != SCRIPT_ARGUMENT_FLOAT) {
599 length = 1;
600
601 if (arg_types[i] != SCRIPT_ARGUMENT_INTEGER) {
602 switch (arg_types[i]) {
603 case SCRIPT_ARGUMENT_STRING:
604 break;
605 default:
606 goto invalid_type;
607 }
608
609 {
610 if (word[0] != '"') {
611 return -1;
612 }
613
614 while (1) {
615 char letter = word[length];
616
617 if (letter == '"') {
618 word[length] = 0;
619 break;
620 }
621
622 if (letter == 0) {
623 return -1;
624 }
625
626 length++;
627 }
628
629 strcpy((char *) argv[i], word + 1);
630 goto next_arg;
631 }
632 } else {
633 for (length = 0; word[length] != 0; length++) {
634 char letter = word[length];
635
636 if (letter < '0' || letter > '9') {
637 return -1;
638 }
639 }
640
641 *(int *) argv[i] = atoi(word);
642 goto next_arg;
643 }
644 } else {
645 for (length = 0; word[length] != 0; length++) {
646 char letter = word[length];
647
648 if ((letter < '0' || letter > '9') && letter != '.' && letter != '-') {
649 return -1;
650 }
651 }
652
653 *(float *) argv[i] = (float) atof(word);
654 goto next_arg;
655 }
656
657 invalid_type:
658 return -1;
659 next_arg:;
660 }
661
662 return 1;
663}
664
665static int SearchCommand(input_str &input, int *command) {
666 char word[256];
667
668 if (!SkipSpace(input)) {
669 return 0;
670 }
671
672 int length = 0;
673 int ch;
674
675 while (1) {
676 if (input.get(&ch) == 0 && length == 0) {
677 return 0;
678 }
679
680 if (!CheckChar(ch)) {
681 break;
682 }
683
684 word[length++] = ch;
685 }
686
687 word[length] = 0;
688
689 for (int i = 0; i < 19; i++) {
690 if (strcmp(Command[i].name, word) == 0) {
691 *command = i;
692 return 1;
693 }
694 }
695
696 *command = 20;
697 return 1;
698}
699
700static int SkipSpace(input_str &input) {
701 char *text;
702 int pos;
703
704 text = input.data;
705 pos = input.pos;
706
707 while (pos < input.size) {
708 if (CheckChar(text[pos])) {
709 break;
710 }
711
712 pos++;
713 }
714
715 input.pos = pos;
716
717 if (pos >= input.size) {
718 return 0;
719 }
720
721 return 1;
722}
723
724static int CheckChar(char ch) {
725 int is_space = 0;
726
727 if (ch == ' ') {
728 is_space = 1;
729 }
730
731 if (ch == '\t') {
732 is_space = 1;
733 }
734
735 if (ch == '\n') {
736 is_space = 1;
737 }
738
739 if (ch == '\r') {
740 is_space = 1;
741 }
742
743 return !is_space;
744}
745
746static void PreProcess(input_str &input) {
747 u_char *text;
748 int pos;
749
750 text = (u_char *) input.data;
751 pos = 0;
752
753 while (pos < input.size) {
754 if (text[pos] == '/' && text[pos + 1] == '/') {
755 while (pos < input.size) {
756 if (text[pos] == '\n' || text[pos] == '\r') {
757 break;
758 }
759
760 text[pos] = ' ';
761 pos++;
762 }
763 }
764
765 if (text[pos] == '/' && text[pos + 1] == '*') {
766 while (pos < input.size) {
767 if (text[pos] == '*' && text[pos + 1] == '/') {
768 text[pos] = ' ';
769 text[pos + 1] = ' ';
770 break;
771 }
772
773 text[pos] = ' ';
774 pos++;
775 }
776
777 continue;
778 }
779
780 pos++;
781 }
782}
783
784void CCharacter::StopCloth(int unused) {
785 int i;
786
787 for (i = 0; i < 4; i++) {
788 if (cloth[i] != 0) {
789 cloth[i]->stop = true;
790 }
791 }
792}
793#ifndef PORT
801void StretchBind2(float *point_a, float *point_b, float *spring) {
802 asm {
803 lqc2 $vf10, 0x0($4)
804 lqc2 $vf11, 0x0($5)
805 lqc2 $vf12, 0x0($6)
806 vmulx.xyzw $vf1, $vf0, $vf0x
807 vsub.xyz $vf13, $vf10, $vf11
808 vnop
809 vnop
810 vnop
811 vaddy.x $vf5, $vf1, $vf13y
812 vaddz.x $vf6, $vf1, $vf13z
813 vmula.x $ACC, $vf13, $vf13
814 vmadday.x $ACC, $vf5, $vf13y
815 vmaddz.x $vf7, $vf6, $vf13z
816 vrsqrt $Q, $vf12x, $vf7x
817 vaddax.xyzw $ACC, $vf13, $vf0x
818 vwaitq
819 vmsubq.xyzw $vf25, $vf13, $Q
820 vaddax.xyzw $ACC, $vf10, $vf0x
821 vmsuby.xyz $vf10, $vf25, $vf12y
822 vaddax.xyzw $ACC, $vf11, $vf0x
823 vmaddz.xyz $vf11, $vf25, $vf12z
824 sqc2 $vf10, 0x0($4)
825 sqc2 $vf11, 0x0($5)
826 }
827}
828
836float vuabs(float *vector) {
837 asm {
838 lqc2 $vf4, 0x0($4)
839 vmul.xyz $vf4, $vf4, $vf4
840 vmr32.xy $vf5, $vf4
841 vmr32.x $vf6, $vf5
842 vadd.x $vf7, $vf4, $vf5
843 vadd.x $vf5, $vf6, $vf7
844 vsqrt $Q, $vf5x
845 vwaitq
846 cfc2.ni $2, $vi22
847 mtc1 $2, $f0
848 }
849}
850#endif
CCloth ** cloth
virtual void StopCloth(int unused)
CFrame * frame
void ClearEvent(int motion_no)
void SetEvent(float frame, int kind, int no, int motion_no)
tagMOTION_TYPE * shadow_motion[CHARA_MOTION_MAX]
MotionParam shadow_motion_storage[CHARA_MOTION_MAX]
s32 motion_end[CHARA_MOTION_MAX]
char * config
virtual void Initialize()
CFrame * shadow_frame
MotionParam motion_storage[CHARA_MOTION_MAX]
u_int * images[4]
float body_height
tagFRAME_INF * shadow_frame_info
float body_depth
CTextureAnime tex_anime
int SetFootSound(float left_frame, float right_frame, int motion_no)
s32 motion_start[CHARA_MOTION_MAX]
float body_width
tagMOTION_TYPE * motion[CHARA_MOTION_MAX]
tagFRAME_INF * frame_info
int stop
Definition cloth.hpp:28
void LoadCFGFile(char *script, int script_size)
u8 storage[sizeof(tagMOTION_TYPE)]
Definition character.hpp:89
int arg_types[16]
Definition chararead.cpp:28
unsigned int * data
Definition gameutil.hpp:291
float blend_step
Definition gameutil.hpp:190
int pos
Definition sysmes.hpp:13
char * data
Definition sysmes.hpp:11
int size
Definition sysmes.hpp:12
MOTION_INFO * motion_info
Definition gameutil.hpp:275
tagFRAME_INF * frame_info
Definition gameutil.hpp:274
MOTION_STATE state
Definition gameutil.hpp:273