3#pragma argument_flag_ones 47, 54, 61, 64, 66, 159, 160, 162, 168, 1204
4#pragma argument_flag_ones 1205, 1206, 1209, 1210, 1211, 1473, 1493, 1494, 1580, 1582
5#pragma argument_flag_ones 1583, 1585, 1599
8#pragma argument_flag_ones 47, 54, 61, 64, 66, 159, 160, 162, 168, 334
9#pragma argument_flag_ones 339, 344, 349, 354, 359, 364, 428, 430, 1138, 1139
10#pragma argument_flag_ones 1140, 1143, 1144, 1145, 1407, 1427, 1428, 1514, 1516, 1517
11#pragma argument_flag_ones 1519, 1533
23#include "dataalloc.hpp"
26#include "framevu1.hpp"
30#include "mainselect.hpp"
36#include "title/dispfade.hpp"
37#include "title/op_a.hpp"
38#include "title/opening.hpp"
39#include "title/script.hpp"
68 CRect(T left, T top, T width, T height) {
74} __attribute__((aligned(16)));
76void MGSetViewMatrix(sceVu0FMATRIX view);
77void MGFillBox(
const CRect<int> &rect, u_char r, u_char g, u_char b, u_char a);
79void wait_now_loading_vsync();
80void InitializeDataBuffer();
84void OpB_InitProcess();
85void OpB_InitProcess2();
87void OpB_LoadDataBG2();
88void OpB_MotionProcess();
89void OpB_SoundProcess();
90void OpB_DrawProcess();
91void OpC_InitProcess();
92void OpC_InitProcess2();
93void OpC_InitProcess3();
94void OpC_InitProcess4();
95void OpC_InitProcess5();
97void OpC_LoadDataBG2();
98void OpC_LoadDataBG3();
99void OpC_LoadDataBG4();
100void OpC_LoadDataBG5();
101void OpC_MotionProcess();
102void OpC_SoundProcess();
103void OpC_DrawProcess();
104void OpD_InitProcess();
105void OpD_InitProcess2();
106void OpD_LoadDataBG();
107void OpD_LoadDataBG2();
108void OpD_MotionProcess();
109void OpD_SoundProcess();
110void OpD_DrawProcess();
112static void LoadMessage();
113static void LoadScene();
114static void SceneChange();
115static void PauseProcess();
116static void SoundStop();
117static void WaitKeyProcess();
118static void MotionProcess();
119static void SoundProcess();
120static void DrawProcess();
121static void DrawMess();
137static int OpeningWork[9];
139static void OpeningWorkInit() {
154CCameraFollow OP_MainCamera(60.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f, 20.0f, 0.0f, 4.0f);
161u_char *PassReadBuffer;
167static int CameraMode;
172static float PauseFrame;
180 wait_now_loading_vsync();
181 InitializeDataBuffer();
182 SetDataBuffer(&VisualData, 7500);
183 MesBuffer = VisualData.Alloc(4312);
184 SetDataBuffer(&CharaDataBuffer__2[0], 253000);
185 SetDataBuffer(&CharaDataBuffer__2[4], 65000);
186 SetDataBuffer(&CharaDataBuffer__2[6], 327000);
187 SetDataBuffer(&PassDataBuffer[0], 15000);
188 SetDataBuffer(&PassDataBuffer[1], 15000);
189 SetDataBuffer(&PassDataBuffer[2], 15000);
190 SetDataBuffer(&testBuffer, 15000);
191 PassReadBuffer = testBuffer.Alloc(15000);
192 SetDataBuffer(&MapDataBuffer, 159500);
193 SetDataBuffer(&WaterBuffer__2, 30000);
195 SetDataBuffer(&TextureData, 365000);
197 SetDataBuffer(&TextureData, 355000);
199 SetPacketReadBuffer(40000, 273000);
200 OP_MainCamera.
SetRef(0, 0.0f, 0.0f, 0.0f);
201 OP_MainCamera.
SetPos(0, 0.0f, 0.0f, 0.0f);
204 OP_MainCamera.
SetFollow(0.0f, 0.0f, 0.0f);
205 OP_MainCamera.
Step(0);
207 MGSetRenderInfo(800.0f, 6.0f, 65535);
208 wait_now_loading_vsync();
210 CScript__2.
Load(
"opdat/opening.pal");
212 CScript__2.
Load(
"opdat/opening.scr");
214 wait_now_loading_vsync();
216 wait_now_loading_vsync();
218 wait_now_loading_vsync();
224 SceneFlg = SCENE_READ_IDLE;
244static void LoadMessage() {
245 Mes1.
Preset(MES_PRESET_AUTO_PAGE);
261 switch (LanguageCode) {
263 LoadFile(
"opdat/optext_0.mes", MesBuffer, 0);
265 case LANG_ENGLISH_US:
266 LoadFile(
"opdat/optext_1.mes", MesBuffer, 0);
268 case LANG_ENGLISH_UK:
269 LoadFile(
"opdat/optext_2.mes", MesBuffer, 0);
272 LoadFile(
"opdat/optext_3.mes", MesBuffer, 0);
275 LoadFile(
"opdat/optext_4.mes", MesBuffer, 0);
278 LoadFile(
"opdat/optext_5.mes", MesBuffer, 0);
281 LoadFile(
"opdat/optext_6.mes", MesBuffer, 0);
285 switch (LanguageCode) {
287 LoadFile(
"opdat/fconv.bin", MesBuffer, 0);
289 case LANG_ENGLISH_US:
290 LoadFile(
"opdat/usa/fconv.bin", MesBuffer, 0);
292 case LANG_ENGLISH_UK:
293 LoadFile(
"opdat/usa/fconv.bin", MesBuffer, 0);
296 LoadFile(
"opdat/optext_3.mes", MesBuffer, 0);
299 LoadFile(
"opdat/optext_4.mes", MesBuffer, 0);
302 LoadFile(
"opdat/optext_5.mes", MesBuffer, 0);
305 LoadFile(
"opdat/usa/fconv.bin", MesBuffer, 0);
310 Mes1.
buff = (
short *) MesBuffer;
311 Mes1.
text = (
char *) MesBuffer;
312 Mes1.
text += *(
short *) (MesBuffer + 2);
323static void LoadScene() {
324 char *files[3][2] = {
325 {
"opdat/scene/0101acp.sne",
"0101acp.cfg"},
326 {
"opdat/scene/0101bcp.sne",
"0101bcp.cfg"},
327 {
"opdat/scene/0104cp.sne",
"0104cp.cfg" },
331 for (i = 0; i < 3; i++) {
332 LoadFile(files[i][0], (
void *) read_buffer, 0);
333 Cam__2[i].
LoadPackData(read_buffer, files[i][1], &PassDataBuffer[i], 0);
345 char *files[126][2] = {
346 {
"opdat/scene/0101acp.sne",
"0101acp.cfg" },
347 {
"opdat/scene/0101bcp.sne",
"0101bcp.cfg" },
348 {
"opdat/scene/0104cp.sne",
"0104cp.cfg" },
349 {
"opdat/scene/0104bcp.sne",
"0104bcp.cfg" },
350 {
"opdat/scene/0105cp.sne",
"0105cp.cfg" },
351 {
"opdat/scene/0107cp.sne",
"0107cp.cfg" },
352 {
"opdat/scene/0108cp.sne",
"0108cp.cfg" },
353 {
"opdat/scene/0109cp.sne",
"0109cp.cfg" },
354 {
"opdat/scene/0110cp.sne",
"0110cp.cfg" },
355 {
"opdat/scene/0111cp.sne",
"0111cp.cfg" },
356 {
"opdat/scene/0112cp.sne",
"0112cp.cfg" },
357 {
"opdat/scene/0113cp.sne",
"0113cp.cfg" },
358 {
"opdat/scene/0114acp.sne",
"0114acp.cfg" },
359 {
"opdat/scene/0114bcp.sne",
"0114bcp.cfg" },
360 {
"opdat/scene/0114ccp.sne",
"0114ccp.cfg" },
361 {
"opdat/scene/0114dcp.sne",
"0114dcp.cfg" },
362 {
"opdat/scene/0114ecp.sne",
"0114ecp.cfg" },
363 {
"opdat/scene/0114gcp.sne",
"0114gcp.cfg" },
364 {
"opdat/scene/0114hcp.sne",
"0114hcp.cfg" },
365 {
"opdat/scene/0114icp.sne",
"0114icp.cfg" },
366 {
"opdat/scene/0114jcp.sne",
"0114jcp.cfg" },
367 {
"opdat/scene/0114kcp.sne",
"0114kcp.cfg" },
368 {
"opdat/scene/0114f1cp.sne",
"0114f1cp.cfg"},
369 {
"opdat/scene/0114f2cp.sne",
"0114f2cp.cfg"},
370 {
"opdat/scene/0115cp.sne",
"0115cp.cfg" },
371 {
"opdat/scene/0116cp.sne",
"0116cp.cfg" },
372 {
"opdat/scene/0117cp.sne",
"0117cp.cfg" },
373 {
"opdat/scene/0118cp.sne",
"0118cp.cfg" },
374 {
"opdat/scene/0119cp.sne",
"0119cp.cfg" },
375 {
"opdat/scene/0119bcp.sne",
"0119bcp.cfg" },
376 {
"opdat/scene/0120cp.sne",
"0120cp.cfg" },
377 {
"opdat/scene/0121cp.sne",
"0121cp.cfg" },
378 {
"opdat/scene/0122cp.sne",
"0122cp.cfg" },
379 {
"opdat/scene/0123cp.sne",
"0123cp.cfg" },
380 {
"opdat/scene/0124cp.sne",
"0124cp.cfg" },
381 {
"opdat/scene/0125cp.sne",
"0125cp.cfg" },
382 {
"opdat/scene/0126cp.sne",
"0126cp.cfg" },
383 {
"opdat/scene/0120cp.sne",
"0120cp.cfg" },
384 {
"opdat/scene/0128cp.sne",
"0128cp.cfg" },
385 {
"opdat/scene/0129cp.sne",
"0129cp.cfg" },
386 {
"opdat/scene/0126cp.sne",
"0126cp.cfg" },
387 {
"opdat/scene/0130cp.sne",
"0130cp.cfg" },
388 {
"opdat/scene/0126cp.sne",
"0126cp.cfg" },
389 {
"opdat/scene/0132cp.sne",
"0132cp.cfg" },
390 {
"opdat/scene/0132bcp.sne",
"0132bcp.cfg" },
391 {
"opdat/scene/0132ccp.sne",
"0132ccp.cfg" },
392 {
"opdat/scene/0133cp.sne",
"0133cp.cfg" },
393 {
"opdat/scene/0134cp.sne",
"0134cp.cfg" },
394 {
"opdat/scene/0135cp.sne",
"0135cp.cfg" },
395 {
"opdat/scene/0136cp.sne",
"0136cp.cfg" },
396 {
"opdat/scene/0301cp.sne",
"0301cp.cfg" },
397 {
"opdat/scene/0302cp.sne",
"0302cp.cfg" },
398 {
"opdat/scene/0303cp.sne",
"0303cp.cfg" },
399 {
"opdat/scene/0304cp.sne",
"0304cp.cfg" },
400 {
"opdat/scene/0305cp.sne",
"0305cp.cfg" },
401 {
"opdat/scene/0306cp.sne",
"0306cp.cfg" },
402 {
"opdat/scene/0307cp.sne",
"0307cp.cfg" },
403 {
"opdat/scene/0308cp.sne",
"0308cp.cfg" },
404 {
"opdat/scene/0401cp.sne",
"0401cp.cfg" },
405 {
"opdat/scene/0402cp.sne",
"0402cp.cfg" },
406 {
"opdat/scene/0403cp.sne",
"0403cp.cfg" },
407 {
"opdat/scene/0404cp.sne",
"0404cp.cfg" },
408 {
"opdat/scene/0405cp.sne",
"0405cp.cfg" },
409 {
"opdat/scene/0406cp.sne",
"0406cp.cfg" },
410 {
"opdat/scene/0407cp.sne",
"0407cp.cfg" },
411 {
"opdat/scene/0408cp.sne",
"0408cp.cfg" },
412 {
"opdat/scene/0409cp.sne",
"0409cp.cfg" },
413 {
"opdat/scene/0410cp.sne",
"0410cp.cfg" },
414 {
"opdat/scene/0411cp.sne",
"0411cp.cfg" },
415 {
"opdat/scene/0412cp.sne",
"0412cp.cfg" },
416 {
"opdat/scene/0413cp.sne",
"0413cp.cfg" },
417 {
"opdat/scene/0414cp.sne",
"0414cp.cfg" },
418 {
"opdat/scene/0415cp.sne",
"0415cp.cfg" },
419 {
"opdat/scene/0416cp.sne",
"0416cp.cfg" },
420 {
"opdat/scene/0417cp.sne",
"0417cp.cfg" },
421 {
"opdat/scene/0418cp.sne",
"0418cp.cfg" },
422 {
"opdat/scene/0419cp.sne",
"0419cp.cfg" },
423 {
"opdat/scene/0420cp.sne",
"0420cp.cfg" },
424 {
"opdat/scene/0421cp.sne",
"0421cp.cfg" },
425 {
"opdat/scene/0423cp.sne",
"0423cp.cfg" },
426 {
"opdat/scene/0425cp.sne",
"0425cp.cfg" },
427 {
"opdat/scene/0426cp.sne",
"0426cp.cfg" },
428 {
"opdat/scene/0427cp.sne",
"0427cp.cfg" },
429 {
"opdat/scene/0428cp.sne",
"0428cp.cfg" },
430 {
"opdat/scene/0429cp.sne",
"0429cp.cfg" },
431 {
"opdat/scene/0430cp.sne",
"0430cp.cfg" },
432 {
"opdat/scene/0431cp.sne",
"0431cp.cfg" },
433 {
"opdat/scene/0432cp.sne",
"0432cp.cfg" },
434 {
"opdat/scene/0433cp.sne",
"0433cp.cfg" },
435 {
"opdat/scene/0434cp.sne",
"0434cp.cfg" },
436 {
"opdat/scene/0435cp.sne",
"0435cp.cfg" },
437 {
"opdat/scene/0436cp.sne",
"0436cp.cfg" },
438 {
"opdat/scene/0437cp.sne",
"0437cp.cfg" },
439 {
"opdat/scene/0438cp.sne",
"0438cp.cfg" },
440 {
"opdat/scene/0439cp.sne",
"0439cp.cfg" },
441 {
"opdat/scene/0440cp.sne",
"0440cp.cfg" },
442 {
"opdat/scene/0441cp.sne",
"0441cp.cfg" },
443 {
"opdat/scene/0442cp.sne",
"0442cp.cfg" },
444 {
"opdat/scene/0443cp.sne",
"0443cp.cfg" },
445 {
"opdat/scene/0501cp.sne",
"0501cp.cfg" },
446 {
"opdat/scene/0502cp.sne",
"0502cp.cfg" },
447 {
"opdat/scene/0503cp.sne",
"0503cp.cfg" },
448 {
"opdat/scene/0504cp.sne",
"0504cp.cfg" },
449 {
"opdat/scene/0505cp.sne",
"0505cp.cfg" },
450 {
"opdat/scene/0506cp.sne",
"0506cp.cfg" },
451 {
"opdat/scene/0510cp.sne",
"0510cp.cfg" },
452 {
"opdat/scene/0511cp.sne",
"0511cp.cfg" },
453 {
"opdat/scene/0512cp.sne",
"0512cp.cfg" },
454 {
"opdat/scene/0513cp.sne",
"0513cp.cfg" },
455 {
"opdat/scene/0514cp.sne",
"0514cp.cfg" },
456 {
"opdat/scene/0515cp.sne",
"0515cp.cfg" },
457 {
"opdat/scene/0515bcp.sne",
"0515bcp.cfg" },
458 {
"opdat/scene/0516cp.sne",
"0516cp.cfg" },
459 {
"opdat/scene/0517cp.sne",
"0517cp.cfg" },
460 {
"opdat/scene/0518cp.sne",
"0518cp.cfg" },
461 {
"opdat/scene/0520cp.sne",
"0520cp.cfg" },
462 {
"opdat/scene/0521cp.sne",
"0521cp.cfg" },
463 {
"opdat/scene/0522cp.sne",
"0522cp.cfg" },
464 {
"opdat/scene/0523cp.sne",
"0523cp.cfg" },
465 {
"opdat/scene/0524cp.sne",
"0524cp.cfg" },
466 {
"opdat/scene/0525cp.sne",
"0525cp.cfg" },
467 {
"opdat/scene/0526cp.sne",
"0526cp.cfg" },
468 {
"opdat/scene/0527cp.sne",
"0527cp.cfg" },
469 {
"opdat/scene/0528cp.sne",
"0528cp.cfg" },
470 {
"opdat/scene/0529cp.sne",
"0529cp.cfg" },
474 if (files[SceneCnt][0] ==
"-1") {
479 case SCENE_READ_START:
483 if (SceneCnt % 5 == 0) {
487 LoadFileBG(files[SceneCnt][0], (u_long128 *) PassReadBuffer, 0);
488 SceneFlg = SCENE_READ_WAIT;
490 case SCENE_READ_WAIT:
496 buffer = &PassDataBuffer[slot];
498 Cam__2[slot].
LoadPackData((u_int *) PassReadBuffer, files[SceneCnt][1], buffer, 0);
506 SceneFlg = SCENE_READ_IDLE;
508 case SCENE_READ_IDLE:
532 MGSetBGColor(0.0f, 0.0f, 0.0f, 128.0f);
539 typedef float ExitState0, ExitState1;
541 if (CScript__2.
end) {
542 MGSetBGColor(0.0f, 0.0f, 0.0f, 128.0f);
559static void SceneChange() {
561 case OP_SCENE_NORUNE:
564 case OP_SCENE_TOAN_HOUSE:
567 case OP_SCENE_NORUNE_NIGHT:
576 case OP_SCENE_NORUNE_RUINED:
579 case OP_SCENE_NORUNE_BURNING:
582 case OP_SCENE_SEIREI_KING:
585 case OP_SCENE_MEADOW:
591 case OP_SCENE_NORUNE:
595 case OP_SCENE_TOAN_HOUSE:
598 case OP_SCENE_NORUNE_NIGHT:
609 case OP_SCENE_NORUNE_RUINED:
612 case OP_SCENE_NORUNE_BURNING:
615 case OP_SCENE_SEIREI_KING:
619 case OP_SCENE_MEADOW:
634static void PauseProcess() {
635 static int endflg = 0;
637 if (DispFade.
GetRate() != 0.0) {
647 if (!GamePad.
Down(PAD_START)) {
651 CSnd.
Stop(MIDI_PORT_BGM);
653 if (CScript__2.
scene) {
654 CSnd.
Stop(MIDI_PORT_AMBIENT);
657 CSnd.
SetVol(MIDI_PORT_SE_TITLE, 0);
658 CSnd.
SetVol(MIDI_PORT_SE_DEFAULT, 0);
659 CSnd.
SetVol(MIDI_PORT_UNK_D, 0);
660 CSnd.
SetVol(MIDI_PORT_SE_SPECIAL, 0);
664 }
else if (Pause == 1) {
665 if (GamePad.
Down(PAD_CIRCLE)) {
667 CSnd.
SetVol(MIDI_PORT_SE_TITLE, 256);
668 CSnd.
SetVol(MIDI_PORT_SE_DEFAULT, 256);
669 CSnd.
SetVol(MIDI_PORT_UNK_D, 256);
670 CSnd.
SetVol(MIDI_PORT_SE_SPECIAL, 256);
672 if (CScript__2.
scene) {
676 if (OpBgmSqPort != -1) {
679 }
else if (GamePad.
Down(PAD_CROSS)) {
701static void SoundStop() {
703 CSnd.
Stop(MIDI_PORT_BGM);
715static void WaitKeyProcess() {
729 if (GamePad.
Down(PAD_CIRCLE) || GamePad.
Down(PAD_CROSS)) {
730 if (Mes1.
State() == CLSMES_PAGE_WAIT) {
734 }
else if (Mes1.
State() == CLSMES_SHOWN) {
758static void MotionProcess() {
760 switch (CScript__2.
fade) {
761 case TSFADE_IN_BLACK:
767 CScript__2.
fade = TSFADE_NONE;
769 case TSFADE_OUT_BLACK:
775 CScript__2.
fade = TSFADE_NONE;
777 case TSFADE_IN_WHITE:
783 CScript__2.
fade = TSFADE_NONE;
785 case TSFADE_OUT_WHITE:
791 CScript__2.
fade = TSFADE_NONE;
805 if (SceneNp__2 > 2) {
809 SceneFlg = SCENE_READ_START;
820 if (Cam__2[SceneNp__2].motion_type.state.time > (
float) (CScript__2.
motion_end - 1)) {
824 if (CameraMode == 0) {
827 if (PauseFrame > (
float) (CScript__2.
motion_end - 1)) {
828 PauseFrame = (float) (CScript__2.
motion_end - 1);
839 SetMotionEX(Cam__2[SceneNp__2].frame, &Cam__2[SceneNp__2].motion_type, &Op_MotionInfo, &Cam__2[SceneNp__2].motion_type.state, frame_info_cam);
844 switch (CScript__2.
scene) {
845 case OP_SCENE_DUNGEON_SQUARE:
848 case OP_SCENE_NORUNE:
851 case OP_SCENE_TOAN_HOUSE:
854 case OP_SCENE_NORUNE_NIGHT:
863 case OP_SCENE_NORUNE_RUINED:
866 case OP_SCENE_NORUNE_BURNING:
869 case OP_SCENE_SEIREI_KING:
872 case OP_SCENE_MEADOW:
887static void SoundProcess() {
892 OpPlayVolSE(MIDI_PORT_SE_DEFAULT, CScript__2.
se_no, CScript__2.
se_voice, 1.0f);
895 OpPlayVolSE(MIDI_PORT_SE_SPECIAL, CScript__2.
se_no, CScript__2.
se_voice, 1.0f);
933 switch (CScript__2.
scene) {
934 case OP_SCENE_DUNGEON_SQUARE:
937 case OP_SCENE_NORUNE:
940 case OP_SCENE_TOAN_HOUSE:
943 case OP_SCENE_NORUNE_NIGHT:
952 case OP_SCENE_NORUNE_RUINED:
955 case OP_SCENE_NORUNE_BURNING:
958 case OP_SCENE_SEIREI_KING:
961 case OP_SCENE_MEADOW:
975static void DrawProcess() {
976 sceVu0FVECTOR position;
977 sceVu0FMATRIX camera;
982 OP_MainCamera.
GetPos(position);
983 SndSetCamera(&OP_MainCamera);
986 if (CScript__2.
scene == OP_SCENE_MAJIN || CScript__2.
scene == OP_SCENE_SEIREI_KING) {
987 OP_MainCamera.
Step(1);
990 sceVu0UnitMatrix(unit);
991 sceVu0MulMatrix(view, unit, camera);
993 if (CScript__2.
scene != OP_SCENE_NORUNE) {
994 MGSetViewMatrix(view, position);
996 MGSetViewMatrix(view);
999 sceVif1PkCall(Vif1Packet, (u_long128 *) Vu_prog0f, 0);
1000 sceVif1PkTerminate(Vif1Packet);
1002 switch (CScript__2.
scene) {
1003 case OP_SCENE_DUNGEON_SQUARE:
1006 case OP_SCENE_NORUNE:
1009 case OP_SCENE_TOAN_HOUSE:
1012 case OP_SCENE_NORUNE_NIGHT:
1015 case OP_SCENE_DANCE:
1018 case OP_SCENE_MAJIN:
1021 case OP_SCENE_NORUNE_RUINED:
1024 case OP_SCENE_NORUNE_BURNING:
1027 case OP_SCENE_SEIREI_KING:
1030 case OP_SCENE_MEADOW:
1039 MGFillBox(
CRect<int>(0, 0, 10240, SCREEN_HEIGHT * 8), 0, 0, 0, 64);
1040 TexManager.ReloadTexture(Vif1Packet, 19);
1043 switch (LanguageCode) {
1045 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1047 case LANG_ENGLISH_US:
1048 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause_e", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1050 case LANG_ENGLISH_UK:
1051 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause_e", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1054 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause_f", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1057 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause_g", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1060 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause_i", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1063 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause_s", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1068 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"pause_e", -1),
CRect<int>(256, 160, 128, 128),
CRect<int>(0, 0, 128, 128), 128);
1073 MGGetFBuffBackTex(&tex0);
1077 texture.
tex0 = *(u_long *) &tex0;
1079 set2DSprite(Vif1Packet, &texture,
CRect<int>(0, 0, 640, SCREEN_HEIGHT),
CRect<int>(0, 0, 640, SCREEN_HALF_HEIGHT), 128, 128, 128, 40);
1081 set2DSprite(Vif1Packet, &texture,
CRect<int>(0, 0, 640, 448),
CRect<int>(0, 0, 640, 224), 128, 128, 128, 35);
1083 DispFade.
FadeIn(Vif1Packet);
1095static void DrawMess() {
1099 if (CScript__2.
scene > OP_SCENE_NORUNE_RUINED) {
1103 if (CScript__2.
mes_no == 0) {
1107 TexManager.ReloadTexture(Vif1Packet, Mes1.
tex_block);
1111 if (CScript__2.
mes_no != no) {
1128 if (Mes1.
State() == CLSMES_SHOWN || (Mes1.
auto_page == 0 && Mes1.
State() == CLSMES_PAGE_WAIT)) {
1165 offset = (center - Mes1.
tail_to_x) >> 2;
1166 Mes1.
tail_x = center - offset;
1194 int volumes[8] = {82, 106, 64, 69, 91, 92, 95, 108};
1197 CSnd.
SQ_Play(MIDI_PORT_BGM, 0);
1199 CSnd.
SQ_Play(MIDI_PORT_BGM, 0, 0);
1202 BgmVol = volumes[BgmNo];
1206void OpPlayVolPanSE(
float *position,
float near_dist,
float far_dist,
int group,
int no,
int voice) {
1215 SndGetVolPan(&volume, &pan, position, near_dist, far_dist);
1225 pan_level = (int) (63.0f * pan) + 64;
1226 se_index = CSnd.
GetSeNo(no, voice);
1228 base_volume = se_info[se_index * 2 + 1];
1229 level = (int) ((
float) base_volume * volume);
1239 CSnd.
SE_Play(group, no, voice, pan_level, 127, level, 0);
1242void OpSetVolPanSE(
float *position,
float near_dist,
float far_dist,
int group,
int no,
int voice) {
1251 SndGetVolPan(&volume, &pan, position, near_dist, far_dist);
1261 pan_level = (int) (63.0f * pan) + 64;
1262 CSnd.
SE_SetPan(group, no, voice, pan_level, 0);
1263 se_index = CSnd.
GetSeNo(no, voice);
1265 base_volume = se_info[se_index * 2 + 1];
1266 level = (int) ((
float) base_volume * volume);
1276 CSnd.
SE_SetVol(group, no, voice, level, 0);
1279void OpPlayVolSE(
int group,
int no,
int voice,
float volume) {
1285 se_index = CSnd.
GetSeNo(no, voice);
1287 base_volume = se_info[se_index * 2 + 1];
1288 level = (int) ((
float) base_volume * volume);
1298 CSnd.
SE_Play(group, no, voice, 64, 127, level, 0);
1301int OpGetVolSQ(
int no) {
1321 CSnd.
SetVol(MIDI_PORT_SE_TITLE, 256);
1322 CSnd.
SetVol(MIDI_PORT_SE_DEFAULT, 256);
1323 CSnd.
SetVol(MIDI_PORT_UNK_D, 256);
1324 CSnd.
SetVol(MIDI_PORT_SE_SPECIAL, 256);
1339 virtual void FrameObjectOnOff(
char *name,
int on);
1340 virtual void Draw();
1358 virtual void Draw();
1361 void DrawShadow(
int fast);
1393 sceVu0FVECTOR unk_30;
1407float op_fogRate[4] = {1000.0f, 3500.0f, 0.0f, 255.0f};
1408u_char op_fogColor[3] = {96, 160, 239};
1410static int debugModeFlag = 1;
1411static float run_speed = 1.0f;
1416static sceVu0FVECTOR WaterV1;
1417static sceVu0FVECTOR WaterV2;
1418static sceVu0FVECTOR WaterV3;
1419static sceVu0FVECTOR WaterV4;
1420static sceVu0FVECTOR WaterPos;
1421static u_char WaterR;
1422static u_char WaterG;
1423static u_char WaterB;
1424static int WaterFlag;
1425static int WaterMeshW;
1426static int WaterMeshH;
1427static float WaterShake;
1428static float WaterCourant;
1429static float WaterDecline;
1430static float WaterAmplitude;
1431static float WaterRefraction;
1436static int ColModelCount;
1438static int shadowModelCount;
1440static int animeSpeed1;
1441static int animeSpeed2;
1447static int TEIGI_GRD_IMG[] = {0, 2, TSARG_STRING, TSARG_COMMA_VALUE};
1448static int TEIGI_BLD_IMG[] = {1, 2, TSARG_STRING, TSARG_COMMA_VALUE};
1449static int TEIGI_SKY_IMG[] = {2, 2, TSARG_STRING, TSARG_COMMA_VALUE};
1450static int TEIGI_FIRE_IMG[] = {31, 1, TSARG_STRING};
1451static int TEIGI_GRD[] = {3, 7, TSARG_STRING, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1452static int TEIGI_BLD[] = {4, 8, TSARG_STRING, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1453static int TEIGI_LOD[] = {5, 1, TSARG_STRING};
1454static int TEIGI_CRD[] = {6, 1, TSARG_STRING};
1455static int TEIGI_SKY[] = {7, 2, TSARG_STRING, TSARG_COMMA_VALUE};
1456static int TEIGI_FOG[] = {8, 7, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1457static int TEIGI_AMBIENT[] = {9, 3, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1458static int TEIGI_LIGHT_COL[] = {10, 7, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1459static int TEIGI_FARCLIP[] = {11, 1, TSARG_VALUE};
1460static int TEIGI_BG_COL2[] = {12, 3, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1461static int TEIGI_BG_COL[] = {12, 3, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1462static int TEIGI_NORMALCLIP_OFF[] = {13, 1, TSARG_VALUE};
1463static int TEIGI_RUN_SPEED[] = {14, 1, TSARG_VALUE};
1464static int TEIGI_EDIT_FOG[] = {16, 7, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1465static int TEIGI_WATER_SET[] = {17, 5, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1466static int TEIGI_WATER_RGB[] = {18, 3, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1467static int TEIGI_WATER_PARAM[] = {19, 7, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1468static int TEIGI_LEVEL_FAR[] = {21, 4, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1469static int TEIGI_DebugFlag[] = {22, 1, TSARG_VALUE};
1470static int TEIGI_AnimeSpeed[] = {23, 2, TSARG_VALUE, TSARG_COMMA_VALUE};
1471static int TEIGI_UPER[] = {24, 8, TSARG_STRING, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1472static int TEIGI_UPR_IMG[] = {25, 2, TSARG_STRING, TSARG_COMMA_VALUE};
1473static int TEIGI_PLIGHT[] = {26, 9, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1474static int TEIGI_ADD_CRD[] = {27, 7, TSARG_STRING, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1475static int TEIGI_DEF_PATS[] = {50, 0};
1476static int TEIGI_DEF_ENDS[] = {51, 0};
1477static int TEIGI_S_VOLUME[] = {28, 7, TSARG_STRING, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1478static int TEIGI_PROJECTION[] = {29, 1, TSARG_VALUE};
1479static int TEIGI_OBJ_ROT[] = {30, 7, TSARG_STRING, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1480static int TEIGI_FIRE[] = {32, 5, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1481static int TEIGI_MAPINFO[] = {80, 1, TSARG_STRING};
1482static int TEIGI_PT_BASE[] = {52, 2, TSARG_STRING, TSARG_COMMA_VALUE};
1483static int TEIGI_PT_COLS[] = {54, 1, TSARG_STRING};
1484static int TEIGI_MAPD[] = {53, 32, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1485static int TEIGI_PT_FIRE[] = {55, 3, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1486static int TEIGI_PT_WATER[] = {56, 9, TSARG_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE, TSARG_COMMA_VALUE};
1489static float Projection = 800.0f;
1490static u_char editFogColor[3] = {96, 160, 239};
1491static float editFogRate[4] = {1000.0f, 3500.0f, 0.0f, 255.0f};
1495static float levelOfDitialZ[4] = {200.0f, 400.0f, 800.0f, 1600.0f};
1515static int pointLightStack;
1521static int teigiFileSize;
1525static char teigiBuff[4096] __attribute__((aligned(64)));
1526static char argStrBuff[128][64];
1527static float argValBuff[128][64];
1531static char *LODNameBuff[4];
1533static int nowObjCnt;
1534static int nowObjCnt2;
1535static int nowPartsCnt;
1537static int skipSpace(
char *buf,
int pos);
1538static int checkArg(
char *buf,
int pos,
int *command);
1546void OPAnalyz(
char *name) {
1555 if (LoadFile(name, teigiBuff, &teigiFileSize) == 0) {
1559 for (i = 0; i < teigiFileSize; i++) {
1560 if (buffer[i] == 13 && buffer[i + 1] == 10) {
1566 for (i = 0; i < 96; i++) {
1567 pointLight[i].
used = 0;
1570 pointLightStack = 0;
1574 while (position < teigiFileSize) {
1577 position = skipSpace(buffer, position);
1579 if (memcmp(&buffer[position],
"GRD_IMG", 7) == 0) {
1580 position = skipSpace(buffer, position + 7);
1581 position = checkArg(buffer, position, TEIGI_GRD_IMG);
1583 if (position != -1) {
1587 position = skipSpace(buffer, position);
1591 if (memcmp(&buffer[position],
"BLD_IMG", 7) == 0) {
1592 position = skipSpace(buffer, position + 7);
1593 position = checkArg(buffer, position, TEIGI_BLD_IMG);
1595 if (position != -1) {
1599 position = skipSpace(buffer, position);
1603 if (memcmp(&buffer[position],
"SKY_IMG", 7) == 0) {
1604 position = skipSpace(buffer, position + 7);
1605 position = checkArg(buffer, position, TEIGI_SKY_IMG);
1607 if (position != -1) {
1611 position = skipSpace(buffer, position);
1615 if (memcmp(&buffer[position],
"GND", 3) == 0) {
1616 position = skipSpace(buffer, position + 3);
1617 position = checkArg(buffer, position, TEIGI_GRD);
1619 if (position != -1) {
1623 position = skipSpace(buffer, position);
1627 if (memcmp(&buffer[position],
"BLD", 3) == 0 && memcmp(&buffer[position],
"BLD_IMG", 7) != 0) {
1628 position = skipSpace(buffer, position + 3);
1629 position = checkArg(buffer, position, TEIGI_BLD);
1631 if (position != -1) {
1635 position = skipSpace(buffer, position);
1639 if (memcmp(&buffer[position],
"LOD", 3) == 0) {
1640 position = skipSpace(buffer, position + 3);
1641 position = checkArg(buffer, position, TEIGI_LOD);
1643 if (position != -1) {
1647 position = skipSpace(buffer, position);
1651 if (memcmp(&buffer[position],
"SKY", 3) == 0) {
1652 position = skipSpace(buffer, position + 3);
1653 position = checkArg(buffer, position, TEIGI_SKY);
1655 if (position != -1) {
1659 position = skipSpace(buffer, position);
1663 if (memcmp(&buffer[position],
"FOG", 3) == 0) {
1664 position = skipSpace(buffer, position + 3);
1665 position = checkArg(buffer, position, TEIGI_FOG);
1667 if (position != -1) {
1671 position = skipSpace(buffer, position);
1675 if (memcmp(&buffer[position],
"CRD", 3) == 0) {
1676 position = skipSpace(buffer, position + 3);
1677 position = checkArg(buffer, position, TEIGI_CRD);
1679 if (position != -1) {
1683 position = skipSpace(buffer, position);
1687 if (memcmp(&buffer[position],
"AMBIENT", 7) == 0) {
1688 position = skipSpace(buffer, position + 7);
1689 position = checkArg(buffer, position, TEIGI_AMBIENT);
1691 if (position != -1) {
1695 position = skipSpace(buffer, position);
1699 if (memcmp(&buffer[position],
"LIGHT_C", 7) == 0) {
1700 position = skipSpace(buffer, position + 7);
1701 position = checkArg(buffer, position, TEIGI_LIGHT_COL);
1703 if (position != -1) {
1707 position = skipSpace(buffer, position);
1711 if (memcmp(&buffer[position],
"FARCLIP", 7) == 0) {
1712 position = skipSpace(buffer, position + 7);
1713 position = checkArg(buffer, position, TEIGI_FARCLIP);
1715 if (position != -1) {
1719 position = skipSpace(buffer, position);
1725 if (memcmp(&buffer[position],
"BG_COL2", 7) == 0) {
1726 position = skipSpace(buffer, position + 6);
1727 position = checkArg(buffer, position, TEIGI_BG_COL2);
1729 if (position != -1) {
1733 position = skipSpace(buffer, position);
1737 if (memcmp(&buffer[position],
"BG_COL", 6) == 0) {
1738 position = skipSpace(buffer, position + 6);
1739 position = checkArg(buffer, position, TEIGI_BG_COL);
1741 if (position != -1) {
1745 position = skipSpace(buffer, position);
1749 if (memcmp(&buffer[position],
"NORMALCLIP_OFF", 14) == 0) {
1750 position = skipSpace(buffer, position + 14);
1751 position = checkArg(buffer, position, TEIGI_NORMALCLIP_OFF);
1753 if (position != -1) {
1757 position = skipSpace(buffer, position);
1761 if (memcmp(&buffer[position],
"RUN_SPEED", 9) == 0) {
1762 position = skipSpace(buffer, position + 9);
1763 position = checkArg(buffer, position, TEIGI_RUN_SPEED);
1765 if (position != -1) {
1769 position = skipSpace(buffer, position);
1773 if (memcmp(&buffer[position],
"EDIT_FOG", 8) == 0) {
1774 position = skipSpace(buffer, position + 8);
1775 position = checkArg(buffer, position, TEIGI_EDIT_FOG);
1777 if (position != -1) {
1781 position = skipSpace(buffer, position);
1785 if (memcmp(&buffer[position],
"WATER_SET", 9) == 0) {
1786 position = skipSpace(buffer, position + 9);
1787 position = checkArg(buffer, position, TEIGI_WATER_SET);
1789 if (position != -1) {
1793 position = skipSpace(buffer, position);
1797 if (memcmp(&buffer[position],
"WATER_RGB", 9) == 0) {
1798 position = skipSpace(buffer, position + 9);
1799 position = checkArg(buffer, position, TEIGI_WATER_RGB);
1801 if (position != -1) {
1805 position = skipSpace(buffer, position);
1809 if (memcmp(&buffer[position],
"WATER_PARAM", 11) == 0) {
1810 position = skipSpace(buffer, position + 11);
1811 position = checkArg(buffer, position, TEIGI_WATER_PARAM);
1813 if (position != -1) {
1817 position = skipSpace(buffer, position);
1821 if (memcmp(&buffer[position],
"LEVEL_FAR", 9) == 0) {
1822 position = skipSpace(buffer, position + 9);
1823 position = checkArg(buffer, position, TEIGI_LEVEL_FAR);
1825 if (position != -1) {
1829 position = skipSpace(buffer, position);
1833 if (memcmp(&buffer[position],
"DebugFlag", 9) == 0) {
1834 position = skipSpace(buffer, position + 9);
1835 position = checkArg(buffer, position, TEIGI_DebugFlag);
1837 if (position != -1) {
1841 position = skipSpace(buffer, position);
1845 if (memcmp(&buffer[position],
"AnimeSpeed", 10) == 0) {
1846 position = skipSpace(buffer, position + 10);
1847 position = checkArg(buffer, position, TEIGI_AnimeSpeed);
1849 if (position != -1) {
1853 position = skipSpace(buffer, position);
1857 if (memcmp(&buffer[position],
"UPER", 4) == 0) {
1858 position = skipSpace(buffer, position + 4);
1859 position = checkArg(buffer, position, TEIGI_UPER);
1861 if (position != -1) {
1865 position = skipSpace(buffer, position);
1869 if (memcmp(&buffer[position],
"UPR_IMG", 7) == 0) {
1870 position = skipSpace(buffer, position + 7);
1871 position = checkArg(buffer, position, TEIGI_UPR_IMG);
1873 if (position != -1) {
1877 position = skipSpace(buffer, position);
1881 if (memcmp(&buffer[position],
"PLIGHT", 6) == 0) {
1882 position = skipSpace(buffer, position + 6);
1883 position = checkArg(buffer, position, TEIGI_PLIGHT);
1885 if (position != -1) {
1889 position = skipSpace(buffer, position);
1893 if (memcmp(&buffer[position],
"ADD_CRD", 7) == 0) {
1894 position = skipSpace(buffer, position + 7);
1895 position = checkArg(buffer, position, TEIGI_ADD_CRD);
1897 if (position != -1) {
1901 position = skipSpace(buffer, position);
1905 if (memcmp(&buffer[position],
"DEF_PATS", 8) == 0) {
1906 position = skipSpace(buffer, position + 8);
1907 argValBuff[argLevel][0] = (float) TEIGI_DEF_PATS[0];
1912 if (memcmp(&buffer[position],
"DEF_ENDS", 8) == 0) {
1913 position = skipSpace(buffer, position + 8);
1914 argValBuff[argLevel][0] = (float) TEIGI_DEF_ENDS[0];
1919 if (memcmp(&buffer[position],
"PT_BASE", 7) == 0) {
1920 position = skipSpace(buffer, position + 7);
1921 position = checkArg(buffer, position, TEIGI_PT_BASE);
1923 if (position != -1) {
1927 position = skipSpace(buffer, position);
1931 if (memcmp(&buffer[position],
"MAPD", 4) == 0) {
1932 position = skipSpace(buffer, position + 4);
1933 position = checkArg(buffer, position, TEIGI_MAPD);
1935 if (position != -1) {
1939 position = skipSpace(buffer, position);
1943 if (memcmp(&buffer[position],
"PT_COLS", 7) == 0) {
1944 position = skipSpace(buffer, position + 7);
1945 position = checkArg(buffer, position, TEIGI_PT_COLS);
1947 if (position != -1) {
1951 position = skipSpace(buffer, position);
1955 if (memcmp(&buffer[position],
"PT_FIRE", 7) == 0) {
1956 position = skipSpace(buffer, position + 7);
1957 position = checkArg(buffer, position, TEIGI_PT_FIRE);
1959 if (position != -1) {
1963 position = skipSpace(buffer, position);
1967 if (memcmp(&buffer[position],
"PT_WATER", 8) == 0) {
1968 position = skipSpace(buffer, position + 8);
1969 position = checkArg(buffer, position, TEIGI_PT_WATER);
1971 if (position != -1) {
1975 position = skipSpace(buffer, position);
1979 if (memcmp(&buffer[position],
"S_VOLUME", 8) == 0) {
1980 position = skipSpace(buffer, position + 8);
1981 position = checkArg(buffer, position, TEIGI_S_VOLUME);
1983 if (position != -1) {
1987 position = skipSpace(buffer, position);
1991 if (memcmp(&buffer[position],
"PROJECTION", 10) == 0) {
1992 position = skipSpace(buffer, position + 10);
1993 position = checkArg(buffer, position, TEIGI_PROJECTION);
1995 if (position != -1) {
1999 position = skipSpace(buffer, position);
2003 if (memcmp(&buffer[position],
"OBJ_ROT", 7) == 0) {
2004 position = skipSpace(buffer, position + 7);
2005 position = checkArg(buffer, position, TEIGI_OBJ_ROT);
2007 if (position != -1) {
2011 position = skipSpace(buffer, position);
2015 if (memcmp(&buffer[position],
"MAPINFO", 7) == 0) {
2016 position = skipSpace(buffer, position + 7);
2017 position = checkArg(buffer, position, TEIGI_MAPINFO);
2019 if (position != -1) {
2023 position = skipSpace(buffer, position);
2027 if (memcmp(&buffer[position],
"FIRE_IMG", 8) == 0) {
2028 position = skipSpace(buffer, position + 8);
2029 position = checkArg(buffer, position, TEIGI_FIRE_IMG);
2031 if (position != -1) {
2035 position = skipSpace(buffer, position);
2039 if (memcmp(&buffer[position],
"FIRE", 4) == 0) {
2040 position = skipSpace(buffer, position + 4);
2041 position = checkArg(buffer, position, TEIGI_FIRE);
2043 if (position != -1) {
2047 position = skipSpace(buffer, position);
2055 position = skipSpace(buffer, position);
2069 sceVu0FVECTOR light_dir;
2091 for (i = 0; i < argLevel; i++) {
2092 if (TEIGI_AnimeSpeed[0] == (
int) argValBuff[i][0]) {
2093 animeSpeed1 = (int) argValBuff[i][1];
2094 animeSpeed2 = (int) argValBuff[i][2];
2097 if (TEIGI_DebugFlag[0] == (
int) argValBuff[i][0]) {
2098 debugModeFlag = (int) argValBuff[i][1];
2101 if (TEIGI_LEVEL_FAR[0] == (
int) argValBuff[i][0]) {
2102 levelOfDitialZ[0] = argValBuff[i][1];
2103 levelOfDitialZ[1] = argValBuff[i][2];
2104 levelOfDitialZ[2] = argValBuff[i][3];
2105 levelOfDitialZ[3] = argValBuff[i][4];
2108 if (TEIGI_WATER_PARAM[0] == (
int) argValBuff[i][0]) {
2109 WaterMeshW = (int) argValBuff[i][1];
2110 WaterMeshH = (int) argValBuff[i][2];
2111 WaterShake = argValBuff[i][3];
2112 WaterCourant = argValBuff[i][4];
2113 WaterDecline = argValBuff[i][5];
2114 WaterAmplitude = argValBuff[i][6];
2115 WaterRefraction = argValBuff[i][7];
2118 if (TEIGI_WATER_SET[0] == (
int) argValBuff[i][0]) {
2119 float half_width = argValBuff[i][1] / 2.0f;
2120 float half_depth = argValBuff[i][2] / 2.0f;
2122 WaterV1[0] = -half_width;
2123 WaterV1[2] = -half_depth;
2124 WaterV2[0] = half_width;
2125 WaterV2[2] = -half_depth;
2126 WaterV3[0] = -half_width;
2127 WaterV3[2] = half_depth;
2128 WaterV4[0] = half_width;
2129 WaterV4[2] = half_depth;
2130 WaterPos[0] = argValBuff[i][3];
2131 WaterPos[1] = argValBuff[i][4];
2132 WaterPos[2] = argValBuff[i][5];
2136 if (TEIGI_WATER_RGB[0] == (
int) argValBuff[i][0]) {
2137 WaterR = argValBuff[i][1];
2138 WaterG = argValBuff[i][2];
2139 WaterB = argValBuff[i][3];
2142 if (TEIGI_RUN_SPEED[0] == (
int) argValBuff[i][0]) {
2143 run_speed = argValBuff[i][1];
2146 if (TEIGI_NORMALCLIP_OFF[0] == (
int) argValBuff[i][0]) {
2147 if (argValBuff[i][1] == 0.0f) {
2154 if (TEIGI_BG_COL2[0] == (
int) argValBuff[i][0]) {
2155 MGSetBGColor((
float) (u_int) argValBuff[i][1], (
float) (u_int) argValBuff[i][2], (
float) (u_int) argValBuff[i][3], 128.0f);
2158 if (TEIGI_BG_COL[0] == (
int) argValBuff[i][0]) {
2159 MGSetBGColor((
float) (u_int) argValBuff[i][1], (
float) (u_int) argValBuff[i][2], (
float) (u_int) argValBuff[i][3], 128.0f);
2162 if (TEIGI_FARCLIP[0] == (
int) argValBuff[i][0]) {
2167 if (TEIGI_LIGHT_COL[0] == (
int) argValBuff[i][0]) {
2168 light_no = (int) argValBuff[i][7];
2169 light_dir[0] = argValBuff[i][1];
2170 light_dir[1] = argValBuff[i][2];
2171 light_dir[2] = argValBuff[i][3];
2172 sceVu0Normalize(light_dir, light_dir);
2177 light_x = light_dir[0];
2178 light_slot = light_no - 1;
2179 light[0][light_slot] = light_x;
2180 light[1][light_slot] = light_dir[1];
2181 light[2][light_slot] = light_dir[2];
2182 lightcolor[light_slot][0] = argValBuff[i][4];
2183 lightcolor[light_slot][1] = argValBuff[i][5];
2184 lightcolor[light_slot][2] = argValBuff[i][6];
2185 MGSetPLight(light, lightcolor);
2188 if (TEIGI_AMBIENT[0] == (
int) argValBuff[i][0]) {
2189 ambientlight[0] = argValBuff[i][1];
2190 ambientlight[1] = argValBuff[i][2];
2191 ambientlight[2] = argValBuff[i][3];
2192 MGSetAmbient(ambientlight);
2195 if (TEIGI_CRD[0] == (
int) argValBuff[i][0]) {
2196 strcpy(path[0],
"sim:");
2197 strcat(path[0], argStrBuff[i]);
2198 LoadFile(path[0], (
void *) read_buffer, 0);
2199 OP_GroundCol = LoadCollisionFile(read_buffer);
2202 if (TEIGI_FOG[0] == (
int) argValBuff[i][0]) {
2203 op_fogRate[0] = argValBuff[i][1];
2204 op_fogRate[1] = argValBuff[i][2];
2205 op_fogRate[2] = argValBuff[i][6];
2206 op_fogRate[3] = argValBuff[i][7];
2207 op_fogColor[0] = argValBuff[i][3];
2208 op_fogColor[1] = argValBuff[i][4];
2209 op_fogColor[2] = argValBuff[i][5];
2210 MGSetFogParm(op_fogRate[0], op_fogRate[1], op_fogColor[0], op_fogColor[1], op_fogColor[2], op_fogRate[2], op_fogRate[3]);
2214 if (TEIGI_EDIT_FOG[0] == (
int) argValBuff[i][0]) {
2215 editFogRate[0] = argValBuff[i][1];
2216 editFogRate[1] = argValBuff[i][2];
2217 editFogRate[2] = argValBuff[i][6];
2218 editFogRate[3] = argValBuff[i][7];
2219 editFogColor[0] = argValBuff[i][3];
2220 editFogColor[1] = argValBuff[i][4];
2221 editFogColor[2] = argValBuff[i][5];
2225 if (TEIGI_PLIGHT[0] == (
int) argValBuff[i][0]) {
2226 pointLight[pointLightStack].
used = 1;
2227 pointLight[pointLightStack].
x = 10.0f * argValBuff[i][1];
2228 pointLight[pointLightStack].
y = 10.0f * argValBuff[i][2];
2229 pointLight[pointLightStack].
z = 10.0f * argValBuff[i][3];
2230 pointLight[pointLightStack].
r = argValBuff[i][4];
2231 pointLight[pointLightStack].
g = argValBuff[i][5];
2232 pointLight[pointLightStack].
b = argValBuff[i][6];
2233 pointLight[pointLightStack].
arg7 = argValBuff[i][7];
2234 pointLight[pointLightStack].
arg8 = argValBuff[i][8];
2235 pointLight[pointLightStack].
arg9 = argValBuff[i][9];
2239 if (TEIGI_GRD[0] == (
int) argValBuff[i][0]) {
2240 strcpy(path[0],
"sim:");
2241 strcat(path[0], argStrBuff[i]);
2242 LoadFile(path[0], (
void *) read_buffer, 0);
2243 frame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
2245 frame->SetAttr(attr, 1, 64);
2246 SetFrameAttr(frame, 1);
2247 object = OP_GroundMap.SetObject(frame, 0, 0);
2248 CVector3_f_ position(10.0f * argValBuff[i][2], 10.0f * argValBuff[i][3], 10.0f * argValBuff[i][4]);
2249 object->SetPosition(position);
2250 rx = PI * argValBuff[i][5] / 180.0f;
2251 ry = PI * argValBuff[i][6] / 180.0f;
2252 rz = PI * argValBuff[i][7] / 180.0f;
2254 object->SetRotation(rotation);
2257 if (TEIGI_SKY[0] == (
int) argValBuff[i][0]) {
2258 strcpy(path[0],
"sim:");
2259 strcat(path[0], argStrBuff[i]);
2260 LoadFile(path[0], (
void *) read_buffer, 0);
2261 OP_SkyFrame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
2263 if (argValBuff[i][2] == 1.0f) {
2264 OP_SkyFrame->SetAttr(attr, 1, 64);
2268 if (TEIGI_BLD[0] == (
int) argValBuff[i][0]) {
2271 if (argValBuff[i][8] == 0.0f) {
2272 strcpy(path[0],
"sim:");
2273 strcat(path[0], argStrBuff[i]);
2274 LoadFile(path[0], (
void *) read_buffer, 0);
2275 frame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
2277 frame->SetAttr(attr, 1, 64);
2278 SetFrameAttr(frame, 1);
2279 object = OP_BuildingMap.SetObject(nowObjCnt++, frame, 0, 0);
2282 CVector3_f_ position(10.0f * argValBuff[i][2], 10.0f * argValBuff[i][3], 10.0f * argValBuff[i][4]);
2283 object->SetPosition(position);
2284 rx = PI * argValBuff[i][5] / 180.0f;
2285 ry = PI * argValBuff[i][6] / 180.0f;
2286 rz = PI * argValBuff[i][7] / 180.0f;
2288 object->SetRotation(rotation);
2290 for (j = 0; j < 4; j++) {
2291 if (argStrBuff[i + j][0] != 0) {
2292 strcpy(path[j],
"sim:");
2293 strcat(path[j], argStrBuff[i + j]);
2294 LODNameBuff[j] = path[j];
2300 LoadLODData(lod_frames, LODNameBuff, read_buffer, 0);
2302 object = OP_BuildingMap.GetObject(nowObjCnt++);
2308 for (k = 0; k < 4; k++) {
2309 category->
lod[k] = levelOfDitialZ[k];
2315 for (j = 0; j < 4; j++) {
2316 object->SetFrame(lod_frames[j], j);
2318 if (lod_frames[j] != 0) {
2319 lod_frames[j]->SetAttr(attr, 1, 64);
2320 SetFrameAttr(lod_frames[j], 1);
2321 shadow = frame->SearchFrame(
"shadow");
2325 shadow->SetAttr(attr, 1, 64);
2326 SetFrameAttr(shadow, 1);
2331 CVector3_f_ position(10.0f * argValBuff[i][2], 10.0f * argValBuff[i][3], 10.0f * argValBuff[i][4]);
2332 object->SetPosition(position);
2333 rx = PI * argValBuff[i][5] / 180.0f;
2334 ry = PI * argValBuff[i][6] / 180.0f;
2335 rz = PI * argValBuff[i][7] / 180.0f;
2337 object->SetRotation(rotation);
2343 if (TEIGI_UPER[0] == (
int) argValBuff[i][0]) {
2346 if (argValBuff[i][8] == 0.0f) {
2347 strcpy(path[0],
"sim:");
2348 strcat(path[0], argStrBuff[i]);
2349 LoadFile(path[0], (
void *) read_buffer, 0);
2350 frame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
2351 frame->SetAttr(attr, 1, 64);
2352 SetFrameAttr(frame, 1);
2353 object = OP_BuildingMap2.SetObject(nowObjCnt2++, frame, 0, 0);
2356 CVector3_f_ position(10.0f * argValBuff[i][2], 10.0f * argValBuff[i][3], 10.0f * argValBuff[i][4]);
2357 object->SetPosition(position);
2358 rx = PI * argValBuff[i][5] / 180.0f;
2359 ry = PI * argValBuff[i][6] / 180.0f;
2360 rz = PI * argValBuff[i][7] / 180.0f;
2362 object->SetRotation(rotation);
2364 for (j = 0; j < 4; j++) {
2365 if (argStrBuff[i + j][0] != 0) {
2366 strcpy(path[j],
"sim:");
2367 strcat(path[j], argStrBuff[i + j]);
2368 LODNameBuff[j] = path[j];
2374 LoadLODData(lod_frames, LODNameBuff, read_buffer, 0);
2376 object = OP_BuildingMap2.GetObject(nowObjCnt++);
2382 for (k = 0; k < 4; k++) {
2383 category->
lod[k] = levelOfDitialZ[k];
2389 for (j = 0; j < 4; j++) {
2390 object->SetFrame(lod_frames[j], j);
2392 if (lod_frames[j] != 0) {
2393 lod_frames[j]->SetAttr(attr, 1, 64);
2394 SetFrameAttr(lod_frames[j], 1);
2395 shadow = frame->SearchFrame(
"shadow");
2399 shadow->SetAttr(attr, 1, 64);
2400 SetFrameAttr(shadow, 1);
2405 CVector3_f_ position(10.0f * argValBuff[i][2], 10.0f * argValBuff[i][3], 10.0f * argValBuff[i][4]);
2406 object->SetPosition(position);
2407 rx = PI * argValBuff[i][5] / 180.0f;
2408 ry = PI * argValBuff[i][6] / 180.0f;
2409 rz = PI * argValBuff[i][7] / 180.0f;
2411 object->SetRotation(rotation);
2417 if (TEIGI_S_VOLUME[0] == (
int) argValBuff[i][0]) {
2418 strcpy(path[0],
"sim:");
2419 strcat(path[0], argStrBuff[i]);
2420 LoadFile(path[0], (
void *) read_buffer, 0);
2421 ShadowModel[shadowModelCount] = LoadMDSFile(read_buffer, 14, 0);
2422 ShadowModel[shadowModelCount]->SetPosition(10.0f * argValBuff[i][2], 10.0f * argValBuff[i][3], 10.0f * argValBuff[i][4]);
2423 rx = PI * argValBuff[i][5] / 180.0f;
2424 ry = PI * argValBuff[i][6] / 180.0f;
2425 rz = PI * argValBuff[i][7] / 180.0f;
2426 ShadowModel[shadowModelCount]->SetRotation(rx, ry, rz);
2430 if (TEIGI_ADD_CRD[0] == (
int) argValBuff[i][0]) {
2431 strcpy(path[0],
"sim:");
2432 strcat(path[0], argStrBuff[i]);
2433 LoadFile(path[0], (
void *) read_buffer, 0);
2434 ColModel[ColModelCount] = LoadCollisionFile(read_buffer);
2435 ColModel[ColModelCount]->SetPosition(10.0f * argValBuff[i][2], 10.0f * argValBuff[i][3], 10.0f * argValBuff[i][4]);
2436 rx = PI * argValBuff[i][5] / 180.0f;
2437 ry = PI * argValBuff[i][6] / 180.0f;
2438 rz = PI * argValBuff[i][7] / 180.0f;
2439 ColModel[ColModelCount]->SetRotation(rx, ry, rz);
2443 if (TEIGI_PROJECTION[0] == (
int) argValBuff[i][0]) {
2444 Projection = argValBuff[i][1];
2447 if (TEIGI_OBJ_ROT[0] == (
int) argValBuff[i][0]) {
2449 OP_AnimeSeq[OP_AnimeSeqRot].
type = 0;
2450 OP_AnimeSeq[OP_AnimeSeqRot].
number = 0;
2451 OP_AnimeSeq[OP_AnimeSeqRot].
start[0] = argValBuff[i][2];
2452 OP_AnimeSeq[OP_AnimeSeqRot].
start[1] = argValBuff[i][3];
2453 OP_AnimeSeq[OP_AnimeSeqRot].
start[2] = argValBuff[i][4];
2454 OP_AnimeSeq[OP_AnimeSeqRot].
step_x = argValBuff[i][5];
2455 OP_AnimeSeq[OP_AnimeSeqRot].
step_y = argValBuff[i][6];
2456 OP_AnimeSeq[OP_AnimeSeqRot].
step_z = argValBuff[i][7];
2457 strcpy(OP_AnimeSeq[OP_AnimeSeqRot].name, argStrBuff[i]);
2458 InitObjAnime(rot_frame, &OP_AnimeSeq[OP_AnimeSeqRot]);
2462 if (TEIGI_FIRE[0] == (
int) argValBuff[i][0]) {
2463 OP_FirePosition[OP_FireList][0] = argValBuff[i][1];
2464 OP_FirePosition[OP_FireList][1] = argValBuff[i][2];
2465 OP_FirePosition[OP_FireList][2] = argValBuff[i][3];
2466 OP_FireScale[OP_FireList] = argValBuff[i][4];
2467 OP_FireFlg[OP_FireList] = (int) argValBuff[i][5];
2471 if (TEIGI_DEF_ENDS[0] == (
int) argValBuff[i][0]) {
2488static int skipSpace(
char *buffer,
int position) {
2491 while (position < teigiFileSize) {
2494 if (memcmp(&buffer[position],
"\x81\x40", 2) == 0) {
2499 if (buffer[position] ==
' ') {
2503 if (buffer[position] ==
'\t') {
2507 if (buffer[position] ==
'\0') {
2512 if (memcmp(&buffer[position],
"//", 2) == 0) {
2513 while (buffer[position] !=
'\0') {
2528 return teigiFileSize;
2543static int checkArg(
char *buffer,
int position,
int *command) {
2551 if (command[1] == 0) {
2555 for (i = 0; i < command[1]; i++) {
2556 argValBuff[argLevel][0] = (float) command[0];
2558 switch (command[2 + i]) {
2560 if (buffer[cursor] !=
'"') {
2566 for (char_count = 0; char_count < 64; char_count++) {
2567 if (buffer[cursor] ==
'"') {
2568 argStrBuff[argLevel][char_count] =
'\0';
2573 argStrBuff[argLevel][char_count] = buffer[cursor];
2577 if (char_count == 64) {
2581 cursor = skipSpace(buffer, cursor);
2584 case TSARG_COMMA_VALUE:
2585 if (buffer[cursor] !=
',') {
2589 cursor = skipSpace(buffer, cursor + 1);
2591 if (memcmp(&buffer[cursor],
"ON", 2) == 0) {
2592 argValBuff[argLevel][1 + i] = 1.0f;
2594 }
else if (memcmp(&buffer[cursor],
"OFF", 3) == 0) {
2595 argValBuff[argLevel][1 + i] = 0;
2600 if (buffer[cursor] ==
'-') {
2604 if (buffer[cursor] >=
'0' && buffer[cursor] <=
'9') {
2612 argValBuff[argLevel][1 + i] = (float) atof(&buffer[cursor]);
2614 for (char_count = 0; char_count < 32; char_count++) {
2617 if (buffer[cursor] ==
'-') {
2622 if (buffer[cursor] >=
'0' && buffer[cursor] <=
'9') {
2627 if (buffer[cursor] ==
'.') {
2637 if (char_count == 32) {
2642 cursor = skipSpace(buffer, cursor);
2646 if (memcmp(&buffer[cursor],
"ON", 2) == 0) {
2647 argValBuff[argLevel][1 + i] = 1.0f;
2649 }
else if (memcmp(&buffer[cursor],
"OFF", 3) == 0) {
2650 argValBuff[argLevel][1 + i] = 0;
2655 if (buffer[cursor] ==
'-') {
2659 if (buffer[cursor] >=
'0' && buffer[cursor] <=
'9') {
2667 argValBuff[argLevel][1 + i] = (float) atof(&buffer[cursor]);
2669 for (char_count = 0; char_count < 32; char_count++) {
2672 if (buffer[cursor] ==
'-') {
2677 if (buffer[cursor] >=
'0' && buffer[cursor] <=
'9') {
2682 if (buffer[cursor] ==
'.') {
2692 if (char_count == 32) {
2697 cursor = skipSpace(buffer, cursor);
void SetHeight(float height)
void SetFollow(float x, float y, float z)
void SetDistance(float distance)
virtual void Step(int steps)
void GetCameraMatrix(float(*matrix)[4])
void SetRef(CFrame *parent, float x, float y, float z)
void SetPos(CFrame *parent, float x, float y, float z)
void SetSpeed(float speed)
virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2< 1 > *model_alloc, CDataAlloc2< 1 > *texture_alloc)
tagMOTION_TYPE motion_type
void FadeOutStart(float speed, int colour)
float FadeOut(sceVif1Packet *packet)
float FadeIn(sceVif1Packet *packet)
void FadeInit(float initial_rate)
void FadeInStart(float speed, int colour)
CFrameVu1 * collision_frame
CategoryAttr category[16]
void Load(const char *name)
void SE_Play(int port, int bank, int program, int pan, int velocity, int volume, int voice)
void SE_SetPan(int port, int bank, int program, int pan, int voice)
void SetVol(int port, int volume)
void SE_SetVol(int port, int bank, int program, int volume, int voice)
void Fade(int port, float step, int volume)
void SE_Stop(int port, int bank, int program, int voice)
void SQ_Play(int port, int seq_no)
int GetSeNo(int bank, int program)
MIDI_STATE * GetMidiState()
int MakeMesWin(int mes_no)
MIDI_SEQUENCE * sequence[10]