1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
5#pragma argument_flag_ones 91, 97, 98, 99, 104, 136, 164, 165, 166, 167
6#pragma argument_flag_ones 174, 175, 176, 177, 257, 258, 259, 268, 269, 270
7#pragma argument_flag_ones 304, 305, 306, 332, 334, 345, 347, 401, 403, 443
8#pragma argument_flag_ones 454, 464, 713, 723, 725, 733, 739, 742, 743, 744
9#pragma argument_flag_ones 782
11#pragma argument_flag 0
12#pragma argument_flag_ones 91, 97, 98, 99, 104, 136, 164, 165, 166, 167
13#pragma argument_flag_ones 174, 175, 176, 177, 252, 253, 254, 257, 258, 259
14#pragma argument_flag_ones 276, 277, 278, 304, 305, 306, 327, 329, 345, 347
15#pragma argument_flag_ones 401, 403, 442, 443, 454, 464, 713, 723, 725, 733
16#pragma argument_flag_ones 739, 742, 743, 744, 782
32#include "dataalloc.hpp"
35#include "framevu1.hpp"
45#include "title/dispfade.hpp"
46#include "title/op_a.hpp"
47#include "title/op_b.hpp"
48#include "title/opening.hpp"
49#include "title/rushmovi.hpp"
50#include "title/script.hpp"
87 void SetVertex(
float *v0,
float *v1,
float *v2,
float *v3);
90 void SetColor(u_char r, u_char g, u_char b, u_char a);
91 void Shake(
int x,
int y,
float power);
107 virtual void FrameObjectOnOff(
char *name,
int on);
131 void DrawShadow(
int fast);
164 void SetPosition(
float x,
float y,
float z) {
171 void DrawFire(
int unused0,
int unused1,
CCamera *camera,
float *colour,
float scale,
int layers,
float camera_offset);
198 CRect(T left, T top, T width, T height) {
214void wait_now_loading_vsync();
215void InitializeDataBuffer();
222void 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);
224CCameraFollow MainCamera__3(20.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f + 0.0f, 15.0f, 0.0f, 8.0f);
246static int CameraMode;
253float atraGetStatusRate;
273static void MotionProcess();
274static void DrawProcess();
275static void SoundProcess();
276static void DataLoad();
277static void DrawProcA();
278static void DrawProcB();
279static void DrawProcC();
280static void DrawProcD();
281static void DrawProcE();
282static void DrawProcF();
283static void DrawProcG();
284static void DrawProcH();
285static void DrawProcI();
286static void DrawProcTitle();
292void FaceChange(
int actor_no) {
293 static FACE_INFO face = {
"c01d01",
"c01d01an_4", 27, 48, 78, 44, 0, 0, 512, 3, 0};
301 sceVif1PkCnt(Vif1Packet, 0);
302 sceVif1PkOpenDirectCode(Vif1Packet, 0);
303 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
304 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
305 sceVif1PkCloseGifTag(Vif1Packet);
306 sceVif1PkCloseDirectCode(Vif1Packet);
308 if (face.
plate == 0) {
312 plate = TexManager.GetTexture(face.
plate, -1);
313 strip = TexManager.GetTexture(face.
strip, -1);
315 if (plate == 0 || strip == 0) {
319 sbp = strip->
tex0 & 0x3fff;
320 dbp = plate->
tex0 & 0x3fff;
321 sbw = (strip->
tex0 >> 14) & 0x3f;
322 dbw = (plate->
tex0 >> 14) & 0x3f;
331 }
else if (eye < 18) {
341 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8, eyes, dbp, dbw, SCE_GS_PSMT8, 0, 128 - face.
eye_height - face.
eye_bottom, 0);
347 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8, mouth, dbp, dbw, SCE_GS_PSMT8, 0, 128 - face.
mouth_height - face.
mouth_bottom, 0);
349 sceVif1PkCnt(Vif1Packet, 0);
350 sceVif1PkOpenDirectCode(Vif1Packet, 0);
351 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
352 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
353 sceVif1PkCloseGifTag(Vif1Packet);
354 sceVif1PkCloseDirectCode(Vif1Packet);
358 wait_now_loading_vsync();
359 InitializeDataBuffer();
360 SetDataBuffer(&CharaDataBuffer, 490000);
361 SetDataBuffer(&PathDataBuffer, 30000);
362 SetDataBuffer(&MapDataBuffer, 260000);
363 SetDataBuffer(&WaterBuffer, 30000);
364 SetDataBuffer(&DummyDataBuffer, 10000);
365 SetDataBuffer(&TextureData, 250000);
366 SetPacketReadBuffer(50000, 360000);
370 MainCamera__3.
SetFollow(0.0f, 0.0f, 0.0f);
371 MainCamera__3.
Step(0);
372 MGSetRenderInfo(800.0f, 6.0f, 65535.0f);
374 wait_now_loading_vsync();
375 SndInitialize(4, 30, 4, 5);
376 SndSetReadBuffer(read_buffer);
382 wait_now_loading_vsync();
388 wait_now_loading_vsync();
400 atraGetStatusRate = 0;
410 DispFade.
FadeIn(Vif1Packet);
415 if (GamePad.
Down(PAD_START)) {
421 SndBgmFadeOut(32, 0);
433 MGSetBGColor(black, black, black, 128.0f);
447 MGSetBGColor(black, black, black, 128.0f);
467static void MotionProcess() {
469 case TSFADE_IN_BLACK:
477 case TSFADE_OUT_BLACK:
485 case TSFADE_IN_WHITE:
493 case TSFADE_OUT_WHITE:
503 if (DispFade.
GetRate() == 128.0) {
529 for (
int i = 0; i < OP_AnimeSeqRot - 1; i++) {
530 ObjAnimePlay(&OP_AnimeSeq[i]);
533 for (
int i = 0; i < 9; i++) {
536 if (Chara__3[i].motion_type.state.time > (
float) (Chara__3[i].motion_type.motion_info[
CScript.
obj[i].
motion].end - 1)) {
563 SetMotionEX(Cam[SceneNp].frame, &Cam[SceneNp].motion_type, &MotionInfo, &Cam[SceneNp].motion_type.state, frame_info_cam);
565 sceVu0FVECTOR wind_dir;
609 case RUSH_SCENE_TITLE:
615 Chara__3[1].
wind = (int) &Wind__4;
617 Chara__3[0].
wind = (int) &Wind__4;
622 typedef float MotionLocal0, MotionLocal1, MotionLocal2, MotionLocal3, MotionLocal4, MotionLocal5, MotionLocal6, MotionLocal7, MotionLocal8, MotionLocal9, MotionLocal10, MotionLocal11, MotionLocal12, MotionLocal13, MotionLocal14, MotionLocal15;
623 char *opening_frames[9] = {
624 "c12a",
"c12a",
"c08a",
"c08a",
"e04a1",
"e04a2",
"e04a3",
"e04a4",
"e04a5"};
625 char *scene_frames[9] = {
626 "chr_a",
"chr_b",
"chr_c",
"chr_d",
"chr_e",
"chr_f",
"chr_g",
"chr_h",
"chr_i"};
627 sceVu0FMATRIX matrix;
630 for (
int i = 0; i < 9; i++) {
633 frame = Cam[SceneNp].
frame->SearchFrame(opening_frames[i]);
635 frame = Cam[SceneNp].
frame->SearchFrame(scene_frames[i]);
642 Chara__3[i].
frame->SetReference(frame);
644 frame->GetLWMatrix(matrix);
647 Chara__3[i].
SetRotation(0.0f, atan2f(matrix[2][0], matrix[2][2]), 0.0f);
649 float angle = atan2f(matrix[2][0], matrix[2][2]);
654 float x = matrix[3][0];
655 float y = matrix[3][1];
656 float z = matrix[3][2];
665 if (scene == RUSH_SCENE_B || scene == RUSH_SCENE_D || scene == RUSH_SCENE_F || scene == RUSH_SCENE_H) {
666 if (scene != RUSH_SCENE_H) {
667 frame = Chara__3[0].
frame->SearchFrame(
"weapon");
669 frame = Chara__3[1].
frame->SearchFrame(
"weapon");
673 frame->GetLWMatrix(matrix);
674 sceVu0Normalize(matrix[0], matrix[0]);
675 sceVu0Normalize(matrix[1], matrix[1]);
676 sceVu0Normalize(matrix[2], matrix[2]);
677 Chara__3[8].
SetPosition((
float) (scene & 0), 0.0f, 0.0f);
679 Chara__3[8].
frame->SetTransMatrix(matrix);
683 if (scene == RUSH_SCENE_B) {
689 frame = Chara__3[0].
frame->SearchFrame(
"dcol");
692 frame->GetLWMatrix(matrix);
693 sceVu0Normalize(matrix[0], matrix[0]);
694 sceVu0Normalize(matrix[1], matrix[1]);
695 sceVu0Normalize(matrix[2], matrix[2]);
696 typedef float m7p0, m7p1, m7p2, m7p3, m7p4, m7p5, m7p6, m7p7, m7p8, m7p9, m7p10, m7p11, m7p12, m7p13, m7p14, m7p15, m7p16, m7p17, m7p18, m7p19, m7p20, m7p21, m7p22, m7p23, m7p24, m7p25, m7p26, m7p27, m7p28, m7p29, m7p30, m7p31;
699 Chara__3[7].
frame->SetTransMatrix(matrix);
704 int cam_frame = (int) Cam[SceneNp].motion_type.state.time;
706 if (old != cam_frame && (cam_frame == 12 || cam_frame == 17 || cam_frame == 52 || cam_frame == 111)) {
712 }
else if (old != cam_frame && cam_frame == 119) {
726 static int iwacnt = 0;
740 Chara__3[2].
SetRotation((
float) (iwacnt & 0), 1.92f, 0.0f);
767static void DrawProcess() {
768 if (DispFade.
GetRate() == 128.0) {
772 sceVu0FVECTOR position;
773 sceVu0FMATRIX camera;
777 MainCamera__3.
GetPos(position);
778 SndSetCamera(&MainCamera__3);
780 MainCamera__3.
Step(1);
782 sceVu0UnitMatrix(unit);
783 sceVu0MulMatrix(view, unit, camera);
784 MGSetViewMatrix(view, position);
786 sceVif1PkCall(Vif1Packet, (u_long128 *) Vu_prog0f, 0);
787 sceVif1PkTerminate(Vif1Packet);
817 case RUSH_SCENE_TITLE:
826 TexManager.ReloadTexture(Vif1Packet, 20);
828 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"start2", -1),
CRect<int>(192, 392, 256, 32),
CRect<int>(0, 0, 256, 32), fade);
830 set2DSprite(GetVif1Packet(), TexManager.GetTexture(
"start2", -1),
CRect<int>(192, 360, 256, 32),
CRect<int>(0, 0, 256, 32), fade);
832 fade = (fade + 2) & 127;
835 if (GamePad.
Down(PAD_TRIANGLE | PAD_CIRCLE | PAD_CROSS | PAD_SQUARE)) {
846 MGGetFBuffBackTex(&back_tex);
850 texture.
tex0 = *(u_long *) &back_tex;
851 set2DSprite(Vif1Packet, &texture,
CRect<int>(0, 0, 640, SCREEN_HEIGHT),
CRect<int>(0, 0, 640, SCREEN_HALF_HEIGHT), 128, 128, 128, 35);
862static void SoundProcess() {
864 SndBgmFadeOut(64, 0);
894 if (
CScript.
scene == RUSH_SCENE_A && Cam[SceneNp].motion_type.state.time > 10.0f) {
896 CFrame *frame = Cam[SceneNp].
frame->SearchFrame(
"e04a5");
899 sceVu0FMATRIX matrix;
901 frame->GetLWMatrix(matrix);
903 sceVu0FVECTOR position;
905 position[0] = matrix[3][0];
906 position[1] = matrix[3][1];
907 position[2] = matrix[3][2];
908 SndSePlay(SE_RUSH_IMPACT, position, 100.0f, 1000.0f);
921 if ((
CScript.
scene == RUSH_SCENE_A && Cam[SceneNp].motion_type.state.time > 10.0f) || (
CScript.
scene == RUSH_SCENE_H && Cam[SceneNp].motion_type.state.time > 10.0f)) {
925 CFrame *frame = Cam[SceneNp].
frame->SearchFrame(
"c12a");
926 int chara_frame = (int) Chara__3[1].motion_type.state.time;
929 if (chara_frame == 10) {
931 sceVu0FMATRIX matrix;
933 frame->GetLWMatrix(matrix);
935 sceVu0FVECTOR position;
937 position[0] = matrix[3][0];
938 position[1] = matrix[3][1];
939 position[2] = matrix[3][2];
940 SndSePlay(SE_RUSH_LOW_BUMP, position, 500.0f, 3000);
945 }
else if (wait > 0) {
949 CFrame *frame = Cam[SceneNp].
frame->SearchFrame(
"chr_a");
950 int chara_frame = (int) Chara__3[0].motion_type.state.time;
953 if (chara_frame == 20) {
955 sceVu0FMATRIX matrix;
957 frame->GetLWMatrix(matrix);
959 sceVu0FVECTOR position;
961 position[0] = matrix[3][0];
962 position[1] = matrix[3][1];
963 position[2] = matrix[3][2];
964 SndSePlay(SE_RUSH_LOW_BUMP, position, 500.0f, 3000);
969 }
else if (wait > 0) {
978 int cam_frame = (int) Cam[SceneNp].motion_type.state.time;
982 if (cam_frame == 30) {
983 SndSePlay(SE_AMBIENT_TOWN_PATTER, -1, 0);
984 SndSetSeVolf(SE_AMBIENT_TOWN_PATTER, 0.75f, 0);
990 if (cam_frame == 10) {
991 SndSetSeVolf(SE_AMBIENT_TOWN_PATTER, 0.65f, 0);
992 SndSePlay(SE_RUSH_CRACK, -1, 0);
996 if (cam_frame == 17) {
997 SndSePlay(SE_RUSH_CRACK_2, -1, 0);
1001 if (cam_frame == 23) {
1002 SndSePlay(SE_RUSH_TAP, -1, 0);
1006 if (cam_frame == 31) {
1007 SndSePlay(SE_RUSH_TAP_2, -1, 0);
1011 if (cam_frame == 46) {
1012 SndSePlay(SE_WORLD_MAP_OPEN, -1, 0);
1016 if (cam_frame == 50) {
1017 SndSePlay(SE_CHARA_SHOUT_3, -1, 0);
1018 SndSePlay(SE_CHARA_ACTION_4, -1, 0);
1022 if (cam_frame == 53) {
1023 SndSePlay(SE_RUSH_HISS, -1, 0);
1027 if (cam_frame == 62) {
1028 SndSePlay(SE_RUSH_TAP_2, -1, 0);
1032 if (cam_frame == 65) {
1033 SndSePlay(SE_BOX_OPEN, -1, 0);
1037 if (cam_frame == 97) {
1038 SndSePlay(SE_RUSH_TAP, -1, 0);
1042 if (cam_frame == 113) {
1043 SndSePlay(SE_CHARA_ACTION, -1, 0);
1044 SndSePlay(SE_RUSH_CRACK_2, -1, 0);
1048 if (cam_frame == 119) {
1049 SndSePlay(SE_CHARA_ACTION_2, -1, 0);
1050 SndSePlay(SE_CHARA_SHOUT, -1, 0);
1051 SndSePlay(SE_MONSTER_HIT, -1, 0);
1055 if (cam_frame == 124) {
1056 SndSePlay(SE_RUSH_RUSTLE, -1, 0);
1060 if (cam_frame == 130) {
1061 SndSePlay(SE_RUSH_CRACK_3, -1, 0);
1067 if (cam_frame == 47) {
1068 SndSePlay(SE_RUSH_BRIGHT_SWELL, -1, 0);
1072 if (cam_frame == 124) {
1073 SndSeStop(SE_AMBIENT_TOWN_PATTER, 0);
1079 if (cam_frame == 20) {
1080 SndSePlay(SE_RUSH_WHOOSH, -1, 0);
1084 if (cam_frame == 37) {
1085 SndSePlay(SE_WORLD_MAP_OPEN, -1, 0);
1089 if (cam_frame == 57) {
1090 SndSePlay(SE_CHARA_ACTION, -1, 0);
1094 if (cam_frame == 60) {
1095 SndSePlay(SE_MONSTER_HIT, -1, 0);
1099 if (cam_frame == 71) {
1100 SndSePlay(SE_WORLD_MAP_OPEN, -1, 0);
1104 if (cam_frame == 86) {
1105 SndSePlay(SE_RUSH_LONG_SWELL, -1, 0);
1111 if (cam_frame == 140) {
1112 SndSePlay(SE_RUSH_DULL_KNOCK, -1, 0);
1116 if (cam_frame == 145) {
1117 SndSePlay(SE_RUSH_DULL_KNOCK, -1, 0);
1121 if (cam_frame == 158) {
1122 SndSePlay(SE_RUSH_SWELLING_TONE, -1, 0);
1128 if (cam_frame == 117) {
1129 SndSePlay(SE_RUSH_DULL_KNOCK_2, -1, 0);
1133 if (cam_frame == 160) {
1134 SndSePlay(SE_RUSH_DEEP_TONE, -1, 0);
1140 if (cam_frame == 87) {
1141 SndSePlay(SE_RUSH_LOW_THUMP, -1, 0);
1147 if (cam_frame == 10) {
1148 SndSePlay(SE_RUSH_CLACK, -1, 0);
1149 SndSePlay(SE_RUSH_RISING_CHIRP, -1, 0);
1153 if (cam_frame == 18) {
1154 SndSePlay(SE_RUSH_KNOCK, -1, 0);
1158 if (cam_frame == 40) {
1159 SndSePlay(SE_RUSH_CLACK_2, -1, 0);
1163 if (cam_frame == 52) {
1164 SndSePlay(SE_RUSH_KNOCK, -1, 0);
1168 if (cam_frame == 72) {
1169 SndSePlay(SE_RUSH_FALLING_CHIRP, -1, 0);
1173 if (cam_frame == 88) {
1174 SndSePlay(SE_RUSH_SCRAPE, -1, 0);
1175 SndSePlay(SE_RUSH_BRIGHT_HIT, -1, 0);
1179 if (cam_frame == 94) {
1180 SndSePlay(SE_RUSH_RISING_SWELL, -1, 0);
1186 if (cam_frame == 2) {
1187 SndSePlay(SE_DRAN_FIELD_START, -1, 0);
1191 if (cam_frame == 40) {
1192 SndSePlay(SE_RUSH_LONG_NOISE, -1, 0);
1196 if (cam_frame == 70) {
1197 SndSePlay(SE_DRAN_FIELD_START, -1, 0);
1198 SndSePlay(SE_RUSH_LONG_RUMBLE, -1, 0);
1204 if (cam_frame == 2) {
1205 SndSePlay(SE_RUSH_LOW_HUM, -1, 0);
1206 SndSePlay(SE_RUSH_LOW_SWELL, -1, 0);
1212 if (cam_frame == 26) {
1213 SndSePlay(SE_RUSH_LOW_TONE, -1, 0);
1217 if (cam_frame == 56) {
1218 SndSePlay(SE_RUSH_LOW_TONE, -1, 0);
1222 if (cam_frame == 86) {
1223 SndSePlay(SE_RUSH_LOW_TONE, -1, 0);
1227 if (cam_frame == 120) {
1228 SndSeStop(SE_RUSH_LOW_HUM, 0);
1229 SndSeStop(SE_RUSH_LOW_SWELL, 0);
1240void SetObjAnime(
char *name,
CFrameVu1 *frame,
float *start,
float *step) {
1242 OP_AnimeSeq[OP_AnimeSeqRot].
type = 0;
1243 OP_AnimeSeq[OP_AnimeSeqRot].
number = 0;
1244 OP_AnimeSeq[OP_AnimeSeqRot].
start[0] = start[0];
1245 OP_AnimeSeq[OP_AnimeSeqRot].
start[1] = start[1];
1246 OP_AnimeSeq[OP_AnimeSeqRot].
start[2] = start[2];
1247 OP_AnimeSeq[OP_AnimeSeqRot].
step_x = step[0];
1248 OP_AnimeSeq[OP_AnimeSeqRot].
step_y = step[1];
1249 OP_AnimeSeq[OP_AnimeSeqRot].
step_z = step[2];
1250 strcpy(OP_AnimeSeq[OP_AnimeSeqRot].name, name);
1251 InitObjAnime(frame, &OP_AnimeSeq[OP_AnimeSeqRot]);
1255void WaterProcess() {
1260 MGGetFBuffTex(&frame_tex);
1262 CRect<int> rect(0, 0, 640, SCREEN_HALF_HEIGHT);
1264 water_tex = *(
sceGsTex0 *) &TexManager.GetTexture(
"water_buff", -1)->
tex0;
1265 MGMoveImage(&frame_tex, rect, &water_tex, 0, 0, 0);
1272 sceVu0FVECTOR position = {0.0f, -0.4f, 0.0f, 0.0f};
1274 Water__2.
frame.SetPosition(position);
1275 Water__2.Shake(12, 4, (
float) rand() * 4.5 / 2147483647.0 + 0.5);
1279 MainCamera__3.
GetRef(ref);
1281 Water__2.
frame.SetPosition(ref);
1282 Water__2.Shake((
int) (rand() * 32.0f / 2147483648.0f), (
int) (rand() * 32.0f / 2147483648.0f), -0.5f);
1286 Water__2.DrawVu1(&mgRenderInfo, GetVif1Packet(), 0);
1287 MGSetGsZBUF(&mgZBuffer);
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])
tagMOTION_TYPE motion_type
virtual void SetRotation(float x, float y, float z)
virtual void SetPosition(float x, float y, float z)
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
void Set(float *position)
void Load(const char *name)
void SetVelocity(float speed)
void SetDir(float *direction)