DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
op_c.cpp
1#include "common.h"
2
3#include <libgraph.h>
4#include <libpkt.h>
5#include <libvu0.h>
6
7#include <cmath>
8#include <cstdlib>
9#include <cstring>
10
11#include "camera.hpp"
12#include "camerafollow.hpp"
13#include "character.hpp"
14#include "dataalloc.hpp"
15#include "dataread.hpp"
16#include "frame.hpp"
17#include "framevu1.hpp"
18#include "main.hpp"
19#include "mainselect.hpp"
20#include "mathutil.hpp"
21#include "mds.hpp"
22#include "mglib.hpp"
23#include "renderinfo.hpp"
24#include "sound.hpp"
25#include "texture.hpp"
26#include "title/bombeffect.hpp"
27#include "title/majinbeem.hpp"
28#include "title/op_a.hpp"
29#include "title/op_b.hpp"
30#include "title/op_c.hpp"
31#include "title/opening.hpp"
32#include "title/script.hpp"
33#include "vector.hpp"
34#include "visualvu1.hpp"
35#include "wind.hpp"
36
37/* The rectangle a texture transfer takes, declared here rather than reached through rect.h for the
38 reason op_b.cpp declares its own: rect.h's four-argument constructor assigns h, w, y and x in
39 that order and every rectangle this file builds assigns them the other way round. The default
40 constructor keeps rect.h's order and is not dead code — the effect parameter block below carries
41 one as a member, so it runs wherever a caller builds that block. */
42template <class T>
43class CRect {
44public:
45 T x;
46 T y;
47 T w;
48 T h;
50 CRect() {
51 h = 0;
52 w = 0;
53 y = 0;
54 x = 0;
55 }
56
57 CRect(T left, T top, T width, T height) {
58 x = left;
59 y = top;
60 w = width;
61 h = height;
62 }
63} __attribute__((aligned(16)));
64
65/* The three classes this scene places in the world, declared here rather than reached through
66 headers of their own because each is another unit's to type. Only the members this file touches
67 are named; the extents are the sizes the executable gives the objects below. */
68
69/* A frame parented to an object, which is what lets the world transform drive a model. */
70class CObjectFrame : public CObject {
71public:
72 CFrameVu1 *frame[4];
74 s32 draw_on;
76 virtual void FrameObjectOnOff(char *name, int on);
77 virtual void Draw();
78
79 void SetFrame(CFrameVu1 *frame, int level);
80};
81
82/* One piece of scenery. The scene builds a table of them, hands each its model, and drives them
83 through the object dispatch like anything else in the world. */
84class CMapObject : public CObjectFrame {
85public:
90 float shadow_offset;
91 int unk_34;
92 int handle;
93 char unk_3C[4];
94
95 CMapObject();
96
97 virtual void Draw();
98
99 void Initialize();
100 void DrawShadow(int fast);
101};
102
103class CTexture;
104
105/* The scene's one fire, which is a light rather than a model. */
106class CFireOmni {
107public:
108 char unk_00[32];
109 sceVu0FVECTOR position;
110 s32 texture_set;
111 CTexture *core;
112 CTexture *glow;
113 s32 unk_3C;
114
115 CFireOmni();
116
117 void FireStep();
118 void FireCreate();
119 void DrawFire(int unused0, int unused1, CCamera *camera, float *eye, float scale, int layers, float camera_offset);
120};
121
122/* One piece of scenery as the scene was laid out: the model, the model its shadow is drawn
123 from, where it stands in tenths of a world unit, and its heading in degrees. */
124struct MAPOBJ_INFO {
125 char *name;
126 char *shadow_name;
127 float position[3];
128 float rotation[3];
129};
130
131/* The river the scene draws, which is a grid the file sizes and colours once and then shakes every
132 tick. Another unit's class to type; only what this file calls and the extent are named. */
133/* The rippling water the scene stands on. Laid out as the shared CWater, so its pointers take their
134 host size; this file declares DrawVu1 with the argument types its call passes. */
135class CWater {
136public:
137 s32 rows;
139 float *height;
140 float *height_a;
141 float *height_b;
142 sceVu0FVECTOR vertex[4];
143 u_int *packet[3];
145 u8 color[4];
147 float damping;
153 CWater();
154
155 void SetVertex(float *corner0, float *corner1, float *corner2, float *corner3);
156 void SetSize(int rows, int columns, CDataAlloc2<1> *arena);
157 void SetParam(float wave_speed, float damping, float height_scale, float distortion);
158 void SetColor(u_char red, u_char green, u_char blue, u_char alpha);
159 void Shake(int x, int y, float height_change);
160 void Hamon();
161 void DrawVu1(RenderInfo *info, sceVif1Packet *packet, u_long128 *buffer);
162};
163
164/* One looping object animation: a frame is found by name and then driven between two motion
165 numbers at a rate, with a scale and a position offset of its own. */
166class OBJ_ANIME_SEQ {
167public:
168 char name[16];
171 char unk_18[8];
172 sceVu0FVECTOR start_value;
173 sceVu0FVECTOR end_value;
174 float step_x;
175 float step_y;
176 float step_z;
177 float step_w;
178 sceVu0FVECTOR current;
179 CFrame *frames[10];
180 int completion_flag;
181 int unk_8C;
182
184
185 void Initialize();
186};
187
188/* One particle of the smoke this scene gives off, and the pool the group hands them out of. Both
189 classes are another unit's to type; this file only sizes the pool and names the group. */
190class CEffect;
191class CEffectParam;
192
193class CEffectGroup {
194public:
196 int capacity;
198 CEffectGroup() { Initialize(0, 0); }
199
200 void Initialize(CEffect *table, int count);
201 void Clear();
202 void EnterEffect(CEffectParam *param);
203 void Step(int unused);
204 void Draw();
205};
206
207/* What one particle is entered with. Only the fields the smoke sets are named; the rectangle is a
208 member rather than filler because the block's own construction zeroes it. */
209class CEffectParam {
210public:
211 int lifetime;
213 float unk_08;
214 float unk_0C;
215 char unk_10[16];
216 sceVu0FVECTOR position;
217 char unk_30[4];
219 char unk_38[24];
221 char unk_54[12];
223 char unk_64[28];
226 char unk_88[40];
227 int opacity_mode;
228 int render_flags;
229 float opacity;
232 char unk_D0[4];
234 char unk_D8[8];
235
236 CEffectParam() {}
237
238 void Initialize();
239};
240
241/* One actor's face, as this scene animates it. The eyes and the mouth are two strips of frames
242 stacked bottom-up in one 256-wide texture — the eyes down the left half and the mouth down the
243 right — and a tick copies the current frame of each over the plate the model draws with. The
244 two offsets are measured from the bottom edge of the 128-pixel plate, and the two frame numbers
245 are kept here rather than read from the script twice because the transfer needs them twice. */
246struct FACE_INFO {
247 char *plate;
248 char *strip;
249 int eye_bottom;
250 int eye_height;
251 int mouth_bottom;
252 int mouth_height;
253 int eye;
254 int mouth;
255 int strip_bottom;
256 int unk_24;
257 int unk_28;
258};
259
260/* One sound the demon's rampage plays, timed against the scene's own tick count rather than against
261 a motion. Only the first four fields are read here; the two after them are the row as the table
262 was written and nothing reconstructed reaches them yet. */
263struct SND_INFO {
264 int group;
265 int no;
266 int voice;
267 int count;
268 int unk_10;
269 int unk_14;
270};
271
272void InitObjAnime(CFrame *frame, OBJ_ANIME_SEQ *sequence);
273void ObjAnimePlay(OBJ_ANIME_SEQ *sequence);
274void 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);
275void set2DSprite(sceVif1Packet *packet, CTexture *texture, const CRect<int> &src, const CRect<int> &dst, u_char r, u_char g, u_char b, u_char a);
276void MGMoveImage(sceGsTex0 *dst, const CRect<int> &rect, sceGsTex0 *src, int dsax, int dsay, int dir);
277void DepthOfField(float *dist, int level, int alpha, int blur);
278
279static void MapLoad();
280static void MapLoad2();
281static void LoadCharaMajin();
282static void DrawDancer();
283static void InchikiShadow();
284static void DrawShadow(int shadow_no, float x, float y, float z);
285static void MajinBeemProcess();
286static void SmokeProcess();
287static void WaterProcess();
288static int KageCheck(int actor);
289static void LightSet(float x, float y, float z, int actor);
290static void setTexScroll();
291static void setTexAnim();
292void FaceChangeD(int actor);
293
294static CFireOmni CFire;
295static OBJ_ANIME_SEQ Fuusya[2];
296static CWind Wind;
297static CFrame *TaimatsuFrame[12];
298static OBJ_ANIME_SEQ Taimatsu[12];
299CWater Water;
300static CMapObject OP_NornMapObj3[4];
301static CBombEffect CBomb[3];
302static CFrameVu1 *DoransFuusya[2];
303static CEffect *EffectTable;
304static CEffectGroup Smoke;
305static CMajinBeem CBeem[3];
306static CFrameVu1 *Shadow[16];
307static CFrame *CharaF[3];
308
309static int MBeemCnt;
310static float FireStep;
311static int MajinBgmStart;
312static int DanceBgmStart;
313static int DanceBgmCnt;
314static int SndCnt;
315
316/* One actor's blinking and speaking. The mouth is driven from the script's own clock rather than
317 from a motion: while the actor is talking, a new mouth frame is picked at random every sixth
318 hundredth of a second left on the timer (in the PAL build, on a random one tick in five), and the
319 timer running out closes the mouth and ends the line. The eyes are whatever the script last asked
320 for. The cache is flushed on both sides of the two transfers because the plate is a texture the
321 previous tick drew from and the next one will. */
322void FaceChange(int actor_no) {
323 static FACE_INFO face[21] = {
324 {0, 0, 42, 40, 87, 35, 0, 0, 256, 2, 0},
325 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
326 {0, 0, 32, 40, 84, 35, 0, 0, 448, 3, 0},
327 {"c09a01", "c09a01an", 10, 40, 73, 35, 0, 0, 448, 2, 0},
328 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
329 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
330 {0, 0, 8, 40, 76, 35, 0, 0, 256, 2, 0},
331 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
332 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
333 {"p09a01", "p09a01an_2", 44, 40, 92, 32, 0, 0, 256, 2, 0},
334 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
335 {"c01d01", "c01d01an_3", 27, 48, 78, 44, 0, 0, 512, 3, 0},
336 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
337 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
338 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
339 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
340 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
341 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
342 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
343 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0},
344 {0, 0, 42, 40, 87, 35, 0, 0, 320, 2, 0}
345 };
346 CTexture *plate;
347 CTexture *strip;
348 int sbp;
349 int dbp;
350 int sbw;
351 int dbw;
352
353 sceVif1PkCnt(Vif1Packet, 0);
354 sceVif1PkOpenDirectCode(Vif1Packet, 0);
355 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
356 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
357 sceVif1PkCloseGifTag(Vif1Packet);
358 sceVif1PkCloseDirectCode(Vif1Packet);
359
360 if (face[actor_no].plate == 0) {
361 return;
362 }
363
364 plate = TexManager.GetTexture(face[actor_no].plate, -1);
365 strip = TexManager.GetTexture(face[actor_no].strip, -1);
366
367 if (plate == 0 || strip == 0) {
368 return;
369 }
370
371 sbp = strip->tex0 & 0x3fff;
372 dbp = plate->tex0 & 0x3fff;
373 sbw = (strip->tex0 >> 14) & 0x3f;
374 dbw = (plate->tex0 >> 14) & 0x3f;
375
376 face[actor_no].eye = CScript__2.obj[actor_no].eye;
377
378 CRect<int> eye(0, face[actor_no].strip_bottom - face[actor_no].eye_height * (face[actor_no].eye + 1), 128, face[actor_no].eye_height);
379
380 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8, eye, dbp, dbw, SCE_GS_PSMT8, 0, 128 - face[actor_no].eye_height - face[actor_no].eye_bottom, 0);
381
382 if (CScript__2.obj[actor_no].mouth_time >= CScript__2.motion_step) {
383 CScript__2.obj[actor_no].mouth_time -= CScript__2.motion_step;
384
385 if (CScript__2.obj[actor_no].talk) {
386#ifdef PAL_TIMING
387 if (rand() % 5 == 0) {
388#else
389 if ((int) (100.0f * CScript__2.obj[actor_no].mouth_time) % 6 == 0) {
390#endif
391 CScript__2.obj[actor_no].mouth = rand() % 4;
392 }
393 }
394 } else {
395 CScript__2.obj[actor_no].mouth = 0;
396 CScript__2.obj[actor_no].talk = false;
397 }
398
399 face[actor_no].mouth = CScript__2.obj[actor_no].mouth;
400
401 CRect<int> mouth(128, face[actor_no].strip_bottom - face[actor_no].mouth_height * (face[actor_no].mouth + 1), 128, face[actor_no].mouth_height);
402
403 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8, mouth, dbp, dbw, SCE_GS_PSMT8, 0, 128 - face[actor_no].mouth_height - face[actor_no].mouth_bottom, 0);
404
405 sceVif1PkCnt(Vif1Packet, 0);
406 sceVif1PkOpenDirectCode(Vif1Packet, 0);
407 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
408 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
409 sceVif1PkCloseGifTag(Vif1Packet);
410 sceVif1PkCloseDirectCode(Vif1Packet);
411}
412
413/* The background loads are one wrapper per file because the script names them by index: each waits
414 for the previous read to land, starts the next, and marks the load done by putting the script's
415 own load number back to none. */
416void OpC_LoadDataBG() {
417 while (ReadBGSync())
418 ;
419
420 LoadFileBG("opdat/norn2/norn2.pim", (u_long128 *) read_buffer, 0);
421 CScript__2.load_no = OP_SCENE_NONE;
422}
423
424void OpC_LoadDataBG2() {
425 while (ReadBGSync())
426 ;
427
428 LoadFileBG("opdat/norn2/ndance.pak", (u_long128 *) read_buffer, 0);
429 CScript__2.load_no = OP_SCENE_NONE;
430}
431
432void OpC_LoadDataBG3() {
433 while (ReadBGSync())
434 ;
435
436 LoadFileBG("opdat/norn2/majin.pak", (u_long128 *) read_buffer, 0);
437 CScript__2.load_no = OP_SCENE_NONE;
438}
439
440void OpC_LoadDataBG4() {
441 while (ReadBGSync())
442 ;
443
444 LoadFileBG("opdat/norn2/norn2.pim", (u_long128 *) read_buffer, 0);
445 CScript__2.load_no = OP_SCENE_NONE;
446}
447
448void OpC_LoadDataBG5() {
449 while (ReadBGSync())
450 ;
451
452 LoadFileBG("opdat/norn3/norn3.pak", (u_long128 *) read_buffer, 0);
453 CScript__2.load_no = OP_SCENE_NONE;
454}
455
456/* The set-up for the scene the dance is danced in: the whole of Norune at night, its scenery placed
457 from a configuration file rather than a table of this file's own, and its images filled into a
458 manifest whose first six rows are the registry's fixed surfaces. The second manifest is the same
459 array written over again, because the second pack is read only once the first block is entered. */
460void OpC_InitProcess() {
461 while (ReadBGSync())
462 ;
463
464 LOADTEXTURE_INFO2 tex[] = {
465 {"#water_buff#640#" HALF_BUFFER_HEIGHT_STR "#4", 22, 0},
466 {"#blender#640#" HALF_BUFFER_HEIGHT_STR "#4", 0, 0},
467 {"#fontbase#512#256#1", 26, 0},
468 {"#fukidashibase#640#" HALF_BUFFER_HEIGHT_STR "#4", 26, 0},
469 {"#shadow_buff#640#" HALF_BUFFER_HEIGHT_STR "#4", 23, 0},
470 {"#frame_image#640#" HALF_BUFFER_HEIGHT_STR "#4", 22, 0},
471 {0, 0, 0},
472 {0, 10, 0},
473 {0, 10, 0},
474 {0, 10, 0},
475 {0, 10, 0},
476#ifdef PAL
477 {0, 13, 0},
478#else
479 {0, 10, 0},
480#endif
481 {0, 10, 0},
482 {0, 11, 0},
483 {0, 11, 0},
484 {0, 11, 0},
485 {0, 11, 0},
486 {0, 26, 0},
487 {0, 26, 0},
488 {0, 26, 0},
489 {0, 19, 0},
490 {0, 19, 0},
491#ifndef PAL
492 {0, 19, 0},
493#endif
494 {0, 0, 0}
495 };
496
497 tex[6].name = (char *) GetPackFile(read_buffer, "fire.img", 0);
498 tex[7].name = (char *) GetPackFile(read_buffer, "t0203.img", 0);
499 tex[8].name = (char *) GetPackFile(read_buffer, "e01b01.img", 0);
500 tex[9].name = (char *) GetPackFile(read_buffer, "e01b02.img", 0);
501 tex[10].name = (char *) GetPackFile(read_buffer, "e01b03.img", 0);
502 tex[11].name = (char *) GetPackFile(read_buffer, "e01t01.img", 0);
503 tex[12].name = (char *) GetPackFile(read_buffer, "t0205.img", 0);
504 tex[13].name = (char *) GetPackFile(read_buffer, "t0003.img", 0);
505 tex[14].name = (char *) GetPackFile(read_buffer, "e01s03.img", 0);
506 tex[15].name = (char *) GetPackFile(read_buffer, "e01s06.img", 0);
507 tex[16].name = (char *) GetPackFile(read_buffer, "t0001.img", 0);
508 tex[17].name = (char *) GetPackFile(read_buffer, "gaiji.img", 0);
509 tex[18].name = (char *) GetPackFile(read_buffer, "fuki256.img", 0);
510 tex[19].name = (char *) GetPackFile(read_buffer, "syst04.img", 0);
511 tex[20].name = (char *) GetPackFile(read_buffer, "pause.img", 0);
512
513#ifdef PAL
514 switch (LanguageCode) {
515 case LANG_JAPANESE:
516 tex[21].name = (char *) GetPackFile(read_buffer, "pause_e.img", 0);
517 break;
518 case LANG_ENGLISH_US:
519 tex[21].name = (char *) GetPackFile(read_buffer, "pause_e.img", 0);
520 break;
521 case LANG_ENGLISH_UK:
522 tex[21].name = (char *) GetPackFile(read_buffer, "pause_e.img", 0);
523 break;
524 case LANG_FRENCH:
525 tex[21].name = (char *) GetPackFile(read_buffer, "pause_f.img", 0);
526 break;
527 case LANG_GERMAN:
528 tex[21].name = (char *) GetPackFile(read_buffer, "pause_g.img", 0);
529 break;
530 case LANG_ITALIAN:
531 tex[21].name = (char *) GetPackFile(read_buffer, "pause_i.img", 0);
532 break;
533 case LANG_SPANISH:
534 tex[21].name = (char *) GetPackFile(read_buffer, "pause_s.img", 0);
535 break;
536 }
537#else
538 tex[21].name = (char *) GetPackFile(read_buffer, "pause_e.img", 0);
539 tex[22].name = (char *) GetPackFile(read_buffer, "start2.img", 0);
540#endif
541
542 TexManager.Initialize(16352);
543 TexManager.LoadTextureBlock(-1, tex);
544
545 LoadFile("opdat/norn2/norn2b.pak", (void *) read_buffer, 0);
546
547 tex[0].name = (char *) GetPackFile(read_buffer, "t0201.img", 0);
548 tex[0].block_no = 12;
549 tex[0].mipmap = false;
550 tex[1].name = (char *) GetPackFile(read_buffer, "t0206.img", 0);
551 tex[1].block_no = 12;
552 tex[1].mipmap = false;
553 tex[2].name = (char *) GetPackFile(read_buffer, "c01d01.img", 0);
554 tex[2].block_no = 2;
555 tex[2].mipmap = false;
556 tex[3].name = (char *) GetPackFile(read_buffer, "c01d01an.img", 0);
557 tex[3].block_no = 2;
558 tex[3].mipmap = false;
559 tex[4].name = (char *) GetPackFile(read_buffer, "p03a01.img", 0);
560#ifdef PAL
561 tex[4].block_no = 14;
562#else
563 tex[4].block_no = 13;
564#endif
565 tex[4].mipmap = false;
566 tex[5].name = (char *) GetPackFile(read_buffer, "p08a01.img", 0);
567#ifdef PAL
568 tex[5].block_no = 15;
569#else
570 tex[5].block_no = 14;
571#endif
572 tex[5].mipmap = false;
573 tex[6].name = (char *) GetPackFile(read_buffer, "p07a01.img", 0);
574 tex[6].block_no = 7;
575 tex[6].mipmap = false;
576 tex[7].name = (char *) GetPackFile(read_buffer, "yokobue.img", 0);
577 tex[7].block_no = 7;
578 tex[7].mipmap = false;
579 tex[8].name = (char *) GetPackFile(read_buffer, "p02a01.img", 0);
580 tex[8].block_no = 8;
581 tex[8].mipmap = false;
582 tex[9].name = (char *) GetPackFile(read_buffer, "guiter.img", 0);
583 tex[9].block_no = 8;
584 tex[9].mipmap = false;
585 tex[10].name = 0;
586 tex[10].block_no = 0;
587 tex[10].mipmap = false;
588
589 TexManager.LoadTextureBlock(-1, tex);
590
591#ifdef PAL
592 CharaTex__2[11] = 2;
593 CharaTex__2[12] = 14;
594 CharaTex__2[13] = 15;
595 CharaTex__2[9] = 3;
596 CharaTex__2[11] = 2;
597 CharaTex__2[12] = 14;
598 CharaTex__2[13] = 15;
599#else
600 CharaTex__2[11] = 2;
601 CharaTex__2[12] = 13;
602 CharaTex__2[13] = 14;
603 CharaTex__2[9] = 3;
604 CharaTex__2[11] = 2;
605 CharaTex__2[12] = 13;
606 CharaTex__2[13] = 14;
607#endif
608 CharaTex__2[14] = 4;
609 CharaTex__2[15] = 5;
610 CharaTex__2[16] = 6;
611 CharaTex__2[17] = 7;
612 CharaTex__2[18] = 8;
613 CharaTex__2[19] = 9;
614 CharaTex__2[20] = 9;
615#ifdef PAL
616 CharaTex__2[1] = 16;
617 CharaTex__2[4] = 16;
618 CharaTex__2[3] = 17;
619 CharaTex__2[5] = 18;
620#else
621 CharaTex__2[1] = 15;
622 CharaTex__2[4] = 15;
623 CharaTex__2[3] = 16;
624 CharaTex__2[5] = 17;
625#endif
626
627 CSnd.SetReverb(0, 3, 20);
628 CSnd.SetReverb(1, 4, 5);
629 CSnd.LoadSoundFileFromPack("o03a.txt", read_buffer);
630 CSnd.SetVol(MIDI_PORT_SE_TITLE, 256);
631 CSnd.SetVol(MIDI_PORT_SE_DEFAULT, 256);
632 CSnd.SetVol(MIDI_PORT_UNK_D, 256);
633 CSnd.SetVol(MIDI_PORT_SE_SPECIAL, 256);
634 CSnd.SQ_Play(MIDI_PORT_AMBIENT, 0);
635
636 sceVu0FVECTOR river1 = {50.0f, 100.0f, -100.0f, 0.0f};
637
638 OpPlayVolPanSE(river1, 50.0f, 500.0f, MIDI_PORT_SE_TITLE, 16, 21);
639
640 sceVu0FVECTOR river2 = {0.0f, 0.0f, 0.0f, 0.0f};
641
642 OpPlayVolPanSE(river2, 50.0f, 500.0f, MIDI_PORT_SE_TITLE, 16, 22);
643
644 sceVu0FVECTOR river3 = {0.0f, 0.0f, 300.0f, 0.0f};
645
646 OpPlayVolPanSE(river3, 100.0f, 300.0f, MIDI_PORT_SE_TITLE, 16, 24);
647 CSnd.Step();
648 DanceBgmStart = 0;
649 DanceBgmCnt = 0;
650
651 CharaDataBuffer__2[0].used = 0;
652 Chara__3[11].LoadPackData(read_buffer, "04c01d.cfg", &CharaDataBuffer__2[0], 0);
653
654 CFrameAttr attr11;
655
656 attr11.clip_enable = false;
657 Chara__3[11].frame->SetAttr(attr11, 1, 4);
658 Chara__3[11].motion_type.state.time = 10.0f;
659 Chara__3[11].motion_type.state.blend_step = 0.05f;
660 Chara__3[11].motion_type.state.motion_no = 0;
661 Chara__3[11].motion_type.state.playing_no = 0;
662
663 Chara__3[17].LoadPackData(read_buffer, "04p07a.cfg", &CharaDataBuffer__2[0], 0);
664
665 CFrameAttr attr17;
666
667 attr17.clip_enable = false;
668 Chara__3[17].frame->SetAttr(attr17, 1, 4);
669 Chara__3[17].motion_type.state.time = 10.0f;
670 Chara__3[17].motion_type.state.blend_step = 0.05f;
671 Chara__3[17].motion_type.state.motion_no = 0;
672 Chara__3[17].motion_type.state.playing_no = 0;
673
674 Chara__3[18].LoadPackData(read_buffer, "04p02a.cfg", &CharaDataBuffer__2[0], 0);
675
676 CFrameAttr attr18;
677
678 attr18.clip_enable = false;
679 Chara__3[18].frame->SetAttr(attr18, 1, 4);
680 Chara__3[18].motion_type.state.time = 10.0f;
681 Chara__3[18].motion_type.state.blend_step = 0.05f;
682 Chara__3[18].motion_type.state.motion_no = 0;
683 Chara__3[18].motion_type.state.playing_no = 0;
684
685 Chara__3[12].LoadPackData(read_buffer, "04p03a.cfg", &CharaDataBuffer__2[0], 0);
686
687 CFrameAttr attr12;
688
689 attr12.clip_enable = false;
690 Chara__3[12].frame->SetAttr(attr12, 1, 4);
691 Chara__3[12].motion_type.state.time = 10.0f;
692 Chara__3[12].motion_type.state.blend_step = 0.05f;
693 Chara__3[12].motion_type.state.motion_no = 0;
694 Chara__3[12].motion_type.state.playing_no = 0;
695
696 CharaDataBuffer__2[6].used = 0;
697 Chara__3[13].LoadPackData(read_buffer, "04p08a.cfg", &CharaDataBuffer__2[6], 0);
698
699 CFrameAttr attr13;
700
701 attr13.clip_enable = false;
702 Chara__3[13].frame->SetAttr(attr13, 1, 4);
703 Chara__3[13].motion_type.state.time = 10.0f;
704 Chara__3[13].motion_type.state.blend_step = 0.05f;
705 Chara__3[13].motion_type.state.motion_no = 0;
706 Chara__3[13].motion_type.state.playing_no = 0;
707
708 OP_FireList = 0;
709 OPAnalyz("opdat/norn2.cfg");
710 OPMdsLoad();
711 MapLoad();
712
713 for (int i = 0; i < 2; i++) {
714 Fuusya[i].Initialize();
715 Fuusya[i].anim_type = 0;
716 Fuusya[i].play_mode = 0;
717 Fuusya[i].start_value[2] = 0.0f;
718 Fuusya[i].start_value[1] = 0.0f;
719 Fuusya[i].start_value[0] = 0.0f;
720 Fuusya[i].end_value[2] = 0.0f;
721 Fuusya[i].end_value[1] = 0.0f;
722 Fuusya[i].end_value[0] = 0.0f;
723 Fuusya[i].step_y = 0.0f;
724 Fuusya[i].step_x = 0.0f;
725 Fuusya[i].step_z = -0.5f;
726 strcpy(Fuusya[i].name, "hane");
727 InitObjAnime(DoransFuusya[i], &Fuusya[i]);
728 }
729
730 for (int i = 0; i < 8; i++) {
731 Taimatsu[i].Initialize();
732 Taimatsu[i].anim_type = 3;
733 Taimatsu[i].play_mode = 4;
734 Taimatsu[i].start_value[2] = 80.0f;
735 Taimatsu[i].start_value[1] = 80.0f;
736 Taimatsu[i].start_value[0] = 80.0f;
737 Taimatsu[i].end_value[2] = 128.0f;
738 Taimatsu[i].end_value[1] = 128.0f;
739 Taimatsu[i].end_value[0] = 128.0f;
740 strcpy(Taimatsu[i].name, "effect");
741 InitObjAnime(TaimatsuFrame[i], &Taimatsu[i]);
742 }
743
744 Taimatsu[8].Initialize();
745 Taimatsu[8].anim_type = 3;
746 Taimatsu[8].play_mode = 4;
747 Taimatsu[8].start_value[0] = 110.0f;
748 Taimatsu[8].start_value[2] = 120.0f;
749 Taimatsu[8].start_value[1] = 120.0f;
750 Taimatsu[8].end_value[0] = 128.0f;
751 Taimatsu[8].end_value[2] = 125.0f;
752 Taimatsu[8].end_value[1] = 125.0f;
753 strcpy(Taimatsu[8].name, "hikari");
754 InitObjAnime(TaimatsuFrame[8], &Taimatsu[8]);
755
756 sceVu0FVECTOR corner0 = {-160.0f, 0.0f, -160.0f, 1.0f};
757 sceVu0FVECTOR corner1 = {160.0f, 0.0f, -160.0f, 1.0f};
758 sceVu0FVECTOR corner2 = {-160.0f, 0.0f, 160.0f, 1.0f};
759 sceVu0FVECTOR corner3 = {160.0f, 0.0f, 160.0f, 1.0f};
760
761 Water.SetVertex(corner0, corner1, corner2, corner3);
762 Water.frame.SetPosition(0.0f, -10.0f, 0.0f);
763 Water.SetSize(32, 32, &WaterBuffer__2);
764 Water.SetParam(0.1f, 0.015f, 0.0f, 2.0f);
765 Water.SetColor(128, 128, 128, 128);
766
767 for (int i = 0; i < 3; i++) {
768 for (int j = 0; j < 8; j++) {
769 CBomb[i].active[j] = 0;
770 }
771 }
772
773 for (int i = 0; i < 3; i++) {
774 CBeem[i].active = false;
775 CBeem[i].alphas[59] = 0.0f;
776 }
777
778 MBeemCnt = 0;
779 FireStep = 1.0f;
780 CScript__2.init_no = 0;
781}
782
783/* The dancers, which is a texture load rather than a scene: the shadow model all sixteen actors
784 share, then the five villagers who join the dance, each loaded straight after the block its
785 images went into. */
786void OpC_InitProcess2() {
787 while (ReadBGSync())
788 ;
789
790 TexManager.DeleteTextureBlock(0);
791#ifdef PAL
792 TexManager.DeleteTextureBlock(15);
793#else
794 TexManager.DeleteTextureBlock(14);
795#endif
796 TexManager.CleanUpBuffer();
797
798 LOADTEXTURE_INFO2 tex[15] = {
799 {"#blender#640#" HALF_BUFFER_HEIGHT_STR "#4", 0, 0},
800 {0, 0, 0},
801 {0, 0, 0},
802 {0, 0, 0},
803 {0, 0, 0},
804 {0, 0, 0},
805 {0, 0, 0},
806 {0, 0, 0},
807 {0, 0, 0},
808 {0, 0, 0},
809 {0, 0, 0},
810 {0, 0, 0},
811 {0, 0, 0},
812 {0, 0, 0},
813 {0, 0, 0}
814 };
815
816 tex[1].name = (char *) GetPackFile(read_buffer, "fire.img", 0);
817 tex[1].block_no = 0;
818 tex[1].mipmap = false;
819 tex[2].name = 0;
820
821 TexManager.LoadTextureBlock(0, tex);
822
823 tex[0].name = (char *) GetPackFile(read_buffer, "ashikage.img", 0);
824#ifdef PAL
825 tex[0].block_no = 18;
826#else
827 tex[0].block_no = 17;
828#endif
829 tex[0].mipmap = false;
830 tex[1].name = 0;
831
832#ifdef PAL
833 TexManager.LoadTextureBlock(18, tex);
834#else
835 TexManager.LoadTextureBlock(17, tex);
836#endif
837
838 CharaDataBuffer__2[6].used = 0;
839
840 CFrameVu1 *shadow = LoadMDSFile((u_int *) GetPackFile(read_buffer, "ashikage.mds", 0), &CharaDataBuffer__2[6], 2, 0, 0);
841
842 for (int i = 0; i < 16; i++) {
843 Shadow[i] = shadow;
844 }
845
846 tex[0].name = (char *) GetPackFile(read_buffer, "p05b01.img", 0);
847 tex[0].block_no = 4;
848 tex[0].mipmap = false;
849 tex[1].name = 0;
850
851 TexManager.LoadTextureBlock(4, tex);
852 Chara__3[14].LoadPackData(read_buffer, "04p05b.cfg", &CharaDataBuffer__2[6], 0);
853
854 CFrameAttr attr14;
855
856 attr14.clip_enable = false;
857 Chara__3[14].frame->SetAttr(attr14, 1, 4);
858 Chara__3[14].motion_type.state.time = 1.0f;
859 Chara__3[14].motion_type.state.blend_step = 1.0f;
860 Chara__3[14].motion_type.state.motion_no = 0;
861 Chara__3[14].motion_type.state.playing_no = 0;
862
863 tex[0].name = (char *) GetPackFile(read_buffer, "p15a01.img", 0);
864 tex[0].block_no = 9;
865 tex[0].mipmap = false;
866 tex[1].name = 0;
867
868 TexManager.LoadTextureBlock(9, tex);
869 Chara__3[19].LoadPackData(read_buffer, "04p15a.cfg", &CharaDataBuffer__2[6], 0);
870
871 CFrameAttr attr19;
872
873 attr19.clip_enable = false;
874 Chara__3[19].frame->SetAttr(attr19, 1, 4);
875 Chara__3[19].motion_type.state.time = 1.0f;
876 Chara__3[19].motion_type.state.blend_step = 1.0f;
877 Chara__3[19].motion_type.state.motion_no = 0;
878 Chara__3[19].motion_type.state.playing_no = 0;
879
880 Chara__3[20].LoadPackData(read_buffer, "04p16a.cfg", &CharaDataBuffer__2[6], 0);
881
882 CFrameAttr attr20;
883
884 attr20.clip_enable = false;
885 Chara__3[20].frame->SetAttr(attr20, 1, 4);
886 Chara__3[20].motion_type.state.time = 1.0f;
887 Chara__3[20].motion_type.state.blend_step = 1.0f;
888 Chara__3[20].motion_type.state.motion_no = 0;
889 Chara__3[20].motion_type.state.playing_no = 0;
890
891 tex[0].name = (char *) GetPackFile(read_buffer, "p01a01.img", 0);
892 tex[0].block_no = 5;
893 tex[0].mipmap = false;
894 tex[1].name = 0;
895
896 TexManager.LoadTextureBlock(5, tex);
897 Chara__3[15].LoadPackData(read_buffer, "04p01a.cfg", &CharaDataBuffer__2[6], 0);
898
899 CFrameAttr attr15;
900
901 attr15.clip_enable = false;
902 Chara__3[15].frame->SetAttr(attr15, 1, 4);
903 Chara__3[15].motion_type.state.time = 300.0f;
904 Chara__3[15].motion_type.state.blend_step = 0.5f;
905 Chara__3[15].motion_type.state.motion_no = 0;
906 Chara__3[15].motion_type.state.playing_no = 0;
907
908 tex[0].name = (char *) GetPackFile(read_buffer, "p12a01.img", 0);
909 tex[0].block_no = 6;
910 tex[0].mipmap = false;
911 tex[1].name = 0;
912
913 TexManager.LoadTextureBlock(6, tex);
914 Chara__3[16].LoadPackData(read_buffer, "04p12a.cfg", &CharaDataBuffer__2[6], 0);
915
916 CFrameAttr attr16;
917
918 attr16.clip_enable = false;
919 Chara__3[16].frame->SetAttr(attr16, 1, 4);
920 Chara__3[16].motion_type.state.time = 300.0f;
921 Chara__3[16].motion_type.state.blend_step = 0.5f;
922 Chara__3[16].motion_type.state.motion_no = 0;
923 Chara__3[16].motion_type.state.playing_no = 0;
924
925 CScript__2.init_no = 0;
926}
927
928/* The demon's arrival: the two halves of it the scene animates, the beam it fires, and the four
929 pieces of sky and moonlight the rest of the scene is drawn against. The sky is given an attribute
930 mask of its own because it is drawn behind everything rather than lit with it. */
931void OpC_InitProcess3() {
932 while (ReadBGSync())
933 ;
934
935 TexManager.DeleteTextureBlock(7);
936 TexManager.DeleteTextureBlock(5);
937 TexManager.DeleteTextureBlock(6);
938 TexManager.DeleteTextureBlock(4);
939 TexManager.DeleteTextureBlock(9);
940 TexManager.DeleteTextureBlock(10);
941#ifdef PAL
942 TexManager.DeleteTextureBlock(13);
943#endif
944 TexManager.CleanUpBuffer();
945
946 LOADTEXTURE_INFO2 tex[4];
947
948 tex[0].name = (char *) GetPackFile(read_buffer, "b0203.img", 0);
949 tex[0].block_no = 10;
950 tex[0].mipmap = false;
951 tex[1].name = (char *) GetPackFile(read_buffer, "b0204.img", 0);
952 tex[1].block_no = 10;
953 tex[1].mipmap = false;
954 tex[2].name = (char *) GetPackFile(read_buffer, "tukikage.img", 0);
955 tex[2].block_no = 10;
956 tex[2].mipmap = false;
957 tex[3].name = 0;
958
959 TexManager.LoadTextureBlock(10, tex);
960
961 tex[0].name = (char *) GetPackFile(read_buffer, "c08a01.img", 0);
962#ifdef PAL
963 tex[0].block_no = 16;
964#else
965 tex[0].block_no = 15;
966#endif
967 tex[0].mipmap = false;
968 tex[1].name = 0;
969
970#ifdef PAL
971 TexManager.LoadTextureBlock(16, tex);
972#else
973 TexManager.LoadTextureBlock(15, tex);
974#endif
975
976 tex[0].name = (char *) GetPackFile(read_buffer, "c09a01.img", 0);
977#ifdef PAL
978 tex[0].block_no = 17;
979#else
980 tex[0].block_no = 16;
981#endif
982 tex[0].mipmap = false;
983 tex[1].name = 0;
984
985#ifdef PAL
986 TexManager.LoadTextureBlock(17, tex);
987#else
988 TexManager.LoadTextureBlock(16, tex);
989#endif
990
991 tex[0].name = (char *) GetPackFile(read_buffer, "beem.img", 0);
992#ifdef PAL
993 tex[0].block_no = 18;
994#else
995 tex[0].block_no = 17;
996#endif
997 tex[0].mipmap = false;
998 tex[1].name = 0;
999
1000#ifdef PAL
1001 TexManager.LoadTextureBlock(18, tex);
1002#else
1003 TexManager.LoadTextureBlock(17, tex);
1004#endif
1005
1006 CharaDataBuffer__2[6].used = 0;
1007 Chara__3[1].LoadPackData(read_buffer, "04c08a.cfg", &CharaDataBuffer__2[6], 0);
1008
1009 CFrameAttr attr1;
1010
1011 attr1.clip_enable = false;
1012 Chara__3[1].frame->SetAttr(attr1, 1, 4);
1013 Chara__3[1].motion_type.state.time = 10.0f;
1014 Chara__3[1].motion_type.state.blend_step = 0.5f;
1015 Chara__3[1].motion_type.state.motion_no = 0;
1016 Chara__3[1].motion_type.state.playing_no = 0;
1017
1018 Chara__3[3].LoadPackData(read_buffer, "04c09a.cfg", &CharaDataBuffer__2[6], 0);
1019
1020 CFrameAttr attr3;
1021
1022 attr3.clip_enable = false;
1023 Chara__3[3].frame->SetAttr(attr3, 1, 4);
1024 Chara__3[3].motion_type.state.time = 10.0f;
1025 Chara__3[3].motion_type.state.blend_step = 0.5f;
1026 Chara__3[3].motion_type.state.motion_no = 0;
1027 Chara__3[3].motion_type.state.playing_no = 0;
1028
1029 CFrameAttr sky_attr;
1030
1031 sky_attr.use_color = true;
1032 sky_attr.depth_write = false;
1033
1034 CFrameVu1 *frame = LoadMDSFile((u_int *) GetPackFile(read_buffer, "b0203.mds", 0), &MapDataBuffer, 2, 0, 0);
1035
1036 frame->SetAttr(sky_attr, 1, 4608);
1037 CMapObject &sky0 = OP_NornMapObj3[0];
1038
1039 sky0.Initialize();
1040 sky0.SetFrame(frame, 0);
1041 OP_NornMapObj3[0].handle = 0;
1042 OP_NornMapObj3[0].unk_34 = 0;
1043 sky0.SetPosition(CVector3_f_(0.0f, 0.0f, 0.0f));
1044 sky0.SetRotation(CVector3_f_(0.0f, 0.0f, 0.0f));
1045
1046 frame = LoadMDSFile((u_int *) GetPackFile(read_buffer, "b0204.mds", 0), &MapDataBuffer, 2, 0, 0);
1047 frame->SetAttr(sky_attr, 1, 4608);
1048 OP_NornMapObj3[1].Initialize();
1049 OP_NornMapObj3[1].SetFrame(frame, 0);
1050 OP_NornMapObj3[1].handle = 0;
1051 OP_NornMapObj3[1].unk_34 = 0;
1052
1053 CMapObject &sky1 = OP_NornMapObj3[1];
1054
1055 sky1.SetPosition(CVector3_f_(0.0f, 0.0f, 0.0f));
1056 sky1.SetRotation(CVector3_f_(0.0f, 0.0f, 0.0f));
1057
1058 frame = LoadMDSFile((u_int *) GetPackFile(read_buffer, "b0302.mds", 0), &MapDataBuffer, 2, 0, 0);
1059 OP_NornMapObj3[2].Initialize();
1060 OP_NornMapObj3[2].SetFrame(frame, 0);
1061 OP_NornMapObj3[2].handle = 0;
1062 OP_NornMapObj3[2].unk_34 = 0;
1063
1064 CMapObject &sky2 = OP_NornMapObj3[2];
1065
1066 sky2.SetPosition(CVector3_f_(-1147.01f, 2524.122f, 1603.736f));
1067 sky2.SetRotation(CVector3_f_(0.49406955f, 2.3992832f, -0.07209257f));
1068
1069 frame = LoadMDSFile((u_int *) GetPackFile(read_buffer, "tukikage.mds", 0), &MapDataBuffer, 2, 0, 0);
1070 OP_NornMapObj3[3].Initialize();
1071 OP_NornMapObj3[3].SetFrame(frame, 0);
1072 OP_NornMapObj3[3].handle = 0;
1073 OP_NornMapObj3[3].unk_34 = 0;
1074
1075 CMapObject &sky3 = OP_NornMapObj3[3];
1076
1077 sky3.SetPosition(CVector3_f_(0.0f, 0.0f, 0.0f));
1078 sky3.SetRotation(CVector3_f_(0.0f, 0.0f, 0.0f));
1079
1080 CSnd.SetReverb(0, 4, 50);
1081 CSnd.SetReverb(1, 4, 5);
1082 CSnd.LoadSoundFileFromPack("o03b.txt", read_buffer);
1083 CSnd.SetVol(MIDI_PORT_SE_TITLE, 256);
1084 CSnd.SetVol(MIDI_PORT_SE_DEFAULT, 256);
1085 CSnd.SetVol(MIDI_PORT_UNK_D, 256);
1086 CSnd.SetVol(MIDI_PORT_SE_SPECIAL, 256);
1087 MajinBgmStart = 0;
1088 SndCnt = 0;
1089 CScript__2.init_no = 0;
1090}
1091
1092/* The village once the demon has been through it, which is the first scene's manifest with the
1093 explosion and the dust it throws up added and everything the dance needed left out. */
1094void OpC_InitProcess4() {
1095 while (ReadBGSync())
1096 ;
1097
1098 TexManager.DeleteTextureBlock(0);
1099 TexManager.DeleteTextureBlock(10);
1100 TexManager.DeleteTextureBlock(11);
1101 TexManager.CleanUpBuffer();
1102
1103 LOADTEXTURE_INFO2 tex[15] = {
1104 {"#blender#640#" HALF_BUFFER_HEIGHT_STR "#4", 0, 0},
1105 {0, 0, 0},
1106 {0, 0, 0},
1107 {0, 0, 0},
1108 {0, 0, 0},
1109 {0, 0, 0},
1110 {0, 0, 0},
1111 {0, 0, 0},
1112 {0, 0, 0},
1113 {0, 0, 0},
1114 {0, 0, 0},
1115 {0, 0, 0},
1116 {0, 0, 0},
1117 {0, 0, 0},
1118 {0, 0, 0}
1119 };
1120
1121 tex[1].name = (char *) GetPackFile(read_buffer, "fire.img", 0);
1122 tex[1].block_no = 0;
1123 tex[1].mipmap = false;
1124 tex[2].name = (char *) GetPackFile(read_buffer, "t0203.img", 0);
1125 tex[2].block_no = 10;
1126 tex[2].mipmap = false;
1127 tex[3].name = (char *) GetPackFile(read_buffer, "e01b01.img", 0);
1128 tex[3].block_no = 10;
1129 tex[3].mipmap = false;
1130 tex[4].name = (char *) GetPackFile(read_buffer, "e01b02.img", 0);
1131 tex[4].block_no = 10;
1132 tex[4].mipmap = false;
1133 tex[5].name = (char *) GetPackFile(read_buffer, "e01b03.img", 0);
1134 tex[5].block_no = 10;
1135 tex[5].mipmap = false;
1136 tex[6].name = (char *) GetPackFile(read_buffer, "e01t01.img", 0);
1137#ifdef PAL
1138 tex[6].block_no = 13;
1139#else
1140 tex[6].block_no = 10;
1141#endif
1142 tex[6].mipmap = false;
1143 tex[7].name = (char *) GetPackFile(read_buffer, "t0205.img", 0);
1144 tex[7].block_no = 10;
1145 tex[7].mipmap = false;
1146 tex[8].name = (char *) GetPackFile(read_buffer, "t0003.img", 0);
1147 tex[8].block_no = 11;
1148 tex[8].mipmap = false;
1149 tex[9].name = (char *) GetPackFile(read_buffer, "e01s03.img", 0);
1150 tex[9].block_no = 11;
1151 tex[9].mipmap = false;
1152 tex[10].name = (char *) GetPackFile(read_buffer, "e01s06.img", 0);
1153 tex[10].block_no = 11;
1154 tex[10].mipmap = false;
1155 tex[11].name = (char *) GetPackFile(read_buffer, "t0001.img", 0);
1156 tex[11].block_no = 11;
1157 tex[11].mipmap = false;
1158 tex[12].name = (char *) GetPackFile(read_buffer, "bakuhatu.img", 0);
1159#ifdef PAL
1160 tex[12].block_no = 18;
1161#else
1162 tex[12].block_no = 17;
1163#endif
1164 tex[12].mipmap = false;
1165 tex[13].name = (char *) GetPackFile(read_buffer, "sunakemuri.img", 0);
1166#ifdef PAL
1167 tex[13].block_no = 18;
1168#else
1169 tex[13].block_no = 17;
1170#endif
1171 tex[13].mipmap = false;
1172 tex[14].name = 0;
1173
1174 TexManager.LoadTextureBlock(-1, tex);
1175 CScript__2.init_no = 0;
1176}
1177
1178/* The burning village: the ruined map, the smoke pool the fires feed, and the five actors who walk
1179 through it. The cloth Toan carries is driven by this file's own wind rather than the scene's. */
1180void OpC_InitProcess5() {
1181 while (ReadBGSync())
1182 ;
1183
1184#ifdef PAL
1185 TexManager.DeleteTextureBlock(14);
1186#else
1187 TexManager.DeleteTextureBlock(13);
1188#endif
1189#ifdef PAL
1190 TexManager.DeleteTextureBlock(18);
1191#else
1192 TexManager.DeleteTextureBlock(17);
1193#endif
1194 TexManager.DeleteTextureBlock(0);
1195 TexManager.CleanUpBuffer();
1196
1197 LOADTEXTURE_INFO2 tex[15] = {
1198 {"#blender#640#" HALF_BUFFER_HEIGHT_STR "#4", 0, 0},
1199 {0, 0, 0},
1200 {0, 0, 0},
1201 {0, 0, 0},
1202 {0, 0, 0},
1203 {0, 0, 0},
1204 {0, 0, 0},
1205 {0, 0, 0},
1206 {0, 0, 0},
1207 {0, 0, 0},
1208 {0, 0, 0},
1209 {0, 0, 0},
1210 {0, 0, 0},
1211 {0, 0, 0},
1212 {0, 0, 0}
1213 };
1214
1215 tex[1].name = (char *) GetPackFile(read_buffer, "fire.img", 0);
1216 tex[1].block_no = 0;
1217 tex[1].mipmap = false;
1218 tex[2].name = 0;
1219
1220 TexManager.LoadTextureBlock(0, tex);
1221
1222 tex[0].name = (char *) GetPackFile(read_buffer, "smoke.img", 0);
1223#ifdef PAL
1224 tex[0].block_no = 18;
1225#else
1226 tex[0].block_no = 17;
1227#endif
1228 tex[0].mipmap = false;
1229 tex[1].name = (char *) GetPackFile(read_buffer, "beem.img", 0);
1230#ifdef PAL
1231 tex[1].block_no = 18;
1232#else
1233 tex[1].block_no = 17;
1234#endif
1235 tex[1].mipmap = false;
1236 tex[2].name = (char *) GetPackFile(read_buffer, "bakuhatu.img", 0);
1237#ifdef PAL
1238 tex[2].block_no = 18;
1239#else
1240 tex[2].block_no = 17;
1241#endif
1242 tex[2].mipmap = false;
1243 tex[3].name = (char *) GetPackFile(read_buffer, "sunakemuri.img", 0);
1244#ifdef PAL
1245 tex[3].block_no = 18;
1246#else
1247 tex[3].block_no = 17;
1248#endif
1249 tex[3].mipmap = false;
1250 tex[4].name = 0;
1251
1252#ifdef PAL
1253 TexManager.LoadTextureBlock(18, tex);
1254#else
1255 TexManager.LoadTextureBlock(17, tex);
1256#endif
1257
1258 CharaDataBuffer__2[6].used = 0;
1259 MapLoad2();
1260
1261 Chara__3[11].LoadPackData(read_buffer, "04c01d.cfg", &CharaDataBuffer__2[0], 0);
1262
1263 CFrameAttr attr11;
1264
1265 attr11.clip_enable = false;
1266 Chara__3[11].frame->SetAttr(attr11, 1, 4);
1267 Chara__3[11].motion_type.state.time = 10.0f;
1268 Chara__3[11].motion_type.state.blend_step = 0.05f;
1269 Chara__3[11].motion_type.state.motion_no = 0;
1270 Chara__3[11].motion_type.state.playing_no = 0;
1271 Chara__3[11].wind = (int) &Wind;
1272
1273 tex[0].name = (char *) GetPackFile(read_buffer, "p09a01.img", 0);
1274 tex[0].block_no = 3;
1275 tex[0].mipmap = false;
1276 tex[1].name = (char *) GetPackFile(read_buffer, "p09a01an.img", 0);
1277 tex[1].block_no = 3;
1278 tex[1].mipmap = false;
1279 tex[2].name = 0;
1280
1281 TexManager.LoadTextureBlock(3, tex);
1282 Chara__3[9].LoadPackData(read_buffer, "04p09a.cfg", &CharaDataBuffer__2[6], 0);
1283
1284 CFrameAttr attr9;
1285
1286 attr9.clip_enable = false;
1287 Chara__3[9].frame->SetAttr(attr9, 1, 4);
1288 Chara__3[9].motion_type.state.time = 5.0f;
1289 Chara__3[9].motion_type.state.blend_step = 1.0f;
1290 Chara__3[9].motion_type.state.motion_no = 0;
1291 Chara__3[9].motion_type.state.playing_no = 0;
1292
1293 tex[0].name = (char *) GetPackFile(read_buffer, "p08a01.img", 0);
1294#ifdef PAL
1295 tex[0].block_no = 15;
1296#else
1297 tex[0].block_no = 14;
1298#endif
1299 tex[0].mipmap = false;
1300 tex[1].name = 0;
1301
1302#ifdef PAL
1303 TexManager.LoadTextureBlock(15, tex);
1304#else
1305 TexManager.LoadTextureBlock(14, tex);
1306#endif
1307 Chara__3[13].LoadPackData(read_buffer, "04p08a.cfg", &CharaDataBuffer__2[6], 0);
1308
1309 CFrameAttr attr13;
1310
1311 attr13.clip_enable = false;
1312 Chara__3[13].frame->SetAttr(attr13, 1, 4);
1313 Chara__3[13].motion_type.state.time = 5.0f;
1314 Chara__3[13].motion_type.state.blend_step = 1.0f;
1315 Chara__3[13].motion_type.state.motion_no = 0;
1316 Chara__3[13].motion_type.state.playing_no = 0;
1317
1318 Chara__3[18].LoadPackData(read_buffer, "04p02a.cfg", &CharaDataBuffer__2[6], 0);
1319
1320 CFrameAttr attr18;
1321
1322 attr18.clip_enable = false;
1323 Chara__3[18].frame->SetAttr(attr18, 1, 4);
1324 Chara__3[18].motion_type.state.time = 10.0f;
1325 Chara__3[18].motion_type.state.blend_step = 0.5f;
1326 Chara__3[18].motion_type.state.motion_no = 0;
1327 Chara__3[18].motion_type.state.playing_no = 0;
1328
1329 Chara__3[1].LoadPackData(read_buffer, "04c08a.cfg", &CharaDataBuffer__2[6], 0);
1330
1331 CFrameAttr attr1;
1332
1333 attr1.clip_enable = false;
1334 Chara__3[1].frame->SetAttr(attr1, 1, 4);
1335 Chara__3[1].motion_type.state.time = 10.0f;
1336 Chara__3[1].motion_type.state.blend_step = 0.5f;
1337 Chara__3[1].motion_type.state.motion_no = 0;
1338 Chara__3[1].motion_type.state.playing_no = 0;
1339
1340 Chara__3[3].LoadPackData(read_buffer, "04c09a.cfg", &CharaDataBuffer__2[6], 0);
1341
1342 CFrameAttr attr3;
1343
1344 attr3.clip_enable = false;
1345 Chara__3[3].frame->SetAttr(attr3, 1, 4);
1346 Chara__3[3].motion_type.state.time = 10.0f;
1347 Chara__3[3].motion_type.state.blend_step = 0.5f;
1348 Chara__3[3].motion_type.state.motion_no = 0;
1349 Chara__3[3].motion_type.state.playing_no = 0;
1350
1351 Fuusya[0].Initialize();
1352 Fuusya[0].anim_type = 0;
1353 Fuusya[0].play_mode = 0;
1354 Fuusya[0].start_value[2] = 0.0f;
1355 Fuusya[0].start_value[1] = 0.0f;
1356 Fuusya[0].start_value[0] = 0.0f;
1357 Fuusya[0].end_value[2] = 0.0f;
1358 Fuusya[0].end_value[1] = 0.0f;
1359 Fuusya[0].end_value[0] = 0.0f;
1360 Fuusya[0].step_y = 0.0f;
1361 Fuusya[0].step_x = 0.0f;
1362 Fuusya[0].step_z = -0.5f;
1363 strcpy(Fuusya[0].name, "hane");
1364 InitObjAnime(DoransFuusya[0], &Fuusya[0]);
1365
1366 Fuusya[1].Initialize();
1367 Fuusya[1].anim_type = 0;
1368 Fuusya[1].play_mode = 3;
1369 Fuusya[1].start_value[2] = 0.0f;
1370 Fuusya[1].start_value[1] = 0.0f;
1371 Fuusya[1].start_value[0] = 0.0f;
1372 Fuusya[1].end_value[0] = 0.0f;
1373 Fuusya[1].end_value[1] = 0.0f;
1374 Fuusya[1].end_value[2] = -90.0f;
1375 Fuusya[1].step_x = 0.0f;
1376 Fuusya[1].step_y = 0.0f;
1377 Fuusya[1].step_z = -0.048f;
1378 strcpy(Fuusya[1].name, "obj1");
1379 InitObjAnime(DoransFuusya[1], &Fuusya[1]);
1380
1381 for (int i = 0; i < 5; i++) {
1382 Taimatsu[i].Initialize();
1383 Taimatsu[i].anim_type = 3;
1384 Taimatsu[i].play_mode = 4;
1385 Taimatsu[i].start_value[2] = 80.0f;
1386 Taimatsu[i].start_value[1] = 80.0f;
1387 Taimatsu[i].start_value[0] = 80.0f;
1388 Taimatsu[i].end_value[2] = 128.0f;
1389 Taimatsu[i].end_value[1] = 128.0f;
1390 Taimatsu[i].end_value[0] = 128.0f;
1391 strcpy(Taimatsu[i].name, "effect");
1392 InitObjAnime(TaimatsuFrame[i], &Taimatsu[i]);
1393 }
1394
1395 Taimatsu[8].Initialize();
1396 Taimatsu[8].anim_type = 3;
1397 Taimatsu[8].play_mode = 4;
1398 Taimatsu[8].start_value[0] = 110.0f;
1399 Taimatsu[8].start_value[2] = 120.0f;
1400 Taimatsu[8].start_value[1] = 120.0f;
1401 Taimatsu[8].end_value[0] = 128.0f;
1402 Taimatsu[8].end_value[2] = 125.0f;
1403 Taimatsu[8].end_value[1] = 125.0f;
1404 strcpy(Taimatsu[8].name, "hikari");
1405 InitObjAnime(TaimatsuFrame[8], &Taimatsu[8]);
1406
1407 EffectTable = (CEffect *) CharaDataBuffer__2[0].Alloc(12800);
1408 Smoke.Initialize(EffectTable, 50);
1409 Smoke.Clear();
1410 CScript__2.init_no = 0;
1411}
1412
1425static void MapLoad() {
1426 MAPOBJ_INFO norn[] = {
1427 {"opdat/norn2/t0207.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} },
1428 {"opdat/norn2/e01h01_0.mds", "opdat/norn2/e01h01_s.mds", {-35.0f, 0.0f, -20.0f}, {0.0f, 0.0f, 0.0f} },
1429 {"opdat/norn2/e01h05_2.mds", 0, {50.0f, 0.0f, 20.0f}, {0.0f, -90.0f, 0.0f} },
1430 {"opdat/norn2/e01h11_2.mds", 0, {50.0f, 0.0f, -10.0f}, {0.0f, -90.0f, 0.0f} },
1431 {"opdat/norn2/e01h07_2.mds", 0, {5.0f, 0.0f, -20.0f}, {0.0f, 0.0f, 0.0f} },
1432 {"opdat/norn2/e01h08_2.mds", 0, {-45.0f, 0.0f, -45.0f}, {0.0f, 0.0f, 0.0f} },
1433 {"opdat/norn2/e01h02_2.mds", 0, {-60.0f, 0.0f, 30.0f}, {0.0f, 90.0f, 0.0f} },
1434 {"opdat/norn2/e01h06_2.mds", 0, {0.0f, 4.7424f, 79.274f}, {0.0f, 0.0f, 0.0f} },
1435 {"opdat/norn2/e01a02_1.mds", 0, {0.0f, 0.0f, 59.965f}, {0.0f, 0.0f, 0.0f} },
1436 {"opdat/norn2/t0002.mds", 0, {-23.7809f, 0.0f, 19.8331f}, {0.0f, -4.4f, 0.0f} },
1437 {0, 0, {23.1908f, 0.0f, 38.0943f}, {0.0f, -170.971f, 0.0f}},
1438 {"opdat/norn2/e01t01_0.mds", 0, {-45.0f, 0.1f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1439 {"opdat/norn2/e01t01_1.mds", 0, {65.0f, 0.1f, 45.0f}, {0.0f, -90.0f, 0.0f} },
1440 {0, 0, {55.0f, 0.1f, 55.0f}, {0.0f, -90.0f, 0.0f} },
1441 {0, 0, {-45.0f, 0.1f, 55.0f}, {0.0f, -90.0f, 0.0f} },
1442 {0, 0, {55.0f, 0.1f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1443 {"opdat/norn2/e01c01_0.mds", 0, {25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1444 {0, 0, {-45.0f, 0.0f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1445 {"opdat/norn2/e01c02_0.mds", 0, {-45.0f, 0.0f, 25.0f}, {0.0f, 0.0f, 0.0f} },
1446 {0, 0, {-45.0f, 0.0f, 15.0f}, {0.0f, 0.0f, 0.0f} },
1447 {0, 0, {-25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1448 {0, 0, {-5.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1449 {0, 0, {-15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1450 {0, 0, {15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1451 {0, 0, {25.0f, 0.0f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1452 {0, 0, {25.0f, 0.0f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1453 {0, 0, {25.0f, 0.0f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1454 {"opdat/norn2/e01c06_0.mds", 0, {-45.0f, 0.0f, 35.0f}, {0.0f, 180.0f, 0.0f} },
1455 {"opdat/norn2/e01c07_0.mds", 0, {-35.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1456 {0, 0, {5.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1457 {"opdat/norn2/e01c08_0.mds", 0, {25.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1458 {0, 0, {-45.0f, -0.01f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1459 {0, 0, {-45.0f, -0.01f, 25.0f}, {0.0f, 0.0f, 0.0f} },
1460 {0, 0, {-45.0f, -0.01f, 15.0f}, {0.0f, 0.0f, 0.0f} },
1461 {0, 0, {-25.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1462 {0, 0, {-5.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1463 {0, 0, {-15.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1464 {0, 0, {15.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1465 {0, 0, {25.0f, -0.01f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1466 {0, 0, {25.0f, -0.01f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1467 {0, 0, {25.0f, -0.01f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1468 {0, 0, {-45.0f, -0.01f, 35.0f}, {0.0f, 180.0f, 0.0f} },
1469 {0, 0, {-35.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1470 {0, 0, {5.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1471 {"opdat/norn2/e01w01_0.mds", 0, {25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1472 {0, 0, {-45.0f, 0.0f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1473 {"opdat/norn2/e01w02_0.mds", 0, {-45.0f, 0.0f, 25.0f}, {0.0f, 0.0f, 0.0f} },
1474 {0, 0, {-45.0f, 0.0f, 15.0f}, {0.0f, 0.0f, 0.0f} },
1475 {0, 0, {-25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1476 {0, 0, {-5.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1477 {0, 0, {-15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1478 {0, 0, {15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1479 {0, 0, {25.0f, 0.0f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1480 {0, 0, {25.0f, 0.0f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1481 {0, 0, {25.0f, 0.0f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1482 {"opdat/norn2/e01w06_0.mds", 0, {-45.0f, 0.0f, 35.0f}, {0.0f, 180.0f, 0.0f} },
1483 {"opdat/norn2/e01r02_0.mds", 0, {-35.0f, 0.05f, -35.0f}, {0.0f, 90.0f, 0.0f} },
1484 {0, 0, {-25.0f, 0.05f, -35.0f}, {0.0f, 90.0f, 0.0f} },
1485 {"opdat/norn2/e01r02_0.mds", 0, {-15.0f, 0.05f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1486 {0, 0, {-5.0f, 0.05f, -5.0f}, {0.0f, -90.0f, 0.0f} },
1487 {0, 0, {-15.0f, 0.05f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1488 {0, 0, {-25.0f, 0.05f, -5.0f}, {0.0f, 90.0f, 0.0f} },
1489 {"opdat/norn2/e01r03_0.mds", 0, {-15.0f, 0.05f, -35.0f}, {0.0f, 0.0f, 0.0f} },
1490 {0, 0, {-15.0f, 0.05f, -5.0f}, {0.0f, 180.0f, 0.0f} },
1491 {"opdat/norn2/e01r06_0.mds", 0, {-35.0f, 0.05f, -5.0f}, {0.0f, 90.0f, 0.0f} },
1492 {0, 0, {5.0f, 0.05f, -5.0f}, {0.0f, -90.0f, 0.0f} },
1493 {"opdat/norn2/t0004.mds", 0, {-32.9331f, 0.06f, 10.3033f}, {0.0f, 0.0f, 0.0f} },
1494 {0, 0, {-36.9302f, 0.06f, 10.3033f}, {0.0f, 0.0f, 0.0f} },
1495 {0, 0, {-36.9302f, 0.06f, -0.0916f}, {0.0f, 0.0f, 0.0f} },
1496 {0, 0, {-32.9331f, 0.06f, -0.0916f}, {0.0f, 0.0f, 0.0f} },
1497 {0, 0, {3.0797f, 0.06f, -0.0916f}, {0.0f, 0.0f, 0.0f} },
1498 {0, 0, {7.0849f, 0.06f, -0.0916f}, {0.0f, 0.0f, 0.0f} },
1499 {0, 0, {7.0849f, 0.06f, 10.3125f}, {0.0f, 0.0f, 0.0f} },
1500 {0, 0, {3.0797f, 0.06f, 10.3125f}, {0.0f, 0.0f, 0.0f} },
1501 {"opdat/norn2/t0213.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} }
1502 };
1503 CFrameAttr attr;
1504 CFrameVu1 *frame;
1505 int i;
1506 CFrameVu1 *ground_frame;
1507
1508 attr.fog_enable = true;
1509 MapDataBuffer.used = 0;
1510
1511 for (i = 0; i < 75; i++) {
1512 if (norn[i].name) {
1513 LoadFile(norn[i].name, (void *) read_buffer, 0);
1514 frame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
1515 }
1516
1517 if (i == 4) {
1518 DoransFuusya[0] = frame;
1519 }
1520
1521 if (i == 5) {
1522 DoransFuusya[1] = frame;
1523 }
1524
1525 if (i >= 67 && i < 75) {
1526 TaimatsuFrame[i - 67] = frame;
1527 }
1528
1529 SetFrameAttr(frame, 1);
1530 frame->SetAttr(attr, 1, 64);
1531
1532 CMapObject &object = OP_NornMapObj[i];
1533
1534 object.Initialize();
1535 object.SetFrame(frame, 0);
1536 OP_NornMapObj[i].handle = 0;
1537 OP_NornMapObj[i].unk_34 = 0;
1538
1539 object.SetPosition(CVector3_f_(10.0f * norn[i].position[0], 10.0f * norn[i].position[1], 10.0f * norn[i].position[2]));
1540 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)));
1541
1542 object.FrameObjectOnOff("win1", 0);
1543 object.FrameObjectOnOff("light1", 0);
1544
1545 if (norn[i].shadow_name) {
1546 LoadFile(norn[i].shadow_name, (void *) read_buffer, 0);
1547 object.shadow_frame = LoadMDSFile(read_buffer, &MapDataBuffer, 14, 0, 0);
1548 object.shadow_offset = -20.0f;
1549 }
1550 }
1551
1552 MAPOBJ_INFO ground[] = {
1553 {"opdat/norn/t0006.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} },
1554 {"opdat/norn2/t0001.mds", 0, {-33.25f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1555 {0, 0, {-23.25f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1556 {0, 0, {-13.25f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1557 {0, 0, {-3.25f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1558 {0, 0, {14.9146f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1559 {0, 0, {24.9146f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1560 {0, 0, {34.9146f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1561 {0, 0, {36.4833f, 0.03f, 17.4747f}, {0.0f, -90.0f, 0.0f} },
1562 {0, 0, {36.4833f, 0.03f, 27.4747f}, {0.0f, -90.0f, 0.0f} },
1563 {0, 0, {36.4833f, 0.03f, 37.4747f}, {0.0f, -90.0f, 0.0f} },
1564 {0, 0, {36.4833f, 0.03f, 47.4747f}, {0.0f, -90.0f, 0.0f} },
1565 {0, 0, {34.9598f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1566 {0, 0, {25.8411f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1567 {0, 0, {16.0658f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1568 {0, 0, {6.657f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1569 {0, 0, {-6.7301f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1570 {0, 0, {-15.4243f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1571 {0, 0, {-24.5027f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1572 {0, 0, {-33.5025f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1573 {0, 0, {-35.0227f, 0.03f, 47.4712f}, {0.0f, 90.0f, 0.0f} },
1574 {0, 0, {-35.0227f, 0.03f, 37.4712f}, {0.0f, 90.0f, 0.0f} },
1575 {0, 0, {-35.0227f, 0.03f, 27.4712f}, {0.0f, 90.0f, 0.0f} },
1576 {0, 0, {-35.0227f, 0.03f, 17.4712f}, {0.0f, 90.0f, 0.0f} },
1577 {"opdat/norn2/t0003.mds", 0, {-28.23f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1578 {0, 0, {-18.23f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1579 {0, 0, {-8.23f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1580 {0, 0, {19.937f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1581 {0, 0, {29.937f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1582 {0, 0, {36.4365f, 0.03f, 22.4967f}, {0.0f, -90.0f, 0.0f} },
1583 {0, 0, {36.4365f, 0.03f, 32.4967f}, {0.0f, -90.0f, 0.0f} },
1584 {0, 0, {36.4365f, 0.03f, 42.4967f}, {0.0f, -90.0f, 0.0f} },
1585 {0, 0, {31.6374f, 0.03f, 52.3176f}, {0.0f, -180.0f, 0.0f} },
1586 {0, 0, {21.6374f, 0.03f, 52.3176f}, {0.0f, -180.0f, 0.0f} },
1587 {0, 0, {11.6374f, 0.03f, 52.3176f}, {0.0f, -180.0f, 0.0f} },
1588 {0, 0, {-10.1013f, 0.03f, 52.3176f}, {0.0f, -180.0f, 0.0f} },
1589 {0, 0, {-20.1013f, 0.03f, 52.3176f}, {0.0f, -180.0f, 0.0f} },
1590 {0, 0, {-30.1013f, 0.03f, 52.3176f}, {0.0f, -180.0f, 0.0f} },
1591 {0, 0, {-34.9775f, 0.03f, 42.4508f}, {0.0f, 90.0f, 0.0f} },
1592 {0, 0, {-34.9775f, 0.03f, 32.4508f}, {0.0f, 90.0f, 0.0f} },
1593 {0, 0, {-34.9775f, 0.03f, 22.4508f}, {0.0f, 90.0f, 0.0f} },
1594 {"opdat/norn2/t0212.mds", 0, {0.0f, 0.02f, 30.0f}, {0.0f, 0.0f, 0.0f} },
1595 {"opdat/norn2/t0208.mds", 0, {0.0f, 0.0f, 29.999f}, {0.0f, 0.0f, 0.0f} },
1596 {"opdat/norn2/t0201.mds", 0, {8.1246f, 0.0f, 21.2374f}, {0.0f, -190.452f, 0.0f}},
1597 {0, 0, {9.3114f, 0.0f, 21.4458f}, {0.0f, -243.621f, 0.0f}},
1598 {0, 0, {9.8278f, 0.0f, 22.3789f}, {0.0f, -237.204f, 0.0f}},
1599 {0, 0, {9.6149f, 1.2748f, 21.9196f}, {0.0f, -237.777f, 0.0f}},
1600 {0, 0, {-10.8524f, 0.0f, 38.0058f}, {0.0f, 279.8325f, 0.0f}},
1601 {0, 0, {-11.6807f, 0.0f, 36.7247f}, {0.0f, 281.7807f, 0.0f}},
1602 {0, 0, {-11.9794f, 0.0f, 37.8902f}, {0.0f, 287.5107f, 0.0f}},
1603 {0, 0, {-12.2587f, 0.0f, 39.046f}, {0.0f, 288.9999f, 0.0f}},
1604 {0, 0, {-10.9969f, 0.0f, 39.1231f}, {0.0f, 280.291f, 0.0f} },
1605 {0, 0, {24.4449f, 0.0f, 28.8081f}, {0.0f, -84.5684f, 0.0f}},
1606 {0, 0, {24.5097f, 1.2748f, 29.317f}, {0.0f, -84.5684f, 0.0f}},
1607 {0, 0, {24.7114f, 0.0f, 29.8031f}, {0.0f, -84.5684f, 0.0f}},
1608 {0, 0, {24.9802f, 1.2748f, 30.2274f}, {0.0f, -84.5684f, 0.0f}},
1609 {0, 0, {25.2412f, 0.0f, 30.6682f}, {0.0f, -84.5684f, 0.0f}},
1610 {"opdat/norn2/t0202.mds", 0, {6.9352f, 0.0f, 22.8016f}, {0.0f, -66.4631f, 0.0f}},
1611 {0, 0, {-14.5591f, 0.0f, 35.5869f}, {0.0f, 112.4143f, 0.0f}},
1612 {"opdat/norn2/t0203.mds", 0, {8.5959f, 0.0f, 23.4822f}, {0.0f, -49.7327f, 0.0f}},
1613 {0, 0, {-13.0716f, 0.0f, 36.4929f}, {0.0f, 129.2592f, 0.0f}},
1614 {0, 0, {-14.4103f, 0.0f, 37.4364f}, {0.0f, 112.5289f, 0.0f}},
1615 {"opdat/norn2/t0204.mds", 0, {-9.0122f, 0.0f, 20.8749f}, {0.0f, -234.912f, 0.0f}},
1616 {0, 0, {-9.9647f, 0.0f, 21.4127f}, {0.0f, -227.234f, 0.0f}},
1617 {0, 0, {-10.7374f, 0.0f, 22.1576f}, {0.0f, -223.797f, 0.0f}},
1618 {0, 0, {-9.4268f, 0.9971f, 21.1822f}, {0.0f, -241.444f, 0.0f}},
1619 {0, 0, {-10.3487f, 0.9971f, 21.8464f}, {0.0f, -225.287f, 0.0f}},
1620 {0, 0, {-9.8716f, 1.9904f, 21.4498f}, {0.0f, -228.61f, 0.0f} },
1621 {0, 0, {12.8223f, 0.0f, 26.3336f}, {0.0f, -343.545f, 0.0f}},
1622 {0, 0, {11.8478f, 0.0f, 26.9861f}, {0.0f, -348.702f, 0.0f}},
1623 {0, 0, {11.9701f, 0.0f, 28.1885f}, {0.0f, -354.661f, 0.0f}},
1624 {0, 0, {13.085f, 0.0f, 27.3741f}, {0.0f, -346.983f, 0.0f}},
1625 {0, 0, {11.7334f, 0.9971f, 27.8052f}, {0.0f, -348.358f, 0.0f}},
1626 {0, 0, {12.58f, 0.9971f, 26.905f}, {0.0f, -337.013f, 0.0f}},
1627 {0, 0, {12.8088f, 0.0f, 38.6433f}, {0.0f, -382.965f, 0.0f}},
1628 {0, 0, {11.6416f, 0.0f, 38.5285f}, {0.0f, -388.121f, 0.0f}},
1629 {0, 0, {10.9726f, 0.0f, 39.535f}, {0.0f, -394.08f, 0.0f} },
1630 {0, 0, {12.3514f, 0.0f, 39.6143f}, {0.0f, -386.402f, 0.0f}},
1631 {0, 0, {11.0331f, 0.9971f, 39.0886f}, {0.0f, -387.777f, 0.0f}},
1632 {0, 0, {12.2587f, 0.9971f, 38.9308f}, {0.0f, -376.433f, 0.0f}},
1633 {"opdat/norn2/t0205.mds", 0, {-9.8702f, 2.9808f, 21.5102f}, {0.0f, -140.374f, 0.0f}},
1634 {0, 0, {-11.6688f, 1.2789f, 36.7089f}, {0.0f, -61.7649f, 0.0f}},
1635 {0, 0, {12.4831f, 1.9258f, 26.9556f}, {0.0f, -84.3394f, 0.0f}},
1636 {"opdat/norn2/t0206.mds", 0, {-4.3913f, 0.0f, 18.9443f}, {0.0f, 18.3347f, 0.0f} },
1637 {0, 0, {-13.2586f, 0.0f, 27.5378f}, {0.0f, 77.6931f, 0.0f} },
1638 {0, 0, {4.648f, 0.0f, 19.1829f}, {0.0f, -21.6578f, 0.0f}},
1639 {0, 0, {13.7675f, 0.0f, 33.1962f}, {0.0f, -110.58f, 0.0f} }
1640 };
1641
1642 for (int j = 0; j < 87; j++) {
1643 if (ground[j].name) {
1644 LoadFile(ground[j].name, (void *) read_buffer, 0);
1645 ground_frame = LoadMDSFile(read_buffer, &MapDataBuffer, 2, 0, 0);
1646 }
1647
1648 if (j > 0) {
1649 ground_frame->SetAttr(attr, 1, 64);
1650 SetFrameAttr(ground_frame, 1);
1651 }
1652
1653 if (j == 41) {
1654 TaimatsuFrame[8] = ground_frame;
1655 }
1656
1657 if (j == 0) {
1658 CFrame *sun = ground_frame->SearchFrame("sun3");
1659
1660 float x, y, z;
1661
1662 y = 400.0f;
1663 z = -30.0f;
1664 x = 420.0f;
1665 sun->SetPosition(x, (float) y, (float) z);
1666 }
1667
1668 CMapObject &object = OP_NornMapObj2[j];
1669
1670 object.Initialize();
1671 object.SetFrame(ground_frame, 0);
1672 OP_NornMapObj2[j].handle = 0;
1673 OP_NornMapObj2[j].unk_34 = 0;
1674
1675 object.SetPosition(CVector3_f_(10.0f * ground[j].position[0], 10.0f * ground[j].position[1], 10.0f * ground[j].position[2]));
1676 object.SetRotation(CVector3_f_((float) (PI_D * ground[j].rotation[0] / 180), (float) (PI_D * ground[j].rotation[1] / 180), (float) (PI_D * ground[j].rotation[2] / 180)));
1677 }
1678}
1679
1690static void MapLoad2() {
1691 MAPOBJ_INFO norn[] = {
1692 {"b0301.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} },
1693 {"e01h01_1.mds", 0, {-35.0f, 0.0f, -20.0f}, {0.0f, 0.0f, 0.0f} },
1694 {"e01h05_2.mds", 0, {50.0f, 0.0f, 20.0f}, {0.0f, -90.0f, 0.0f} },
1695 {"e01h11_2.mds", 0, {55.0f, 0.0f, -10.0f}, {0.0f, -90.0f, 0.0f} },
1696 {"e01h07_2.mds", 0, {5.0f, 0.0f, -20.0f}, {0.0f, 0.0f, 0.0f} },
1697 {"e01h02_2.mds", 0, {-60.0f, 0.0f, 30.0f}, {0.0f, 90.0f, 0.0f} },
1698 {"e01h06_2.mds", 0, {0.0f, 4.7424f, 79.274f}, {0.0f, 0.0f, 0.0f} },
1699 {"e01a02_1.mds", 0, {0.0f, 0.0f, 59.965f}, {0.0f, 0.0f, 0.0f} },
1700 {"t0304.mds", 0, {-5.0f, 0.0f, -45.0f}, {0.0f, 0.0f, 0.0f} },
1701 {0, 0, {-25.0f, 0.0f, -45.0f}, {0.0f, 0.0f, 0.0f} },
1702 {"t0305.mds", 0, {45.0f, 0.0f, -50.0f}, {0.0f, 0.0f, 0.0f} },
1703 {"t0002.mds", 0, {-23.7809f, 0.0f, 19.8331f}, {0.0f, -4.4f, 0.0f} },
1704 {0, 0, {23.1908f, 0.0f, 38.0943f}, {0.0f, -170.971f, 0.0f}},
1705 {"e01t01_0.mds", 0, {-45.0f, 0.1f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1706 {0, 0, {65.0f, 0.1f, 45.0f}, {0.0f, 0.0f, 0.0f} },
1707 {"e01t01_1.mds", 0, {55.0f, 0.1f, -35.0f}, {0.0f, -90.0f, 0.0f} },
1708 {0, 0, {-45.0f, 0.1f, 55.0f}, {0.0f, -90.0f, 0.0f} },
1709 {0, 0, {-55.0f, 0.1f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1710 {"e01c01_0.mds", 0, {25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1711 {0, 0, {-45.0f, 0.0f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1712 {"e01c02_0.mds", 0, {-45.0f, 0.0f, 25.0f}, {0.0f, 0.0f, 0.0f} },
1713 {0, 0, {-45.0f, 0.0f, 15.0f}, {0.0f, 0.0f, 0.0f} },
1714 {0, 0, {-25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1715 {0, 0, {-5.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1716 {0, 0, {-15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1717 {0, 0, {15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1718 {0, 0, {25.0f, 0.0f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1719 {0, 0, {25.0f, 0.0f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1720 {0, 0, {25.0f, 0.0f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1721 {"e01c06_0.mds", 0, {-45.0f, 0.0f, 35.0f}, {0.0f, 180.0f, 0.0f} },
1722 {"e01c07_0.mds", 0, {-35.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1723 {0, 0, {5.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1724 {"e01c08_0.mds", 0, {25.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1725 {0, 0, {-45.0f, -0.01f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1726 {0, 0, {-45.0f, -0.01f, 25.0f}, {0.0f, 0.0f, 0.0f} },
1727 {0, 0, {-45.0f, -0.01f, 15.0f}, {0.0f, 0.0f, 0.0f} },
1728 {0, 0, {-25.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1729 {0, 0, {-5.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1730 {0, 0, {-15.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1731 {0, 0, {15.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1732 {0, 0, {25.0f, -0.01f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1733 {0, 0, {25.0f, -0.01f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1734 {0, 0, {25.0f, -0.01f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1735 {0, 0, {-45.0f, -0.01f, 35.0f}, {0.0f, 180.0f, 0.0f} },
1736 {0, 0, {-35.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1737 {0, 0, {5.0f, -0.01f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1738 {"e01w01_0.mds", 0, {25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1739 {0, 0, {-45.0f, 0.0f, 5.0f}, {0.0f, -90.0f, 0.0f} },
1740 {"e01w02_0.mds", 0, {-45.0f, 0.0f, 25.0f}, {0.0f, 0.0f, 0.0f} },
1741 {0, 0, {-45.0f, 0.0f, 15.0f}, {0.0f, 0.0f, 0.0f} },
1742 {0, 0, {-25.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1743 {0, 0, {-5.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1744 {0, 0, {-15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1745 {0, 0, {15.0f, 0.0f, 5.0f}, {0.0f, 90.0f, 0.0f} },
1746 {0, 0, {25.0f, 0.0f, -5.0f}, {0.0f, 0.0f, 0.0f} },
1747 {0, 0, {25.0f, 0.0f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1748 {0, 0, {25.0f, 0.0f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1749 {"e01w06_0.mds", 0, {-45.0f, 0.0f, 35.0f}, {0.0f, 180.0f, 0.0f} },
1750 {"e01r02_0.mds", 0, {-35.0f, 0.05f, -35.0f}, {0.0f, 90.0f, 0.0f} },
1751 {0, 0, {-25.0f, 0.05f, -35.0f}, {0.0f, 90.0f, 0.0f} },
1752 {"e01r02_0.mds", 0, {-15.0f, 0.05f, -25.0f}, {0.0f, 0.0f, 0.0f} },
1753 {0, 0, {-5.0f, 0.05f, -5.0f}, {0.0f, -90.0f, 0.0f} },
1754 {0, 0, {-15.0f, 0.05f, -15.0f}, {0.0f, 0.0f, 0.0f} },
1755 {0, 0, {-25.0f, 0.05f, -5.0f}, {0.0f, 90.0f, 0.0f} },
1756 {"e01r03_0.mds", 0, {-15.0f, 0.05f, -35.0f}, {0.0f, 0.0f, 0.0f} },
1757 {0, 0, {-15.0f, 0.05f, -5.0f}, {0.0f, 180.0f, 0.0f} },
1758 {"e01r06_0.mds", 0, {-35.0f, 0.05f, -5.0f}, {0.0f, 90.0f, 0.0f} },
1759 {0, 0, {5.0f, 0.05f, -5.0f}, {0.0f, -90.0f, 0.0f} },
1760 {"t0302.mds", 0, {2.9721f, 0.06f, -0.6331f}, {0.0f, 36.2109f, 0.0f} },
1761 {0, 0, {7.2685f, 0.06f, 11.4402f}, {0.0f, -116.883f, 0.0f}},
1762 {0, 0, {2.9715f, 0.06f, 12.3798f}, {0.0f, 135.9057f, 0.0f}},
1763 {0, 0, {7.6022f, 0.06f, -3.0402f}, {0.0f, 75.5158f, 0.0f} },
1764 {0, 0, {-35.9097f, 0.06f, 12.6724f}, {0.0f, 145.6459f, 0.0f}},
1765 {"t0213.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} },
1766 {"t0306.mds", 0, {45.0f, 0.0f, 50.0f}, {0.0f, 90.0f, 0.0f} },
1767 {"t0307.mds", 0, {45.0f, 0.0f, 50.0f}, {0.0f, 180.0f, 0.0f} }
1768 };
1769 CFrameAttr attr;
1770 CFrameVu1 *frame;
1771 int i;
1772 CFrameVu1 *ground_frame;
1773
1774 attr.fog_enable = true;
1775 CharaDataBuffer__2[0].used = 0;
1776
1777 for (i = 0; i < 76; i++) {
1778 if (norn[i].name) {
1779 frame = LoadMDSFile((u_int *) GetPackFile(read_buffer, norn[i].name, 0), &CharaDataBuffer__2[0], 2, 0, 0);
1780 }
1781
1782 if (i == 4) {
1783 DoransFuusya[0] = frame;
1784 }
1785
1786 if (i == 74) {
1787 DoransFuusya[1] = frame;
1788 }
1789
1790 if (i >= 69 && i < 74) {
1791 TaimatsuFrame[i - 69] = frame;
1792 }
1793
1794 frame->SetAttr(attr, 1, 64);
1795 SetFrameAttr(frame, 1);
1796
1797 CMapObject &object = OP_NornMapObj[i];
1798
1799 object.Initialize();
1800 object.SetFrame(frame, 0);
1801 OP_NornMapObj[i].handle = 0;
1802 OP_NornMapObj[i].unk_34 = 0;
1803
1804 object.SetPosition(CVector3_f_(10.0f * norn[i].position[0], 10.0f * norn[i].position[1], 10.0f * norn[i].position[2]));
1805 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)));
1806
1807 object.FrameObjectOnOff("win1", 0);
1808 object.FrameObjectOnOff("light1", 0);
1809
1810 if (norn[i].shadow_name) {
1811 LoadFile(norn[i].shadow_name, (void *) read_buffer, 0);
1812 object.shadow_frame = LoadMDSFile(read_buffer, &MapDataBuffer, 14, 0, 0);
1813 object.shadow_offset = -20.0f;
1814 }
1815 }
1816
1817 MAPOBJ_INFO ground[] = {
1818 {"t0006.mds", 0, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} },
1819 {"t0001.mds", 0, {-33.25f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1820 {0, 0, {-23.25f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1821 {0, 0, {-3.25f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1822 {0, 0, {14.9146f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1823 {0, 0, {24.9146f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1824 {0, 0, {34.9146f, 0.03f, 13.0707f}, {0.0f, 0.0f, 0.0f} },
1825 {0, 0, {36.4833f, 0.03f, 17.4747f}, {0.0f, -90.0f, 0.0f} },
1826 {0, 0, {6.657f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1827 {0, 0, {-24.5027f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1828 {0, 0, {-33.5025f, 0.03f, 52.2721f}, {0.0f, -180.0f, 0.0f} },
1829 {0, 0, {-35.0227f, 0.03f, 37.4712f}, {0.0f, 90.0f, 0.0f} },
1830 {0, 0, {-35.0227f, 0.03f, 27.4712f}, {0.0f, 90.0f, 0.0f} },
1831 {"t0301.mds", 0, {-35.6934f, 0.0f, 20.4342f}, {0.0f, 130.0f, 0.0f} },
1832 {0, 0, {-32.5089f, 0.0f, 46.7067f}, {0.0f, -74.3699f, 0.0f}},
1833 {0, 0, {-10.4729f, 0.0f, 13.2973f}, {0.0f, 79.7557f, 0.0f} },
1834 {0, 0, {15.1651f, 0.0f, 54.5186f}, {0.0f, 207.0f, 0.0f} },
1835 {0, 0, {35.441f, 0.0f, 28.889f}, {0.0f, 156.3029f, 0.0f}},
1836 {0, 0, {-6.7649f, 0.0f, 49.889f}, {0.0f, 17.6471f, 0.0f} },
1837 {0, 0, {-17.6795f, 0.0f, 54.369f}, {0.0f, 105.768f, 0.0f} },
1838 {0, 0, {34.153f, 0.0f, 39.193f}, {0.0f, 42.628f, 0.0f} },
1839 {0, 0, {28.736f, 0.0f, 55.7777f}, {0.0f, 121.467f, 0.0f} },
1840 {"t0003.mds", 0, {-28.23f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1841 {0, 0, {19.937f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1842 {0, 0, {29.937f, 0.03f, 13.1174f}, {0.0f, 0.0f, 0.0f} },
1843 {0, 0, {-30.1013f, 0.03f, 52.3176f}, {0.0f, -180.0f, 0.0f} },
1844 {"t0212.mds", 0, {0.0f, 0.02f, 30.0f}, {0.0f, 0.0f, 0.0f} },
1845 {"t0208.mds", 0, {0.0f, 0.0f, 29.999f}, {0.0f, 0.0f, 0.0f} },
1846 {"t0201.mds", 0, {9.8278f, 0.0f, 22.3789f}, {0.0f, -237.204f, 0.0f}},
1847 {0, 0, {-11.6807f, 0.0f, 36.7247f}, {0.0f, 281.7807f, 0.0f}},
1848 {"t0303.mds", 0, {5.6932f, 0.0f, 21.7183f}, {0.0f, -40.0f, 0.0f} },
1849 {0, 0, {8.0326f, 0.0f, 25.0416f}, {0.0f, 57.0f, 0.0f} },
1850 {0, 0, {8.1469f, 0.0f, 18.4168f}, {0.0f, 77.0f, 0.0f} },
1851 {0, 0, {-11.9749f, 0.0f, 34.2407f}, {0.0f, 157.0f, 0.0f} },
1852 {0, 0, {-10.5469f, 0.0f, 36.1527f}, {0.0f, 217.0f, 0.0f} },
1853 {0, 0, {-18.8727f, 0.0f, 32.604f}, {0.0f, 40.0f, 0.0f} },
1854 {0, 0, {12.1088f, 0.0f, 43.2429f}, {0.0f, -55.0f, 0.0f} },
1855 {0, 0, {-25.5735f, 0.0f, 30.4597f}, {0.0f, -52.0f, 0.0f} },
1856 {0, 0, {-27.1088f, 0.0f, 29.2536f}, {0.0f, 22.0f, 0.0f} },
1857 {0, 0, {-28.1088f, 0.0f, 33.4081f}, {0.0f, 78.0f, 0.0f} },
1858 {"t0202.mds", 0, {6.9352f, 0.0f, 22.8016f}, {0.0f, -66.4631f, 0.0f}},
1859 {0, 0, {-14.5591f, 0.0f, 35.5869f}, {0.0f, 112.4143f, 0.0f}},
1860 {"t0203.mds", 0, {8.5959f, 0.0f, 23.4822f}, {0.0f, -49.7327f, 0.0f}},
1861 {0, 0, {-13.0716f, 0.0f, 36.4929f}, {0.0f, 129.2592f, 0.0f}},
1862 {0, 0, {-14.4103f, 0.0f, 37.4364f}, {0.0f, 112.5289f, 0.0f}},
1863 {"t0204.mds", 0, {19.0043f, 0.0f, 20.5515f}, {0.0f, 18.2201f, 0.0f} },
1864 {0, 0, {23.1962f, 0.0f, 27.52f}, {0.0f, 71.7343f, 0.0f} },
1865 {0, 0, {19.0335f, 0.0f, 22.3668f}, {0.0f, 39.5341f, 0.0f} },
1866 {0, 0, {15.9599f, 0.0f, 27.5015f}, {0.0f, -11.6883f, 0.0f}},
1867 {0, 0, {-11.7777f, 0.0f, 28.0256f}, {0.0f, -16.9596f, 0.0f}},
1868 {0, 0, {-8.2194f, 0.0f, 22.6732f}, {0.0f, -23.3767f, 0.0f}},
1869 {0, 0, {-8.9274f, 0.0f, 17.7011f}, {0.0f, 28.9917f, 0.0f} },
1870 {0, 0, {-15.2388f, 0.0f, 22.5856f}, {0.0f, -15.5854f, 0.0f}},
1871 {0, 0, {-12.4433f, 0.0f, 23.0674f}, {0.0f, 15.2407f, 0.0f} },
1872 {0, 0, {-11.3862f, 0.0f, 21.697f}, {0.0f, -10.657f, 0.0f} },
1873 {0, 0, {11.704f, 0.0f, 38.1355f}, {0.0f, -45.7425f, 0.0f}},
1874 {0, 0, {14.5128f, 0.0f, 38.3406f}, {0.0f, -16.272f, 0.0f} },
1875 {0, 0, {10.6253f, 0.0f, 40.4613f}, {0.0f, 25.3247f, 0.0f} },
1876 {0, 0, {-21.0844f, 0.0f, 38.2517f}, {0.0f, 50.0f, 0.0f} },
1877 {"t0205.mds", 0, {-11.6688f, 1.2789f, 36.7089f}, {0.0f, -61.7649f, 0.0f}},
1878 {"t0206.mds", 0, {-4.3913f, 0.0f, 18.9443f}, {0.0f, 18.3347f, 0.0f} },
1879 {0, 0, {13.2586f, 0.0f, 33.1962f}, {0.0f, 110.58f, 0.0f} }
1880 };
1881
1882 for (int j = 0; j < 62; j++) {
1883 if (ground[j].name) {
1884 ground_frame = LoadMDSFile((u_int *) GetPackFile(read_buffer, ground[j].name, 0), &CharaDataBuffer__2[6], 2, 0, 0);
1885 }
1886
1887 if (j > 0) {
1888 ground_frame->SetAttr(attr, 1, 64);
1889 SetFrameAttr(ground_frame, 1);
1890 }
1891
1892 if (j == 26) {
1893 TaimatsuFrame[8] = ground_frame;
1894 }
1895
1896 CMapObject &object = OP_NornMapObj2[j];
1897
1898 object.Initialize();
1899 object.SetFrame(ground_frame, 0);
1900 OP_NornMapObj2[j].handle = 0;
1901 OP_NornMapObj2[j].unk_34 = 0;
1902
1903 object.SetPosition(CVector3_f_(10.0f * ground[j].position[0], 10.0f * ground[j].position[1], 10.0f * ground[j].position[2]));
1904 object.SetRotation(CVector3_f_((float) (PI_D * ground[j].rotation[0] / 180), (float) (PI_D * ground[j].rotation[1] / 180), (float) (PI_D * ground[j].rotation[2] / 180)));
1905
1906 if (j == 0) {
1907 object.FrameObjectOnOff("sun3", 0);
1908 }
1909 }
1910}
1911
1912/* The tick's motion. Every one of the twenty-three actors the script is displaying takes whatever
1913 it last asked for — a motion whose frame has run past its last key falls through to the motion
1914 queued behind it — and is then placed from a frame of the camera's own model found by name, which
1915 is how an actor walks with a camera move animated in the same file. The name table is two entries
1916 shorter than the loop that reads it, which is the original's own reach past its end.
1917
1918 The last camera of the scene is the one the fire and the windmill are timed against: while it
1919 runs, the motion step drops to a twentieth and the camera shakes by a random amount whose spread
1920 narrows as the shot goes on. */
1921void OpC_MotionProcess() {
1922 for (int i = 0; i < 23; i++) {
1923 if (CScript__2.obj[i].disp) {
1924 if (CScript__2.obj[i].motion_end != -1) {
1925 if (Chara__3[i].motion_type.state.time > (float) (Chara__3[i].motion_type.motion_info[CScript__2.obj[i].motion].end - 1)) {
1926 CScript__2.obj[i].motion = CScript__2.obj[i].motion_end;
1927 CScript__2.obj[i].motion_end = -1;
1928 }
1929 }
1930
1931 Chara__3[i].motion_type.state.blend_step = CScript__2.obj[i].step;
1932 Chara__3[i].motion_no = CScript__2.obj[i].motion;
1933 Chara__3[i].motion_flags = 0;
1934 Chara__3[i].motion_speed = -1.0f;
1935 }
1936 }
1937
1938 typedef float MotionLocal0, MotionLocal1, MotionLocal2, MotionLocal3, MotionLocal4, MotionLocal5, MotionLocal6, MotionLocal7, MotionLocal8, MotionLocal9, MotionLocal10, MotionLocal11, MotionLocal12, MotionLocal13, MotionLocal14, MotionLocal15, MotionLocal16, MotionLocal17, MotionLocal18, MotionLocal19, MotionLocal20, MotionLocal21, MotionLocal22, MotionLocal23;
1939 char *frame_names[21] = {"", "c08a", "", "", "c08a", "point", "", "", "", "p09a", "", "c01d", "p03a",
1940 "p08a", "p05b", "p01a", "p12a", "p07a", "p02a", "p15a", "p16a"};
1941 sceVu0FMATRIX matrix;
1942
1943 for (int i = 0; i < 23; i++) {
1944 if (CScript__2.obj[i].disp) {
1945 CFrame *frame = Cam__2[SceneNp__2].frame->SearchFrame(frame_names[i]);
1946
1947 if (frame) {
1948 frame->GetLWMatrix(matrix);
1949 Chara__3[i].SetRotation(0.0f, atan2f(matrix[2][0], matrix[2][2]), 0.0f);
1950 float x = matrix[3][0];
1951 float y = matrix[3][1];
1952 float z = matrix[3][2];
1953 Chara__3[i].SetPosition(x, y, z);
1954 }
1955 }
1956 }
1957
1958 if (CScript__2.obj[1].disp) {
1959 CFrame *frame = Chara__3[1].frame->SearchFrame("f0");
1960
1961 if (frame) {
1962 sceVu0FMATRIX beam_matrix;
1963
1964 frame->GetLWMatrix(beam_matrix);
1965 sceVu0Normalize(beam_matrix[0], beam_matrix[0]);
1966 sceVu0Normalize(beam_matrix[1], beam_matrix[1]);
1967 sceVu0Normalize(beam_matrix[2], beam_matrix[2]);
1968 Chara__3[3].SetPosition(0.0f, 0.0f, 0.0f);
1969 Chara__3[3].SetRotation(0.0f, 0.0f, 0.0f);
1970 Chara__3[3].frame->SetTransMatrix(beam_matrix);
1971 }
1972 }
1973
1974 sceVu0FVECTOR dir;
1975
1976 dir[0] = -0.1f;
1977 dir[2] = 0.1f;
1978 dir[1] = 0.0f;
1979 dir[3] = 0.0f;
1980 Wind.SetDir(dir);
1981 Wind.SetVelocity(0.2f);
1982 Chara__3[11].wind = (int) &Wind;
1983 Wind.Step();
1984
1985 static int camera = 0;
1986
1987 if (camera != CScript__2.camera_start) {
1988 camera = CScript__2.camera_start;
1989
1990 switch (camera) {
1991 case 59:
1992 case 95:
1993 Chara__3[11].ClothStep(-1);
1994
1995 for (int i = 0; i < 10; i++) {
1996 Chara__3[11].ClothStep(0);
1997 }
1998
1999 break;
2000
2001 case 75:
2002 Chara__3[4].motion_type.state.time = 5.0f;
2003 break;
2004
2005 case 76:
2006 Chara__3[4].motion_type.state.time = 5.0f;
2007 Chara__3[1].motion_type.state.time = 35.0f;
2008 break;
2009
2010 case 77:
2011 Chara__3[1].motion_type.state.time = 35.0f;
2012 break;
2013 }
2014 }
2015
2016 if (!Pause) {
2017 ObjAnimePlay(&Fuusya[0]);
2018
2019 if (CScript__2.scene != OP_SCENE_NORUNE_BURNING) {
2020 ObjAnimePlay(&Fuusya[1]);
2021 } else if (CScript__2.camera_start > 34) {
2022 ObjAnimePlay(&Fuusya[1]);
2023 }
2024 }
2025
2026 if (!Pause) {
2027 if (CScript__2.scene == OP_SCENE_NORUNE_BURNING) {
2028 for (int i = 0; i < 5; i++) {
2029 ObjAnimePlay(&Taimatsu[i]);
2030 }
2031
2032 ObjAnimePlay(&Taimatsu[8]);
2033 } else {
2034 for (int i = 0; i < 9; i++) {
2035 ObjAnimePlay(&Taimatsu[i]);
2036 }
2037 }
2038 }
2039
2040 static float step = 0.5f;
2041 static float d = 2.0f;
2042
2043 switch (CScript__2.camera_start) {
2044 case 96:
2045#ifdef PAL_TIMING
2046 Fuusya[1].step_z = -0.12f * 1.2f;
2047#else
2048 Fuusya[1].step_z = -0.12f;
2049#endif
2050 break;
2051
2052 case 97:
2053 d = 2.0f;
2054#ifdef PAL_TIMING
2055 Fuusya[1].step_z = -0.04f * 1.2f;
2056#else
2057 Fuusya[1].step_z = -0.04f;
2058#endif
2059 break;
2060
2061 case 100:
2062 if (Cam__2[SceneNp__2].motion_type.state.time < 258.0f) {
2063#ifdef PAL_TIMING
2064 step = 0.025f * 1.2f;
2065#else
2066 step = 0.025f;
2067#endif
2068#ifdef PAL_TIMING
2069 Fuusya[1].step_z = -0.0048f * 1.2f;
2070#else
2071 Fuusya[1].step_z = -0.0048f;
2072#endif
2073
2074 if (FireStep >= 1.0f) {
2075 FireStep = 0.0f;
2076 }
2077
2078 FireStep += 0.1f;
2079 } else {
2080 if (Cam__2[SceneNp__2].motion_type.state.time < 270.0f) {
2081 sceVu0FVECTOR ref;
2082
2083 OP_MainCamera.GetRef(ref);
2084
2085 if (d < 100.0f) {
2086 d += 0.5f;
2087 }
2088
2089 ref[1] += (float) (rand() % 10) / d;
2090 OP_MainCamera.SetRef(ref);
2091 }
2092
2093#ifdef PAL_TIMING
2094 step = 0.5f * 1.2f;
2095#else
2096 step = 0.5f;
2097#endif
2098#ifdef PAL_TIMING
2099 Fuusya[1].step_z = -10.0f * 1.2f;
2100#else
2101 Fuusya[1].step_z = -10.0f;
2102#endif
2103 FireStep = 1.0f;
2104 }
2105
2106 Op_MotionInfo.speed = step;
2107 CScript__2.motion_step = step;
2108 Chara__3[11].motion_type.motion_info[5].speed = step;
2109 break;
2110 }
2111
2112 if (CScript__2.obj[4].load != -1) {
2113 LoadCharaMajin();
2114 }
2115}
2116
2127static void LoadCharaMajin() {
2128 switch (CScript__2.obj[4].load_step) {
2129 case TSLOAD_START:
2130 LoadFileBG("opdat/norn2/majinb.pak", (u_long128 *) read_buffer, 0);
2131 CScript__2.obj[4].load_step = TSLOAD_WAIT;
2132 break;
2133
2134 case TSLOAD_WAIT:
2135 if (!ReadBGSync()) {
2136 CScript__2.obj[4].load_step = TSLOAD_UNPACK;
2137 }
2138
2139 break;
2140
2141 case TSLOAD_UNPACK:
2142 Chara__3[4].Initialize();
2143 Chara__3[4].LoadPackData(read_buffer, "04c08b.cfg", &CharaDataBuffer__2[6], 0);
2144 Chara__3[4].motion_type.state.time = 5.0f;
2145 Chara__3[4].motion_type.state.blend_step = 1.0f;
2146 Chara__3[4].motion_type.state.motion_no = 0;
2147 Chara__3[4].motion_type.state.playing_no = 0;
2148 CScript__2.obj[4].load = -1;
2149 CScript__2.obj[4].load_step = TSLOAD_NONE;
2150 break;
2151 }
2152}
2153
2154/* The tick's sound. Most of the scene is a table played against one counter — a row states which
2155 sample goes on which tick of the count, which is what keeps a long cut in step without the script
2156 naming every effect — and the four footfalls beside it are windows on an actor's own motion frame
2157 with a wait behind them, so a motion that stalls inside a window plays the step once. Which of
2158 the two footfall samples the first actor takes is decided by which camera is running and how far
2159 its motion has gone, because the ground under him changes part way through the scene. */
2160void OpC_SoundProcess() {
2161 static float vol = 40.0f;
2162 static int cnt = 0;
2163
2164 if (!DanceBgmStart) {
2165 vol = 40.0f;
2166
2167 if (CScript__2.camera_start >= 58) {
2168 DanceBgmCnt = DanceBgmCnt + 1;
2169 }
2170
2171#ifdef PAL_TIMING
2172 if (DanceBgmCnt == 53) {
2173#else
2174 if (DanceBgmCnt == 63) {
2175#endif
2176 OpBgmSqPort = 0;
2177 OpBgmPlay();
2178 }
2179 }
2180
2181 static int se = 0;
2182
2183 if (CScript__2.camera_start == 70) {
2184 if (!se) {
2185 CSnd.SQ_Play(MIDI_PORT_AMBIENT, 0);
2186 se = 1;
2187 }
2188 } else {
2189 se = 0;
2190 }
2191
2192 if (CScript__2.camera_start < 69) {
2193 sceVu0FVECTOR river1 = {50.0f, 100.0f, -100.0f, 0.0f};
2194
2195 OpSetVolPanSE(river1, 50.0f, 500.0f, 15, 16, 21);
2196
2197 sceVu0FVECTOR river2 = {0.0f, 0.0f, 0.0f, 0.0f};
2198
2199 float river2_near;
2200 float river2_far;
2201 river2_far = (float) (CScript__2.camera_start - CScript__2.camera_start + 500);
2202 river2_near = 50.0f;
2203 OpSetVolPanSE(river2, river2_near, river2_far, 15, 16, 22);
2204
2205 sceVu0FVECTOR river3 = {0.0f, 0.0f, 300.0f, 0.0f};
2206
2207 float river3_near;
2208 float river3_far;
2209 river3_far = (float) (cnt - cnt + 300);
2210 river3_near = 100.0f;
2211 OpSetVolPanSE(river3, river3_near, river3_far, 15, 16, 24);
2212 }
2213
2214 static SND_INFO SndInfo[43] = {
2215 {14, 40, 50, 893, 0, 90 },
2216 {14, 40, 55, 1100, 0, 127},
2217 {14, 40, 52, 1100, 1, 127},
2218 {14, 40, 52, 1292, 0, 127},
2219 {14, 40, 56, 1292, 1, 127},
2220 {14, 40, 57, 1292, 2, 127},
2221 {14, 40, 52, 1554, 0, 127},
2222 {14, 40, 57, 1554, 1, 127},
2223 {14, 40, 53, 1585, 0, 127},
2224 {14, 40, 55, 1585, 1, 127},
2225 {14, 40, 52, 1863, 0, 127},
2226 {14, 40, 57, 1863, 1, 127},
2227 {14, 40, 52, 2033, 0, 127},
2228 {14, 40, 57, 2033, 1, 127},
2229 {14, 40, 52, 2115, 0, 127},
2230 {14, 40, 57, 2115, 0, 127},
2231 {14, 40, 53, 2156, 0, 127},
2232 {14, 40, 55, 2156, 1, 127},
2233 {14, 40, 53, 2217, 0, 127},
2234 {14, 40, 57, 2217, 1, 127},
2235 {14, 40, 53, 2275, 0, 127},
2236 {14, 40, 55, 2275, 1, 127},
2237 {14, 40, 59, 2349, 0, 127},
2238 {14, 40, 71, 2441, 0, 80 },
2239 {14, 40, 61, 2445, 0, 127},
2240 {14, 40, 62, 2469, 0, 127},
2241 {14, 40, 64, 2503, 0, 127},
2242 {14, 40, 65, 2528, 0, 127},
2243 {14, 40, 62, 2528, 0, 127},
2244 {14, 40, 66, 2586, 0, 127},
2245 {14, 40, 61, 2588, 1, 127},
2246 {14, 40, 67, 2642, 0, 127},
2247 {14, 40, 61, 2686, 0, 127},
2248 {14, 40, 69, 2740, 0, 127},
2249 {14, 40, 62, 2756, 0, 127},
2250 {14, 40, 69, 2810, 0, 127},
2251 {14, 40, 72, 3006, 3, 100},
2252 {14, 1, 67, 3006, 4, 127},
2253 {14, 40, 67, 3307, 0, 127},
2254 {14, 40, 74, 3339, 0, 127},
2255 {14, 40, 74, 3572, 0, 127},
2256 {14, 40, 75, 4255, 0, 127},
2257 {14, 40, 77, 4305, 0, 127}
2258 };
2259
2260 if (!Pause && CScript__2.camera_start >= 70) {
2261#ifdef PAL
2262 SndCnt += 1.0f;
2263#else
2264 SndCnt = SndCnt + 1;
2265#endif
2266 }
2267
2268 for (int i = 0; i < 43; i++) {
2269#ifdef PAL_TIMING
2270 // The table counts 60 Hz ticks; the 50 Hz count reaches the same moment at five sixths.
2271 if (SndCnt == SndInfo[i].count * 5 / 6) {
2272#else
2273 if (SndCnt == SndInfo[i].count) {
2274#endif
2275 OpPlayVolSE(SndInfo[i].group, SndInfo[i].no, SndInfo[i].voice, 1.0f);
2276 }
2277 }
2278
2279 int footstep_ground = 40;
2280
2281 if (CScript__2.camera_start == 58 && Cam__2[SceneNp__2].motion_type.state.time < 80.0f) {
2282 footstep_ground = 44;
2283 }
2284
2285 if (CScript__2.camera_start == 67 && Cam__2[SceneNp__2].motion_type.state.time > 45.0f) {
2286 footstep_ground = 44;
2287 }
2288
2289 if (CScript__2.camera_start == 67 && Cam__2[SceneNp__2].motion_type.state.time > 70.0f) {
2290 footstep_ground = 40;
2291 }
2292
2293 if (CScript__2.obj[11].motion == 2 || CScript__2.obj[11].motion == 7) {
2294 static int wait = 0;
2295 sceVu0FVECTOR position;
2296 float motion_frame;
2297
2298 sceVu0CopyVector(position, Chara__3[11].pos);
2299 motion_frame = (int) Chara__3[11].motion_type.state.time;
2300
2301 if (wait == 0) {
2302#ifdef PAL_TIMING
2303 if (motion_frame > 73.0f && motion_frame < 76.0f) {
2304#else
2305 if (motion_frame > 73.0f && motion_frame < 75.0f) {
2306#endif
2307 if (footstep_ground == 40) {
2308 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 20);
2309 } else {
2310 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 32);
2311 }
2312
2313 wait = 4;
2314#ifdef PAL_TIMING
2315 } else if (motion_frame > 83.0f && motion_frame < 86.0f) {
2316#else
2317 } else if (motion_frame > 83.0f && motion_frame < 85.0f) {
2318#endif
2319 if (footstep_ground == 40) {
2320 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 21);
2321 } else {
2322 OpPlayVolPanSE(position, 10.0f, (float) (footstep_ground - footstep_ground + 400), MIDI_PORT_SE_DEFAULT, 21, 33);
2323 }
2324
2325 wait = 4;
2326 }
2327 } else {
2328 wait = wait - 1;
2329 }
2330 }
2331
2332 if (CScript__2.obj[11].motion == 5) {
2333 static int wait = 0;
2334 sceVu0FVECTOR position;
2335 float motion_frame;
2336
2337 sceVu0CopyVector(position, Chara__3[11].pos);
2338 motion_frame = (int) Chara__3[11].motion_type.state.time;
2339
2340 if (wait == 0) {
2341#ifdef PAL_TIMING
2342 if (motion_frame > 258.0f && motion_frame < 261) {
2343#else
2344 if (motion_frame > 258.0f && motion_frame < 260.0f) {
2345#endif
2346 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 20);
2347 wait = 4;
2348#ifdef PAL_TIMING
2349 } else if (motion_frame > 268.0f && motion_frame < 271) {
2350#else
2351 } else if (motion_frame > 268.0f && motion_frame < 270.0f) {
2352#endif
2353 OpPlayVolPanSE(position, 10.0f, 400.0f, MIDI_PORT_SE_DEFAULT, 21, 21);
2354 wait = 4;
2355 }
2356 } else {
2357 wait = wait - 1;
2358 }
2359 }
2360
2361 if (CScript__2.obj[13].disp) {
2362 static int wait = 0;
2363 sceVu0FVECTOR position;
2364 float motion_frame;
2365
2366 sceVu0CopyVector(position, Chara__3[13].pos);
2367 motion_frame = (int) Chara__3[13].motion_type.state.time;
2368
2369 if (wait == 0) {
2370#ifdef PAL_TIMING
2371 if (motion_frame > 123.0f && motion_frame < 126.0f) {
2372#else
2373 if (motion_frame > 123.0f && motion_frame < 125.0f) {
2374#endif
2375 OpPlayVolPanSE(position, 10.0f, (float) (wait - wait + 300), MIDI_PORT_SE_DEFAULT, 21, 20);
2376 wait = 4;
2377#ifdef PAL_TIMING
2378 } else if (motion_frame > 133.0f && motion_frame < 136.0f) {
2379#else
2380 } else if (motion_frame > 133.0f && motion_frame < 135.0f) {
2381#endif
2382 OpPlayVolPanSE(position, 10.0f, (float) (wait - wait + 300), MIDI_PORT_SE_DEFAULT, 21, 21);
2383 wait = 4;
2384 }
2385 } else {
2386 wait = wait - 1;
2387 }
2388 }
2389
2390 if (CScript__2.scene == OP_SCENE_NORUNE_RUINED && CScript__2.obj[12].disp) {
2391 static int wait = 0;
2392 sceVu0FVECTOR position;
2393 float motion_frame;
2394
2395 sceVu0CopyVector(position, Chara__3[12].pos);
2396 motion_frame = (int) Chara__3[12].motion_type.state.time;
2397
2398 if (wait == 0) {
2399#ifdef PAL_TIMING
2400 if (motion_frame > 33.0f && motion_frame < 36.0f) {
2401#else
2402 if (motion_frame > 33.0f && motion_frame < 35.0f) {
2403#endif
2404 OpPlayVolPanSE(position, 10.0f, (float) (wait - wait + 300), MIDI_PORT_SE_DEFAULT, 21, 20);
2405 wait = 4;
2406#ifdef PAL_TIMING
2407 } else if (motion_frame > 43.0f && motion_frame < 46.0f) {
2408#else
2409 } else if (motion_frame > 43.0f && motion_frame < 45.0f) {
2410#endif
2411 OpPlayVolPanSE(position, 10.0f, 300.0f, MIDI_PORT_SE_DEFAULT, 21, 21);
2412 wait = 4;
2413 }
2414 } else {
2415 wait = wait - 1;
2416 }
2417 }
2418}
2419
2420/* The tick's drawing, in the order the frame is built: the fog and the projection the camera asks
2421 for, the world, the light the lightning flash overrides, the depth of field, the actors' shadows
2422 onto the one buffer that holds them all, the actors themselves, the water, the map's own shadows,
2423 the fires, the beam and the explosions. The light and the ambient colour are saved on the way in
2424 and put back on the way out, because every object in the scene is lit from its own position by
2425 LightSet rather than from one light for the whole frame. */
2426void OpC_DrawProcess() {
2427 sceVu0FMATRIX light_save;
2428 sceVu0FVECTOR ambient_save;
2429 float far_fog;
2430
2431 sceVu0CopyMatrix(light_save, light);
2432 sceVu0CopyVector(ambient_save, ambientlight);
2433 far_fog = op_fogRate[1];
2434
2435 switch (CScript__2.camera_start) {
2436 case 58:
2437 case 62:
2438 case 90:
2439 far_fog = 10000;
2440 break;
2441
2442 case 59:
2443 case 61:
2444 far_fog = 600.0f;
2445 break;
2446
2447 case 64:
2448 typedef float RenderPhase0, RenderPhase1, RenderPhase2;
2449 MGSetRenderInfo(mgRenderInfo.scale[0], 6.0f, 0xffff);
2450 break;
2451
2452 case 74:
2453 case 91:
2454 case 92:
2455 case 97:
2456 case 99:
2457 MGSetRenderInfo(mgRenderInfo.scale[0], 4.0f, 0xffff);
2458 break;
2459
2460 default:
2461 typedef float DefaultRenderPhase;
2462 MGSetRenderInfo(mgRenderInfo.scale[0], 8.0f, 0xffff);
2463 break;
2464 }
2465
2466 MGSetFogParm(op_fogRate[0], far_fog, op_fogColor[0], op_fogColor[1], op_fogColor[2], op_fogRate[2], op_fogRate[3]);
2467
2468 switch (CScript__2.scene) {
2469 case OP_SCENE_MAJIN:
2470 TexManager.ReloadTexture(Vif1Packet, 10);
2471
2472 for (int i = 0; i < 3; i++) {
2473 ((CMapObject &) OP_NornMapObj3[i]).Draw();
2474 }
2475
2476 if (CScript__2.camera_start < 72) {
2477 ((CMapObject &) OP_NornMapObj3[3]).Draw();
2478 }
2479
2480 break;
2481
2482 case OP_SCENE_NORUNE_BURNING:
2483 TexManager.ReloadTexture(Vif1Packet, 10);
2484
2485#ifdef PAL
2486 // Objects 1-17 and 68-72 take their images from block 13, so they are drawn once it is loaded.
2487 for (int i = 0; i < 74; i++) {
2488 if (i > 0 && (i <= 17 || i >= 68) && i <= 72) {
2489 continue;
2490 }
2491
2492 CMapObject &object = OP_NornMapObj[i];
2493 sceVu0FVECTOR position;
2494
2495 sceVu0CopyVector(position, object.pos);
2496 LightSet(position[0], position[1], position[2], 0);
2497 object.Draw();
2498 }
2499
2500 TexManager.ReloadTexture(Vif1Packet, 13);
2501
2502 for (int i = 0; i < 74; i++) {
2503 if ((i > 0 && i <= 17) || (i >= 68 && i < 73)) {
2504 CMapObject &object = OP_NornMapObj[i];
2505 sceVu0FVECTOR position;
2506
2507 sceVu0CopyVector(position, object.pos);
2508 LightSet(position[0], position[1], position[2], 0);
2509 object.Draw();
2510 }
2511 }
2512#else
2513 for (int i = 0; i < 74; i++) {
2514 CMapObject &object = OP_NornMapObj[i];
2515 sceVu0FVECTOR position;
2516
2517 sceVu0CopyVector(position, object.pos);
2518 LightSet(position[0], position[1], position[2], 0);
2519 object.Draw();
2520 }
2521#endif
2522
2523 if (CScript__2.camera_start == 100 && Cam__2[SceneNp__2].motion_type.state.time > 262.0f) {
2524 CMapObject &object = OP_NornMapObj[75];
2525 sceVu0FVECTOR position;
2526
2527 sceVu0CopyVector(position, object.pos);
2528 LightSet(position[0], position[1], position[2], 0);
2529 object.Draw();
2530 } else {
2531 CMapObject &object = OP_NornMapObj[74];
2532 sceVu0FVECTOR position;
2533
2534 sceVu0CopyVector(position, object.pos);
2535 LightSet(position[0], position[1], position[2], 0);
2536 object.Draw();
2537 }
2538
2539 TexManager.ReloadTexture(Vif1Packet, 11);
2540
2541 for (int i = 0; i < 26; i++) {
2542 CMapObject &object = OP_NornMapObj2[i];
2543 sceVu0FVECTOR position;
2544
2545 sceVu0CopyVector(position, object.pos);
2546 LightSet(position[0], position[1], position[2], 0);
2547 object.Draw();
2548 }
2549
2550 TexManager.ReloadTexture(Vif1Packet, 12);
2551
2552 for (int i = 26; i < 62; i++) {
2553 CMapObject &object = OP_NornMapObj2[i];
2554 sceVu0FVECTOR position;
2555
2556 sceVu0CopyVector(position, object.pos);
2557 LightSet(position[0], position[1], position[2], 0);
2558 object.Draw();
2559 }
2560
2561 break;
2562
2563 default:
2564 TexManager.ReloadTexture(Vif1Packet, 10);
2565
2566#ifdef PAL
2567 // Objects 1-15 and 66-73 take their images from block 13, so they are drawn once it is loaded.
2568 for (int i = 0; i < 75; i++) {
2569 if (i > 0 && (i <= 15 || i >= 66) && i <= 73) {
2570 continue;
2571 }
2572
2573 CMapObject &object = OP_NornMapObj[i];
2574 sceVu0FVECTOR position;
2575
2576 sceVu0CopyVector(position, object.pos);
2577 LightSet(position[0], position[1], position[2], 0);
2578 object.Draw();
2579 }
2580
2581 TexManager.ReloadTexture(Vif1Packet, 13);
2582
2583 for (int i = 0; i < 75; i++) {
2584 if ((i > 0 && i <= 15) || (i >= 66 && i < 74)) {
2585 CMapObject &object = OP_NornMapObj[i];
2586 sceVu0FVECTOR position;
2587
2588 sceVu0CopyVector(position, object.pos);
2589 LightSet(position[0], position[1], position[2], 0);
2590 object.Draw();
2591 }
2592 }
2593#else
2594 for (int i = 0; i < 75; i++) {
2595 CMapObject &object = OP_NornMapObj[i];
2596 sceVu0FVECTOR position;
2597
2598 sceVu0CopyVector(position, object.pos);
2599 LightSet(position[0], position[1], position[2], 0);
2600 object.Draw();
2601 }
2602#endif
2603
2604 TexManager.ReloadTexture(Vif1Packet, 11);
2605
2606 for (int i = 0; i < 41; i++) {
2607 CMapObject &object = OP_NornMapObj2[i];
2608 sceVu0FVECTOR position;
2609
2610 sceVu0CopyVector(position, object.pos);
2611 LightSet(position[0], position[1], position[2], 0);
2612 object.Draw();
2613 }
2614
2615 TexManager.ReloadTexture(Vif1Packet, 12);
2616
2617 for (int i = 41; i < 87; i++) {
2618 CMapObject &object = OP_NornMapObj2[i];
2619 sceVu0FVECTOR position;
2620
2621 sceVu0CopyVector(position, object.pos);
2622 LightSet(position[0], position[1], position[2], 0);
2623 object.Draw();
2624 }
2625
2626 break;
2627 }
2628
2629 static int flg = 0;
2630 static int bright = 255;
2631
2632 if (CScript__2.sprite == 1) {
2633 CScript__2.sprite = 0;
2634 flg = 1;
2635 bright = 255;
2636 }
2637
2638 if (flg == 1) {
2639 sceVu0FMATRIX color;
2640
2641 sceVu0CopyMatrix(color, lightcolor);
2642
2643 int brightened = 0;
2644
2645 if (color[0][0] < (float) bright) {
2646 color[0][0] = (float) bright;
2647 brightened = 1;
2648 }
2649
2650 if (color[0][1] < (float) bright) {
2651 color[0][1] = (float) bright;
2652 brightened = 1;
2653 }
2654
2655 if (color[0][2] < (float) bright) {
2656 color[0][2] = (float) bright;
2657 brightened = 1;
2658 }
2659
2660 bright = bright - 4;
2661 MGSetPLight(light, color);
2662
2663 if (!brightened) {
2664 flg = 0;
2665 }
2666 } else {
2667 bright = 255;
2668 }
2669
2670 TexManager.ReloadTexture(Vif1Packet, 22);
2671
2672 switch (CScript__2.camera_start) {
2673 case 58:
2674 case 60:
2675 case 70:
2676 case 71:
2677 break;
2678
2679 case 62: {
2680 float dof[2] = {200.0f, 400.0f};
2681
2682 DepthOfField(dof, 2, 32, 0);
2683 } break;
2684
2685 case 63:
2686 case 64:
2687 case 65:
2688 case 66: {
2689 float dof[2] = {200.0f, 400.0f};
2690
2691 DepthOfField(dof, 2, 64, 0);
2692 } break;
2693
2694 default: {
2695 float dof[2] = {200.0f, 400.0f};
2696
2697 DepthOfField(dof, 2, 48, 0);
2698 } break;
2699 }
2700
2701 if (CScript__2.scene == OP_SCENE_MAJIN && CScript__2.camera_start > 76 && CScript__2.camera_start < 86) {
2702 sceGsTex0 back;
2703
2704 MGGetFBuffBackTex(&back);
2705
2706 CTexture texture;
2707
2708 texture.tex0 = *(u_long *) &back;
2709 set2DSprite(Vif1Packet, &texture, CRect<int>(0, 0, 640, SCREEN_HEIGHT), CRect<int>(0, 0, 640, SCREEN_HALF_HEIGHT), 128, 128, 128, 105);
2710 }
2711
2712 for (int i = 0; i < 23; i++) {
2713 if (KageCheck(i) && CScript__2.obj[i].disp) {
2714 TexManager.ReloadTexture(Vif1Packet, 23);
2715 MGBeginDrawShadow(*(sceGsTex0 *) &TexManager.GetTexture("shadow_buff", -1)->tex0);
2716
2717 if (!Pause) {
2718 Chara__3[i].ShadowStep();
2719 }
2720
2721 if (CScript__2.scene != OP_SCENE_MAJIN) {
2722 sceVu0FVECTOR position;
2723
2724 sceVu0CopyVector(position, Chara__3[i].pos);
2725 LightSet(position[0], position[1], position[2], 1);
2726 }
2727
2728 Chara__3[i].DrawShadow();
2729 MGEndDrawShadow(52);
2730 }
2731 }
2732
2733 for (int i = 0; i < 23; i++) {
2734 if (CScript__2.obj[i].disp) {
2735 TexManager.ReloadTexture(Vif1Packet, CharaTex__2[i]);
2736
2737 if (!Pause) {
2738 Chara__3[i].Step();
2739 Chara__3[i].ClothStep(0);
2740 }
2741
2742 if (CScript__2.scene != OP_SCENE_MAJIN) {
2743 sceVu0FVECTOR position;
2744
2745 sceVu0CopyVector(position, Chara__3[i].pos);
2746 LightSet(position[0], position[1], position[2], 0);
2747 }
2748
2749 FaceChangeD(i);
2750 Chara__3[i].Draw();
2751 }
2752 }
2753
2754 if (CScript__2.scene == OP_SCENE_DANCE) {
2755 InchikiShadow();
2756 DrawDancer();
2757 }
2758
2759 if (CScript__2.camera_start > 66 && CScript__2.camera_start < 69) {
2760 TexManager.ReloadTexture(Vif1Packet, 10);
2761 WaterProcess();
2762 }
2763
2764 if (CScript__2.scene != OP_SCENE_MAJIN && CScript__2.camera_start < 60) {
2765 TexManager.ReloadTexture(Vif1Packet, 23);
2766 MGBeginDrawShadow(*(sceGsTex0 *) &TexManager.GetTexture("shadow_buff", -1)->tex0);
2767
2768 if (CScript__2.scene != OP_SCENE_NORUNE_BURNING) {
2769 for (int i = 0; i < 75; i++) {
2770 CMapObject &object = OP_NornMapObj[i];
2771 sceVu0FVECTOR position;
2772
2773 sceVu0CopyVector(position, object.pos);
2774 LightSet(position[0], position[1], position[2], 0);
2775 object.DrawShadow(0);
2776 }
2777 } else {
2778 for (int i = 0; i < 76; i++) {
2779 CMapObject &object = OP_NornMapObj[i];
2780 sceVu0FVECTOR position;
2781
2782 sceVu0CopyVector(position, object.pos);
2783 LightSet(position[0], position[1], position[2], 0);
2784 object.DrawShadow(0);
2785 }
2786 }
2787
2788 MGEndDrawShadow(52);
2789 }
2790
2791 if (CScript__2.scene != OP_SCENE_MAJIN && OP_FireList > 0) {
2792 TexManager.ReloadTexture(GetVif1Packet(), 0);
2793
2794 if (!Pause && FireStep >= 1.0f) {
2795 CFire.FireStep();
2796 }
2797
2798 CFire.FireCreate();
2799 OP_CharaFrame__2 = Cam__2[SceneNp__2].frame;
2800
2801 sceVu0FVECTOR eye;
2802
2803 sceVu0CopyVector(eye, OP_CharaFrame__2->position);
2804
2805 if (CScript__2.scene != OP_SCENE_NORUNE_BURNING) {
2806 for (int i = 0; i < 22; i++) {
2807 float z = OP_FirePosition[i][2];
2808 float y = OP_FirePosition[i][1];
2809 float x = OP_FirePosition[i][0];
2810
2811 CFire.position[0] = 10.0f * x;
2812 CFire.position[1] = 10.0f * y;
2813 CFire.position[2] = 10.0f * z;
2814 CFire.position[3] = 1.0f;
2815
2816 int fire_flag = OP_FireFlg[i];
2817
2818 if (fire_flag == 1) {
2819 CFire.DrawFire(1, 1, &OP_MainCamera, eye, OP_FireScale[i], 3, (float) (15.0 * OP_FireScale[i]));
2820 } else {
2821 CFire.DrawFire(1, 1, &OP_MainCamera, eye, OP_FireScale[i], 2, 15.0f);
2822 }
2823 }
2824 } else {
2825 for (int i = 0; i < OP_FireList; i++) {
2826 if (i < 22) {
2827 OP_FirePosition[i][1] = -100.0f;
2828 }
2829
2830 float z = OP_FirePosition[i][2];
2831 float y = OP_FirePosition[i][1];
2832 float x = OP_FirePosition[i][0];
2833
2834 CFire.position[0] = 10.0f * x;
2835 CFire.position[1] = 10.0f * y;
2836 CFire.position[2] = 10.0f * z;
2837 CFire.position[3] = 1.0f;
2838
2839 int fire_flag = OP_FireFlg[i];
2840
2841 if (fire_flag == 1) {
2842 CFire.DrawFire(1, 1, &OP_MainCamera, eye, OP_FireScale[i], 3, 15.0f);
2843 } else {
2844 CFire.DrawFire(1, 1, &OP_MainCamera, eye, OP_FireScale[i], 2, 15.0f);
2845 }
2846 }
2847 }
2848 }
2849
2850 if (CScript__2.scene >= OP_SCENE_MAJIN) {
2851 if (CScript__2.camera_start == 77 && Cam__2[SceneNp__2].motion_type.state.time > 37.5f && !MajinBgmStart) {
2852 MajinBgmStart = 1;
2853 OpBgmSqPort = 0;
2854 OpBgmPlay();
2855 CSnd.Fade(MIDI_PORT_AMBIENT, -1.0f, 0);
2856 }
2857
2858 MajinBeemProcess();
2859 }
2860
2861 if (CScript__2.scene == OP_SCENE_NORUNE_BURNING) {
2862#ifdef PAL
2863 TexManager.ReloadTexture(Vif1Packet, 18);
2864#else
2865 TexManager.ReloadTexture(Vif1Packet, 17);
2866#endif
2867 SmokeProcess();
2868 }
2869
2870 if (CScript__2.scene >= OP_SCENE_NORUNE_RUINED) {
2871 if (CScript__2.bom_req) {
2872 int bomb = CScript__2.bom_no;
2873 float size = CScript__2.bom_size[bomb];
2874
2875 for (int i = 0; i < 8; i++) {
2876 sceVu0CopyVector(CBomb[bomb].positions[i], CScript__2.bom_pos[bomb]);
2877 CBomb[bomb].phases[i] = BOMB_PHASE_BURST;
2878 CBomb[bomb].counters[i] = -(i * 3);
2879 CBomb[bomb].alphas[i] = 128.0f;
2880 CBomb[bomb].sizes[i] = size;
2881 CBomb[bomb].active[i] = 1;
2882 }
2883
2884 CBomb[bomb].phases[0] = BOMB_PHASE_LINGER;
2885 CBomb[bomb].phases[1] = BOMB_PHASE_BLOOM;
2886 CBomb[bomb].alphas[5] = 32.0f;
2887 CBomb[bomb].alphas[6] = 32.0f;
2888 CBomb[bomb].alphas[7] = 32.0f;
2889 CScript__2.bom_req = false;
2890 }
2891
2892#ifdef PAL
2893 TexManager.ReloadTexture(Vif1Packet, 18);
2894#else
2895 TexManager.ReloadTexture(Vif1Packet, 17);
2896#endif
2897
2898 int dust;
2899
2900 if (CScript__2.camera_start == 100) {
2901 dust = 1;
2902 } else {
2903 dust = 0;
2904 }
2905
2906 for (int i = 0; i < 3; i++) {
2907 if (!Pause) {
2908 CBomb[i].Step();
2909 }
2910
2911 CBomb[i].Draw(&OP_MainCamera, dust);
2912 }
2913 }
2914
2915 sceVu0CopyMatrix(light, light_save);
2916 sceVu0CopyVector(ambientlight, ambient_save);
2917 MGSetPLight(light, lightcolor);
2918 MGSetAmbient(ambientlight);
2919}
2920
2931static void DrawDancer() {
2932 sceVu0FMATRIX matrix;
2933 register float zero = 0.0f;
2934
2935 if (CScript__2.obj[19].disp) {
2936 TexManager.ReloadTexture(Vif1Packet, CharaTex__2[19]);
2937 CharaF[0] = Chara__3[19].frame;
2938
2939 CFrame *frame = Cam__2[SceneNp__2].frame->SearchFrame("p15a1");
2940
2941 if (frame) {
2942 frame->GetLWMatrix(matrix);
2943#ifdef PAL
2944 CharaF[0]->SetRotation((float) zero, atan2f(matrix[2][0], matrix[2][2]), zero);
2945#else
2946 CharaF[0]->SetRotation(0.0f, atan2f(matrix[2][0], matrix[2][2]), (float) zero);
2947#endif
2948 float x = matrix[3][0];
2949 float y = matrix[3][1];
2950 float z = matrix[3][2];
2951 CharaF[0]->SetPosition(x, y, z);
2952 LightSet(matrix[3][0], matrix[3][1], matrix[3][2], 0);
2953 MGDraw(CharaF[0]);
2954
2955 frame = CharaF[0]->SearchFrame("r_foot");
2956
2957 if (frame) {
2958 frame->GetLWMatrix(matrix);
2959 DrawShadow(10, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
2960 }
2961
2962 frame = CharaF[0]->SearchFrame("l_foot");
2963
2964 if (frame) {
2965 frame->GetLWMatrix(matrix);
2966 DrawShadow(11, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
2967 }
2968 }
2969
2970 TexManager.ReloadTexture(Vif1Packet, CharaTex__2[19]);
2971 CharaF[1] = Chara__3[19].frame;
2972
2973 CFrame *second_frame = Cam__2[SceneNp__2].frame->SearchFrame("p15a2");
2974
2975 if (second_frame) {
2976 second_frame->GetLWMatrix(matrix);
2977#ifdef PAL
2978 CharaF[1]->SetRotation(0.0f, atan2f(matrix[2][0], matrix[2][2]), zero);
2979#else
2980 CharaF[1]->SetRotation((float) zero, atan2f(matrix[2][0], matrix[2][2]), zero);
2981#endif
2982 float x = matrix[3][0];
2983 float y = matrix[3][1];
2984 float z = matrix[3][2];
2985 CharaF[1]->SetPosition(x, y, z);
2986 LightSet(matrix[3][0], matrix[3][1], matrix[3][2], 0);
2987 MGDraw(CharaF[1]);
2988
2989 frame = CharaF[1]->SearchFrame("r_foot");
2990
2991 if (frame) {
2992 frame->GetLWMatrix(matrix);
2993 DrawShadow(12, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
2994 }
2995
2996 frame = CharaF[1]->SearchFrame("l_foot");
2997
2998 if (frame) {
2999 frame->GetLWMatrix(matrix);
3000 DrawShadow(13, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3001 }
3002 }
3003 }
3004
3005 float unused;
3006
3007 if (CScript__2.obj[20].disp) {
3008 TexManager.ReloadTexture(Vif1Packet, CharaTex__2[20]);
3009 CharaF[2] = Chara__3[20].frame;
3010
3011 CFrame *frame = Cam__2[SceneNp__2].frame->SearchFrame("p16a1");
3012
3013 if (frame) {
3014 sceVu0FMATRIX matrix2;
3015
3016 frame->GetLWMatrix(matrix2);
3017#ifdef PAL
3018 CharaF[2]->SetRotation(0.0f, atan2f(matrix2[2][0], matrix2[2][2]), zero);
3019#else
3020 CharaF[2]->SetRotation(0.0f, atan2f(matrix2[2][0], matrix2[2][2]), (float) zero);
3021#endif
3022 float x = matrix2[3][0];
3023 float y = matrix2[3][1];
3024 float z = matrix2[3][2];
3025 CharaF[2]->SetPosition(x, y, z);
3026 LightSet(matrix2[3][0], matrix2[3][1], matrix2[3][2], 0);
3027 MGDraw(CharaF[2]);
3028
3029 frame = CharaF[2]->SearchFrame("r_foot");
3030
3031 if (frame) {
3032 frame->GetLWMatrix(matrix2);
3033 DrawShadow(14, (float) matrix2[3][0], (float) matrix2[3][1], (float) matrix2[3][2]);
3034 }
3035
3036 frame = CharaF[2]->SearchFrame("l_foot");
3037
3038 if (frame) {
3039 frame->GetLWMatrix(matrix2);
3040 DrawShadow(15, (float) matrix2[3][0], (float) matrix2[3][1], (float) matrix2[3][2]);
3041 }
3042 }
3043 }
3044}
3045
3056static void InchikiShadow() {
3057 sceVu0FMATRIX matrix;
3058 CFrame *frame;
3059
3060 if (CScript__2.obj[14].disp) {
3061 frame = Chara__3[14].frame->SearchFrame("r_foot");
3062
3063 if (frame) {
3064 frame->GetLWMatrix(matrix);
3065 DrawShadow(0, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3066 }
3067
3068 frame = Chara__3[14].frame->SearchFrame("l_foot");
3069
3070 if (frame) {
3071 frame->GetLWMatrix(matrix);
3072 DrawShadow(1, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3073 }
3074 }
3075
3076 if (CScript__2.obj[15].disp) {
3077 frame = Chara__3[15].frame->SearchFrame("r_foot");
3078
3079 if (frame) {
3080 frame->GetLWMatrix(matrix);
3081 DrawShadow(2, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3082 }
3083
3084 frame = Chara__3[15].frame->SearchFrame("l_foot");
3085
3086 if (frame) {
3087 frame->GetLWMatrix(matrix);
3088 DrawShadow(3, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3089 }
3090 }
3091
3092 if (CScript__2.obj[16].disp) {
3093 frame = Chara__3[16].frame->SearchFrame("r_foot");
3094
3095 if (frame) {
3096 frame->GetLWMatrix(matrix);
3097 DrawShadow(4, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3098 }
3099
3100 frame = Chara__3[16].frame->SearchFrame("l_foot");
3101
3102 if (frame) {
3103 frame->GetLWMatrix(matrix);
3104 DrawShadow(5, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3105 }
3106 }
3107
3108 if (CScript__2.obj[17].disp) {
3109 frame = Chara__3[17].frame->SearchFrame("eff19");
3110
3111 if (frame) {
3112 frame->GetLWMatrix(matrix);
3113 DrawShadow(4, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3114 }
3115
3116 frame = Chara__3[17].frame->SearchFrame("eff7");
3117
3118 if (frame) {
3119 frame->GetLWMatrix(matrix);
3120 DrawShadow(5, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3121 }
3122 }
3123
3124 if (CScript__2.obj[18].disp) {
3125 frame = Chara__3[18].frame->SearchFrame("r_foot");
3126
3127 if (frame) {
3128 frame->GetLWMatrix(matrix);
3129 DrawShadow(4, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3130 }
3131
3132 frame = Chara__3[18].frame->SearchFrame("l_foot");
3133
3134 if (frame) {
3135 frame->GetLWMatrix(matrix);
3136 DrawShadow(5, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3137 }
3138 }
3139
3140 if (CScript__2.obj[19].disp) {
3141 frame = Chara__3[19].frame->SearchFrame("r_foot");
3142
3143 if (frame) {
3144 frame->GetLWMatrix(matrix);
3145 DrawShadow(6, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3146 }
3147
3148 frame = Chara__3[19].frame->SearchFrame("l_foot");
3149
3150 if (frame) {
3151 frame->GetLWMatrix(matrix);
3152 DrawShadow(7, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3153 }
3154 }
3155
3156 if (CScript__2.obj[20].disp) {
3157 frame = Chara__3[20].frame->SearchFrame("r_foot");
3158
3159 if (frame) {
3160 frame->GetLWMatrix(matrix);
3161 DrawShadow(6, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3162 }
3163
3164 frame = Chara__3[20].frame->SearchFrame("l_foot");
3165
3166 if (frame) {
3167 frame->GetLWMatrix(matrix);
3168 DrawShadow(7, (float) matrix[3][0], (float) matrix[3][1], (float) matrix[3][2]);
3169 }
3170 }
3171}
3172
3183static void DrawShadow(int shadow_no, float x, float y, float z) {
3184 sceVu0FVECTOR ambient = {0.0f, 0.0f, 0.0f, 54.0f};
3185
3186#ifdef PAL
3187 TexManager.ReloadTexture(Vif1Packet, 18);
3188#else
3189 TexManager.ReloadTexture(Vif1Packet, 17);
3190#endif
3191 ambient[3] = ambient[3] - 10.0f * y;
3192
3193 if (ambient[3] > 0.0f) {
3194 MGSetAmbient(ambient);
3195
3196 float heading = atan2f(x, z - 300.0f);
3197
3198 Shadow[shadow_no]->SetPosition(x, 0.05f, z);
3199 Shadow[shadow_no]->SetRotation(1.5533431f, heading, 0.0f);
3200 MGDraw(Shadow[shadow_no]);
3201 MGSetAmbient(ambientlight);
3202 }
3203}
3204
3216static void MajinBeemProcess() {
3217 char *frame_names[10] = {"yubi", "heso", "l_asi", "r_asi", "kuti", "toutyou", "yubi", "yubi", "yubi",
3218 "heso"};
3219
3220 if (CScript__2.beem_req) {
3221 float speed;
3222
3223#ifdef PAL_TIMING
3224 if (CScript__2.scene == OP_SCENE_MAJIN) {
3225 speed = 5.4f;
3226 } else {
3227 speed = 9.6f;
3228 }
3229#else
3230 if (CScript__2.scene == OP_SCENE_MAJIN) {
3231 speed = 4.5f;
3232 } else {
3233 speed = 8.0f;
3234 }
3235#endif
3236
3237 int beam = CScript__2.beem_no;
3238
3239 if (CScript__2.beem_end) {
3240 static sceVu0FVECTOR pos = {0.0f, 0.0f, 0.0f, 0.0f};
3241 static sceVu0FVECTOR pos2 = {0.0f, 0.0f, 0.0f, 0.0f};
3242 sceVu0FMATRIX matrix;
3243
3244 CFrame *frame = Chara__3[1].frame->SearchFrame(frame_names[MBeemCnt]);
3245
3246 MBeemCnt = MBeemCnt + 1;
3247
3248 if (frame) {
3249 frame->GetLWMatrix(matrix);
3250 pos[0] = matrix[3][0];
3251 pos[1] = matrix[3][1];
3252 pos[2] = matrix[3][2];
3253 }
3254
3255 CFrame *end = Cam__2[SceneNp__2].frame->SearchFrame("end");
3256
3257 if (end) {
3258 end->GetLWMatrix(matrix);
3259 pos2[0] = matrix[3][0];
3260 pos2[1] = matrix[3][1];
3261 pos2[2] = matrix[3][2];
3262 }
3263
3264 if (MBeemCnt - 1 == 2 || MBeemCnt - 1 == 3) {
3265 sceVu0CopyVector(CBeem[beam].target, pos2);
3266 CBeem[beam].speed = speed;
3267
3268 for (int i = 0; i < 60; i++) {
3269 sceVu0CopyVector(CBeem[beam].positions[i], pos);
3270 CBeem[beam].state = MAJIN_BEEM_AIM;
3271 CBeem[beam].counters[i] = -i;
3272 CBeem[beam].alphas[i] = 128.0f - (float) (2 * i);
3273 CBeem[beam].sizes[i] = 20.0f - (float) (i / 3);
3274
3275 if (CBeem[beam].sizes[i] < 8.0f) {
3276 CBeem[beam].sizes[i] = 8.0f;
3277 }
3278
3279 CBeem[beam].active = true;
3280 }
3281
3282 for (int i = 0; i < 10; i++) {
3283 CBeem[beam].sizes[i] = 20.0f;
3284 }
3285
3286 CBeem[beam].alphas[59] = 128.0f;
3287 CBeem[beam].sizes[59] = 48.0f;
3288 } else {
3289 sceVu0CopyVector(CBeem[beam].target, pos2);
3290 CBeem[beam].speed = speed;
3291
3292 for (int i = 0; i < 60; i++) {
3293 sceVu0CopyVector(CBeem[beam].positions[i], pos);
3294 CBeem[beam].state = MAJIN_BEEM_AIM;
3295 CBeem[beam].counters[i] = -i;
3296 CBeem[beam].alphas[i] = 128.0f - (float) (2 * i);
3297 CBeem[beam].sizes[i] = 20.0f - (float) (i / 3);
3298
3299 if (CBeem[beam].sizes[i] < 8.0f) {
3300 CBeem[beam].sizes[i] = 8.0f;
3301 }
3302
3303 CBeem[beam].active = true;
3304 }
3305
3306 for (int i = 0; i < 10; i++) {
3307 CBeem[beam].sizes[i] = 20.0f;
3308 }
3309
3310 CBeem[beam].alphas[59] = 128.0f;
3311 CBeem[beam].sizes[59] = 32.0f;
3312 }
3313 } else {
3314 sceVu0CopyVector(CBeem[beam].target, CScript__2.beem_to[beam]);
3315 CBeem[beam].speed = speed;
3316
3317 for (int i = 0; i < 60; i++) {
3318 sceVu0CopyVector(CBeem[beam].positions[i], CScript__2.beem_from[beam]);
3319 CBeem[beam].state = MAJIN_BEEM_AIM;
3320 CBeem[beam].counters[i] = -i;
3321 CBeem[beam].alphas[i] = 128.0f - (float) (2 * i);
3322 CBeem[beam].sizes[i] = 20.0f - (float) (i / 3);
3323
3324 if (CBeem[beam].sizes[i] < 8.0f) {
3325 CBeem[beam].sizes[i] = 8.0f;
3326 }
3327
3328 CBeem[beam].active = true;
3329 }
3330
3331 for (int i = 0; i < 10; i++) {
3332 CBeem[beam].sizes[i] = 20.0f;
3333 }
3334
3335 CBeem[beam].alphas[59] = 128.0f;
3336 CBeem[beam].sizes[59] = 0.0f;
3337 }
3338
3339 CScript__2.beem_req = false;
3340 }
3341
3342#ifdef PAL
3343 TexManager.ReloadTexture(Vif1Packet, 18);
3344#else
3345 TexManager.ReloadTexture(Vif1Packet, 17);
3346#endif
3347
3348 for (int i = 0; i < 3; i++) {
3349 if (!Pause) {
3350 CBeem[i].Step();
3351 }
3352
3353 CBeem[i].Draw(&OP_MainCamera);
3354 }
3355
3356 if (CScript__2.obj[1].disp && CScript__2.scene == OP_SCENE_MAJIN) {
3357 sceVu0FVECTOR head;
3358 int part;
3359
3360 if (MBeemCnt == 0) {
3361 part = 0;
3362 } else {
3363 part = MBeemCnt - 1;
3364 }
3365
3366 CFrame *frame = Chara__3[1].frame->SearchFrame(frame_names[part]);
3367
3368 if (frame) {
3369 sceVu0FMATRIX matrix;
3370
3371 frame->GetLWMatrix(matrix);
3372 head[0] = matrix[3][0];
3373 head[1] = matrix[3][1];
3374 head[2] = matrix[3][2];
3375 OP_CharaFrame__2 = Cam__2[SceneNp__2].frame;
3376
3377 sceVu0FVECTOR eye;
3378
3379 sceVu0CopyVector(eye, OP_CharaFrame__2->position);
3380 CBeem[CScript__2.beem_no].Draw2(&OP_MainCamera, head, eye);
3381 }
3382 }
3383}
3384
3396static void SmokeProcess() {
3397 static int cnt = 0;
3398
3399 cnt = cnt + 1;
3400
3401 if (cnt > 7) {
3402 cnt = 0;
3403 }
3404
3405 if (cnt == 0) {
3406 sceVu0FVECTOR position = {400.0f, 10.0f, -450.0f, 1.0f};
3407 CEffectParam param;
3408
3409 param.Initialize();
3410 sceVu0CopyVector(param.position, position);
3412 param.wobble_scale = 0.5f * rand() / 2147483648.0f;
3413 param.wobble_rate = (float) PI_D / (20.0f + 10 * rand() / 2147483648.0f);
3414 param.opacity_mode = 2;
3415 param.render_flags = 1;
3416 param.opacity = 0.15f;
3417 param.rise_speed = 1.5f + 0.2f * rand() / 2147483648.0f;
3418 param.width_growth = 0.04f;
3419 param.height_growth = 0.04f;
3420 param.lifetime = 120;
3421 param.texture = TexManager.GetTexture("gray smoke", -1);
3422
3423 switch (rand() % 4) {
3424 case 0:
3425 param.texel = CRect<int>(0, 0, 64, 64);
3426 break;
3427
3428 case 1:
3429 param.texel = CRect<int>(64, 0, 64, 64);
3430 break;
3431
3432 case 2:
3433 param.texel = CRect<int>(0, 64, 64, 64);
3434 break;
3435
3436 case 3:
3437 param.texel = CRect<int>(64, 64, 64, 64);
3438 break;
3439 }
3440
3441 param.unk_08 = 20.0f;
3442 param.unk_0C = 20.0f;
3443 param.texture_frame_period = 60;
3444 Smoke.EnterEffect(&param);
3445
3446 position[0] = -550;
3447 position[1] = 0.0f;
3448 position[2] = 300.0f;
3449
3450 CEffectParam param2;
3451
3452 param2.Initialize();
3453 sceVu0CopyVector(param2.position, position);
3454 param2.position_oscillation_flags = 1;
3455 param2.wobble_scale = 0.5f * rand() / 2147483648.0f;
3456 param2.wobble_rate = (float) PI_D / (20.0f + 10 * rand() / 2147483648.0f);
3457 param2.opacity_mode = 2;
3458 param2.render_flags = 1;
3459 param2.opacity = 0.15f;
3460 param2.rise_speed = 1.5f + 0.2f * rand() / 2147483648.0f;
3461 param2.width_growth = 0.04f;
3462 param2.height_growth = 0.04f;
3463 param2.lifetime = 120;
3464 param2.texture = TexManager.GetTexture("gray smoke", -1);
3465
3466 switch (rand() % 4) {
3467 case 0:
3468 param2.texel = CRect<int>(0, 0, 64, 64);
3469 break;
3470
3471 case 1:
3472 param2.texel = CRect<int>(64, 0, 64, 64);
3473 break;
3474
3475 case 2:
3476 param2.texel = CRect<int>(0, 64, 64, 64);
3477 break;
3478
3479 case 3:
3480 param2.texel = CRect<int>(64, 64, 64, 64);
3481 break;
3482 }
3483
3484 param2.unk_08 = 20.0f;
3485 param2.unk_0C = 20.0f;
3486 param2.texture_frame_period = 60;
3487 Smoke.EnterEffect(&param2);
3488 }
3489
3490 Smoke.Step(1);
3491 Smoke.Draw();
3492}
3493
3504static void WaterProcess() {
3505 setTexScroll();
3506 setTexAnim();
3507
3508 sceGsTex0 frame_tex;
3509
3510 MGGetFBuffTex(&frame_tex);
3511
3512 CRect<int> rect(0, 0, 640, SCREEN_HALF_HEIGHT);
3513 sceGsTex0 surface = *(sceGsTex0 *) &TexManager.GetTexture("water_buff", -1)->tex0;
3514
3515 MGMoveImage(&frame_tex, rect, &surface, 0, 0, 0);
3516
3517 sceVu0FVECTOR ref;
3518
3519 OP_MainCamera.GetRef(ref);
3520 ref[1] = -13.0f;
3521 Water.frame.SetPosition(ref);
3522
3523 sceGsZbuf zbuf = mgZBuffer;
3524
3525 zbuf.bits.zmsk = 1;
3526 MGSetGsZBUF(&zbuf);
3527 Water.Shake((int) (32.0f * rand() / 2147483648.0f), (int) (32.0f * rand() / 2147483648.0f), -0.5f);
3528 Water.Hamon();
3529 Water.DrawVu1(&mgRenderInfo, GetVif1Packet(), 0);
3530 MGSetGsZBUF(&mgZBuffer);
3531}
3532
3543static int KageCheck(int actor) {
3544 if (actor == 1) {
3545 return 0;
3546 }
3547
3548 if (actor == 3) {
3549 return 0;
3550 }
3551
3552 if (actor == 4) {
3553 return 0;
3554 }
3555
3556 if (actor == 5) {
3557 return 0;
3558 }
3559
3560 if (actor == 14) {
3561 return 0;
3562 }
3563
3564 if (actor == 15) {
3565 return 0;
3566 }
3567
3568 if (actor == 16) {
3569 return 0;
3570 }
3571
3572 if (CScript__2.scene < OP_SCENE_NORUNE_BURNING && actor == 18) {
3573 return 0;
3574 }
3575
3576 if (actor == 17) {
3577 return 0;
3578 }
3579
3580 if (actor == 19) {
3581 return 0;
3582 }
3583
3584 if (actor == 20) {
3585 return 0;
3586 }
3587
3588 return 1;
3589}
3590
3602static void LightSet(float x, float y, float z, int actor) {
3603 sceVu0FVECTOR dir;
3604
3605 dir[0] = -x;
3606
3607 if (actor == 0) {
3608 dir[1] = 50.1f;
3609 } else {
3610 dir[1] = 250.1f;
3611 }
3612
3613 dir[2] = 299.99f - z;
3614 sceVu0Normalize(dir, dir);
3615 light[0][0] = dir[0];
3616 light[1][0] = dir[1];
3617 light[2][0] = dir[2];
3618 dir[0] = x;
3619 dir[1] = 70.1f;
3620 dir[2] = z - 299.99f;
3621 sceVu0Normalize(dir, dir);
3622 light[0][1] = dir[0];
3623 light[1][1] = dir[1];
3624 light[2][1] = dir[2];
3625
3626 sceVu0FMATRIX color;
3627
3628 sceVu0CopyMatrix(color, lightcolor);
3629
3630 sceVu0FVECTOR from;
3631 sceVu0FVECTOR to;
3632
3633 from[0] = x;
3634 from[1] = y;
3635 from[2] = z;
3636 from[3] = 0.0f;
3637 to[0] = 0.0f;
3638 to[1] = 0.0f;
3639 to[2] = 299.99f;
3640 to[3] = 0.0f;
3641
3642 int falloff = (int) DistVector(from, to) / 20;
3643
3644 if (falloff > 60) {
3645 falloff = 60;
3646 }
3647
3648 color[0][0] = color[0][0] - (float) falloff;
3649 color[0][0] = color[0][0] + (float) (rand() % 20 - 10);
3650 MGSetPLight(light, color);
3651
3652 sceVu0FVECTOR ambient;
3653
3654 sceVu0CopyVector(ambient, ambientlight);
3655
3656 if (CScript__2.scene != OP_SCENE_NORUNE_BURNING) {
3657 falloff = (int) DistVector(from, to) / 10;
3658
3659 if (falloff > 20) {
3660 falloff = 20;
3661 }
3662
3663 ambient[0] += 20.0f;
3664 ambient[0] = ambient[0] - (float) falloff;
3665 } else {
3666 ambient[0] += 25.0f;
3667 ambient[1] += 10.0f;
3668 }
3669
3670 MGSetAmbient(ambient);
3671}
3672
3673static int setTexScrollCnt;
3674static float setTexScrollCntf;
3675static int setTexAnimCnt;
3676static float setTexAnimCntf;
3677
3687static void setTexScroll() {
3688 if (setTexScrollCntf >= 126.0f) {
3689 setTexScrollCntf = 0.0f;
3690 } else {
3691 setTexScrollCntf += 0.5f;
3692 }
3693
3694 setTexScrollCnt = (int) setTexScrollCntf;
3695
3696 CTexture *plate = TexManager.GetTexture("e01b20", -1);
3697 CTexture *strip = TexManager.GetTexture("e01b21", -1);
3698
3699 if (plate == 0 || strip == 0) {
3700 return;
3701 }
3702
3703 int dbp = plate->tex0 & 0x3fff;
3704 int sbp = strip->tex0 & 0x3fff;
3705 int dbw = (plate->tex0 >> 14) & 0x3f;
3706 int sbw = (strip->tex0 >> 14) & 0x3f;
3707 sceGsTex0 dst_tex;
3708 sceGsTex0 src_tex;
3709
3710 dst_tex.TBP0 = dbp;
3711 dst_tex.TBW = dbw;
3712 dst_tex.PSM = SCE_GS_PSMT8;
3713 src_tex.TBP0 = sbp;
3714 src_tex.TBW = sbw;
3715 src_tex.PSM = SCE_GS_PSMT8;
3716
3717 if (setTexScrollCnt != 128) {
3718 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8, CRect<int>(setTexScrollCnt, 0, 128 - setTexScrollCnt, 128), dbp, dbw, SCE_GS_PSMT8, 0, 0, 0);
3719 }
3720
3721 if (setTexScrollCnt != 0) {
3722 MoveImageTest(Vif1Packet, sbp, sbw, SCE_GS_PSMT8, CRect<int>(0, 0, setTexScrollCnt, 128), dbp, dbw, SCE_GS_PSMT8, 128 - setTexScrollCnt, 0, 0);
3723 }
3724}
3725
3736static void setTexAnim() {
3737 sceVif1PkCnt(Vif1Packet, 0);
3738 sceVif1PkOpenDirectCode(Vif1Packet, 0);
3739 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
3740 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
3741 sceVif1PkCloseGifTag(Vif1Packet);
3742 sceVif1PkCloseDirectCode(Vif1Packet);
3743
3744 if (setTexAnimCntf >= 7.0f) {
3745 setTexAnimCntf = 0.0f;
3746 } else {
3747 setTexAnimCntf += 0.2f;
3748 }
3749
3750 setTexAnimCnt = (int) setTexAnimCntf;
3751
3752 CTexture *strip = TexManager.GetTexture("e01b23", -1);
3753 CTexture *plate = TexManager.GetTexture("e01b22", -1);
3754
3755 if (strip == 0 || plate == 0) {
3756 return;
3757 }
3758
3759 MGMoveImage((sceGsTex0 *) &strip->tex0, CRect<int>(0, setTexAnimCnt * 64, 64, 64), (sceGsTex0 *) &plate->tex0, 0, 0, 0);
3760 sceVif1PkCnt(Vif1Packet, 0);
3761 sceVif1PkOpenDirectCode(Vif1Packet, 0);
3762 sceVif1PkOpenGifTag(Vif1Packet, *(u_long128 *) &GiftagAD);
3763 sceVif1PkAddGsAD(Vif1Packet, SCE_GS_TEXFLUSH, 0);
3764 sceVif1PkCloseGifTag(Vif1Packet);
3765 sceVif1PkCloseDirectCode(Vif1Packet);
3766}
void Draw(CCamera *camera, int dust_only)
s32 phases[8]
s32 counters[8]
float sizes[8]
float alphas[8]
s32 active[8]
void GetRef(float *ref)
Definition camera.cpp:234
void SetRef(CFrame *parent, float x, float y, float z)
Definition camera.cpp:124
CFrame * frame
virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2< 1 > *model_alloc, CDataAlloc2< 1 > *texture_alloc)
virtual void Step()
virtual void ShadowStep()
tagMOTION_TYPE motion_type
virtual void SetRotation(float x, float y, float z)
virtual void DrawShadow()
virtual void Initialize()
float motion_speed
virtual void Draw()
virtual void SetPosition(float x, float y, float z)
virtual void ClothStep(int step)
CEffect * effect_table
Definition op_a.cpp:128
int capacity
Definition op_a.cpp:129
sceVu0FVECTOR position
Definition op_a.cpp:149
float rise_speed
Definition op_c.cpp:218
float wobble_scale
Definition op_c.cpp:220
int position_oscillation_flags
Definition op_a.cpp:145
CRect< int > texel
Definition op_a.cpp:164
float wobble_rate
Definition op_c.cpp:222
float unk_0C
Definition op_c.cpp:214
float height_growth
Definition op_c.cpp:225
float unk_08
Definition op_a.cpp:146
float width_growth
Definition op_c.cpp:224
int render_flags
Definition op_a.cpp:161
float opacity
Definition op_a.cpp:162
int texture_frame_period
Definition op_a.cpp:166
int opacity_mode
Definition op_a.cpp:160
int lifetime
Definition op_a.cpp:144
CTexture * texture
Definition op_a.cpp:163
CTexture * core
Definition op_a.cpp:110
s32 texture_set
Definition op_a.cpp:109
sceVu0FVECTOR position
Definition op_c.cpp:109
CTexture * glow
Definition op_a.cpp:111
char clip_enable
Definition frame.hpp:29
char use_color
Definition frame.hpp:38
char depth_write
Definition frame.hpp:45
char fog_enable
Definition frame.hpp:33
sceVu0FVECTOR position
Definition frame.hpp:76
int counters[60]
Definition majinbeem.hpp:28
void Step()
float alphas[60]
Definition majinbeem.hpp:30
void Draw(CCamera *camera)
Definition majinbeem.cpp:16
void Draw2(CCamera *camera, float *head, float *source)
Definition majinbeem.cpp:87
float sizes[60]
Definition majinbeem.hpp:29
float speed
Definition majinbeem.hpp:34
float shadow_offset
Definition op_b.cpp:94
CFrameVu1 * collision_frame
Definition op_b.cpp:90
int handle
Definition op_b.cpp:96
int unk_34
Definition op_b.cpp:95
CFrameVu1 * shadow_frame
Definition op_b.cpp:91
CFrameVu1 * shade_frame
Definition op_b.cpp:92
CFrameVu1 * camera_frame
Definition op_b.cpp:93
virtual void SetRotation(CVector3_f_ rotation)
s32 rotation_changed
Definition op_b.cpp:77
CFrameVu1 * frame[4]
Definition op_b.cpp:76
s32 draw_on
Definition op_b.cpp:78
virtual void SetPosition(CVector3_f_ position)
Definition object.cpp:38
Definition op_a.cpp:55
T h
Definition op_a.cpp:60
T y
Definition op_a.cpp:58
T x
Definition op_a.cpp:57
T w
Definition op_a.cpp:59
SCRIPT_OBJ obj[23]
Definition script.hpp:149
sceVu0FVECTOR beem_to[3]
Definition script.hpp:174
float motion_step
Definition script.hpp:152
int load_no
Definition script.hpp:143
sceVu0FVECTOR bom_pos[3]
Definition script.hpp:167
sceVu0FVECTOR beem_from[3]
Definition script.hpp:173
int scene
Definition script.hpp:142
int beem_no
Definition script.hpp:169
int sprite
Definition script.hpp:141
u8 beem_req
Definition script.hpp:170
u8 bom_req
Definition script.hpp:165
int bom_no
Definition script.hpp:164
float bom_size[4]
Definition script.hpp:168
int camera_start
Definition script.hpp:135
u8 beem_end
Definition script.hpp:171
int init_no
Definition script.hpp:144
int LoadSoundFileFromPack(char *name, unsigned int *pack)
Definition sound.cpp:186
void Step()
Definition sound.cpp:814
void SetVol(int port, int volume)
Definition sound.cpp:983
void Fade(int port, float step, int volume)
Definition sound.cpp:755
void SQ_Play(int port, int seq_no)
Definition sound.cpp:495
void SetReverb(int core, int mode, int depth)
Definition sound.cpp:74
char name[32]
Definition texture.hpp:56
u_long tex0
Definition texture.hpp:57
float wave_speed
Definition op_c.cpp:146
float height_scale
Definition op_c.cpp:148
float damping
Definition op_c.cpp:147
float * height
Definition op_c.cpp:139
float * height_b
Definition op_c.cpp:141
u_int * packet[3]
Definition op_c.cpp:143
float * height_a
Definition op_c.cpp:140
sceVu0FVECTOR vertex[4]
Definition op_c.cpp:142
s32 tags_built
Definition op_c.cpp:150
u8 color[4]
Definition op_c.cpp:145
s32 columns
Definition op_c.cpp:138
s32 rows
Definition op_c.cpp:137
float distortion
Definition op_c.cpp:149
CFrameVu1 frame
Definition op_c.cpp:151
CVisualPolyVu1 visual
Definition op_c.cpp:144
Definition wind.hpp:12
void SetVelocity(float speed)
Definition wind.cpp:9
void SetDir(float *direction)
Definition wind.cpp:5
void Step()
Definition wind.cpp:21
sceVu0FVECTOR end_value
Definition op_a.cpp:203
float step_y
Definition op_a.cpp:205
sceVu0FVECTOR current
Definition op_a.cpp:208
int anim_type
Definition op_c.cpp:169
void Initialize()
Definition objanime.cpp:33
char name[16]
Definition op_a.cpp:198
int completion_flag
Definition op_a.cpp:210
CFrame * frames[10]
Definition op_a.cpp:209
sceVu0FVECTOR start_value
Definition op_a.cpp:202
int play_mode
Definition op_c.cpp:170
float step_z
Definition op_a.cpp:206
float step_x
Definition op_a.cpp:204
char * plate
Definition op_a.cpp:180
char * strip
Definition op_a.cpp:181
int eye_bottom
Definition op_a.cpp:182
int strip_bottom
Definition op_a.cpp:188
int mouth
Definition op_a.cpp:187
int mouth_height
Definition op_a.cpp:185
int eye_height
Definition op_a.cpp:183
int eye
Definition op_a.cpp:186
int mouth_bottom
Definition op_a.cpp:184
float rotation[3]
Definition op_b.cpp:175
char * name
Definition op_b.cpp:172
float position[3]
Definition op_b.cpp:174
char * shadow_name
Definition op_b.cpp:173
float blend_step
Definition gameutil.hpp:190
sceVu0FVECTOR scale
float step
Definition script.hpp:125
int motion_end
Definition script.hpp:113
int load_step
Definition script.hpp:124
float mouth_time
Definition script.hpp:120
int group
Definition op_c.cpp:264
int count
Definition op_c.cpp:267
int voice
Definition op_c.cpp:266
int no
Definition op_c.cpp:265
MOTION_INFO * motion_info
Definition gameutil.hpp:275
MOTION_STATE state
Definition gameutil.hpp:273