Move sounds to level file
This commit is contained in:
parent
95eb0ff24e
commit
d662d0b465
@ -13,7 +13,9 @@ struct CAMANGLE;
|
|||||||
struct SIBLINGS;
|
struct SIBLINGS;
|
||||||
struct CHILDREN;
|
struct CHILDREN;
|
||||||
struct NODE;
|
struct NODE;
|
||||||
struct QUAD;
|
struct LEVEL;
|
||||||
|
struct VAGsound;
|
||||||
|
struct VAGbank;
|
||||||
|
|
||||||
typedef struct BODY {
|
typedef struct BODY {
|
||||||
VECTOR gForce;
|
VECTOR gForce;
|
||||||
@ -118,6 +120,33 @@ typedef struct NODE {
|
|||||||
CHILDREN * rigidbodies;
|
CHILDREN * rigidbodies;
|
||||||
} NODE;
|
} NODE;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
typedef struct LEVEL {
|
typedef struct LEVEL {
|
||||||
CVECTOR * BGc;
|
CVECTOR * BGc;
|
||||||
VECTOR * BKc;
|
VECTOR * BKc;
|
||||||
@ -132,4 +161,6 @@ typedef struct LEVEL {
|
|||||||
CAMPATH * camPath;
|
CAMPATH * camPath;
|
||||||
CAMANGLE ** camAngles;
|
CAMANGLE ** camAngles;
|
||||||
NODE * curNode;
|
NODE * curNode;
|
||||||
|
VAGbank * VAG;
|
||||||
|
XAbank * XA;
|
||||||
} LEVEL;
|
} LEVEL;
|
||||||
|
@ -11,7 +11,17 @@
|
|||||||
#define CLEAR_COLOR_B 0
|
#define CLEAR_COLOR_B 0
|
||||||
|
|
||||||
// Sound
|
// Sound
|
||||||
|
#define SPU_00CH (0x1L<< 0)
|
||||||
|
#define SPU_01CH (0x1L<< 1)
|
||||||
|
#define SPU_02CH (0x1L<< 2)
|
||||||
|
#define SPU_03CH (0x1L<< 3)
|
||||||
|
#define SPU_04CH (0x1L<< 4)
|
||||||
|
#define SPU_05CH (0x1L<< 5)
|
||||||
|
#define SPU_06CH (0x1L<< 6)
|
||||||
|
#define SPU_07CH (0x1L<< 7)
|
||||||
|
|
||||||
// CDDA / XA volume
|
// CDDA / XA volume
|
||||||
|
#define XA_CHANNELS 8
|
||||||
#define MVOL_L 0x3fff
|
#define MVOL_L 0x3fff
|
||||||
#define MVOL_R 0x3fff
|
#define MVOL_R 0x3fff
|
||||||
#define CDVOL_L 0x7fff
|
#define CDVOL_L 0x7fff
|
||||||
@ -23,11 +33,11 @@
|
|||||||
#define FNT_VRAM_X 960
|
#define FNT_VRAM_X 960
|
||||||
#define FNT_VRAM_Y 256
|
#define FNT_VRAM_Y 256
|
||||||
#define FNT_SCR_X 16
|
#define FNT_SCR_X 16
|
||||||
#define FNT_SCR_Y 192
|
#define FNT_SCR_Y 32
|
||||||
#define FNT_SCR_W 240
|
#define FNT_SCR_W 240
|
||||||
#define FNT_SCR_H 48
|
#define FNT_SCR_H 48
|
||||||
#define FNT_SCR_BG 0
|
#define FNT_SCR_BG 0
|
||||||
#define FNT_SCR_MAX_CHAR 256
|
#define FNT_SCR_MAX_CHAR 512
|
||||||
|
|
||||||
// Ordering table
|
// Ordering table
|
||||||
#define OT2LEN 8
|
#define OT2LEN 8
|
||||||
|
@ -12,15 +12,15 @@
|
|||||||
#define VAG_NBR 8
|
#define VAG_NBR 8
|
||||||
#define MALLOC_MAX VAG_NBR // Max number of time we can call SpuMalloc
|
#define MALLOC_MAX VAG_NBR // Max number of time we can call SpuMalloc
|
||||||
// Custom struct to handle VAG files
|
// Custom struct to handle VAG files
|
||||||
typedef struct VAGsound {
|
//~ typedef struct VAGsound {
|
||||||
u_char * VAGfile; // Pointer to VAG data address
|
//~ u_char * VAGfile; // Pointer to VAG data address
|
||||||
u_long spu_channel; // SPU voice to playback to
|
//~ u_long spu_channel; // SPU voice to playback to
|
||||||
u_long spu_address; // SPU address for memory freeing spu mem
|
//~ u_long spu_address; // SPU address for memory freeing spu mem
|
||||||
} VAGsound;
|
//~ } VAGsound;
|
||||||
typedef struct VAGbank {
|
//~ typedef struct VAGbank {
|
||||||
u_int index;
|
//~ u_int index;
|
||||||
VAGsound samples[];
|
//~ VAGsound samples[];
|
||||||
} VAGbank;
|
//~ } VAGbank;
|
||||||
// VAG header struct (see fileformat47.pdf, p.209)
|
// VAG header struct (see fileformat47.pdf, p.209)
|
||||||
typedef struct VAGhdr { // All the values in this header must be big endian
|
typedef struct VAGhdr { // All the values in this header must be big endian
|
||||||
char id[4]; // VAGp 4 bytes -> 1 char * 4
|
char id[4]; // VAGp 4 bytes -> 1 char * 4
|
||||||
@ -32,20 +32,21 @@ typedef struct VAGhdr { // All the values in this header must be
|
|||||||
char name[16]; // 16 bytes -> 1 char * 16
|
char name[16]; // 16 bytes -> 1 char * 16
|
||||||
// Waveform data after that
|
// Waveform data after that
|
||||||
} VAGhdr;
|
} VAGhdr;
|
||||||
// XA
|
//~ // XA
|
||||||
typedef struct XAsound {
|
//~ typedef struct XAsound {
|
||||||
u_int id;
|
//~ u_int id;
|
||||||
u_int size;
|
//~ u_int size;
|
||||||
u_char file, channel;
|
//~ u_char file, channel;
|
||||||
u_int start, end;
|
//~ u_int start, end;
|
||||||
int cursor;
|
//~ int cursor;
|
||||||
} XAsound;
|
//~ } XAsound;
|
||||||
|
|
||||||
typedef struct XAbank {
|
//~ typedef struct XAbank {
|
||||||
u_int index;
|
//~ char * name;
|
||||||
int offset;
|
//~ u_int index;
|
||||||
XAsound samples[];
|
//~ int offset;
|
||||||
} XAbank;
|
//~ XAsound samples[];
|
||||||
|
//~ } XAbank;
|
||||||
|
|
||||||
// VAG playback
|
// VAG playback
|
||||||
void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec);
|
void initSnd(SpuCommonAttr * spuSettings, char * spu_malloc_rec);
|
||||||
|
@ -990,6 +990,43 @@ CAMANGLE * level0_camPtr = &level0_camAngle_Camera;
|
|||||||
|
|
||||||
NODE * level0_curNode = &level0_nodePlane;
|
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 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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 },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// XA file to load
|
||||||
|
//~ static char * loadXA0 = "\\INTER8.XA;1";
|
||||||
|
|
||||||
LEVEL level0 = {
|
LEVEL level0 = {
|
||||||
&level0_BGc,
|
&level0_BGc,
|
||||||
&level0_BKc,
|
&level0_BKc,
|
||||||
@ -1004,4 +1041,6 @@ LEVEL level0 = {
|
|||||||
&level0_camPath,
|
&level0_camPath,
|
||||||
(CAMANGLE **)&level0_camAngles,
|
(CAMANGLE **)&level0_camAngles,
|
||||||
&level0_nodePlane,
|
&level0_nodePlane,
|
||||||
|
&VAGBank0,
|
||||||
|
&XABank0
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../custom_types.h"
|
#include "../custom_types.h"
|
||||||
|
#include "../include/defines.h"
|
||||||
|
|
||||||
extern LEVEL level0;
|
extern LEVEL level0;
|
||||||
extern CVECTOR level0_BGc;
|
extern CVECTOR level0_BGc;
|
||||||
extern VECTOR level0_BKc;
|
extern VECTOR level0_BKc;
|
||||||
@ -35,3 +37,6 @@ extern MESH * level0_propPtr;
|
|||||||
extern CAMANGLE * level0_camPtr;
|
extern CAMANGLE * level0_camPtr;
|
||||||
extern NODE * level0_curNode;
|
extern NODE * level0_curNode;
|
||||||
extern NODE level0_nodePlane;
|
extern NODE level0_nodePlane;
|
||||||
|
extern VAGbank VAGBank0;
|
||||||
|
extern XAbank XABank0;
|
||||||
|
//~ extern char * loadXA0;
|
||||||
|
@ -11039,6 +11039,43 @@ CAMANGLE * level1_camPtr = &level1_camAngle_camPath_001;
|
|||||||
|
|
||||||
NODE * level1_curNode = &level1_nodegnd;
|
NODE * level1_curNode = &level1_nodegnd;
|
||||||
|
|
||||||
|
// 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 VAGBank1 = {
|
||||||
|
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 }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
XAbank XABank1 = {
|
||||||
|
"\\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 },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// XA file to load
|
||||||
|
//~ static char * loadXA1 = "\\INTER8.XA;1";
|
||||||
|
|
||||||
LEVEL level1 = {
|
LEVEL level1 = {
|
||||||
&level1_BGc,
|
&level1_BGc,
|
||||||
&level1_BKc,
|
&level1_BKc,
|
||||||
@ -11053,5 +11090,6 @@ LEVEL level1 = {
|
|||||||
&level1_camPath,
|
&level1_camPath,
|
||||||
(CAMANGLE **)&level1_camAngles,
|
(CAMANGLE **)&level1_camAngles,
|
||||||
&level1_nodegnd,
|
&level1_nodegnd,
|
||||||
|
&VAGBank1,
|
||||||
|
&XABank1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../custom_types.h"
|
#include "../custom_types.h"
|
||||||
|
#include "../include/defines.h"
|
||||||
|
|
||||||
extern LEVEL level1;
|
extern LEVEL level1;
|
||||||
extern CVECTOR level1_BGc;
|
extern CVECTOR level1_BGc;
|
||||||
@ -176,3 +176,6 @@ extern NODE level1_nodegnd_001;
|
|||||||
extern NODE level1_nodegnd_003;
|
extern NODE level1_nodegnd_003;
|
||||||
extern NODE level1_nodegnd_002;
|
extern NODE level1_nodegnd_002;
|
||||||
extern NODE level1_nodegnd;
|
extern NODE level1_nodegnd;
|
||||||
|
extern VAGbank VAGBank1;
|
||||||
|
extern XAbank XABank1;
|
||||||
|
//~ extern char * loadXA1;
|
||||||
|
115
src/main.c
115
src/main.c
@ -114,53 +114,40 @@ char spu_malloc_rec[SPU_MALLOC_RECSIZ * (2 + MALLOC_MAX + 1)];
|
|||||||
SpuCommonAttr spuSettings; // structure for changing common voice attributes
|
SpuCommonAttr spuSettings; // structure for changing common voice attributes
|
||||||
SpuVoiceAttr voiceAttributes ; // structure for changing individual voice attributes
|
SpuVoiceAttr voiceAttributes ; // structure for changing individual voice attributes
|
||||||
// extern VAG files
|
// extern VAG files
|
||||||
extern u_char _binary_VAG_0_come_vag_start;
|
//~ extern u_char _binary_VAG_0_come_vag_start;
|
||||||
extern u_char _binary_VAG_1_cuek_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_2_erro_vag_start;
|
||||||
extern u_char _binary_VAG_3_hehe_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_4_m4a1_vag_start;
|
||||||
extern u_char _binary_VAG_5_punc_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_7_wron_vag_start;
|
||||||
extern u_char _binary_VAG_8_yooo_vag_start;
|
//~ extern u_char _binary_VAG_8_yooo_vag_start;
|
||||||
// soundBank
|
// soundBank
|
||||||
VAGbank VAGBank = {
|
//~ VAGbank VAGBank = {
|
||||||
8,
|
//~ 8,
|
||||||
{
|
//~ {
|
||||||
{ &_binary_VAG_0_come_vag_start, SPU_00CH, 0 },
|
//~ { &_binary_VAG_0_come_vag_start, SPU_00CH, 0 },
|
||||||
{ &_binary_VAG_1_cuek_vag_start, SPU_01CH, 0 },
|
//~ { &_binary_VAG_1_cuek_vag_start, SPU_01CH, 0 },
|
||||||
{ &_binary_VAG_2_erro_vag_start, SPU_02CH, 0 },
|
//~ { &_binary_VAG_2_erro_vag_start, SPU_02CH, 0 },
|
||||||
{ &_binary_VAG_3_hehe_vag_start, SPU_03CH, 0 },
|
//~ { &_binary_VAG_3_hehe_vag_start, SPU_03CH, 0 },
|
||||||
{ &_binary_VAG_4_m4a1_vag_start, SPU_04CH, 0 },
|
//~ { &_binary_VAG_4_m4a1_vag_start, SPU_04CH, 0 },
|
||||||
{ &_binary_VAG_5_punc_vag_start, SPU_05CH, 0 },
|
//~ { &_binary_VAG_5_punc_vag_start, SPU_05CH, 0 },
|
||||||
{ &_binary_VAG_7_wron_vag_start, SPU_06CH, 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 }
|
||||||
}
|
//~ }
|
||||||
};
|
//~ };
|
||||||
// XA playback
|
// XA playback
|
||||||
XAbank XABank = {
|
//~ XAbank XABank = {
|
||||||
8,
|
//~ 8,
|
||||||
0,
|
//~ 0,
|
||||||
{
|
//~ {
|
||||||
//channel 0
|
//~ //channel 0
|
||||||
{ 0, 698464, 1, 0, 0, ((698464/2336)-1) * XA_CHANNELS, -1 },
|
//~ { 0, 698464, 1, 0, 0, ((698464/2336)-1) * XA_CHANNELS, -1 },
|
||||||
{ 1, 366752, 1, 1 , 0, ((366752/2336)-1) * XA_CHANNELS, -1 },
|
//~ { 1, 366752, 1, 1 , 0, ((366752/2336)-1) * XA_CHANNELS, -1 },
|
||||||
//~ // channel 5
|
//~ }
|
||||||
//~ // id size file channel start end cursor
|
//~ };
|
||||||
//~ { 0, 18688, 0, 5, 0, 56, -1 },
|
//~ // XA file to load
|
||||||
//~ { 1, 44384, 0, 5 , 144, 288, -1 },
|
//~ static char * loadXA = "\\INTER8.XA;1";
|
||||||
//~ // channel 6
|
|
||||||
//~ { 2, 32704, 0, 6 , 0, 104, -1 },
|
|
||||||
//~ { 3, 56064, 0, 6 , 196, 380, -1 },
|
|
||||||
//~ { 4, 53728, 0, 6 , 468, 644, -1 },
|
|
||||||
//~ // channel 7
|
|
||||||
//~ { 5, 84096, 0, 7 , 0, 260, -1 },
|
|
||||||
//~ { 6, 16352, 0, 7 , 368, 440, -1 },
|
|
||||||
//~ // channel 8
|
|
||||||
//~ { 7, 114464, 0, 8 , 0, 384, -1 }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// XA file to load
|
|
||||||
static char * loadXA = "\\INTER8.XA;1";
|
|
||||||
// File informations : pos, size, name
|
// File informations : pos, size, name
|
||||||
CdlFILE XAPos = {0};
|
CdlFILE XAPos = {0};
|
||||||
// CD filter
|
// CD filter
|
||||||
@ -192,9 +179,9 @@ int main() {
|
|||||||
// Load level
|
// Load level
|
||||||
LoadLevelCD(overlayFile, &load_all_overlays_here);
|
LoadLevelCD(overlayFile, &load_all_overlays_here);
|
||||||
// Load XA file
|
// Load XA file
|
||||||
CdSearchFile( &XAPos, loadXA);
|
CdSearchFile( &XAPos, curLvl.XA->name);
|
||||||
// Set cd head to start of file
|
// Set cd head to start of file
|
||||||
XABank.offset = CdPosToInt(&XAPos.pos);
|
curLvl.XA->offset = CdPosToInt(&XAPos.pos);
|
||||||
#endif
|
#endif
|
||||||
// TODO : Add switch case to get the correct pointers
|
// TODO : Add switch case to get the correct pointers
|
||||||
// Get needed pointers from level file
|
// Get needed pointers from level file
|
||||||
@ -252,10 +239,11 @@ int main() {
|
|||||||
//~ spuCDsetup(&spuSettings);
|
//~ spuCDsetup(&spuSettings);
|
||||||
XAsetup();
|
XAsetup();
|
||||||
for (u_short vag = 0; vag < VAG_NBR; vag++ ){
|
for (u_short vag = 0; vag < VAG_NBR; vag++ ){
|
||||||
VAGBank.samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &VAGBank.samples[vag]);
|
//~ VAGBank.samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &VAGBank.samples[vag]);
|
||||||
|
curLvl.VAG->samples[vag].spu_address = setSPUtransfer(&voiceAttributes, &curLvl.VAG->samples[vag]);
|
||||||
}
|
}
|
||||||
sample = 0;
|
sample = 0;
|
||||||
setXAsample(&XABank.samples[sample], &filter);
|
setXAsample(&curLvl.XA->samples[sample], &filter);
|
||||||
// Main loop
|
// Main loop
|
||||||
while ( VSync(VSYNC) ) {
|
while ( VSync(VSYNC) ) {
|
||||||
dt = GetRCnt(RCntCNT1) - oldTime;
|
dt = GetRCnt(RCntCNT1) - oldTime;
|
||||||
@ -266,20 +254,20 @@ int main() {
|
|||||||
// TODO : Fix XA playback with VSYNC = 1
|
// TODO : Fix XA playback with VSYNC = 1
|
||||||
// Begin XA file playback...
|
// Begin XA file playback...
|
||||||
// if sample's cursor is 0
|
// if sample's cursor is 0
|
||||||
if (XABank.samples[sample].cursor == 0){
|
if (curLvl.XA->samples[sample].cursor == 0){
|
||||||
// Convert sector number to CD position in min/second/frame and set CdlLOC accordingly.
|
// Convert sector number to CD position in min/second/frame and set CdlLOC accordingly.
|
||||||
CdIntToPos( XABank.samples[sample].start + XABank.offset , &loc);
|
CdIntToPos( curLvl.XA->samples[sample].start + curLvl.XA->offset , &loc);
|
||||||
// Send CDROM read command
|
// Send CDROM read command
|
||||||
CdControlF(CdlReadS, (u_char *)&loc);
|
CdControlF(CdlReadS, (u_char *)&loc);
|
||||||
XATime = VSync(-1);
|
XATime = VSync(-1);
|
||||||
// Set playing flag
|
// Set playing flag
|
||||||
}
|
}
|
||||||
// if sample's cursor is close to sample's end position, stop playback
|
// if sample's cursor is close to sample's end position, stop playback
|
||||||
if ((XABank.samples[sample].cursor += XA_CDSPEED) >= XABank.samples[sample].end - XABank.samples[sample].start ){
|
if ((curLvl.XA->samples[sample].cursor += XA_CDSPEED) >= curLvl.XA->samples[sample].end - curLvl.XA->samples[sample].start ){
|
||||||
//~ CdControlF(CdlStop,0);
|
//~ CdControlF(CdlStop,0);
|
||||||
XABank.samples[sample].cursor = -1;
|
curLvl.XA->samples[sample].cursor = -1;
|
||||||
//~ sample = !sample;
|
//~ sample = !sample;
|
||||||
setXAsample(&XABank.samples[sample], &filter);
|
setXAsample(&curLvl.XA->samples[sample], &filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check if level has changed
|
// Check if level has changed
|
||||||
@ -323,9 +311,9 @@ int main() {
|
|||||||
// Change XA track
|
// Change XA track
|
||||||
XAsetup();
|
XAsetup();
|
||||||
sample = !sample;
|
sample = !sample;
|
||||||
XABank.samples[sample].cursor = -1;
|
curLvl.XA->samples[sample].cursor = -1;
|
||||||
setXAsample(&XABank.samples[sample], &filter);
|
setXAsample(&curLvl.XA->samples[sample], &filter);
|
||||||
CdIntToPos( XABank.samples[sample].start + XABank.offset , &loc);
|
CdIntToPos( curLvl.XA->samples[sample].start + curLvl.XA->offset , &loc);
|
||||||
// Send CDROM read command
|
// Send CDROM read command
|
||||||
CdControlF(CdlReadS, (u_char *)&loc);
|
CdControlF(CdlReadS, (u_char *)&loc);
|
||||||
}
|
}
|
||||||
@ -339,14 +327,14 @@ int main() {
|
|||||||
// TODO : put in a function
|
// TODO : put in a function
|
||||||
// Reset player/prop pos
|
// Reset player/prop pos
|
||||||
if(curLvl.actorPtr->pos.vy >= 200){
|
if(curLvl.actorPtr->pos.vy >= 200){
|
||||||
playSFX(&voiceAttributes, &VAGBank.samples[6]);
|
playSFX(&voiceAttributes, &curLvl.VAG->samples[6]);
|
||||||
copyVector(&curLvl.actorPtr->body->position, &actorStartPos );
|
copyVector(&curLvl.actorPtr->body->position, &actorStartPos );
|
||||||
copyVector(&curLvl.actorPtr->rot, &actorStartRot );
|
copyVector(&curLvl.actorPtr->rot, &actorStartRot );
|
||||||
curLvl.curNode = actorStartNode;
|
curLvl.curNode = actorStartNode;
|
||||||
curLvl.levelPtr = curLvl.curNode->plane;
|
curLvl.levelPtr = curLvl.curNode->plane;
|
||||||
}
|
}
|
||||||
if(curLvl.propPtr->pos.vy >= 200){
|
if(curLvl.propPtr->pos.vy >= 200){
|
||||||
playSFX(&voiceAttributes, &VAGBank.samples[3]);
|
playSFX(&voiceAttributes, &curLvl.VAG->samples[3]);
|
||||||
copyVector(&curLvl.propPtr->body->position, &propStartPos );
|
copyVector(&curLvl.propPtr->body->position, &propStartPos );
|
||||||
copyVector(&curLvl.propPtr->rot, &propStartRot );
|
copyVector(&curLvl.propPtr->rot, &propStartRot );
|
||||||
curLvl.propPtr->node = propStartNode;
|
curLvl.propPtr->node = propStartNode;
|
||||||
@ -468,7 +456,6 @@ int main() {
|
|||||||
// Add secondary OT to main OT
|
// Add secondary OT to main OT
|
||||||
AddPrims(otdisc[db], ot[db] + OTLEN - 1, ot[db]);
|
AddPrims(otdisc[db], ot[db] + OTLEN - 1, ot[db]);
|
||||||
|
|
||||||
//~ FntPrint("\nTime : %d\n", time);
|
|
||||||
FntPrint("\n#Tri : %d\n", triCount);
|
FntPrint("\n#Tri : %d\n", triCount);
|
||||||
FntPrint("#RCnt : %d %d %d\n", VSync(-1), XA_CDSPEED, dt);
|
FntPrint("#RCnt : %d %d %d\n", VSync(-1), XA_CDSPEED, dt);
|
||||||
FntPrint("CamAngle : %d\n", curCamAngle);
|
FntPrint("CamAngle : %d\n", curCamAngle);
|
||||||
@ -548,7 +535,7 @@ void callback() {
|
|||||||
} else {
|
} else {
|
||||||
curLvl.actorPtr->isPrism = 1;
|
curLvl.actorPtr->isPrism = 1;
|
||||||
}
|
}
|
||||||
playSFX(&voiceAttributes, &VAGBank.samples[0]);
|
playSFX(&voiceAttributes, &curLvl.VAG->samples[0]);
|
||||||
//~ timer = 10;
|
//~ timer = 10;
|
||||||
lastPad = PAD;
|
lastPad = PAD;
|
||||||
}
|
}
|
||||||
@ -556,7 +543,7 @@ void callback() {
|
|||||||
lastPad = PAD;
|
lastPad = PAD;
|
||||||
}
|
}
|
||||||
if ( PAD & Square && !( lastPad & Square ) ){
|
if ( PAD & Square && !( lastPad & Square ) ){
|
||||||
playSFX(&voiceAttributes, &VAGBank.samples[7]);
|
playSFX(&voiceAttributes, &curLvl.VAG->samples[7]);
|
||||||
//~ sample = 0;
|
//~ sample = 0;
|
||||||
//~ setXAsample(&XABank.samples[sample], &filter);
|
//~ setXAsample(&XABank.samples[sample], &filter);
|
||||||
lastPad = PAD;
|
lastPad = PAD;
|
||||||
@ -571,14 +558,14 @@ void callback() {
|
|||||||
curLvl.actorPtr->body->gForce.vy = -200;
|
curLvl.actorPtr->body->gForce.vy = -200;
|
||||||
}
|
}
|
||||||
timer = 10;
|
timer = 10;
|
||||||
playSFX(&voiceAttributes, &VAGBank.samples[4]);
|
playSFX(&voiceAttributes, &curLvl.VAG->samples[4]);
|
||||||
lastPad = PAD;
|
lastPad = PAD;
|
||||||
}
|
}
|
||||||
if ( !(PAD & Cross) && lastPad & Cross ) {
|
if ( !(PAD & Cross) && lastPad & Cross ) {
|
||||||
lastPad = PAD;
|
lastPad = PAD;
|
||||||
}
|
}
|
||||||
if ( PAD & Circle && !(PAD & lastPad) ){
|
if ( PAD & Circle && !(PAD & lastPad) ){
|
||||||
playSFX(&voiceAttributes, &VAGBank.samples[5]);
|
playSFX(&voiceAttributes, &curLvl.VAG->samples[5]);
|
||||||
lastPad = PAD;
|
lastPad = PAD;
|
||||||
}
|
}
|
||||||
if ( !(PAD & Circle) && lastPad & Circle ) {
|
if ( !(PAD & Circle) && lastPad & Circle ) {
|
||||||
|
@ -103,6 +103,8 @@ void LvlPtrSet(LEVEL * curLevel, LEVEL * level){
|
|||||||
curLevel->camPath = level->camPath;
|
curLevel->camPath = level->camPath;
|
||||||
curLevel->camAngles = level->camAngles;
|
curLevel->camAngles = level->camAngles;
|
||||||
curLevel->curNode = level->curNode; // Blank
|
curLevel->curNode = level->curNode; // Blank
|
||||||
|
curLevel->VAG = level->VAG; // Blank
|
||||||
|
curLevel->XA = level->XA; // Blank
|
||||||
|
|
||||||
//~ curLevel->actorPtr->body = level->actorPtr->body;
|
//~ curLevel->actorPtr->body = level->actorPtr->body;
|
||||||
// Move these to drawPoly()
|
// Move these to drawPoly()
|
||||||
|
@ -73,6 +73,7 @@ u_long setSPUtransfer(SpuVoiceAttr * voiceAttributes, VAGsound * sound){
|
|||||||
//~ return 1;
|
//~ return 1;
|
||||||
//~ }
|
//~ }
|
||||||
//~ return transferred;
|
//~ return transferred;
|
||||||
|
FntPrint("Tr: %", transferred);
|
||||||
return spu_address;
|
return spu_address;
|
||||||
}
|
}
|
||||||
void playSFX(SpuVoiceAttr * voiceAttributes, VAGsound * sound){
|
void playSFX(SpuVoiceAttr * voiceAttributes, VAGsound * sound){
|
||||||
|
Loading…
Reference in New Issue
Block a user