svn-id: r10197
This commit is contained in:
Max Horn 2003-09-12 23:22:45 +00:00
parent af14b48b4d
commit 4d9296d4c4
3 changed files with 46 additions and 40 deletions

View File

@ -465,6 +465,8 @@ int32 Sword2Sound::PreFetchCompSpeech(const char *filename, uint32 speechid, uin
fp.close();
// FIXME: potential endian problem, maybe this should be
///data16[0] = READ_LE_UINT16(data8);
data16[0] = *((int16*)data8); // Starting Value
i = 1;
@ -480,12 +482,11 @@ int32 Sword2Sound::PreFetchCompSpeech(const char *filename, uint32 speechid, uin
}
int32 Sword2Sound::PlayCompSpeech(const char *filename, uint32 speechid, uint8 vol, int8 pan) {
uint32 i;
uint16 *data16;
uint8 *data8;
uint32 speechIndex[2];
void *lpv1;
File fp;
uint32 i;
uint16 *data16;
uint8 *data8;
uint32 speechIndex[2];
File fp;
uint32 bufferSize;
if (!speechMuted) {
@ -527,11 +528,11 @@ int32 Sword2Sound::PlayCompSpeech(const char *filename, uint32 speechid, uint8 v
fp.close();
lpv1 = malloc(bufferSize);
// decompress data into speech buffer.
data16 = (uint16*)lpv1;
// Decompress data into speech buffer.
data16 = (uint16*)malloc(bufferSize);
// FIXME: potential endian problem, maybe this should be
///data16[0] = READ_LE_UINT16(data8);
data16[0] = *((int16*)data8); // Starting Value
i = 1;
@ -545,7 +546,7 @@ int32 Sword2Sound::PlayCompSpeech(const char *filename, uint32 speechid, uint8 v
free(data8);
// Modify the volume according to the master volume
// Modify the volume according to the master volume
byte volume;
int8 p;
if (speechMuted) {
@ -555,15 +556,17 @@ int32 Sword2Sound::PlayCompSpeech(const char *filename, uint32 speechid, uint8 v
}
p = panTable[pan + 16];
// Start the speech playing
// Start the speech playing
speechPaused = 1;
uint32 flags = SoundMixer::FLAG_16BITS;
flags |= SoundMixer::FLAG_AUTOFREE;
//Until the mixer supports LE samples natively, we need to convert our LE ones to BE
#ifndef SCUMM_BIG_ENDIAN
// Until the mixer supports LE samples natively, we need to convert our LE ones to BE
for (uint j = 0; j < (bufferSize / 2); j++)
data16[j] = TO_BE_16(data16[j]);
data16[j] = SWAP_BYTES_16(data16[j]);
#endif
_mixer->playRaw(&soundHandleSpeech, data16, bufferSize, 22050, flags, -1, volume, pan);

View File

@ -378,9 +378,9 @@ static void convertEndian(uint8 *file, uint32 len) {
}
case WALK_GRID_FILE: {
_walkGridHeader *walkGridHeader = (_walkGridHeader *)file;
walkGridHeader->numBars = SWAP_BYTES_32(walkGridHeader->numBars);
walkGridHeader->numNodes = SWAP_BYTES_32(walkGridHeader->numNodes);
break;
}
case GLOBAL_VAR_FILE:

View File

@ -173,42 +173,44 @@ typedef struct
//--------------------------------------------------------------------------------------
// Function prototypes
int32 GetRoute(void);
void ExtractRoute(void);
void LoadWalkGrid(void);
void SetUpWalkGrid(Object_mega *ob_mega, int32 x, int32 y, int32 dir);
void LoadWalkData(Object_walkdata *ob_walkdata);
void PlotCross(int16 x, int16 y, uint8 colour);
static int32 GetRoute(void);
static void ExtractRoute(void);
static void LoadWalkGrid(void);
static void SetUpWalkGrid(Object_mega *ob_mega, int32 x, int32 y, int32 dir);
static void LoadWalkData(Object_walkdata *ob_walkdata);
static void PlotCross(int16 x, int16 y, uint8 colour);
int32 Scan(int32);
int32 NewCheck(int32, int32 , int32 , int32 , int32);
int32 LineCheck(int32 , int32 , int32 , int32);
int32 VertCheck(int32 , int32 , int32);
int32 HorizCheck(int32 , int32 , int32);
int32 Check(int32 , int32 , int32 , int32);
int32 CheckTarget(int32 , int32);
static int32 Scan(int32);
static int32 NewCheck(int32, int32 , int32 , int32 , int32);
static int32 LineCheck(int32 , int32 , int32 , int32);
static int32 VertCheck(int32 , int32 , int32);
static int32 HorizCheck(int32 , int32 , int32);
static int32 Check(int32 , int32 , int32 , int32);
static int32 CheckTarget(int32 , int32);
int32 SmoothestPath();
int32 SlidyPath();
int32 SolidPath();
static int32 SmoothestPath();
static int32 SlidyPath();
static int32 SolidPath();
int32 SmoothCheck(int32 best, int32 p, int32 dirS, int32 dirD);
static int32 SmoothCheck(int32 best, int32 p, int32 dirS, int32 dirD);
int32 AddSlowInFrames(_walkData *walkAnim);
void AddSlowOutFrames(_walkData *walkAnim);
void SlidyWalkAnimator(_walkData *walkAnim);
int32 SolidWalkAnimator(_walkData *walkAnim);
void RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour);
static int32 AddSlowInFrames(_walkData *walkAnim);
static void AddSlowOutFrames(_walkData *walkAnim);
static void SlidyWalkAnimator(_walkData *walkAnim);
static int32 SolidWalkAnimator(_walkData *walkAnim);
#ifdef PLOT_PATHS
static void RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour);
#endif
//--------------------------------------------------------------------------------------
#define MAX_WALKGRIDS 10
int32 walkGridList[MAX_WALKGRIDS];
static int32 walkGridList[MAX_WALKGRIDS];
//--------------------------------------------------------------------------------------
#define TOTAL_ROUTE_SLOTS 2 // because we only have 2 megas in the game!
mem *route_slots[TOTAL_ROUTE_SLOTS]; // stores pointers to mem blocks containing routes created & used by megas (NULL if slot not in use)
static mem *route_slots[TOTAL_ROUTE_SLOTS]; // stores pointers to mem blocks containing routes created & used by megas (NULL if slot not in use)
//--------------------------------------------------------------------------------------
// Local Variables
@ -341,7 +343,7 @@ void AllocateRouteMem(void)
}
//------------------------------------------
route_slots[slotNo] = Twalloc( 4800, MEM_locked, UID_walk_anim );
route_slots[slotNo] = Twalloc( sizeof(_walkData)*O_WALKANIM_SIZE, MEM_locked, UID_walk_anim );
// 12000 bytes were used for this in Sword1 mega compacts, based on 20 bytes per '_walkData' frame
// ie. allowing for 600 frames including end-marker
// Now '_walkData' is 8 bytes, so 8*600 = 4800 bytes.
@ -1309,6 +1311,7 @@ void SlidyWalkAnimator(_walkData *walkAnim)
currentDir = 99;// this ensures that we don't put in turn frames for the start
do
{
assert(stepCount < O_WALKANIM_SIZE);
while (modularPath[p].num == 0)
{
p = p + 1;