1#pragma helper_mask_gpr 0x30
16#include "dataalloc.hpp"
19#include "framevu1.hpp"
20#include "mainselect.hpp"
24#include "renderinfo.hpp"
27#include "title/op_a.hpp"
28#include "title/op_b.hpp"
29#include "title/opening.hpp"
30#include "title/script.hpp"
61 CRect(T new_x, T new_y, T new_width, T new_height) {
67} __attribute__((aligned(16)));
80 virtual void FrameObjectOnOff(
char *name,
int on);
104 void DrawShadow(
int unknown0);
123 void DrawFire(
int unknown0,
int unknown1,
CCamera *camera,
float *eye,
float scale,
int unknown2,
float unknown3);
180void MoveImageTest(
sceVif1Packet *packet,
int sbp,
int sbw,
int spsm,
const CRect<int> &rect,
int dbp,
int dbw,
int dpsm,
int dsax,
int dsay,
int dir);
181void DepthOfField(
float *dist,
int level,
int alpha,
int blur);
187static void setTexAnime();
188void FaceChangeC(
int no);
198static CFrame *TaimatsuFrame[12];
208void FaceChange(
int actor_no) {
209 sceGifTag giftag = {0, 1, 0, 0, 0, 0, 1, SCE_GIF_PACKED_AD};
211 {
"c07a01",
"c07a01an", 42, 40, 87, 35, 0, 0, 256, 2, 0},
212 {
"c08a01",
"c08a01an", 42, 40, 87, 35, 0, 0, 320, 2, 0},
213 {
"c11a01",
"c11a01an", 32, 40, 84, 35, 0, 0, 448, 3, 0},
214 {
"c09a01",
"c09a01an", 10, 40, 73, 35, 0, 0, 448, 2, 0},
215 {
"c08a01",
"c08a01an", 42, 40, 87, 35, 0, 0, 320, 2, 0},
216 {
"c08a01",
"c08a01an", 42, 40, 87, 35, 0, 0, 320, 2, 0},
217 {
"p19a_03",
"p19a_03an", 8, 40, 76, 35, 0, 0, 256, 2, 0},
218 {
"p17a01",
"p17a01an", 42, 40, 87, 35, 0, 0, 320, 2, 0}
227 sceVif1PkCnt(Vif1Packet, 0);
228 sceVif1PkOpenDirectCode(Vif1Packet, 0);
229 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &giftag);
230 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
231 sceVif1PkCloseGifTag(Vif1Packet);
232 sceVif1PkCloseDirectCode(Vif1Packet);
233 sceVif1PkTerminate(Vif1Packet);
235 plate = TexManager.GetTexture(face[actor_no].plate, -1);
236 strip = TexManager.GetTexture(face[actor_no].strip, -1);
238 if (plate == 0 || strip == 0) {
242 sbp = strip->
tex0 & 0x3fff;
243 dbp = plate->tex0 & 0x3fff;
244 sbw = (strip->tex0 >> 14) & 0x3f;
245 dbw = (plate->tex0 >> 14) & 0x3f;
264 if (CScript__2.
obj[actor_no].
eye > face[actor_no].eye_max) {
265 face[actor_no].
blink = BLINK_IDLE;
271 switch (face[actor_no].blink) {
273 if (CScript__2.
obj[actor_no].
eye < face[actor_no].eye_max) {
274 CScript__2.
obj[actor_no].
eye++;
276 if (CScript__2.
obj[actor_no].
eye == face[actor_no].eye_max) {
277 face[actor_no].
blink = BLINK_OPENING;
283 if (CScript__2.
obj[actor_no].
eye > 0) {
284 CScript__2.
obj[actor_no].
eye--;
289 }
else if (rand() % 200 == 0) {
290 if (CScript__2.
obj[actor_no].
eye == 0) {
291 face[actor_no].
blink = BLINK_CLOSING;
292 CScript__2.
obj[actor_no].
eye = 1;
295 }
else if (actor_no == 2) {
296 if (CScript__2.
obj[2].
eye == 5) {
297 CScript__2.
obj[2].
eye = 4;
300 CScript__2.
obj[actor_no].
eye = 0;
301 face[actor_no].
blink = BLINK_IDLE;
304 CScript__2.
obj[actor_no].
eye = 0;
305 face[actor_no].
blink = BLINK_IDLE;
309 face[actor_no].
eye = CScript__2.
obj[actor_no].
eye;
311 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8,
CRect<int>(0, face[actor_no].strip_bottom - face[actor_no].eye_height * (face[actor_no].eye + 1), 128, face[actor_no].eye_height), dbp, dbw, SCE_GS_PSMT8, 0, 88 - face[actor_no].eye_bottom, 0);
315 if (CScript__2.
obj[2].
eye == 4) {
316 CScript__2.
obj[2].
eye = 5;
319 if (CScript__2.
obj[2].
eye == 6) {
320 CScript__2.
obj[2].
eye = 7;
325 if (CScript__2.
obj[3].
eye == 3) {
326 CScript__2.
obj[3].
eye = 4;
335 if (CScript__2.
obj[actor_no].
talk) {
337 if (rand() % 5 == 0) {
339 if ((
int) (100.0f * CScript__2.
obj[actor_no].
mouth_time) % 6 == 0) {
341 CScript__2.
obj[actor_no].
mouth = rand() % 4;
346 CScript__2.
obj[actor_no].
talk =
false;
352 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8,
CRect<int>(128, face[actor_no].strip_bottom - face[actor_no].mouth_height * (face[actor_no].mouth + 1), 128, face[actor_no].mouth_height), dbp, dbw, SCE_GS_PSMT8, 0, 88 - face[actor_no].mouth_bottom, 0);
360 sceVif1PkCnt(Vif1Packet, 0);
361 sceVif1PkOpenDirectCode(Vif1Packet, 0);
362 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
363 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
364 sceVif1PkCloseGifTag(Vif1Packet);
365 sceVif1PkCloseDirectCode(Vif1Packet);
368void LoadCharaData(
int buffer_no,
int actor_no) {
370 {
"opdat/chara/01c07a.chr",
"01c07a.cfg"},
371 {
"opdat/chara/01c08a.chr",
"01c08a.cfg"},
372 {
"opdat/chara/01c11a.chr",
"01c11a.cfg"},
373 {
"opdat/chara/01c09a.chr",
"01c09a.cfg"},
374 {
"opdat/chara/01c08b.chr",
"01c08b.cfg"},
375 {
"opdat/chara/01c08c.chr",
"01c08c.cfg"}
380 LoadFileBG(name[actor_no][0], (u_long128 *) read_buffer, 0);
391 CharaDataBuffer__2[buffer_no].
used = 0;
392 Chara__3[actor_no].
LoadPackData(read_buffer, name[actor_no][1], &CharaDataBuffer__2[buffer_no], 0);
397 CScript__2.
obj[actor_no].
load = -1;
406void LoadMotionData() {
407 char *motion_files[20][2] = {
408 {
"opdat/chara/01p19a1a.chr",
"01p19a1a.cfg"},
409 {
"opdat/chara/01p19a1b.chr",
"01p19a1b.cfg"},
410 {
"opdat/chara/01p19a2a.chr",
"01p19a2a.cfg"},
411 {
"opdat/chara/01p19a2a.chr",
"01p19a2a.cfg"},
412 {
"opdat/chara/01p19a2b.chr",
"01p19a2b.cfg"},
413 {
"opdat/chara/01p19a3.chr",
"01p19a3.cfg" },
414 {
"opdat/chara/01p19a3b.chr",
"01p19a3b.cfg"},
415 {
"opdat/chara/01p19a4a.chr",
"01p19a4a.cfg"},
416 {
"opdat/chara/01p19a4b.chr",
"01p19a4b.cfg"},
417 {
"opdat/chara/01p19a5.chr",
"01p19a5.cfg" },
418 {
"opdat/chara/01p17a1a.chr",
"01p17a1a.cfg"},
419 {
"opdat/chara/01p17a1b.chr",
"01p17a1b.cfg"},
420 {
"opdat/chara/01p17a2a.chr",
"01p17a2a.cfg"},
421 {
"opdat/chara/01p17a2a.chr",
"01p17a2a.cfg"},
422 {
"opdat/chara/01p17a2b.chr",
"01p17a2b.cfg"},
423 {
"opdat/chara/01p17a3.chr",
"01p17a3.cfg" },
424 {
"opdat/chara/01p17a3b.chr",
"01p17a3b.cfg"},
425 {
"opdat/chara/01p17a4a.chr",
"01p17a4a.cfg"},
426 {
"opdat/chara/01p17a4b.chr",
"01p17a4b.cfg"},
427 {
"opdat/chara/01p17a5.chr",
"01p17a5.cfg" }
431 if (Chara__3[6].motion_type.state.time > (
float) (Chara__3[6].motion_type.motion_info->end - 1)) {
433 CharaDataBuffer__2[6].
used = 0;
434 Chara__3[6].
LoadPackData((u_int *) ((
char *) read_buffer + 0x10C900), motion_files[DanceCnt][1], &CharaDataBuffer__2[4], &CharaDataBuffer__2[6], 0);
435 Chara__3[7].
LoadPackData(read_buffer, motion_files[DanceCnt + 10][1], &CharaDataBuffer__2[4], &CharaDataBuffer__2[6], 0);
446 if (DanceCnt != 3 && DanceCnt < 10) {
447 LoadFileBG(motion_files[DanceCnt][0], (u_long128 *) ((
char *) read_buffer + 0x10C900), 0);
448 LoadFileBG(motion_files[DanceCnt + 10][0], (u_long128 *) read_buffer, 0);
456 if (Chara__3[6].motion_type.state.time > 225.0f) {
460 if (DanceStart == 1) {
472void OpB_LoadDataBG() {
476 LoadFileBG(
"opdat/norn/norn.pak", (u_long128 *) read_buffer, 0);
477 CScript__2.
load_no = OP_SCENE_NONE;
480void OpB_LoadDataBG2() {
484 LoadFileBG(
"opdat/toan/toan.pim", (u_long128 *) read_buffer, 0);
485 CScript__2.
load_no = OP_SCENE_NONE;
495void OpB_InitProcess() {
497 {
"#blender#640#" HALF_BUFFER_HEIGHT_STR
"#4", 0, 0},
498 {
"#fontbase#512#256#1", 26, 0},
499 {
"#fukidashibase#640#" HALF_BUFFER_HEIGHT_STR
"#4", 26, 0},
500 {
"#shadow_buff#640#" HALF_BUFFER_HEIGHT_STR
"#4", 23, 0},
501 {
"#frame_image#640#" HALF_BUFFER_HEIGHT_STR
"#4", 21, 0},
528 texture_list[5].name = (
char *) GetPackFile(read_buffer,
"p09a01.img", 0);
529 texture_list[6].name = (
char *) GetPackFile(read_buffer,
"e01b01.img", 0);
530 texture_list[7].name = (
char *) GetPackFile(read_buffer,
"e01b02.img", 0);
531 texture_list[8].name = (
char *) GetPackFile(read_buffer,
"e01b03.img", 0);
532 texture_list[9].name = (
char *) GetPackFile(read_buffer,
"e01t01.img", 0);
533 texture_list[10].name = (
char *) GetPackFile(read_buffer,
"t0003.img", 0);
534 texture_list[11].name = (
char *) GetPackFile(read_buffer,
"e01s03.img", 0);
535 texture_list[12].name = (
char *) GetPackFile(read_buffer,
"e01s06.img", 0);
536 texture_list[13].name = (
char *) GetPackFile(read_buffer,
"t0001.img", 0);
537 texture_list[14].name = (
char *) GetPackFile(read_buffer,
"t0002.img", 0);
538 texture_list[15].name = (
char *) GetPackFile(read_buffer,
"gaiji.img", 0);
539 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"fuki256.img", 0);
540 texture_list[17].name = (
char *) GetPackFile(read_buffer,
"syst04.img", 0);
541 texture_list[18].name = (
char *) GetPackFile(read_buffer,
"fire.img", 0);
542 texture_list[19].name = (
char *) GetPackFile(read_buffer,
"pause.img", 0);
545 switch (LanguageCode) {
547 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
549 case LANG_ENGLISH_US:
550 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
552 case LANG_ENGLISH_UK:
553 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
556 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_f.img", 0);
559 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_g.img", 0);
562 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_i.img", 0);
565 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_s.img", 0);
569 texture_list[21].name = (
char *) GetPackFile(read_buffer,
"p09a01an.img", 0);
571 texture_list[20].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
572 texture_list[21].name = (
char *) GetPackFile(read_buffer,
"start2.img", 0);
573 texture_list[22].name = (
char *) GetPackFile(read_buffer,
"p09a01an.img", 0);
576 TexManager.Initialize(16352);
577 TexManager.LoadTextureBlock(-1, texture_list);
580 CharaTex__2[11] = 22;
582 CharaTex__2[10] = 22;
587 CSnd.
SetVol(MIDI_PORT_SE_TITLE, 256);
588 CSnd.
SetVol(MIDI_PORT_SE_DEFAULT, 256);
589 CSnd.
SetVol(MIDI_PORT_UNK_D, 256);
590 CSnd.
SetVol(MIDI_PORT_SE_SPECIAL, 256);
593 CSnd.
SQ_Play(MIDI_PORT_AMBIENT, 0);
594 OpPlayVolSE(MIDI_PORT_SE_TITLE, 16, 22, 0.6f);
596 CSnd.
SE_Play(MIDI_PORT_SE_TITLE, 16, 21, 0);
598 OPAnalyz(
"opdat/norn.cfg");
602 {
"opdat/norn/t0005.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} },
603 {
"opdat/norn/e01h01_0.mds",
"opdat/norn/e01h01_s.mds", {-35.0f, 0.0f, -10.0f}, {0.0f, 0.0f, 0.0f} },
604 {
"opdat/norn/e01h03_2.mds",
"opdat/norn/e01h03_s.mds", {-15.0f, 0.0f, -50.0f}, {0.0f, 0.0f, 0.0f} },
605 {
"opdat/norn/e01h10_2.mds",
"opdat/norn/e01h10_s.mds", {15.0f, 0.0f, -50.0f}, {0.0f, 0.0f, 0.0f} },
606 {
"opdat/norn/e01h07_0.mds",
"opdat/norn/e01h07_s.mds", {5.0f, 0.0f, -10.0f}, {0.0f, 0.0f, 0.0f} },
607 {
"opdat/norn/e01h08_2.mds",
"opdat/norn/e01h08_s.mds", {-45.0f, 0.0f, -35.0f}, {0.0f, 0.0f, 0.0f} },
608 {
"opdat/norn/t0002.mds", 0, {-35.0f, 0.0f, -55.0f}, {0.0f, 0.0f, 0.0f} },
609 {0, 0, {-55.0f, 0.0f, -45.0f}, {0.0f, 0.0f, 0.0f} },
610 {
"opdat/norn/e01t01_0.mds", 0, {-5.0f, 0.1f, 5.0f}, {0.0f, 0.0f, 0.0f} },
611 {
"opdat/norn/e01t01_1.mds", 0, {15.0f, 0.1f, 5.0f}, {0.0f, 0.0f, 0.0f} },
612 {0, 0, {-55.0f, 0.1f, 15.0f}, {0.0f, 0.0f, 0.0f} },
613 {
"opdat/norn/e01t01_2.mds", 0, {-45.0f, 0.1f, -55.0f}, {0.0f, 0.0f, 0.0f} },
614 {0, 0, {-55.0f, 0.1f, -65.0f}, {0.0f, 0.0f, 0.0f} },
615 {0, 0, {-45.0f, 0.1f, -65.0f}, {0.0f, 0.0f, 0.0f} },
616 {0, 0, {-35.0f, 0.1f, -65.0f}, {0.0f, 0.0f, 0.0f} },
617 {0, 0, {-5.0f, 0.1f, -75.0f}, {0.0f, 0.0f, 0.0f} },
618 {0, 0, {5.0f, 0.1f, -75.0f}, {0.0f, 0.0f, 0.0f} },
619 {0, 0, {15.0f, 0.1f, -65.0f}, {0.0f, 0.0f, 0.0f} },
620 {0, 0, {25.0f, 0.1f, -65.0f}, {0.0f, 0.0f, 0.0f} },
621 {0, 0, {35.0f, 0.1f, -55.0f}, {0.0f, 0.0f, 0.0f} },
622 {
"opdat/norn/e01c01_0.mds", 0, {25.0f, 0.0f, -35.0f}, {0.0f, 180.0f, 0.0f}},
623 {0, 0, {-55.0f, 0.0f, -25.0f}, {0.0f, 90.0f, 0.0f} },
624 {0, 0, {-55.0f, 0.0f, -25.0f}, {0.0f, -90.0f, 0.0f}},
625 {
"opdat/norn/e01c02_0.mds", 0, {-25.0f, 0.0f, -35.0f}, {0.0f, 90.0f, 0.0f} },
626 {0, 0, {-5.0f, 0.0f, -35.0f}, {0.0f, 90.0f, 0.0f} },
627 {0, 0, {5.0f, 0.0f, -35.0f}, {0.0f, 90.0f, 0.0f} },
628 {0, 0, {15.0f, 0.0f, -35.0f}, {0.0f, 90.0f, 0.0f} },
629 {0, 0, {25.0f, 0.0f, -15.0f}, {0.0f, 0.0f, 0.0f} },
630 {0, 0, {25.0f, 0.0f, -5.0f}, {0.0f, 0.0f, 0.0f} },
631 {0, 0, {25.0f, 0.0f, 5.0f}, {0.0f, 0.0f, 0.0f} },
632 {0, 0, {15.0f, 0.0f, 15.0f}, {0.0f, 90.0f, 0.0f} },
633 {0, 0, {-5.0f, 0.0f, 15.0f}, {0.0f, 90.0f, 0.0f} },
634 {0, 0, {-15.0f, 0.0f, 15.0f}, {0.0f, 90.0f, 0.0f} },
635 {0, 0, {-35.0f, 0.0f, 15.0f}, {0.0f, 90.0f, 0.0f} },
636 {0, 0, {-45.0f, 0.0f, 25.0f}, {0.0f, 0.0f, 0.0f} },
637 {0, 0, {-45.0f, 0.0f, 35.0f}, {0.0f, 0.0f, 0.0f} },
638 {0, 0, {-45.0f, 0.0f, 45.0f}, {0.0f, 0.0f, 0.0f} },
639 {
"opdat/norn/e01c06_0.mds", 0, {-35.0f, 0.0f, -35.0f}, {0.0f, 90.0f, 0.0f} },
640 {
"opdat/norn/e01c07_0.mds", 0, {-15.0f, 0.0f, -35.0f}, {0.0f, -90.0f, 0.0f}},
641 {0, 0, {25.0f, 0.0f, -25.0f}, {0.0f, 0.0f, 0.0f} },
642 {0, 0, {5.0f, 0.0f, 15.0f}, {0.0f, 90.0f, 0.0f} },
643 {0, 0, {0.0f, 0.0f, 15.0f}, {0.0f, 90.0f, 0.0f} },
644 {
"opdat/norn/e01r01_0.mds", 0, {-55.0f, 0.05f, -35.0f}, {0.0f, -90.0f, 0.0f}},
645 {0, 0, {-55.0f, 0.05f, -25.0f}, {0.0f, 90.0f, 0.0f} },
646 {
"opdat/norn/e01r02_0.mds", 0, {-45.0f, 0.05f, -25.0f}, {0.0f, 90.0f, 0.0f} },
647 {0, 0, {-35.0f, 0.05f, -25.0f}, {0.0f, 90.0f, 0.0f} },
648 {0, 0, {-25.0f, 0.05f, -25.0f}, {0.0f, 90.0f, 0.0f} },
649 {0, 0, {-5.0f, 0.05f, -25.0f}, {0.0f, 90.0f, 0.0f} },
650 {0, 0, {5.0f, 0.05f, -25.0f}, {0.0f, 90.0f, 0.0f} },
651 {0, 0, {15.0f, 0.05f, -25.0f}, {0.0f, 90.0f, 0.0f} },
652 {0, 0, {-15.0f, 0.05f, -15.0f}, {0.0f, 0.0f, 0.0f} },
653 {
"opdat/norn/e01r03_0.mds", 0, {-15.0f, 0.05f, -25.0f}, {0.0f, 0.0f, 0.0f} },
654 {
"opdat/norn/e01r06_0.mds", 0, {-65.0f, 0.05f, -35.0f}, {0.0f, 90.0f, 0.0f} },
655 {0, 0, {-15.0f, 0.05f, -5.0f}, {0.0f, 180.0f, 0.0f}},
656 {
"opdat/norn/t0004.mds", 0, {-22.9331f, 0.05f, 9.8816f}, {0.0f, 0.0f, 0.0f} },
657 {0, 0, {-26.9302f, 0.05f, 9.8816f}, {0.0f, 0.0f, 0.0f} },
658 {0, 0, {-26.9302f, 0.05f, 20.2919f}, {0.0f, 0.0f, 0.0f} },
659 {0, 0, {-22.9331f, 0.05f, 20.2919f}, {0.0f, 0.0f, 0.0f} },
660 {0, 0, {3.0797f, 0.05f, 20.2919f}, {0.0f, 0.0f, 0.0f} },
661 {0, 0, {7.0849f, 0.05f, 20.2919f}, {0.0f, 0.0f, 0.0f} },
662 {0, 0, {7.0849f, 0.05f, 9.8816f}, {0.0f, 0.0f, 0.0f} },
663 {0, 0, {3.0797f, 0.05f, 9.8816f}, {0.0f, 0.0f, 0.0f} },
664 {0, 0, {19.8785f, 0.05f, -22.8436f}, {0.0f, 0.0f, 0.0f} },
665 {0, 0, {19.8785f, 0.05f, -27.0007f}, {0.0f, 0.0f, 0.0f} },
666 {0, 0, {-12.8131f, 0.05f, -28.8014f}, {0.0f, 0.0f, 0.0f} },
667 {0, 0, {-16.9416f, 0.05f, -28.8014f}, {0.0f, 0.0f, 0.0f} },
668 {
"opdat/norn/e01g02_0.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} },
669 {
"opdat/norn/e01g03_0.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} }
676 MapDataBuffer.
used = 0;
678 for (
int i = 0; i < 68; i++) {
680 LoadFile(norn[i].name, (
void *) read_buffer, 0);
681 frame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
685 DoransFuusya[0] = frame;
689 DoransFuusya[1] = frame;
692 if (i >= 54 && i < 66) {
693 TaimatsuFrame[i - 54] = frame;
696 frame->SetAttr(attr, 1, 64);
697 SetFrameAttr(frame, 1);
699 object = &OP_NornMapObj[i];
701 object->Initialize();
702 object->SetFrame(frame, 0);
703 OP_NornMapObj[i].
handle = 0;
704 OP_NornMapObj[i].
unk_34 = 0;
706 object->SetPosition(
CVector3_f_(10.0f * norn[i].position[0], 10.0f * norn[i].position[1], 10.0f * norn[i].position[2]));
707 object->SetRotation(
CVector3_f_((
float) (PI_D * norn[i].rotation[0] / 180), (
float) (PI_D * norn[i].rotation[1] / 180), (
float) (PI_D * norn[i].rotation[2] / 180)));
709 object->FrameObjectOnOff(
"win1", 0);
710 object->FrameObjectOnOff(
"light1", 0);
712 if (norn[i].shadow_name) {
713 LoadFile(norn[i].shadow_name, (
void *) read_buffer, 0);
714 object->shadow_frame = LoadMDSFile(read_buffer, &MapDataBuffer, 14, 0, 0);
715 object->shadow_offset = -20.0f;
720 {
"opdat/norn/t0006.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}},
721 {
"opdat/norn/t0001.mds", 0, {-25.0203f, 0.03f, -21.3403f}, {0.0f, 0.0f, 0.0f}},
722 {0, 0, {-35.0203f, 0.03f, -21.3403f}, {0.0f, 0.0f, 0.0f}},
723 {0, 0, {-45.0203f, 0.03f, -21.3403f}, {0.0f, 0.0f, 0.0f}},
724 {0, 0, {-55.0203f, 0.03f, -21.3403f}, {0.0f, 0.0f, 0.0f}},
725 {0, 0, {-45.0203f, 0.03f, -28.3403f}, {0.0f, 0.0f, 0.0f}},
726 {0, 0, {-35.0203f, 0.03f, -28.3403f}, {0.0f, 0.0f, 0.0f}},
727 {0, 0, {-25.0203f, 0.03f, -28.3403f}, {0.0f, 0.0f, 0.0f}},
728 {0, 0, {-5.0203f, 0.03f, -28.3403f}, {0.0f, 0.0f, 0.0f}},
729 {0, 0, {4.9797f, 0.03f, -28.3403f}, {0.0f, 0.0f, 0.0f}},
730 {0, 0, {14.9797f, 0.03f, -21.3403f}, {0.0f, 0.0f, 0.0f}},
731 {0, 0, {14.9797f, 0.03f, -28.3403f}, {0.0f, 0.0f, 0.0f}},
732 {0, 0, {4.9797f, 0.03f, -21.3403f}, {0.0f, 0.0f, 0.0f}},
733 {0, 0, {-5.0203f, 0.03f, -21.3403f}, {0.0f, 0.0f, 0.0f}},
734 {
"opdat/norn/t0003.mds", 0, {-50.0f, 0.03f, -21.2932f}, {0.0f, 0.0f, 0.0f}},
735 {0, 0, {-40.0f, 0.03f, -21.2932f}, {0.0f, 0.0f, 0.0f}},
736 {0, 0, {-30.0f, 0.03f, -21.2932f}, {0.0f, 0.0f, 0.0f}},
737 {0, 0, {0.0f, 0.03f, -21.2932f}, {0.0f, 0.0f, 0.0f}},
738 {0, 0, {10.0f, 0.03f, -21.2932f}, {0.0f, 0.0f, 0.0f}},
739 {0, 0, {10.0f, 0.03f, -28.2932f}, {0.0f, 0.0f, 0.0f}},
740 {0, 0, {-30.0f, 0.03f, -28.2932f}, {0.0f, 0.0f, 0.0f}},
741 {0, 0, {0.0f, 0.03f, -28.2932f}, {0.0f, 0.0f, 0.0f}},
742 {0, 0, {-40.0f, 0.03f, -28.2932f}, {0.0f, 0.0f, 0.0f}}
745 for (
int i = 0; i < 23; i++) {
746 if (ground[i].name) {
747 LoadFile(ground[i].name, (
void *) read_buffer, 0);
748 frame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
752 frame->SetAttr(attr, 1, 64);
753 SetFrameAttr(frame, 1);
757 CFrame *sun = frame->SearchFrame(
"sun3");
758 sceVu0FVECTOR position;
760 sceVu0CopyVector(position, sun->
position);
761 position[1] += 30.0f;
762 position[2] -= 300.0f;
763 sun->SetPosition(position);
766 object = &OP_NornMapObj2[i];
768 object->Initialize();
769 object->SetFrame(frame, 0);
770 OP_NornMapObj2[i].
handle = 0;
771 OP_NornMapObj2[i].
unk_34 = 0;
773 object->SetPosition(
CVector3_f_(10.0f * ground[i].position[0], 10.0f * ground[i].position[1], 10.0f * ground[i].position[2]));
777 LoadFile(
"opdat/chara/03p09a.chr", (
void *) read_buffer, 0);
778 CharaDataBuffer__2[6].
used = 0;
779 Chara__3[9].
LoadPackData(read_buffer,
"03p09a.cfg", &CharaDataBuffer__2[6], 0);
784 Chara__3[9].
frame->SetAttr(chara_attr, 1, 4);
802 strcpy(Fuusya[0].name,
"hane");
803 InitObjAnime(DoransFuusya[0], &Fuusya[0]);
817 strcpy(Fuusya[1].name,
"hane");
818 InitObjAnime(DoransFuusya[1], &Fuusya[1]);
820 for (
int i = 0; i < 12; i++) {
823 Taimatsu[i].
mode = 4;
830 strcpy(Taimatsu[i].name,
"effect");
831 InitObjAnime(TaimatsuFrame[i], &Taimatsu[i]);
845void OpB_InitProcess2() {
847 {
"#blender#640#" HALF_BUFFER_HEIGHT_STR
"#4", 0, 0},
848 {
"#fontbase#512#256#1", 26, 0},
849 {
"#fukidashibase#640#" HALF_BUFFER_HEIGHT_STR
"#4", 26, 0},
850 {
"#shadow_buff#640#" HALF_BUFFER_HEIGHT_STR
"#4", 23, 0},
851 {
"#frame_image#640#" HALF_BUFFER_HEIGHT_STR
"#4", 21, 0},
874 texture_list[5].name = (
char *) GetPackFile(read_buffer,
"gaiji.img", 0);
875 texture_list[6].name = (
char *) GetPackFile(read_buffer,
"fuki256.img", 0);
876 texture_list[7].name = (
char *) GetPackFile(read_buffer,
"syst04.img", 0);
877 texture_list[8].name = (
char *) GetPackFile(read_buffer,
"i01h01n.img", 0);
878 texture_list[9].name = (
char *) GetPackFile(read_buffer,
"p09a01.img", 0);
879 texture_list[10].name = (
char *) GetPackFile(read_buffer,
"p10a01.img", 0);
880 texture_list[11].name = (
char *) GetPackFile(read_buffer,
"c01d01.img", 0);
881 texture_list[12].name = (
char *) GetPackFile(read_buffer,
"03c01d.img", 0);
882 texture_list[13].name = (
char *) GetPackFile(read_buffer,
"03komono.img", 0);
883 texture_list[14].name = (
char *) GetPackFile(read_buffer,
"fire.img", 0);
884 texture_list[15].name = (
char *) GetPackFile(read_buffer,
"pause.img", 0);
887 switch (LanguageCode) {
889 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
891 case LANG_ENGLISH_US:
892 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
894 case LANG_ENGLISH_UK:
895 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
898 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_f.img", 0);
901 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_g.img", 0);
904 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_i.img", 0);
907 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_s.img", 0);
911 texture_list[17].name = (
char *) GetPackFile(read_buffer,
"p09a01an.img", 0);
913 texture_list[16].name = (
char *) GetPackFile(read_buffer,
"pause_e.img", 0);
914 texture_list[17].name = (
char *) GetPackFile(read_buffer,
"start2.img", 0);
915 texture_list[18].name = (
char *) GetPackFile(read_buffer,
"p09a01an.img", 0);
918 TexManager.Initialize(16352);
919 TexManager.LoadTextureBlock(-1, texture_list);
922 OPAnalyz(
"opdat/toan.cfg");
925 LoadFile(
"opdat/toan/t0101.mds", (
void *) read_buffer, 0);
926 MapDataBuffer.
used = 0;
927 ToansHouse = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
928 OP_ToanMapObj.Initialize();
929 OP_ToanMapObj.SetFrame(ToansHouse, 0);
933 LoadFile(
"opdat/toan/03komono.chr", (
void *) read_buffer, 0);
934 Komono.
LoadPackData(read_buffer,
"03komono.cfg", &MapDataBuffer, 0);
939 Komono.
frame->SetAttr(komono_attr, 1, 4);
945 LoadFile(
"opdat/chara/03p10a.chr", (
void *) read_buffer, 0);
946 Chara__3[10].
LoadPackData(read_buffer,
"03p10a.cfg", &CharaDataBuffer__2[6], 0);
951 Chara__3[10].
frame->SetAttr(mother_attr, 1, 4);
957 CFrame *soup = Chara__3[10].
frame->SearchFrame(
"soup_nakami2");
963 LoadFile(
"opdat/chara/03c01d.chr", (
void *) read_buffer, 0);
964 Chara__3[8].
LoadPackData(read_buffer,
"03c01d.cfg", &CharaDataBuffer__2[6], 0);
969 Chara__3[8].
frame->SetAttr(toan_attr, 1, 4);
975 sceVu0FVECTOR wind_dir;
983 Chara__3[8].
wind = (int) &Wind;
986 LoadFile(
"opdat/chara/03c01d2.chr", (
void *) read_buffer, 0);
987 Chara__3[11].
LoadPackData(read_buffer,
"03c01d2.cfg", &CharaDataBuffer__2[6], 0);
990 Chara__3[11].
frame->SetAttr(toan_attr, 1, 4);
1008 strcpy(Door.
name,
"door_1");
1009 InitObjAnime(ToansHouse, &Door);
1011 CSnd.
SE_Stop(MIDI_PORT_SE_TITLE, 16, 22, 0);
1012 CSnd.
SE_Stop(MIDI_PORT_SE_TITLE, 16, 21, 0);
1013 CSnd.
SetVol(MIDI_PORT_BGM, (
float) (OpGetVolSQ(0) * 0.5));
1014 CSnd.
SetVol(MIDI_PORT_AMBIENT, (
float) (OpGetVolSQ(1) * 0.1));
1023void OpB_MotionProcess() {
1024 for (
int i = 8; i < 12; i++) {
1027 if (Chara__3[i].motion_type.state.time > (
float) (Chara__3[i].motion_type.motion_info[CScript__2.
obj[i].
motion].end - 1)) {
1040 char *frame_names[4] = {
"c01d",
"p09a",
"p10a",
"c01d"};
1041 sceVu0FMATRIX matrix;
1045 sceVu0FVECTOR wind_dir;
1047 for (
int i = 0; i < 4; i++) {
1048 CFrame *frame = Cam__2[SceneNp__2].
frame->SearchFrame(frame_names[i]);
1051 frame->GetLWMatrix(matrix);
1053 float rot_y = atan2f(matrix[2][0], matrix[2][2]);
1054 float rot_x = 0.0f, rot_z = 0.0f;
1058 Chara__3[i + 8].
SetRotation(zero, atan2f(matrix[2][0], matrix[2][2]), zero);
1060 float x = matrix[3][0];
1061 float y = matrix[3][1];
1062 float z = matrix[3][2];
1075 static int camera = 0;
1083 for (
int i = 0; i < 10; i++) {
1091 for (
int i = 0; i < 10; i++) {
1097 if (CScript__2.
scene == OP_SCENE_NORUNE && !Pause) {
1098 ObjAnimePlay(&Fuusya[0]);
1099 ObjAnimePlay(&Fuusya[1]);
1101 for (
int i = 0; i < 12; i++) {
1102 ObjAnimePlay(&Taimatsu[i]);
1106 if (CScript__2.
scene == OP_SCENE_TOAN_HOUSE) {
1107 if (CScript__2.
sprite == 1) {
1112 if (CScript__2.
sprite == 2) {
1118 ObjAnimePlay(&Door);
1129void OpB_SoundProcess() {
1130 if (CScript__2.
scene == OP_SCENE_NORUNE) {
1134 static int wait = 0;
1135 sceVu0FVECTOR position;
1138 sceVu0CopyVector(position, Chara__3[9].pos);
1139 motion_frame = (int) Chara__3[9].motion_type.state.time;
1142 if (motion_frame > 28 && motion_frame < 30) {
1143 if (camera_time < 387.0f) {
1144 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 20);
1146 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 32);
1150 }
else if (motion_frame > 38 && motion_frame < 40) {
1151 if (camera_time < 387.0f) {
1152 OpPlayVolPanSE(&position[0], (
float) (10 + (motion_frame & 0)), (
float) (wait - wait + 400), MIDI_PORT_SE_DEFAULT, 21, 21);
1154 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 33);
1164 sceVu0FVECTOR river = {50.0f, 50.0f, -100.0f, 0.0f};
1166 OpSetVolPanSE(river, 100.0f, 400.0f, 15, 16, 21);
1167 }
else if (CScript__2.
scene == OP_SCENE_TOAN_HOUSE) {
1168 if (CScript__2.
sprite == 1) {
1169 CSnd.
SetVol(MIDI_PORT_BGM, (
float) (OpGetVolSQ(0) * 1.0));
1170 CSnd.
SetVol(MIDI_PORT_AMBIENT, (
float) (OpGetVolSQ(1) * 0.7));
1174 CSnd.
SetVol(MIDI_PORT_BGM, (
float) (OpGetVolSQ(0) * 0.5));
1175 CSnd.
SetVol(MIDI_PORT_AMBIENT, (
float) (OpGetVolSQ(1) * 0.1));
1179 static int wait = 0;
1180 sceVu0FVECTOR position;
1183 sceVu0CopyVector(position, Chara__3[9].pos);
1184 motion_frame = (int) Chara__3[10].motion_type.state.time;
1187 if (motion_frame > 134 && motion_frame < 136) {
1188 OpPlayVolPanSE(position, 50.0f, 300.0f, MIDI_PORT_SE_DEFAULT, 21, 32);
1190 }
else if (motion_frame > 144 && motion_frame < 146) {
1191 OpPlayVolPanSE(position, 50.0f, 300.0f, MIDI_PORT_SE_DEFAULT, 21, 33);
1199 sceVu0FVECTOR position;
1201 sceVu0CopyVector(position, Chara__3[10].pos);
1202 OpSetVolPanSE(position, 100.0f, 200.0f, 14, 40, 39);
1211void OpB_DrawProcess() {
1214 MGSetRenderInfo(info->
scale[0], 0.5f, 0xffff);
1215 TexManager.ReloadTexture(Vif1Packet, 10);
1217 switch (CScript__2.
scene) {
1218 case OP_SCENE_NORUNE:
1219 for (
int i = 0; i < 68; i++) {
1225 TexManager.ReloadTexture(Vif1Packet, 11);
1227 for (
int i = 0; i < 23; i++) {
1235 case OP_SCENE_TOAN_HOUSE:
1237 OP_ToanMapObj.Draw();
1241 if (OP_FireList > 0) {
1244 TexManager.ReloadTexture(GetVif1Packet(), 0);
1245 OP_CharaFrame__2 = Cam__2[SceneNp__2].
frame;
1246 sceVu0CopyVector(eye, OP_CharaFrame__2->
position);
1254 for (
int i = 0; i < OP_FireList; i++) {
1255 float z = OP_FirePosition[i][2];
1256 float y = OP_FirePosition[i][1];
1257 float x = OP_FirePosition[i][0];
1259 CFire.
pos[0] = 10.0f * x;
1260 CFire.
pos[1] = 10.0f * y;
1261 CFire.
pos[2] = 10.0f * z;
1262 CFire.
pos[3] = 1.0f;
1264 int fire_flag = OP_FireFlg[i];
1266 if (fire_flag == 1) {
1267 CFire.DrawFire(1, 1, &OP_MainCamera, eye, OP_FireScale[i], 3, 15.0f);
1269 CFire.DrawFire(1, 1, &OP_MainCamera, eye, OP_FireScale[i], 2, 15.0f);
1274 if (CScript__2.
sprite == 3) {
1275 CFrame *frame = Chara__3[8].
frame->SearchFrame(
"soup_nakami");
1282 TexManager.ReloadTexture(Vif1Packet, 23);
1283 MGBeginDrawShadow(*(
sceGsTex0 *) &TexManager.GetTexture(
"shadow_buff", -1)->
tex0);
1285 for (
int i = 8; i < 12; i++) {
1295 MGEndDrawShadow(52);
1297 for (
int i = 8; i < 12; i++) {
1299 TexManager.ReloadTexture(Vif1Packet, CharaTex__2[i]);
1314 if (CScript__2.
scene == OP_SCENE_TOAN_HOUSE) {
1315 TexManager.ReloadTexture(Vif1Packet, 22);
1324 if (CScript__2.
scene == OP_SCENE_NORUNE) {
1325 TexManager.ReloadTexture(Vif1Packet, 23);
1326 MGBeginDrawShadow(*(
sceGsTex0 *) &TexManager.GetTexture(
"shadow_buff", -1)->
tex0);
1328 switch (CScript__2.
scene) {
1329 case OP_SCENE_NORUNE:
1330 for (
int i = 0; i < 68; i++) {
1331 OP_NornMapObj[i].DrawShadow(0);
1336 case OP_SCENE_TOAN_HOUSE:
1337 OP_ToanMapObj.DrawShadow(0);
1341 MGEndDrawShadow(52);
1344 if (CScript__2.
scene != OP_SCENE_TOAN_HOUSE) {
1345 TexManager.ReloadTexture(Vif1Packet, 21);
1347 float dof[2] = {300.0f, 1000.0f};
1349 DepthOfField(dof, 2, 64, 0);
1365static void setTexAnime() {
1366 sceGifTag giftag = {0, 1, 0, 0, 0, 0, 1, SCE_GIF_PACKED_AD};
1374 sceVif1PkCnt(Vif1Packet, 0);
1375 sceVif1PkOpenDirectCode(Vif1Packet, 0);
1376 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &giftag);
1377 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
1378 sceVif1PkCloseGifTag(Vif1Packet);
1379 sceVif1PkCloseDirectCode(Vif1Packet);
1380 sceVif1PkTerminate(Vif1Packet);
1382 plate = TexManager.GetTexture(
"i01e01", -1);
1383 strip = TexManager.GetTexture(
"i01e01_a", -1);
1385 if (plate == 0 || strip == 0) {
1389 dbp = plate->
tex0 & 0x3fff;
1390 dbw = (plate->
tex0 >> 14) & 0x3f;
1391 sbp = strip->
tex0 & 0x3fff;
1392 sbw = (strip->
tex0 >> 14) & 0x3f;
1394 static float cnt = 0.0f;
1396 MoveImageTest(Vif1Packet, sbp, sbw, 0,
CRect<int>(0, (
int) cnt * 64, 64, 64), dbp, dbw, 0, 0, 0, 0);
virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2< 1 > *model_alloc, CDataAlloc2< 1 > *texture_alloc)
virtual void ShadowStep()
tagMOTION_TYPE motion_type
virtual void SetRotation(float x, float y, float z)
virtual void DrawShadow()
virtual void Initialize()
virtual void SetPosition(float x, float y, float z)
virtual void ClothStep(int step)
CFrameVu1 * collision_frame
void SE_Play(int port, int bank, int program, int pan, int velocity, int volume, int voice)
int LoadSoundFileFromPack(char *name, unsigned int *pack)
void SetVol(int port, int volume)
void SE_Stop(int port, int bank, int program, int voice)
void SQ_Play(int port, int seq_no)
void SetReverb(int core, int mode, int depth)
void SetVelocity(float speed)
void SetDir(float *direction)
sceVu0FVECTOR start_value
MOTION_INFO * motion_info