CRYO: Some more renaming and reducing of scope

This commit is contained in:
Strangerke 2016-11-16 14:42:19 -08:00 committed by Eugene Sandulenko
parent 1b34a02db7
commit c62b719118
7 changed files with 30 additions and 38 deletions

View File

@ -38,7 +38,7 @@ soundgroup_t *CLSoundGroup_New(int16 numSounds, int16 length, int16 sampleSize,
}
sg->_soundIndex = 0;
sg->_playIndex = 0;
sg->ff_106 = 1;
sg->_forceWait = true;
return sg;
}
@ -56,14 +56,14 @@ void CLSoundGroup_Reverse16All(soundgroup_t *sg) {
void *CLSoundGroup_GetNextBuffer(soundgroup_t *sg) {
sound_t *sound = sg->_sound[sg->_soundIndex];
if (sg->ff_106)
if (sg->_forceWait)
while (sound->_locked) ;
return sound->sndHandle + sound->_headerLen;
}
bool CLSoundGroup_AssignDatas(soundgroup_t *sg, void *buffer, int length, bool isSigned) {
sound_t *sound = sg->_sound[sg->_soundIndex];
if (sg->ff_106)
if (sg->_forceWait)
while (sound->_locked) ;
else if (sound->_locked)
return false;
@ -83,17 +83,16 @@ bool CLSoundGroup_AssignDatas(soundgroup_t *sg, void *buffer, int length, bool i
}
bool CLSoundGroup_SetDatas(soundgroup_t *sg, void *data, int length, bool isSigned) {
void *buffer;
sound_t *sound = sg->_sound[sg->_soundIndex];
if (length >= sound->_maxLength)
error("CLSoundGroup_SetDatas - Unexpected length");
if (sg->ff_106)
if (sg->_forceWait)
while (sound->_locked) ;
else if (sound->_locked)
return false;
buffer = sound->sndHandle + sound->_headerLen;
void *buffer = sound->sndHandle + sound->_headerLen;
sound->_buffer = (char *)buffer;
memcpy(buffer, data, length);
CLSound_SetLength(sound, length);
@ -116,7 +115,6 @@ void CLSoundGroup_PlayNextSample(soundgroup_t *sg, soundchannel_t *ch) {
sg->_playIndex = 0;
else
sg->_playIndex++;
}
} // End of namespace Cryo

View File

@ -25,9 +25,7 @@
namespace Cryo {
sound_t *CLSoundRaw_New(int16 length, float rate, int16 sampleSize, int16 mode) {
sound_t *sound;
sound = (sound_t *)malloc(sizeof(*sound));
sound_t *sound = (sound_t *)malloc(sizeof(*sound));
if (sound) {
sound->_maxLength = length;
sound->_rate = rate;
@ -51,10 +49,9 @@ void CLSoundRaw_Free(sound_t *sound) {
}
void CLSoundRaw_AssignBuffer(sound_t *sound, void *buffer, int bufferOffs, int length) {
char *buf;
CLSound_SetLength(sound, length);
sound->_length = length;
buf = bufferOffs + (char *)buffer;
char *buf = bufferOffs + (char *)buffer;
// if(CLSound_GetWantsDesigned())
// CLSound_Signed2NonSigned(buf, length);
sound->_buffer = buf;

View File

@ -380,15 +380,14 @@ void CLSound_SetLength(sound_t *sound, int length) {
///// CLSoundChannel
/// sound output device that plays queue of sounds
soundchannel_t *CLSoundChannel_New(int arg1) {
int16 i;
soundchannel_t *ch = (soundchannel_t *)malloc(sizeof(*ch));
if (!ch)
return 0;
return nullptr;
ch->_volumeLeft = ch->_volumeRight = 255;
ch->_numSounds = 0;
for (i = 0; i < kCryoMaxChSounds; i++)
for (int16 i = 0; i < kCryoMaxChSounds; i++)
ch->_sounds[i] = 0;
return ch;

View File

@ -150,10 +150,10 @@ typedef struct sound_t sound_t;
struct soundgroup_t {
sound_t *_sound[kCryoMaxClSounds];
int16 _numSounds;
int16 _soundIndex;
int16 _playIndex;
int16 ff_106;
int16 _numSounds;
int16 _soundIndex;
int16 _playIndex;
bool _forceWait;
};
typedef struct soundgroup_t soundgroup_t;

View File

@ -813,11 +813,11 @@ extern char kPersoRoomBankTable[];
// area transition descriptors
extern goto_t gotos[];
extern int16 tab_2D24C[];
extern int16 tab_2D28E[];
extern int16 tab_2D298[];
extern int16 tab_2D2AA[];
extern int16 tab_2D2C4[];
extern int16 kFramesVid170[];
extern int16 kFramesVid83[];
extern int16 kFramesVid88[];
extern int16 kFramesVid89[];
extern int16 kFramesVid94[];
extern object_t objects[];
extern int16 kObjectLocations[100];
extern perso_t kPersons[];

View File

@ -6329,23 +6329,23 @@ void EdenGame::displayHNMSubtitles() {
perso_t *perso;
switch (p_global->curVideoNum) {
case 170:
frames = tab_2D24C;
frames = kFramesVid170;
perso = &kPersons[PER_UNKN_156];
break;
case 83:
frames = tab_2D28E;
frames = kFramesVid83;
perso = &kPersons[PER_MORKUS];
break;
case 88:
frames = tab_2D298;
frames = kFramesVid88;
perso = &kPersons[PER_MORKUS];
break;
case 89:
frames = tab_2D2AA;
frames = kFramesVid89;
perso = &kPersons[PER_MORKUS];
break;
case 94:
frames = tab_2D2C4;
frames = kFramesVid94;
perso = &kPersons[PER_MORKUS];
break;
default:
@ -8532,10 +8532,8 @@ void EdenGame::selectmap(int16 num) {
int16 y = (num & 0x18) * 4;
for (int i = 0; i < 6 * 2; i++) {
for (int j = 0; j < 3; j++) {
cube.faces[i]->uv[j * 2 ] = x + cube_texcoords[mode][k];
k++;
cube.faces[i]->uv[j * 2 + 1] = y + cube_texcoords[mode][k];
k++;
cube.faces[i]->uv[j * 2 ] = x + cube_texcoords[mode][k++];
cube.faces[i]->uv[j * 2 + 1] = y + cube_texcoords[mode][k++];
}
}
}

View File

@ -239,7 +239,7 @@ goto_t gotos[] = {
#define SUB_LINE(start, end) \
(start), (end) | 0x8000
int16 tab_2D24C[] = {
int16 kFramesVid170[] = {
SUB_LINE( 68, 120),
SUB_LINE( 123, 196),
SUB_LINE( 199, 274),
@ -259,13 +259,13 @@ int16 tab_2D24C[] = {
-1
};
int16 tab_2D28E[] = {
int16 kFramesVid83[] = {
SUB_LINE(99, 155),
SUB_LINE(157, 256),
-1
};
int16 tab_2D298[] = {
int16 kFramesVid88[] = {
SUB_LINE(106, 173),
SUB_LINE(175, 244),
SUB_LINE(246, 350),
@ -273,7 +273,7 @@ int16 tab_2D298[] = {
-1
};
int16 tab_2D2AA[] = {
int16 kFramesVid89[] = {
SUB_LINE(126, 176),
SUB_LINE(178, 267),
SUB_LINE(269, 342),
@ -283,7 +283,7 @@ int16 tab_2D2AA[] = {
-1
};
int16 tab_2D2C4[] = {
int16 kFramesVid94[] = {
SUB_LINE(101, 213),
SUB_LINE(215, 353),
SUB_LINE(355, 455),