diff --git a/3dcam.bin b/3dcam.bin new file mode 100644 index 0000000..33875f0 Binary files /dev/null and b/3dcam.bin differ diff --git a/3dcam.cue b/3dcam.cue new file mode 100644 index 0000000..a96ca52 --- /dev/null +++ b/3dcam.cue @@ -0,0 +1,3 @@ +FILE "3dcam.bin" BINARY + TRACK 01 MODE2/2352 + INDEX 01 00:00:00 diff --git a/README.md b/README.md index 0400f31..5da1023 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Real-time 3D / 8bpp background / 4bpp background * Up to 3 light sources * Use pre-rendered backgrounds (8bpp and 4bpp) * Basic collisions + * Sound effects (VAG/XA) ### Demo Controls @@ -39,7 +40,6 @@ Real-time 3D / 8bpp background / 4bpp background ## Planned * Fix and improve all the things ! - * Wall collisions # Compiling diff --git a/XA/inter_0.txt b/XA/inter_0.txt new file mode 100644 index 0000000..2fc8833 --- /dev/null +++ b/XA/inter_0.txt @@ -0,0 +1,8 @@ +1 xa /home/arthus/build/psxdev/blender_io_export_psx_mesh/XA/3_hehe.xa 0 0 +1 xa /home/arthus/build/psxdev/blender_io_export_psx_mesh/XA/3_hehe.xa 0 1 +1 xa /home/arthus/build/psxdev/blender_io_export_psx_mesh/XA/1_cuek.xa 0 2 +1 xa /home/arthus/build/psxdev/blender_io_export_psx_mesh/XA/1_cuek.xa 0 3 +1 xa /home/arthus/build/psxdev/blender_io_export_psx_mesh/XA/1_cuek.xa 0 4 +1 xa /home/arthus/build/psxdev/blender_io_export_psx_mesh/XA/3_hehe.xa 0 5 +1 null +1 null diff --git a/XA/inter_0.xa b/XA/inter_0.xa new file mode 100644 index 0000000..df5cdf4 Binary files /dev/null and b/XA/inter_0.xa differ diff --git a/config/3dcam.xml b/config/3dcam.xml index 9c3b9a1..f060d24 100644 --- a/config/3dcam.xml +++ b/config/3dcam.xml @@ -16,7 +16,8 @@ - + + diff --git a/custom_types.h b/custom_types.h index d6cbcc1..f265947 100644 --- a/custom_types.h +++ b/custom_types.h @@ -13,76 +13,80 @@ struct CAMANGLE; struct SIBLINGS; struct CHILDREN; struct NODE; +struct QUAD; struct LEVEL; struct VAGsound; struct VAGbank; -struct XAbank; struct XAsound; +struct XAbank; +struct XAfiles; +struct SOUND_OBJECT; +struct LEVEL_SOUNDS; typedef struct BODY { - VECTOR gForce; - VECTOR position; - SVECTOR velocity; - int mass; - int invMass; - VECTOR min; - VECTOR max; - int restitution; - } BODY; + VECTOR gForce; + VECTOR position; + SVECTOR velocity; + int mass; + int invMass; + VECTOR min; + VECTOR max; + int restitution; + } BODY; typedef struct VANIM { - int nframes; // number of frames e.g 20 - int nvert; // number of vertices e.g 21 - int cursor; // anim cursor - int lerpCursor; // anim cursor - int dir; // playback direction (1 or -1) - int interpolate; // use lerp to interpolate keyframes - SVECTOR data[]; // vertex pos as SVECTORs e.g 20 * 21 SVECTORS - } VANIM; + int nframes; // number of frames e.g 20 + int nvert; // number of vertices e.g 21 + int cursor; // anim cursor + int lerpCursor; // anim cursor + int dir; // playback direction (1 or -1) + int interpolate; // use lerp to interpolate keyframes + SVECTOR data[]; // vertex pos as SVECTORs e.g 20 * 21 SVECTORS + } VANIM; typedef struct PRIM { - VECTOR order; - int code; // Same as POL3/POL4 codes : Code (F3 = 1, FT3 = 2, G3 = 3, + VECTOR order; + int code; // Same as POL3/POL4 codes : Code (F3 = 1, FT3 = 2, G3 = 3, // GT3 = 4) Code (F4 = 5, FT4 = 6, G4 = 7, GT4 = 8) - } PRIM; + } PRIM; typedef struct MESH { - int totalVerts; - TMESH * tmesh; - PRIM * index; - TIM_IMAGE * tim; - unsigned long * tim_data; - MATRIX mat; - VECTOR pos; - SVECTOR rot; - short isProp; - short isRigidBody; - short isStaticBody; - short isRound; - short isPrism; - short isAnim; - short isActor; - short isLevel; - short isWall; - short isBG; - short isSprite; - long p; - long OTz; - BODY * body; - VANIM * anim; - struct NODE * node; - VECTOR pos2D; - } MESH; + int totalVerts; + TMESH * tmesh; + PRIM * index; + TIM_IMAGE * tim; + unsigned long * tim_data; + MATRIX mat; + VECTOR pos; + SVECTOR rot; + short isProp; + short isRigidBody; + short isStaticBody; + short isRound; + short isPrism; + short isAnim; + short isActor; + short isLevel; + short isWall; + short isBG; + short isSprite; + long p; + long OTz; + BODY * body; + VANIM * anim; + struct NODE * node; + VECTOR pos2D; + } MESH; typedef struct QUAD { - VECTOR v0, v1; - VECTOR v2, v3; - } QUAD; + VECTOR v0, v1; + VECTOR v2, v3; + } QUAD; typedef struct CAMPOS { - SVECTOR pos; - SVECTOR rot; - } CAMPOS; + SVECTOR pos; + SVECTOR rot; + } CAMPOS; // Blender cam ~= PSX cam with these settings : @@ -92,77 +96,97 @@ typedef struct CAMPOS { // Lower values mean wider angle typedef struct CAMANGLE { - CAMPOS * campos; - TIM_IMAGE * BGtim; - unsigned long * tim_data; - QUAD bw, fw; - int index; - MESH * objects[]; - } CAMANGLE; + CAMPOS * campos; + TIM_IMAGE * BGtim; + unsigned long * tim_data; + QUAD bw, fw; + int index; + MESH * objects[]; + } CAMANGLE; typedef struct CAMPATH { - short len, cursor, pos; - VECTOR points[]; - } CAMPATH; + short len, cursor, pos; + VECTOR points[]; + } CAMPATH; typedef struct SIBLINGS { - int index; - struct NODE * list[]; - } SIBLINGS ; + int index; + struct NODE * list[]; + } SIBLINGS ; typedef struct CHILDREN { - int index; - MESH * list[]; - } CHILDREN ; + int index; + MESH * list[]; + } CHILDREN ; typedef struct NODE { - MESH * plane; - SIBLINGS * siblings; - CHILDREN * objects; - CHILDREN * rigidbodies; - } NODE; + MESH * plane; + SIBLINGS * siblings; + CHILDREN * objects; + CHILDREN * rigidbodies; + } NODE; +//VAG typedef struct VAGsound { - u_char * VAGfile; // Pointer to VAG data address - u_long spu_channel; // SPU voice to playback to - u_long spu_address; // SPU address for memory freeing spu mem - } VAGsound; - + u_char * VAGfile; // Pointer to VAG data address + u_long spu_channel; // SPU voice to playback to + u_long spu_address; // SPU address for memory freeing spu mem + } VAGsound; + typedef struct VAGbank { - u_int index; - VAGsound samples[]; -} VAGbank; + u_int index; + VAGsound samples[]; + } VAGbank; // XA typedef struct XAsound { - u_int id; - u_int size; - u_char file, channel; - u_int start, end; - int cursor; -} XAsound; + u_int id; + u_int size; + u_char file, channel; + u_int start, end; + int cursor; + } XAsound; typedef struct XAbank { - char name[16]; - u_int index; - int offset; - XAsound samples[]; -} XAbank; + char name[16]; + u_int index; + int offset; + XAsound samples[]; + } XAbank; + +typedef struct XAfiles { + u_int index; + XAbank * banks[]; + } XAfiles; + +typedef struct SOUND_OBJECT { + VECTOR location; + int volume, volume_min, volume_max; + VAGsound * VAGsample; + XAsound * XAsample; + MESH * parent; +} SOUND_OBJECT; + +typedef struct LEVEL_SOUNDS { + int index; + SOUND_OBJECT * sounds[]; +} LEVEL_SOUNDS; typedef struct LEVEL { - CVECTOR * BGc; - VECTOR * BKc; - MATRIX * cmat; - MATRIX * lgtmat; - MESH ** meshes; - int * meshes_length; - MESH * actorPtr; - MESH * levelPtr; - MESH * propPtr; - CAMANGLE * camPtr; - CAMPATH * camPath; - CAMANGLE ** camAngles; - NODE * curNode; - VAGbank * VAG; - XAbank * XA; - } LEVEL; + CVECTOR * BGc; + VECTOR * BKc; + MATRIX * cmat; + MATRIX * lgtmat; + MESH ** meshes; + int * meshes_length; + MESH * actorPtr; + MESH * levelPtr; + MESH * propPtr; + CAMANGLE * camPtr; + CAMPATH * camPath; + CAMANGLE ** camAngles; + NODE * curNode; + LEVEL_SOUNDS * levelSounds; + VAGbank * VAG; + XAfiles * XA; + } LEVEL; diff --git a/include/defines.h b/include/defines.h index 212a4cc..4419bcc 100644 --- a/include/defines.h +++ b/include/defines.h @@ -10,7 +10,18 @@ #define CLEAR_COLOR_G 0 #define CLEAR_COLOR_B 0 +#define CAM_DIST_TO_ACT 200 +#define CAM_DIST_TO_GND 100 + // Sound +// Sound engine +#define SND_DIST_MIN 200 +#define SND_DIST_MAX 1200 +#define SND_ATTENUATION 6144 +#define SND_MAX_VOL 16383 +#define SND_RANGE (SND_DIST_MAX-SND_DIST_MIN) +#define SND_NMALIZED (SND_RANGE*SND_ATTENUATION/SND_MAX_VOL) +// SPU channels #define SPU_00CH (0x1L<< 0) #define SPU_01CH (0x1L<< 1) #define SPU_02CH (0x1L<< 2) @@ -19,7 +30,23 @@ #define SPU_05CH (0x1L<< 5) #define SPU_06CH (0x1L<< 6) #define SPU_07CH (0x1L<< 7) +#define SPU_08CH (0x1L<< 8) +#define SPU_09CH (0x1L<< 9) +#define SPU_10CH (0x1L<<10) +#define SPU_11CH (0x1L<<11) +#define SPU_12CH (0x1L<<12) +#define SPU_13CH (0x1L<<13) +#define SPU_14CH (0x1L<<14) +#define SPU_15CH (0x1L<<15) +#define SPU_16CH (0x1L<<16) +#define SPU_17CH (0x1L<<17) +#define SPU_18CH (0x1L<<18) +#define SPU_19CH (0x1L<<19) +#define SPU_20CH (0x1L<<20) +#define SPU_21CH (0x1L<<21) +#define SPU_22CH (0x1L<<22) +#define SPU_23CH (0x1L<<23) // CDDA / XA volume #define XA_CHANNELS 8 #define MVOL_L 0x3fff diff --git a/include/sound.h b/include/sound.h index 43d268a..6f2f375 100644 --- a/include/sound.h +++ b/include/sound.h @@ -8,20 +8,8 @@ #define XA_RATE 380 // Number of XA samples ( != # of XA files ) #define XA_TRACKS 2 -// VAG -// Number of VAG files to load -#define VAG_NBR 8 -#define MALLOC_MAX VAG_NBR // Max number of time we can call SpuMalloc -// Custom struct to handle VAG files -//~ typedef struct VAGsound { - //~ u_char * VAGfile; // Pointer to VAG data address - //~ u_long spu_channel; // SPU voice to playback to - //~ u_long spu_address; // SPU address for memory freeing spu mem - //~ } VAGsound; -//~ typedef struct VAGbank { - //~ u_int index; - //~ VAGsound samples[]; -//~ } VAGbank; +// SPU +#define MALLOC_MAX 48 // Max number of time we can call SpuMalloc // VAG header struct (see fileformat47.pdf, p.209) typedef struct VAGhdr { // All the values in this header must be big endian char id[4]; // VAGp 4 bytes -> 1 char * 4 @@ -33,28 +21,13 @@ typedef struct VAGhdr { // All the values in this header must be char name[16]; // 16 bytes -> 1 char * 16 // Waveform data after that } VAGhdr; -//~ // XA -//~ typedef struct XAsound { - //~ u_int id; - //~ u_int size; - //~ u_char file, channel; - //~ u_int start, end; - //~ int cursor; -//~ } XAsound; - -//~ typedef struct XAbank { - //~ char * name; - //~ u_int index; - //~ int offset; - //~ XAsound samples[]; -//~ } XAbank; - // VAG playback -void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec); +void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec, u_int mallocMax); u_long sendVAGtoSPU(unsigned int VAG_data_size, u_char *VAG_data); void setVoiceAttr(SpuVoiceAttr * voiceAttributes, u_int pitch, long channel, u_long soundAddr ); u_long setSPUtransfer(SpuVoiceAttr * voiceAttributes, VAGsound * sound); -void playSFX(SpuVoiceAttr * voiceAttributes, VAGsound * sound); +void setVAGvolume(SpuVoiceAttr * voiceAttributes, VAGsound * sound, int volume); +void playSFX(SpuVoiceAttr * voiceAttributes, VAGsound * sound, int volume); // XA playback void XAsetup(void); void getXAoffset(LEVEL * level); diff --git a/levels/level0.c b/levels/level0.c index 921bc05..849f0e7 100644 --- a/levels/level0.c +++ b/levels/level0.c @@ -1,985 +1,985 @@ #include "level0.h" -CVECTOR level0_BGc = { 135, 232, 230, 0 }; +CVECTOR level0_BGc = { 134, 231, 229, 0 }; -VECTOR level0_BKc = { 174, 174, 174, 0 }; +VECTOR level0_BKc = { 173, 173, 173, 0 }; CAMPOS level0_camPos_Camera = { - { -770,459,623 }, - { 301,531,0 } + { -770,459,623 }, + { 301,531,0 } }; CAMPATH level0_camPath = { - 0, - 0, - 0 + 0, + 0, + 0 }; MATRIX level0_lgtmat = { - -2486, 3254, -22, - 0,0,0, - 0,0,0, + -2486, 3254, -22, + 0,0,0, + 0,0,0, - }; + }; MATRIX level0_cmat = { - 4096,0,0, - 4096,0,0, - 4096,0,0 - }; + 4096,0,0, + 4096,0,0, + 4096,0,0 + }; SVECTOR level0_modelCube_mesh[] = { - { -32,32,32 }, - { 32,32,32 }, - { 32,32,-33 }, - { -33,32,-32 }, - { -32,-32,33 }, - { 33,-32,32 }, - { 32,-32,-33 }, - { -33,-32,-32 } + { -32,32,32,0 }, + { 32,32,32,0 }, + { 32,32,-33,0 }, + { -33,32,-32,0 }, + { -32,-32,33,0 }, + { 33,-32,32,0 }, + { 32,-32,-33,0 }, + { -33,-32,-32,0 } }; SVECTOR level0_modelCube_normal[] = { - 2365,-2365,-2365, 0, - -2365,-2365,-2365, 0, - -2365,-2365,2365, 0, - 2365,-2365,2365, 0, - 2365,2365,-2365, 0, - -2365,2365,-2365, 0, - -2365,2365,2365, 0, - 2365,2365,2365, 0 + 2365,-2365,-2365, 0, + -2365,-2365,-2365, 0, + -2365,-2365,2365, 0, + 2365,-2365,2365, 0, + 2365,2365,-2365, 0, + -2365,2365,-2365, 0, + -2365,2365,2365, 0, + 2365,2365,2365, 0 }; CVECTOR level0_modelCube_color[] = { - 255,236,0, 0, - 255,237,0, 0, - 255,237,0, 0, - 255,235,0, 0, - 255,8,0, 0, - 255,2,0, 0, - 255,6,2, 0, - 254,3,0, 0, - 229,0,255, 0, - 229,0,255, 0, - 232,21,232, 0, - 229,0,255, 0, - 0,12,255, 0, - 5,16,250, 0, - 2,13,253, 0, - 0,12,255, 0, - 0,255,26, 0, - 4,251,25, 0, - 0,255,26, 0, - 0,255,26, 0, - 0,248,255, 0, - 0,248,255, 0, - 0,248,255, 0, - 0,248,255, 0 + 255,236,0, 0, + 255,237,0, 0, + 255,237,0, 0, + 255,235,0, 0, + 255,8,0, 0, + 255,2,0, 0, + 255,6,2, 0, + 254,3,0, 0, + 229,0,255, 0, + 229,0,255, 0, + 232,21,232, 0, + 229,0,255, 0, + 0,12,255, 0, + 5,16,250, 0, + 2,13,253, 0, + 0,12,255, 0, + 0,255,26, 0, + 4,251,25, 0, + 0,255,26, 0, + 0,255,26, 0, + 0,248,255, 0, + 0,248,255, 0, + 0,248,255, 0, + 0,248,255, 0 }; PRIM level0_modelCube_index[] = { - 0,1,2,3,8, - 4,7,6,5,8, - 0,4,5,1,8, - 1,5,6,2,8, - 2,6,7,3,8, - 4,0,3,7,8 + 0,1,2,3,8, + 4,7,6,5,8, + 0,4,5,1,8, + 1,5,6,2,8, + 2,6,7,3,8, + 4,0,3,7,8 }; BODY level0_modelCube_body = { - {0, 0, 0, 0}, - 0,-236,23, 0, - 0,-1024,0, 0, - 5, - ONE/5, - -33,-32,-33, 0, - 33,32,33, 0, - 0, - }; + {0, 0, 0, 0}, + 0,-236,23, 0, + 0,-1024,0, 0, + 8, + ONE/8, + -33,-32,-33, 0, + 33,32,33, 0, + 0, + }; TMESH level0_modelCube = { - level0_modelCube_mesh, - level0_modelCube_normal, - 0, - level0_modelCube_color, - 6 + level0_modelCube_mesh, + level0_modelCube_normal, + 0, + level0_modelCube_color, + 6 }; MESH level0_meshCube = { - 24, - &level0_modelCube, - level0_modelCube_index, - 0, - 0, - {0}, - {0,-236,23, 0}, - {0,-1024,0, 0}, - 1, // isProp - 1, // isRigidBody - 0, // isStaticBody - 0, // isRound - 0, // isPrism - 0, // isAnim - 1, // isActor - 0, // isLevel - 0, // isWall - 0, // isBG - 0,// isSprite - 0, - 0, - &level0_modelCube_body, - 0, - &level0_nodePlane, - 0, + 24, + &level0_modelCube, + level0_modelCube_index, + 0, + 0, + {0}, // Nbr of vertices + {0,-236,23, 0}, // position + {0,-1024,0, 0}, // rotation + 1, // isProp + 1, // isRigidBody + 0, // isStaticBody + 0, // isRound + 0, // isPrism + 0, // isAnim + 1, // isActor + 0, // isLevel + 0, // isWall + 0, // isBG + 0,// isSprite + 0, // p + 0, // otz + &level0_modelCube_body, + 0, // No animation data + &level0_nodePlane, + 0 // Screen space coordinates }; SVECTOR level0_modelPlane_mesh[] = { - { -520,0,-520 }, - { 520,0,-520 }, - { -520,0,520 }, - { 520,0,520 }, - { -520,0,312 }, - { -520,0,104 }, - { -520,0,-104 }, - { -520,0,-312 }, - { -312,0,-520 }, - { -104,0,-520 }, - { 104,0,-520 }, - { 312,0,-520 }, - { 520,0,-312 }, - { 520,0,-104 }, - { 520,0,104 }, - { 520,0,312 }, - { 312,0,520 }, - { 104,0,520 }, - { -104,0,520 }, - { -312,0,520 }, - { -312,0,-312 }, - { -312,0,-104 }, - { -312,0,104 }, - { -312,0,312 }, - { -104,0,-312 }, - { -104,0,-104 }, - { -104,0,104 }, - { -104,0,312 }, - { 104,0,-312 }, - { 104,0,-104 }, - { 104,0,104 }, - { 104,0,312 }, - { 312,0,-312 }, - { 312,0,-104 }, - { 312,0,104 }, - { 312,0,312 }, - { -520,0,-416 }, - { 416,0,-520 }, - { 520,0,416 }, - { -416,0,520 }, - { -520,0,416 }, - { -520,0,208 }, - { -520,0,0 }, - { -520,0,-208 }, - { -416,0,-520 }, - { -208,0,-520 }, - { 0,0,-520 }, - { 208,0,-520 }, - { 520,0,-416 }, - { 520,0,-208 }, - { 520,0,0 }, - { 520,0,208 }, - { 416,0,520 }, - { 208,0,520 }, - { 0,0,520 }, - { -208,0,520 }, - { -312,0,416 }, - { -312,0,-416 }, - { -312,0,-208 }, - { -312,0,0 }, - { -312,0,208 }, - { -104,0,416 }, - { -104,0,-416 }, - { -104,0,-208 }, - { -104,0,0 }, - { -104,0,208 }, - { 104,0,416 }, - { 104,0,-416 }, - { 104,0,-208 }, - { 104,0,0 }, - { 104,0,208 }, - { 312,0,416 }, - { 312,0,-416 }, - { 312,0,-208 }, - { 312,0,0 }, - { 312,0,208 }, - { -416,0,-312 }, - { -416,0,-104 }, - { -416,0,104 }, - { -416,0,312 }, - { -208,0,-312 }, - { -208,0,-104 }, - { -208,0,104 }, - { -208,0,312 }, - { 0,0,-312 }, - { 0,0,-104 }, - { 0,0,104 }, - { 0,0,312 }, - { 208,0,-312 }, - { 208,0,-104 }, - { 208,0,104 }, - { 208,0,312 }, - { 416,0,-312 }, - { 416,0,-104 }, - { 416,0,104 }, - { 416,0,312 }, - { 416,0,208 }, - { 416,0,0 }, - { 416,0,-208 }, - { 416,0,-416 }, - { 208,0,208 }, - { 208,0,0 }, - { 208,0,-208 }, - { 208,0,-416 }, - { 0,0,208 }, - { 0,0,0 }, - { 0,0,-208 }, - { 0,0,-416 }, - { -208,0,208 }, - { -208,0,0 }, - { -208,0,-208 }, - { -208,0,-416 }, - { -416,0,208 }, - { -416,0,0 }, - { -416,0,-208 }, - { -416,0,-416 }, - { 208,0,416 }, - { 0,0,416 }, - { -208,0,416 }, - { -416,0,416 }, - { 416,0,416 } + { -520,0,-520,0 }, + { 520,0,-520,0 }, + { -520,0,520,0 }, + { 520,0,520,0 }, + { -520,0,312,0 }, + { -520,0,104,0 }, + { -520,0,-104,0 }, + { -520,0,-312,0 }, + { -312,0,-520,0 }, + { -104,0,-520,0 }, + { 104,0,-520,0 }, + { 312,0,-520,0 }, + { 520,0,-312,0 }, + { 520,0,-104,0 }, + { 520,0,104,0 }, + { 520,0,312,0 }, + { 312,0,520,0 }, + { 104,0,520,0 }, + { -104,0,520,0 }, + { -312,0,520,0 }, + { -312,0,-312,0 }, + { -312,0,-104,0 }, + { -312,0,104,0 }, + { -312,0,312,0 }, + { -104,0,-312,0 }, + { -104,0,-104,0 }, + { -104,0,104,0 }, + { -104,0,312,0 }, + { 104,0,-312,0 }, + { 104,0,-104,0 }, + { 104,0,104,0 }, + { 104,0,312,0 }, + { 312,0,-312,0 }, + { 312,0,-104,0 }, + { 312,0,104,0 }, + { 312,0,312,0 }, + { -520,0,-416,0 }, + { 416,0,-520,0 }, + { 520,0,416,0 }, + { -416,0,520,0 }, + { -520,0,416,0 }, + { -520,0,208,0 }, + { -520,0,0,0 }, + { -520,0,-208,0 }, + { -416,0,-520,0 }, + { -208,0,-520,0 }, + { 0,0,-520,0 }, + { 208,0,-520,0 }, + { 520,0,-416,0 }, + { 520,0,-208,0 }, + { 520,0,0,0 }, + { 520,0,208,0 }, + { 416,0,520,0 }, + { 208,0,520,0 }, + { 0,0,520,0 }, + { -208,0,520,0 }, + { -312,0,416,0 }, + { -312,0,-416,0 }, + { -312,0,-208,0 }, + { -312,0,0,0 }, + { -312,0,208,0 }, + { -104,0,416,0 }, + { -104,0,-416,0 }, + { -104,0,-208,0 }, + { -104,0,0,0 }, + { -104,0,208,0 }, + { 104,0,416,0 }, + { 104,0,-416,0 }, + { 104,0,-208,0 }, + { 104,0,0,0 }, + { 104,0,208,0 }, + { 312,0,416,0 }, + { 312,0,-416,0 }, + { 312,0,-208,0 }, + { 312,0,0,0 }, + { 312,0,208,0 }, + { -416,0,-312,0 }, + { -416,0,-104,0 }, + { -416,0,104,0 }, + { -416,0,312,0 }, + { -208,0,-312,0 }, + { -208,0,-104,0 }, + { -208,0,104,0 }, + { -208,0,312,0 }, + { 0,0,-312,0 }, + { 0,0,-104,0 }, + { 0,0,104,0 }, + { 0,0,312,0 }, + { 208,0,-312,0 }, + { 208,0,-104,0 }, + { 208,0,104,0 }, + { 208,0,312,0 }, + { 416,0,-312,0 }, + { 416,0,-104,0 }, + { 416,0,104,0 }, + { 416,0,312,0 }, + { 416,0,208,0 }, + { 416,0,0,0 }, + { 416,0,-208,0 }, + { 416,0,-416,0 }, + { 208,0,208,0 }, + { 208,0,0,0 }, + { 208,0,-208,0 }, + { 208,0,-416,0 }, + { 0,0,208,0 }, + { 0,0,0,0 }, + { 0,0,-208,0 }, + { 0,0,-416,0 }, + { -208,0,208,0 }, + { -208,0,0,0 }, + { -208,0,-208,0 }, + { -208,0,-416,0 }, + { -416,0,208,0 }, + { -416,0,0,0 }, + { -416,0,-208,0 }, + { -416,0,-416,0 }, + { 208,0,416,0 }, + { 0,0,416,0 }, + { -208,0,416,0 }, + { -416,0,416,0 }, + { 416,0,416,0 } }; SVECTOR level0_modelPlane_normal[] = { - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0, - 0,4096,0, 0 + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0, + 0,4096,0, 0 }; CVECTOR level0_modelPlane_color[] = { - 0,8,255, 0, - 0,8,255, 0, - 243,255,0, 0, - 240,252,3, 0, - 0,8,255, 0, - 0,8,255, 0, - 243,255,0, 0, - 240,252,3, 0, - 0,14,255, 0, - 0,9,255, 0, - 225,236,19, 0, - 243,255,0, 0, - 0,8,255, 0, - 0,8,255, 0, - 226,238,18, 0, - 225,237,19, 0, - 0,10,255, 0, - 0,8,255, 0, - 223,235,20, 0, - 243,255,0, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,8,255, 0, - 251,1,14, 0, - 250,0,14, 0, - 76,6,181, 0, - 78,6,181, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,13,255, 0, - 0,8,255, 0, - 251,1,13, 0, - 251,1,13, 0, - 75,5,182, 0, - 77,5,180, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,12,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,16,255, 0, - 254,0,11, 0, - 254,0,11, 0, - 0,8,255, 0, - 4,9,251, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,10, 0, - 255,0,10, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,9,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,12,255, 0, - 0,8,255, 0, - 255,0,10, 0, - 255,0,10, 0, - 0,9,255, 0, - 0,8,255, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,9,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,9,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,9,255, 0, - 255,0,227, 0, - 255,0,227, 0, - 255,0,10, 0, - 255,0,10, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,10, 0, - 255,0,10, 0, - 0,8,255, 0, - 0,12,255, 0, - 255,0,10, 0, - 255,0,10, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,27,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,9,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,227, 0, - 255,0,227, 0, - 254,0,11, 0, - 255,0,10, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,10, 0, - 254,0,11, 0, - 0,8,255, 0, - 0,8,255, 0, - 255,0,10, 0, - 255,0,10, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,10,255, 0, - 0,8,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 75,5,182, 0, - 4,9,251, 0, - 255,0,227, 0, - 255,0,227, 0, - 4,9,251, 0, - 0,8,255, 0, - 255,0,227, 0, - 255,0,227, 0, - 251,1,13, 0, - 254,0,11, 0, - 4,9,251, 0, - 75,5,182, 0, - 0,13,255, 0, - 0,16,255, 0, - 254,0,11, 0, - 251,1,13, 0, - 0,16,255, 0, - 0,8,255, 0, - 254,0,11, 0, - 254,0,11, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,16,255, 0, - 0,13,255, 0, - 0,31,255, 0, - 0,31,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,31,255, 0, - 0,10,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,12,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 76,6,181, 0, - 77,5,180, 0, - 255,0,227, 0, - 255,0,227, 0, - 77,5,180, 0, - 75,5,182, 0, - 255,0,227, 0, - 255,0,227, 0, - 250,0,14, 0, - 251,1,13, 0, - 77,5,180, 0, - 76,6,181, 0, - 0,8,255, 0, - 0,8,255, 0, - 251,1,13, 0, - 250,0,14, 0, - 0,8,255, 0, - 0,13,255, 0, - 251,1,13, 0, - 251,1,13, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,9,255, 0, - 0,12,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,12,255, 0, - 0,31,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,255,6, 0, - 0,255,6, 0, - 255,0,227, 0, - 255,0,227, 0, - 0,8,255, 0, - 0,8,255, 0, - 74,5,184, 0, - 78,6,181, 0, - 255,0,227, 0, - 255,0,227, 0, - 78,6,181, 0, - 76,6,181, 0, - 255,0,227, 0, - 255,0,227, 0, - 238,1,26, 0, - 251,1,14, 0, - 78,6,181, 0, - 74,5,184, 0, - 0,8,255, 0, - 0,8,255, 0, - 251,1,14, 0, - 238,1,26, 0, - 0,8,255, 0, - 0,8,255, 0, - 250,0,14, 0, - 251,1,14, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,25,255, 0, - 0,17,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,17,255, 0, - 0,9,255, 0, - 0,255,248, 0, - 0,255,248, 0, - 0,8,255, 0, - 0,10,255, 0, - 243,255,0, 0, - 226,238,18, 0, - 0,8,255, 0, - 0,9,255, 0, - 0,10,255, 0, - 0,8,255, 0, - 0,9,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,10,255, 0, - 0,9,255, 0, - 0,8,255, 0, - 225,237,19, 0, - 225,236,19, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,9,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,14,255, 0, - 243,255,0, 0, - 243,255,0, 0, - 0,8,255, 0, - 0,12,255, 0, - 0,14,255, 0, - 0,8,255, 0, - 0,12,255, 0, - 0,8,255, 0, - 0,9,255, 0, - 0,14,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 240,252,3, 0, - 243,255,0, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 240,252,3, 0, - 223,235,20, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0, - 0,8,255, 0 + 0,8,255, 0, + 0,8,255, 0, + 243,255,0, 0, + 240,252,3, 0, + 0,8,255, 0, + 0,8,255, 0, + 243,255,0, 0, + 240,252,3, 0, + 0,14,255, 0, + 0,9,255, 0, + 225,236,19, 0, + 243,255,0, 0, + 0,8,255, 0, + 0,8,255, 0, + 226,238,18, 0, + 225,237,19, 0, + 0,10,255, 0, + 0,8,255, 0, + 223,235,20, 0, + 243,255,0, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,8,255, 0, + 251,1,14, 0, + 250,0,14, 0, + 76,6,181, 0, + 78,6,181, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,13,255, 0, + 0,8,255, 0, + 251,1,13, 0, + 251,1,13, 0, + 75,5,182, 0, + 77,5,180, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,12,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,16,255, 0, + 254,0,11, 0, + 254,0,11, 0, + 0,8,255, 0, + 4,9,251, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,10, 0, + 255,0,10, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,9,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,12,255, 0, + 0,8,255, 0, + 255,0,10, 0, + 255,0,10, 0, + 0,9,255, 0, + 0,8,255, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,9,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,9,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,9,255, 0, + 255,0,227, 0, + 255,0,227, 0, + 255,0,10, 0, + 255,0,10, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,10, 0, + 255,0,10, 0, + 0,8,255, 0, + 0,12,255, 0, + 255,0,10, 0, + 255,0,10, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,27,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,9,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,227, 0, + 255,0,227, 0, + 254,0,11, 0, + 255,0,10, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,10, 0, + 254,0,11, 0, + 0,8,255, 0, + 0,8,255, 0, + 255,0,10, 0, + 255,0,10, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,10,255, 0, + 0,8,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 75,5,182, 0, + 4,9,251, 0, + 255,0,227, 0, + 255,0,227, 0, + 4,9,251, 0, + 0,8,255, 0, + 255,0,227, 0, + 255,0,227, 0, + 251,1,13, 0, + 254,0,11, 0, + 4,9,251, 0, + 75,5,182, 0, + 0,13,255, 0, + 0,16,255, 0, + 254,0,11, 0, + 251,1,13, 0, + 0,16,255, 0, + 0,8,255, 0, + 254,0,11, 0, + 254,0,11, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,16,255, 0, + 0,13,255, 0, + 0,31,255, 0, + 0,31,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,31,255, 0, + 0,10,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,12,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 76,6,181, 0, + 77,5,180, 0, + 255,0,227, 0, + 255,0,227, 0, + 77,5,180, 0, + 75,5,182, 0, + 255,0,227, 0, + 255,0,227, 0, + 250,0,14, 0, + 251,1,13, 0, + 77,5,180, 0, + 76,6,181, 0, + 0,8,255, 0, + 0,8,255, 0, + 251,1,13, 0, + 250,0,14, 0, + 0,8,255, 0, + 0,13,255, 0, + 251,1,13, 0, + 251,1,13, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,9,255, 0, + 0,12,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,12,255, 0, + 0,31,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,255,6, 0, + 0,255,6, 0, + 255,0,227, 0, + 255,0,227, 0, + 0,8,255, 0, + 0,8,255, 0, + 74,5,184, 0, + 78,6,181, 0, + 255,0,227, 0, + 255,0,227, 0, + 78,6,181, 0, + 76,6,181, 0, + 255,0,227, 0, + 255,0,227, 0, + 238,1,26, 0, + 251,1,14, 0, + 78,6,181, 0, + 74,5,184, 0, + 0,8,255, 0, + 0,8,255, 0, + 251,1,14, 0, + 238,1,26, 0, + 0,8,255, 0, + 0,8,255, 0, + 250,0,14, 0, + 251,1,14, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,25,255, 0, + 0,17,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,17,255, 0, + 0,9,255, 0, + 0,255,248, 0, + 0,255,248, 0, + 0,8,255, 0, + 0,10,255, 0, + 243,255,0, 0, + 226,238,18, 0, + 0,8,255, 0, + 0,9,255, 0, + 0,10,255, 0, + 0,8,255, 0, + 0,9,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,10,255, 0, + 0,9,255, 0, + 0,8,255, 0, + 225,237,19, 0, + 225,236,19, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,9,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,14,255, 0, + 243,255,0, 0, + 243,255,0, 0, + 0,8,255, 0, + 0,12,255, 0, + 0,14,255, 0, + 0,8,255, 0, + 0,12,255, 0, + 0,8,255, 0, + 0,9,255, 0, + 0,14,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 240,252,3, 0, + 243,255,0, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 240,252,3, 0, + 223,235,20, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0, + 0,8,255, 0 }; PRIM level0_modelPlane_index[] = { - 120,38,3,52,8, - 119,56,19,39,8, - 118,61,18,55,8, - 117,66,17,54,8, - 116,71,16,53,8, - 115,57,20,76,8, - 114,58,21,77,8, - 113,59,22,78,8, - 112,60,23,79,8, - 111,62,24,80,8, - 110,63,25,81,8, - 109,64,26,82,8, - 108,65,27,83,8, - 107,67,28,84,8, - 106,68,29,85,8, - 105,69,30,86,8, - 104,70,31,87,8, - 103,72,32,88,8, - 102,73,33,89,8, - 101,74,34,90,8, - 100,75,35,91,8, - 99,48,12,92,8, - 98,49,13,93,8, - 97,50,14,94,8, - 96,51,15,95,8, - 75,96,95,35,8, - 34,94,96,75,8, - 94,14,51,96,8, - 74,97,94,34,8, - 33,93,97,74,8, - 93,13,50,97,8, - 73,98,93,33,8, - 32,92,98,73,8, - 92,12,49,98,8, - 72,99,92,32,8, - 11,37,99,72,8, - 37,1,48,99,8, - 70,100,91,31,8, - 30,90,100,70,8, - 90,34,75,100,8, - 69,101,90,30,8, - 29,89,101,69,8, - 89,33,74,101,8, - 68,102,89,29,8, - 28,88,102,68,8, - 88,32,73,102,8, - 67,103,88,28,8, - 10,47,103,67,8, - 47,11,72,103,8, - 65,104,87,27,8, - 26,86,104,65,8, - 86,30,70,104,8, - 64,105,86,26,8, - 25,85,105,64,8, - 85,29,69,105,8, - 63,106,85,25,8, - 24,84,106,63,8, - 84,28,68,106,8, - 62,107,84,24,8, - 9,46,107,62,8, - 46,10,67,107,8, - 60,108,83,23,8, - 22,82,108,60,8, - 82,26,65,108,8, - 59,109,82,22,8, - 21,81,109,59,8, - 81,25,64,109,8, - 58,110,81,21,8, - 20,80,110,58,8, - 80,24,63,110,8, - 57,111,80,20,8, - 8,45,111,57,8, - 45,9,62,111,8, - 41,112,79,4,8, - 5,78,112,41,8, - 78,22,60,112,8, - 42,113,78,5,8, - 6,77,113,42,8, - 77,21,59,113,8, - 43,114,77,6,8, - 7,76,114,43,8, - 76,20,58,114,8, - 36,115,76,7,8, - 0,44,115,36,8, - 44,8,57,115,8, - 66,116,53,17,8, - 31,91,116,66,8, - 91,35,71,116,8, - 61,117,54,18,8, - 27,87,117,61,8, - 87,31,66,117,8, - 56,118,55,19,8, - 23,83,118,56,8, - 83,27,61,118,8, - 40,119,39,2,8, - 4,79,119,40,8, - 79,23,56,119,8, - 71,120,52,16,8, - 35,95,120,71,8, - 95,15,38,120,8 + 120,38,3,52,8, + 119,56,19,39,8, + 118,61,18,55,8, + 117,66,17,54,8, + 116,71,16,53,8, + 115,57,20,76,8, + 114,58,21,77,8, + 113,59,22,78,8, + 112,60,23,79,8, + 111,62,24,80,8, + 110,63,25,81,8, + 109,64,26,82,8, + 108,65,27,83,8, + 107,67,28,84,8, + 106,68,29,85,8, + 105,69,30,86,8, + 104,70,31,87,8, + 103,72,32,88,8, + 102,73,33,89,8, + 101,74,34,90,8, + 100,75,35,91,8, + 99,48,12,92,8, + 98,49,13,93,8, + 97,50,14,94,8, + 96,51,15,95,8, + 75,96,95,35,8, + 34,94,96,75,8, + 94,14,51,96,8, + 74,97,94,34,8, + 33,93,97,74,8, + 93,13,50,97,8, + 73,98,93,33,8, + 32,92,98,73,8, + 92,12,49,98,8, + 72,99,92,32,8, + 11,37,99,72,8, + 37,1,48,99,8, + 70,100,91,31,8, + 30,90,100,70,8, + 90,34,75,100,8, + 69,101,90,30,8, + 29,89,101,69,8, + 89,33,74,101,8, + 68,102,89,29,8, + 28,88,102,68,8, + 88,32,73,102,8, + 67,103,88,28,8, + 10,47,103,67,8, + 47,11,72,103,8, + 65,104,87,27,8, + 26,86,104,65,8, + 86,30,70,104,8, + 64,105,86,26,8, + 25,85,105,64,8, + 85,29,69,105,8, + 63,106,85,25,8, + 24,84,106,63,8, + 84,28,68,106,8, + 62,107,84,24,8, + 9,46,107,62,8, + 46,10,67,107,8, + 60,108,83,23,8, + 22,82,108,60,8, + 82,26,65,108,8, + 59,109,82,22,8, + 21,81,109,59,8, + 81,25,64,109,8, + 58,110,81,21,8, + 20,80,110,58,8, + 80,24,63,110,8, + 57,111,80,20,8, + 8,45,111,57,8, + 45,9,62,111,8, + 41,112,79,4,8, + 5,78,112,41,8, + 78,22,60,112,8, + 42,113,78,5,8, + 6,77,113,42,8, + 77,21,59,113,8, + 43,114,77,6,8, + 7,76,114,43,8, + 76,20,58,114,8, + 36,115,76,7,8, + 0,44,115,36,8, + 44,8,57,115,8, + 66,116,53,17,8, + 31,91,116,66,8, + 91,35,71,116,8, + 61,117,54,18,8, + 27,87,117,61,8, + 87,31,66,117,8, + 56,118,55,19,8, + 23,83,118,56,8, + 83,27,61,118,8, + 40,119,39,2,8, + 4,79,119,40,8, + 79,23,56,119,8, + 71,120,52,16,8, + 35,95,120,71,8, + 95,15,38,120,8 }; BODY level0_modelPlane_body = { - {0, 0, 0, 0}, - 0,0,0, 0, - 0,0,0, 0, - 100, - ONE/100, - -520,0,-520, 0, - 520,0,520, 0, - 0, - }; + {0, 0, 0, 0}, + 0,0,0, 0, + 0,0,0, 0, + 10, + ONE/10, + -520,0,-520, 0, + 520,0,520, 0, + 0, + }; TMESH level0_modelPlane = { - level0_modelPlane_mesh, - level0_modelPlane_normal, - 0, - level0_modelPlane_color, - 100 + level0_modelPlane_mesh, + level0_modelPlane_normal, + 0, + level0_modelPlane_color, + 100 }; MESH level0_meshPlane = { - 400, - &level0_modelPlane, - level0_modelPlane_index, - 0, - 0, - {0}, - {0,0,0, 0}, - {0,0,0, 0}, - 0, // isWall - 0, // isProp - 0, // isRigidBody - 0, // isStaticBody - 0, // isRound - 0, // isPrism - 0, // isAnim - 0, // isActor - 1, // isLevel - 0, // isBG - 0,// isSprite - 0, - 0, - &level0_modelPlane_body, - 0, - 0, - 0, + 400, + &level0_modelPlane, + level0_modelPlane_index, + 0, + 0, + {0}, // Nbr of vertices + {0,0,0, 0}, // position + {0,0,0, 0}, // rotation + 0, // isProp + 0, // isRigidBody + 0, // isStaticBody + 0, // isRound + 0, // isPrism + 0, // isAnim + 0, // isActor + 1, // isLevel + 0, // isWall + 0, // isBG + 0,// isSprite + 0, // p + 0, // otz + &level0_modelPlane_body, + 0, // No animation data + 0, + 0 // Screen space coordinates }; MESH * level0_meshes[2] = { - &level0_meshCube, - &level0_meshPlane + &level0_meshCube, + &level0_meshPlane }; int level0_meshes_length = 2; CAMANGLE level0_camAngle_Camera = { - &level0_camPos_Camera, - 0, - 0, - { 0 }, - { 0 }, - 0, - 0 + &level0_camPos_Camera, + 0, + 0, + { 0 }, + { 0 }, + 0, + 0 }; CAMANGLE * level0_camAngles[0] = { }; SIBLINGS level0_nodePlane_siblings = { - 0, - { - 0 - } + 0, + { + 0 + } }; CHILDREN level0_nodePlane_objects = { - 0, - { - 0 - } + 0, + { + 0 + } }; CHILDREN level0_nodePlane_rigidbodies = { - 1, - { - &level0_meshCube - } + 1, + { + &level0_meshCube + } }; NODE level0_nodePlane = { - &level0_meshPlane, - &level0_nodePlane_siblings, - &level0_nodePlane_objects, - &level0_nodePlane_rigidbodies + &level0_meshPlane, + &level0_nodePlane_siblings, + &level0_nodePlane_objects, + &level0_nodePlane_rigidbodies }; MESH * level0_actorPtr = &level0_meshCube; @@ -990,55 +990,161 @@ CAMANGLE * level0_camPtr = &level0_camAngle_Camera; NODE * level0_curNode = &level0_nodePlane; -// extern VAG files -extern u_char _binary_VAG_0_come_vag_start; extern u_char _binary_VAG_1_cuek_vag_start; -extern u_char _binary_VAG_2_erro_vag_start; extern u_char _binary_VAG_3_hehe_vag_start; -extern u_char _binary_VAG_4_m4a1_vag_start; -extern u_char _binary_VAG_5_punc_vag_start; extern u_char _binary_VAG_7_wron_vag_start; -extern u_char _binary_VAG_8_yooo_vag_start; -// soundBank -VAGbank VAGBank0 = { - 8, - { - { &_binary_VAG_0_come_vag_start, SPU_00CH, 0 }, - { &_binary_VAG_1_cuek_vag_start, SPU_01CH, 0 }, - { &_binary_VAG_2_erro_vag_start, SPU_02CH, 0 }, - { &_binary_VAG_3_hehe_vag_start, SPU_03CH, 0 }, - { &_binary_VAG_4_m4a1_vag_start, SPU_04CH, 0 }, - { &_binary_VAG_5_punc_vag_start, SPU_05CH, 0 }, - { &_binary_VAG_7_wron_vag_start, SPU_06CH, 0 }, - { &_binary_VAG_8_yooo_vag_start, SPU_07CH, 0 } - } + +VAGbank level0_VAGBank = { + 10, + { + { &_binary_VAG_1_cuek_vag_start, SPU_00CH, 0 }, + { &_binary_VAG_3_hehe_vag_start, SPU_01CH, 0 }, + { &_binary_VAG_7_wron_vag_start, SPU_02CH, 0 }, + { &_binary_VAG_3_hehe_vag_start, SPU_03CH, 0 }, + { &_binary_VAG_1_cuek_vag_start, SPU_04CH, 0 }, + { &_binary_VAG_1_cuek_vag_start, SPU_05CH, 0 }, + { &_binary_VAG_3_hehe_vag_start, SPU_06CH, 0 }, + { &_binary_VAG_3_hehe_vag_start, SPU_07CH, 0 }, + { &_binary_VAG_1_cuek_vag_start, SPU_08CH, 0 }, + { &_binary_VAG_3_hehe_vag_start, SPU_09CH, 0 } + } }; -XAbank XABank0 = { - "\\INTER8.XA;1", - 8, - 0, - { - //channel 0 - { 0, 698464, 1, 0, 0, ((698464/2336)-1) * XA_CHANNELS, -1 }, - { 1, 366752, 1, 1 , 0, ((366752/2336)-1) * XA_CHANNELS, -1 } - } +XAbank level0_XABank_0 = { + "\\INTER_0.XA;1", + 1, + 0, + { + { 0, 366752, 0, 0, 0, 156 * XA_CHANNELS, -1 }, + } +}; +XAfiles level0_XAFiles = { + 1, + { + &level0_XABank_0 + } +}; +SOUND_OBJECT level0_Speaker = { + {102,32,210}, + 16383, 0, 16383, + &level0_VAGBank.samples[0], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_001 = { + {-82,28,210}, + 16383, 0, 16383, + &level0_VAGBank.samples[1], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_002 = { + {-267,432,-146}, + 16383, 0, 16383, + &level0_VAGBank.samples[2], + 0, + 0 +}; + +SOUND_OBJECT level0_Speaker_003 = { + {-101,156,253}, + 16383, 0, 16383, + &level0_VAGBank.samples[3], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_004 = { + {83,161,253}, + 16383, 0, 16383, + &level0_VAGBank.samples[4], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_005 = { + {76,-39,188}, + 16383, 0, 16383, + &level0_VAGBank.samples[5], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_006 = { + {-108,-43,188}, + 16383, 0, 16383, + &level0_VAGBank.samples[6], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_007 = { + {-352,55,234}, + 16383, 0, 16383, + &level0_VAGBank.samples[7], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_008 = { + {-168,60,234}, + 16383, 0, 16383, + &level0_VAGBank.samples[8], + 0, + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_009 = { + {188,-156,143}, + 16383, 0, 16383, + 0, + &level0_XABank_0.samples[0], + &level0_meshCube +}; + +SOUND_OBJECT level0_Speaker_010 = { + {4,-160,143}, + 16383, 0, 16383, + &level0_VAGBank.samples[9], + 0, + &level0_meshCube +}; + +LEVEL_SOUNDS level0_sounds = { + 11, + { + &level0_Speaker, + &level0_Speaker_001, + &level0_Speaker_002, + &level0_Speaker_003, + &level0_Speaker_004, + &level0_Speaker_005, + &level0_Speaker_006, + &level0_Speaker_007, + &level0_Speaker_008, + &level0_Speaker_009, + &level0_Speaker_010 + } }; LEVEL level0 = { - &level0_BGc, - &level0_BKc, - &level0_cmat, - &level0_lgtmat, - (MESH **)&level0_meshes, - &level0_meshes_length, - &level0_meshCube, - &level0_meshPlane, - &level0_meshCube, - &level0_camAngle_Camera, - &level0_camPath, - (CAMANGLE **)&level0_camAngles, - &level0_nodePlane, - &VAGBank0, - &XABank0 + &level0_BGc, + &level0_BKc, + &level0_cmat, + &level0_lgtmat, + (MESH **)&level0_meshes, + &level0_meshes_length, + &level0_meshCube, + &level0_meshPlane, + &level0_meshCube, + &level0_camAngle_Camera, + &level0_camPath, + (CAMANGLE **)&level0_camAngles, + &level0_nodePlane, + &level0_sounds, + &level0_VAGBank, + &level0_XAFiles }; + diff --git a/levels/level0.h b/levels/level0.h index 5143dfa..52a257c 100644 --- a/levels/level0.h +++ b/levels/level0.h @@ -36,6 +36,19 @@ extern MESH * level0_levelPtr; extern MESH * level0_propPtr; extern CAMANGLE * level0_camPtr; extern NODE * level0_curNode; +extern VAGbank level0_VAGBank; +extern XAbank level0_XABank_0; +extern XAfiles level0_XAFiles; +extern SOUND_OBJECT level0_Speaker; +extern SOUND_OBJECT level0_Speaker_001; +extern SOUND_OBJECT level0_Speaker_002; +extern SOUND_OBJECT level0_Speaker_003; +extern SOUND_OBJECT level0_Speaker_004; +extern SOUND_OBJECT level0_Speaker_005; +extern SOUND_OBJECT level0_Speaker_006; +extern SOUND_OBJECT level0_Speaker_007; +extern SOUND_OBJECT level0_Speaker_008; +extern SOUND_OBJECT level0_Speaker_009; +extern SOUND_OBJECT level0_Speaker_010; +extern LEVEL_SOUNDS level0_sounds; extern NODE level0_nodePlane; -extern VAGbank VAGBank0; -extern XAbank XABank0; diff --git a/levels/level1.c b/levels/level1.c index be1d371..16dbe07 100644 --- a/levels/level1.c +++ b/levels/level1.c @@ -11049,7 +11049,7 @@ extern u_char _binary_VAG_5_punc_vag_start; extern u_char _binary_VAG_7_wron_vag_start; extern u_char _binary_VAG_8_yooo_vag_start; // soundBank -VAGbank VAGBank1 = { +VAGbank level1_VAGBank = { 8, { { &_binary_VAG_0_come_vag_start, SPU_00CH, 0 }, @@ -11059,13 +11059,13 @@ VAGbank VAGBank1 = { { &_binary_VAG_4_m4a1_vag_start, SPU_04CH, 0 }, { &_binary_VAG_5_punc_vag_start, SPU_05CH, 0 }, { &_binary_VAG_7_wron_vag_start, SPU_06CH, 0 }, - { &_binary_VAG_8_yooo_vag_start, SPU_07CH, 0 } + { &_binary_VAG_8_yooo_vag_start, SPU_07CH, 0 }, } }; -XAbank XABank1 = { +XAbank level1_XABank_0 = { "\\INTER8.XA;1", - 8, + 2, 0, { //channel 0 @@ -11074,6 +11074,109 @@ XAbank XABank1 = { } }; +XAfiles level1_XAFiles = { + 1, + { + &level1_XABank_0 + } +}; + +SOUND_OBJECT level1_Speaker = { + {102,32,210}, + 16383, 0, 16383, + &level1_VAGBank.samples[0], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_001 = { + {-82,28,210}, + 16383, 0, 16383, + &level1_VAGBank.samples[1], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_002 = { + {-267,432,-146}, + 16383, 0, 16383, + &level1_VAGBank.samples[2], + 0, + 0 +}; + +SOUND_OBJECT level1_Speaker_003 = { + {-101,156,253}, + 16383, 0, 16383, + &level1_VAGBank.samples[3], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_004 = { + {83,161,253}, + 16383, 0, 16383, + &level1_VAGBank.samples[4], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_005 = { + {76,-39,188}, + 16383, 0, 16383, + &level1_VAGBank.samples[5], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_006 = { + {-108,-43,188}, + 16383, 0, 16383, + &level1_VAGBank.samples[6], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_007 = { + {-352,55,234}, + 16383, 0, 16383, + &level1_VAGBank.samples[7], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_008 = { + {-168,60,234}, + 16383, 0, 16383, + &level1_VAGBank.samples[8], + 0, + &level1_meshCube +}; + +SOUND_OBJECT level1_Speaker_009 = { + {188,-156,143}, + 16383, 0, 16383, + 0, + &level1_XABank_0.samples[0], + &level1_meshCube +}; + +LEVEL_SOUNDS level1_sounds = { + 10, + { + &level1_Speaker, + &level1_Speaker_001, + &level1_Speaker_002, + &level1_Speaker_003, + &level1_Speaker_004, + &level1_Speaker_005, + &level1_Speaker_006, + &level1_Speaker_007, + &level1_Speaker_008, + &level1_Speaker_009 + } +}; + LEVEL level1 = { &level1_BGc, &level1_BKc, @@ -11088,6 +11191,7 @@ LEVEL level1 = { &level1_camPath, (CAMANGLE **)&level1_camAngles, &level1_nodegnd, - &VAGBank1, - &XABank1 + &level1_sounds, + &level1_VAGBank, + &level1_XAFiles }; diff --git a/src/camera.c b/src/camera.c index 208e22f..730b047 100644 --- a/src/camera.c +++ b/src/camera.c @@ -44,7 +44,7 @@ void setCameraMode(LEVEL * curLvl, CAMERA * camera, VECTOR * posToActor, VECTOR switch (camMode){ // Camera follows actor case 0 : - dist = 200; + dist = CAM_DIST_TO_ACT; setVector(dc_camPos, -(camera->x/ONE), -(camera->y/ONE), -(camera->z/ONE)); angle->vy = -(curLvl->actorPtr->rot.vy / 2) + angleCam->vy; // Camera horizontal and vertical position @@ -55,9 +55,9 @@ void setCameraMode(LEVEL * curLvl, CAMERA * camera, VECTOR * posToActor, VECTOR // Camera rotates continuously around actor case 1 : // Set distance between cam and actor - dist = 150; + dist = CAM_DIST_TO_ACT; // Set camera position - setVector(dc_camPos, -(camera->x/ONE), 100, -(camera->z/ONE)); + setVector(dc_camPos, -(camera->x/ONE), CAM_DIST_TO_GND, -(camera->z/ONE)); // Find new camera position getCameraXZ(&camera->x, &camera->z, curLvl->actorPtr->pos.vx, curLvl->actorPtr->pos.vz, angle->vy, dist); // Set rotation amount @@ -105,7 +105,7 @@ void setCameraMode(LEVEL * curLvl, CAMERA * camera, VECTOR * posToActor, VECTOR // Using precalc sqrt dist = psqrt( (posToActor->vx * posToActor->vx ) + (posToActor->vz * posToActor->vz) ); // Set camera position - setVector(dc_camPos, 190, 100, 180); + setVector(dc_camPos, 190, CAM_DIST_TO_GND, 180); break; // Flyby mode with LERP from camStart to camEnd case 4 : diff --git a/src/main.c b/src/main.c index c955a8b..0e291bc 100644 --- a/src/main.c +++ b/src/main.c @@ -37,7 +37,7 @@ u_long overlaySize = 0; #include "../levels/level1.h" // Levels -u_char level = 1; +u_char level = 0; u_short levelWas = 0; u_short levelHasChanged = 0; // Overlay @@ -199,17 +199,21 @@ int main() { // Time counter oldTime = GetRCnt(RCntCNT1); // Sound - SpuInit(); - // Init sound settings - initSnd(&spuSettings, spu_malloc_rec); + SpuInit(); //~ spuCDsetup(&spuSettings); XAsetup(); - for (u_short vag = 0; vag < VAG_NBR; vag++ ){ - //~ VAGBank.samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &VAGBank.samples[vag]); - curLvl.VAG->samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &curLvl.VAG->samples[vag]); + if (curLvl.VAG != 0){ + // Init sound settings + initSnd(&spuSettings, spu_malloc_rec, curLvl.VAG->index ); + for (u_short vag = 0; vag < curLvl.VAG->index; vag++ ){ + curLvl.VAG->samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &curLvl.VAG->samples[vag]); + } } - sample = 0; - setXAsample(&curLvl.XA->samples[sample], &filter); + if ( curLvl.XA != 0 ){ + sample = 0; + setXAsample(&curLvl.XA->banks[1]->samples[sample], &filter); + } + // Main loop //~ while ( VSync(VSYNC) ) { while ( 1 ) { @@ -220,9 +224,9 @@ int main() { if (sample != -1 ){ // Begin XA file playback... // if sample's cursor is 0 - if (curLvl.XA->samples[sample].cursor == 0){ + if (curLvl.XA->banks[0]->samples[sample].cursor == 0){ // Convert sector number to CD position in min/second/frame and set CdlLOC accordingly. - CdIntToPos(curLvl.XA->samples[sample].start + curLvl.XA->offset , &loc); + CdIntToPos(curLvl.XA->banks[0]->samples[sample].start + curLvl.XA->banks[0]->offset , &loc); // Send CDROM read command CdControlF(CdlReadS, (u_char *)&loc); XATime = VSync(-1); @@ -232,11 +236,11 @@ int main() { //~ if ((curLvl.XA->samples[sample].cursor += XA_CDSPEED) >= curLvl.XA->samples[sample].end - curLvl.XA->samples[sample].start ){ //~ if ((curLvl.XA->samples[sample].cursor += (XA_CDSPEED*4096)/((400/(dt+1)+1)) ) >= (curLvl.XA->samples[sample].end - curLvl.XA->samples[sample].start)*4096 ){ // XA playback has fixed rate - if ((curLvl.XA->samples[sample].cursor += XA_CDSPEED / ((XA_RATE/(dt+1)+1)) ) >= (curLvl.XA->samples[sample].end - curLvl.XA->samples[sample].start) * ONE ){ + if ((curLvl.XA->banks[0]->samples[sample].cursor += XA_CDSPEED / ((XA_RATE/(dt+1)+1)) ) >= (curLvl.XA->banks[0]->samples[sample].end - curLvl.XA->banks[0]->samples[sample].start) * ONE ){ //~ CdControlF(CdlStop,0); - curLvl.XA->samples[sample].cursor = -1; + curLvl.XA->banks[0]->samples[sample].cursor = -1; //~ sample = !sample; - setXAsample(&curLvl.XA->samples[sample], &filter); + setXAsample(&curLvl.XA->banks[0]->samples[sample], &filter); } } // Check if level has changed @@ -277,14 +281,32 @@ int main() { // Set level lighting setLightEnv(draw, curLvl.BGc, curLvl.BKc); levelWas = level; - // Change XA track - XAsetup(); - sample = !sample; - curLvl.XA->samples[sample].cursor = -1; - setXAsample(&curLvl.XA->samples[sample], &filter); - CdIntToPos( curLvl.XA->samples[sample].start + curLvl.XA->offset , &loc); - // Send CDROM read command - CdControlF(CdlReadS, (u_char *)&loc); + // TODO : move to functions + if (curLvl.VAG != 0) { + // Free SPU mem + for (u_short vag = 0; vag < curLvl.VAG->index; vag++ ){ + //~ VAGBank.samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &VAGBank.samples[vag]); + SpuFree(curLvl.VAG->samples[vag].spu_address); + } + // Reinit SPU + initSnd(&spuSettings, spu_malloc_rec, curLvl.VAG->index ); + // Load level VAGs + for (u_short vag = 0; vag < curLvl.VAG->index; vag++ ){ + //~ //VAGBank.samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &VAGBank.samples[vag]); + curLvl.VAG->samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &curLvl.VAG->samples[vag]); + } + } + if (curLvl.XA != 0){ + // Change XA track + XAsetup(); + //~ sample = !sample; + curLvl.XA->banks[0]->samples[sample].cursor = -1; + getXAoffset(&curLvl); + setXAsample(&curLvl.XA->banks[0]->samples[sample], &filter); + CdIntToPos( curLvl.XA->banks[0]->samples[sample].start + curLvl.XA->banks[0]->offset , &loc); + // Send CDROM read command + CdControlF(CdlReadS, (u_char *)&loc); + } } //~ FntPrint("Ovl:%s\nLvl : %x\nLvl: %d %d \n%x", overlayFile, &level, level, levelWas, loadLvl); // atime is used for animations timing @@ -296,18 +318,41 @@ int main() { // TODO : put in a function // Reset player/prop pos if(curLvl.actorPtr->pos.vy >= 200){ - playSFX(&voiceAttributes, &curLvl.VAG->samples[6]); + playSFX(&voiceAttributes, curLvl.levelSounds->sounds[6]->VAGsample, curLvl.levelSounds->sounds[6]->volume); copyVector(&curLvl.actorPtr->body->position, &actorStartPos ); copyVector(&curLvl.actorPtr->rot, &actorStartRot ); curLvl.curNode = actorStartNode; curLvl.levelPtr = curLvl.curNode->plane; } if(curLvl.propPtr->pos.vy >= 200){ - playSFX(&voiceAttributes, &curLvl.VAG->samples[3]); + playSFX(&voiceAttributes, curLvl.levelSounds->sounds[3]->VAGsample, curLvl.levelSounds->sounds[3]->volume); copyVector(&curLvl.propPtr->body->position, &propStartPos ); copyVector(&curLvl.propPtr->rot, &propStartRot ); curLvl.propPtr->node = propStartNode; } + // Sound + if (curLvl.levelSounds != 0){ + //~ for(int snd = 0; snd < level0_sounds.index; snd++){ + for(int snd = 0; snd < curLvl.levelSounds->index; snd++){ + // TODO : move in playSFX() + // update sound location if sound has a parent + u_int r; + // If parent is actor, + if (curLvl.levelSounds->sounds[snd]->parent == curLvl.actorPtr && camMode <= 1){ + r = CAM_DIST_TO_ACT; + } else if ( curLvl.levelSounds->sounds[snd]->parent != 0){ + VECTOR dist; + copyVector(&curLvl.levelSounds->sounds[snd]->location, &curLvl.levelSounds->sounds[snd]->parent->pos); + // Get distance between sound source and camera + addVector2(camera.pos, &curLvl.levelSounds->sounds[snd]->location, &dist); + r = psqrt((dist.vx * dist.vx) + (dist.vz * dist.vz)); + } + curLvl.levelSounds->sounds[snd]->volume = (curLvl.levelSounds->sounds[snd]->volume_max/r) * SND_NMALIZED > SND_MAX_VOL ? SND_MAX_VOL : + (curLvl.levelSounds->sounds[snd]->volume_max/r) * SND_NMALIZED < 0 ? 0 : + (curLvl.levelSounds->sounds[snd]->volume_max/r) * SND_NMALIZED; + //~ FntPrint("Vol %d\n", curLvl.levelSounds->sounds[snd]->volume); + } + } // Spatial partitioning if (curLvl.curNode){ for ( int msh = 0; msh < curLvl.curNode->siblings->index; msh ++ ) { @@ -431,6 +476,7 @@ int main() { //~ FntPrint("XA : %d\n", (XA_CDSPEED)/((400/(dt+1))+1) ); //~ FntPrint("XA : %d\n", curLvl.XA->samples[sample].cursor ); FntPrint("CamAngle : %d\n", curCamAngle); + FntPrint("XA: %x", curLvl.XA); FntFlush(-1); display( &disp[db], &draw[db], otdisc[db], primbuff[db], &nextpri, &db); @@ -508,7 +554,7 @@ void callback() { } else { curLvl.actorPtr->isPrism = 1; } - playSFX(&voiceAttributes, &curLvl.VAG->samples[0]); + playSFX(&voiceAttributes, curLvl.levelSounds->sounds[0]->VAGsample, curLvl.levelSounds->sounds[0]->volume ); //~ timer = 10; lastPad = PAD; } @@ -516,7 +562,7 @@ void callback() { lastPad = PAD; } if ( PAD & Square && !( lastPad & Square ) ){ - playSFX(&voiceAttributes, &curLvl.VAG->samples[7]); + playSFX(&voiceAttributes, curLvl.levelSounds->sounds[7]->VAGsample, curLvl.levelSounds->sounds[7]->volume); //~ sample = 0; //~ setXAsample(&XABank.samples[sample], &filter); lastPad = PAD; @@ -527,18 +573,17 @@ void callback() { if ( PAD & Cross && !(lastPad & Cross) ){ if (curLvl.actorPtr->body->gForce.vy == 0 && (curLvl.actorPtr->body->position.vy - curLvl.actorPtr->body->min.vy) == curLvl.levelPtr->body->min.vy ){ // Use delta to find jump force - //~ curLvl.actorPtr->body->gForce.vy = - ((200/((ONE/(dt<1?1:dt))<1?1:(ONE/(dt<1?1:dt))))*14); curLvl.actorPtr->body->gForce.vy = -200; } timer = 10; - playSFX(&voiceAttributes, &curLvl.VAG->samples[4]); + playSFX(&voiceAttributes, curLvl.levelSounds->sounds[4]->VAGsample, curLvl.levelSounds->sounds[4]->volume); lastPad = PAD; } if ( !(PAD & Cross) && lastPad & Cross ) { lastPad = PAD; } if ( PAD & Circle && !(PAD & lastPad) ){ - playSFX(&voiceAttributes, &curLvl.VAG->samples[5]); + playSFX(&voiceAttributes, curLvl.levelSounds->sounds[5]->VAGsample, curLvl.levelSounds->sounds[5]->volume); lastPad = PAD; } if ( !(PAD & Circle) && lastPad & Circle ) { diff --git a/src/psx.c b/src/psx.c index 8eb4478..52139b2 100644 --- a/src/psx.c +++ b/src/psx.c @@ -106,6 +106,7 @@ void LvlPtrSet(LEVEL * curLevel, LEVEL * level){ curLevel->curNode = level->curNode; // Blank curLevel->VAG = level->VAG; curLevel->XA = level->XA; + curLevel->levelSounds = level->levelSounds; //~ curLevel->actorPtr->body = level->actorPtr->body; // Move these to drawPoly() diff --git a/src/sound.c b/src/sound.c index be43ca4..03d46c0 100644 --- a/src/sound.c +++ b/src/sound.c @@ -2,9 +2,8 @@ #include "../include/space.h" // VAG playback -void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec){ - - SpuInitMalloc(MALLOC_MAX, spu_malloc_rec); // Maximum number of blocks, mem. management table address. +void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec, u_int mallocMax){ + SpuInitMalloc(mallocMax, spu_malloc_rec); // Maximum number of blocks, mem. management table address. spuSettings->mask = (SPU_COMMON_MVOLL | SPU_COMMON_MVOLR | SPU_COMMON_CDVOLL | SPU_COMMON_CDVOLR | SPU_COMMON_CDMIX ); // Mask which attributes to set spuSettings->mvol.left = MVOL_L; // Master volume left spuSettings->mvol.right = MVOL_R; // see libref47.pdf, p.1058 @@ -12,7 +11,7 @@ void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec){ spuSettings->cd.volume.right = CDVOL_R; // Enable CD input ON spuSettings->cd.mix = SPU_ON; - + // Apply settings SpuSetCommonAttr(spuSettings); // Set transfer mode SpuSetTransferMode(SPU_TRANSFER_BY_DMA); @@ -68,21 +67,19 @@ u_long setSPUtransfer(SpuVoiceAttr * voiceAttributes, VAGsound * sound){ SpuSetTransferStartAddr(spu_address); // Sets a starting address in the sound buffer transferred = sendVAGtoSPU(SWAP_ENDIAN32(VAGheader->dataSize), sound->VAGfile); setVoiceAttr(voiceAttributes, pitch, sound->spu_channel, spu_address); - // Return 1 if ok, size transferred else. - //~ if (transferred == SWAP_ENDIAN32(VAGheader->dataSize)){ - //~ return 1; - //~ } - //~ return transferred; return spu_address; } -void playSFX(SpuVoiceAttr * voiceAttributes, VAGsound * sound){ - // Set voice volume to max +void setVAGvolume(SpuVoiceAttr * voiceAttributes, VAGsound * sound, int volume){ voiceAttributes->mask= ( SPU_VOICE_VOLL | SPU_VOICE_VOLR ); voiceAttributes->voice = sound->spu_channel; // Range 0 - 3fff - voiceAttributes->volume.left = VOICEVOL_L; - voiceAttributes->volume.right = VOICEVOL_R; - SpuSetVoiceAttr(voiceAttributes); + voiceAttributes->volume.left = volume; + voiceAttributes->volume.right = volume; + SpuSetVoiceAttr(voiceAttributes); +} +void playSFX(SpuVoiceAttr * voiceAttributes, VAGsound * sound, int volume){ + // Set voice volume to sample volume + setVAGvolume(voiceAttributes, sound, volume); // Play voice SpuSetKey(SpuOn, sound->spu_channel); } @@ -101,9 +98,11 @@ void XAsetup(void){ void getXAoffset(LEVEL * level){ CdlFILE XAPos = {0}; // Load XA file - CdSearchFile(&XAPos, level->XA->name); + //~ CdSearchFile(&XAPos, level->XA->name); + CdSearchFile(&XAPos, level->XA->banks[0]->name); // Set cd head to start of file - level->XA->offset = CdPosToInt(&XAPos.pos); + //~ level->XA->offset = CdPosToInt(&XAPos.pos); + level->XA->banks[0]->offset = CdPosToInt(&XAPos.pos); }; void setXAsample(XAsound * sound, CdlFILTER * filter){ filter->chan = sound->channel; diff --git a/xa/inter8.xa b/xa/inter8.xa deleted file mode 100644 index 1c00570..0000000 Binary files a/xa/inter8.xa and /dev/null differ diff --git a/xa/interleave8.txt b/xa/interleave8.txt deleted file mode 100644 index b491904..0000000 --- a/xa/interleave8.txt +++ /dev/null @@ -1,8 +0,0 @@ -1 xa lobby.xa 1 0 -1 xa pixel.xa 1 1 -1 null -1 null -1 null -1 null -1 null -1 null diff --git a/xa/lobby.xa b/xa/lobby.xa deleted file mode 100644 index 80af6e6..0000000 Binary files a/xa/lobby.xa and /dev/null differ diff --git a/xa/pixel.xa b/xa/pixel.xa deleted file mode 100644 index 9ec6a05..0000000 Binary files a/xa/pixel.xa and /dev/null differ