本文整理汇总了C++中READ_LE_UINT32函数的典型用法代码示例。如果您正苦于以下问题:C++ READ_LE_UINT32函数的具体用法?C++ READ_LE_UINT32怎么用?C++ READ_LE_UINT32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了READ_LE_UINT32函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: READ_LE_UINT32
/**
* Initialize a multi-part object using a list of images to init
* each object piece. One object is created for each image in the list.
* All objects are given the same palette as the first image. A pointer
* to the first (master) object created is returned.
* @param pInitTbl Pointer to multi-object initialisation table
*/
OBJECT *MultiInitObject(const MULTI_INIT *pInitTbl) {
OBJ_INIT obj_init; // object init table
OBJECT *pFirst, *pObj; // object pointers
FRAME *pFrame; // list of images for the multi-part object
if (FROM_LE_32(pInitTbl->hMulFrame)) {
// we have a frame handle
pFrame = (FRAME *)LockMem(FROM_LE_32(pInitTbl->hMulFrame));
obj_init.hObjImg = READ_LE_UINT32(pFrame); // first objects shape
} else { // this must be a animation list for a NULL object
pFrame = NULL;
obj_init.hObjImg = 0; // first objects shape
}
// init the object init table
obj_init.objFlags = (int)FROM_LE_32(pInitTbl->mulFlags); // all objects have same flags
obj_init.objID = (int)FROM_LE_32(pInitTbl->mulID); // all objects have same ID
obj_init.objX = (int)FROM_LE_32(pInitTbl->mulX); // all objects have same X ani pos
obj_init.objY = (int)FROM_LE_32(pInitTbl->mulY); // all objects have same Y ani pos
obj_init.objZ = (int)FROM_LE_32(pInitTbl->mulZ); // all objects have same Z pos
// create and init the first object
pObj = pFirst = InitObject(&obj_init);
if (pFrame) {
// if we have any animation frames
pFrame++;
while (READ_LE_UINT32(pFrame) != 0) {
// set next objects shape
obj_init.hObjImg = READ_LE_UINT32(pFrame);
// create next object and link to previous
pObj = pObj->pSlave = InitObject(&obj_init);
pFrame++;
}
}
// null end of list for final object
pObj->pSlave = NULL;
// return master object
return pFirst;
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:54,代码来源:multiobj.cpp
示例2: READ_LE_UINT32
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan, int vol, bool loop) {
byte *buffer, flags;
uint16 compType;
int blockAlign, rate;
int size = READ_LE_UINT32(soundData + 4);
Common::MemoryReadStream stream(soundData, size);
if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) {
error("playSoundData: Not a valid WAV data");
}
// The Feeble Files originally used DirectSound, which specifies volume
// and panning differently than ScummVM does, using a logarithmic scale
// rather than a linear one.
//
// Volume is a value between -10,000 and 0.
// Panning is a value between -10,000 and 10,000.
//
// In both cases, the -10,000 represents -100 dB. When panning, only
// one speaker's volume is affected - just like in ScummVM - with
// negative values affecting the left speaker, and positive values
// affecting the right speaker. Thus -10,000 means the left speaker is
// silent.
int v, p;
vol = CLIP(vol, -10000, 0);
pan = CLIP(pan, -10000, 10000);
if (vol) {
v = (int)((double)Audio::Mixer::kMaxChannelVolume * pow(10.0, (double)vol / 2000.0) + 0.5);
} else {
v = Audio::Mixer::kMaxChannelVolume;
}
if (pan < 0) {
p = (int)(255.0 * pow(10.0, (double)pan / 2000.0) + 127.5);
} else if (pan > 0) {
p = (int)(255.0 * pow(10.0, (double)pan / -2000.0) - 127.5);
} else {
p = 0;
}
if (loop == true)
flags |= Audio::Mixer::FLAG_LOOP;
if (compType == 2) {
Audio::AudioStream *sndStream = Audio::makeADPCMStream(&stream, size, Audio::kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
buffer = (byte *)malloc(size * 4);
size = sndStream->readBuffer((int16*)buffer, size * 2);
size *= 2; // 16bits.
delete sndStream;
} else {
buffer = (byte *)malloc(size);
memcpy(buffer, soundData + stream.pos(), size);
}
_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, -1, v, p);
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:59,代码来源:sound.cpp
示例3: READ_LE_UINT32
void InputPersistenceBlock::read(uint &value) {
if (checkMarker(UINT_MARKER)) {
value = READ_LE_UINT32(_iter);
_iter += 4;
} else {
value = 0;
}
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:8,代码来源:inputpersistenceblock.cpp
示例4: convertSJIStoUTF32
uint32 convertSJIStoUTF32(uint8 fB, uint8 sB) {
// For some reason iconv will refuse "0x81 0xAD" as valid
// SJIS sequence, even though it is "FULLWIDTH APOSTROPHE",
// thus we will short circuit iconv and convert it ourself
// here.
if (fB == 0x81 && sB == 0xAD)
return 0x0000FF07;
// SJIS uses "YEN SIGN" instead of "REVERSE SOLIDUS"
else if (fB == 0x5C && sB == 0x00)
return 0x000000A5;
// SJIS uses "OVERLINE" instead of "TILDE"
else if (fB == 0x7E && sB == 0x00)
return 0x0000203E;
char inBuf[3];
inBuf[0] = fB;
inBuf[1] = sB;
inBuf[2] = 0;
char outBuf[3 * sizeof(uint32)];
memset(outBuf, 0, sizeof(outBuf));
size_t inBufSize = ((fB >= 0x81 && fB <= 0x9F) || (fB >= 0xE0 && fB <= 0xEF)) ? 3 : 2;
size_t outBufSize = sizeof(outBuf);
#ifdef ICONV_USES_CONST
const char *inBufWrap = inBuf;
#else
char *inBufWrap = inBuf;
#endif
char *outBufWrap = outBuf;
if (iconv(confSetup, &inBufWrap, &inBufSize, &outBufWrap, &outBufSize) == (size_t)-1)
return (uint32)-1;
const uint32 ret = READ_LE_UINT32(outBuf);
// According to http://www.unicode.org/reports/tr19/tr19-9.html it is possible
// that a "zero width no-break space" is added as first character (probably
// to be consistent with the "byte order mark"). In case any iconv implementation
// does that, we just skip over that bit.
if (ret == 0x0000FEFF)
return READ_LE_UINT32(outBuf + 4);
else
return ret;
}
开发者ID:agfor,项目名称:scummvm-tools,代码行数:46,代码来源:create_sjisfnt.cpp
示例5: load
void load(uint32 offset) {
byte *item = getData(offset);
uint32 subItemOffset;
x1 = READ_LE_UINT16(item + 0);
y1 = READ_LE_UINT16(item + 2);
x2 = READ_LE_UINT16(item + 4);
y2 = READ_LE_UINT16(item + 6);
subRectListCount = READ_LE_UINT32(item + 8);
subRectListOffset = READ_LE_UINT32(item + 12);
subItemOffset = subRectListOffset;
for (uint32 j = 0; j < subRectListCount; j++) {
SubRectItem subRectItem;
subRectItem.load(subItemOffset);
subItemOffset += 16;
subRectItems.push_back(subRectItem);
}
}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:17,代码来源:create_neverhood.cpp
示例6: READ_LE_UINT32
void GfxPicture::drawSci11Vga() {
byte *inbuffer = _resource->data;
int size = _resource->size;
int priorityBandsCount = inbuffer[3];
int has_cel = inbuffer[4];
int vector_dataPos = READ_LE_UINT32(inbuffer + 16);
int vector_size = size - vector_dataPos;
int palette_data_ptr = READ_LE_UINT32(inbuffer + 28);
int cel_headerPos = READ_LE_UINT32(inbuffer + 32);
int cel_RlePos = READ_LE_UINT32(inbuffer + cel_headerPos + 24);
int cel_LiteralPos = READ_LE_UINT32(inbuffer + cel_headerPos + 28);
Palette palette;
// Header
// [headerSize:WORD] [unknown:BYTE] [priorityBandCount:BYTE] [hasCel:BYTE] [unknown:BYTE]
// [unknown:WORD] [unknown:WORD] [unknown:WORD] [unknown:WORD] [unknown:WORD]
// Offset 16
// [vectorDataOffset:DWORD] [unknown:DWORD] [unknown:DWORD] [paletteDataOffset:DWORD]
// Offset 32
// [celHeaderOffset:DWORD] [unknown:DWORD]
// [priorityBandData:WORD] * priorityBandCount
// [priority:BYTE] [unknown:BYTE]
// priority bands are supposed to be 14 for sci1.1 pictures
assert(priorityBandsCount == 14);
if (_addToFlag) {
_priority = inbuffer[40 + priorityBandsCount * 2] & 0xF;
}
// display Cel-data
if (has_cel) {
// Create palette and set it
_palette->createFromData(inbuffer + palette_data_ptr, size - palette_data_ptr, &palette);
_palette->set(&palette, true);
drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0);
}
// process vector data
drawVectorData(inbuffer + vector_dataPos, vector_size);
// Set priority band information
_ports->priorityBandsInitSci11(inbuffer + 40);
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:45,代码来源:picture.cpp
示例7: memcpy
void KeyframeAnim::loadBinary(const char *data, int len) {
// First four bytes are the FYEK Keyframe identifier code
// Next 36 bytes are the filename
if (gDebugLevel == DEBUG_NORMAL || gDebugLevel == DEBUG_ALL) {
char filebuf[37];
memcpy(filebuf, data + 4, 36);
filebuf[36] = 0;
printf("Loading Keyframe '%s'.", filebuf);
}
// Next four bytes are the flags
_flags = READ_LE_UINT32(data + 40);
// Next four bytes are a duplicate of _numJoints (?)
// Next four bytes are the type
_type = READ_LE_UINT32(data + 48);
// Next four bytes are the frames per second
_fps = get_float(data + 52);
// Next four bytes are the number of frames
_numFrames = READ_LE_UINT32(data + 56);
// Next four bytes are the number of joints
_numJoints = READ_LE_UINT32(data + 60);
// Next four bytes are unknown (?)
// Next four bytes are the number of markers
_numMarkers = READ_LE_UINT32(data + 68);
_markers = new Marker[_numMarkers];
for (int i = 0; i < _numMarkers; i++) {
_markers[i].frame = get_float(data + 72 + 4 * i);
_markers[i].val = READ_LE_UINT32(data + 104 + 4 * i);
}
_nodes = new KeyframeNode *[_numJoints];
for (int i = 0; i < _numJoints; i++)
_nodes[i] = NULL;
const char *dataEnd = data + len;
// The first 136 bytes are for the header, this was originally
// listed as 180 bytes since the first operation is usually a
// "null" key, however ma_card_hold.key showed that this is
// not always the case so we should not skip this operation
data += 136;
while (data < dataEnd) {
int nodeNum;
// The first 32 bytes (of a keyframe) are the name handle
// The next four bytes are the node number identifier
nodeNum = READ_LE_UINT32(data + 32);
// Because of the issue above ma_card_hold.key used to crash
// at this part without checking to make sure nodeNum is a
// valid number, we'll leave this in just in case something
// else is still wrong but it should now load correctly in
// all cases
if (nodeNum >= _numJoints) {
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL) {
warning("A node number was greater than the maximum number of nodes (%d/%d)", nodeNum, _numJoints);
}
return;
}
_nodes[nodeNum] = new KeyframeNode;
_nodes[nodeNum]->loadBinary(data);
}
}
开发者ID:Templier,项目名称:residual,代码行数:60,代码来源:keyframe.cpp
示例8: read
uint32 Script::readUint32() {
byte v[4] = {0, 0, 0, 0};
uint32 n;
n = read(v, 4);
assert(n == 4);
return READ_LE_UINT32(v);
}
开发者ID:33d,项目名称:scummvm,代码行数:9,代码来源:script.cpp
示例9: playMidi
void Sound::playMidi(int16_t objKey, int index) {
if (index >= 0 && index < kMusicKeyPathsTableSize) {
int16_t sndKey = _res->getKeyFromPath(_res->_musicKeyPathsTable[index]);
const uint8_t *p_sndinfo = _res->getData(kResType_SND, sndKey, "SNDINFO");
if (p_sndinfo && READ_LE_UINT32(p_sndinfo + 32) == 2) {
// printf("play.midi '%s'\n", (const char *)p_sndinfo);
}
}
}
开发者ID:JohnnyonFlame,项目名称:f2bgl-optimized,代码行数:9,代码来源:sound.cpp
示例10: error
int32 SaveGame::readLESint32() {
if (_saving)
error("SaveGame::readBlock called when storing a savegame");
if (_currentSection == 0)
error("Tried to read a block without starting a section");
int32 data = (int32)READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
_sectionPtr += 4;
return data;
}
开发者ID:YakBizzarro,项目名称:residual,代码行数:9,代码来源:savegame.cpp
示例11: READ_LE_UINT32
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan, int vol, bool loop) {
int size = READ_LE_UINT32(soundData + 4) + 8;
Common::SeekableReadStream *stream = new Common::MemoryReadStream(soundData, size);
Audio::RewindableAudioStream *sndStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
convertVolume(vol);
convertPan(pan);
_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeLoopingAudioStream(sndStream, loop ? 0 : 1), -1, vol, pan);
}
开发者ID:CatalystG,项目名称:scummvm,代码行数:10,代码来源:sound.cpp
示例12: Object
Bitmap::Bitmap(const char *fname, const char *data, int len) :
Object() {
_fname = fname;
if (len < 8 || memcmp(data, "BM F\0\0\0", 8) != 0) {
if (gDebugLevel == DEBUG_BITMAPS || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
error("Invalid magic loading bitmap");
}
strcpy(_filename, fname);
int codec = READ_LE_UINT32(data + 8);
// _paletteIncluded = READ_LE_UINT32(data + 12);
_numImages = READ_LE_UINT32(data + 16);
_x = READ_LE_UINT32(data + 20);
_y = READ_LE_UINT32(data + 24);
// _transparentColor = READ_LE_UINT32(data + 28);
_format = READ_LE_UINT32(data + 32);
// _numBits = READ_LE_UINT32(data + 36);
// _blueBits = READ_LE_UINT32(data + 40);
// _greenBits = READ_LE_UINT32(data + 44);
// _redBits = READ_LE_UINT32(data + 48);
// _blueShift = READ_LE_UINT32(data + 52);
// _greenShift = READ_LE_UINT32(data + 56);
// _redShift = READ_LE_UINT32(data + 60);
_width = READ_LE_UINT32(data + 128);
_height = READ_LE_UINT32(data + 132);
_currImage = 1;
_data = new char *[_numImages];
int pos = 0x88;
for (int i = 0; i < _numImages; i++) {
_data[i] = new char[2 * _width * _height];
if (codec == 0) {
memcpy(_data[i], data + pos, 2 * _width * _height);
pos += 2 * _width * _height + 8;
} else if (codec == 3) {
int compressed_len = READ_LE_UINT32(data + pos);
decompress_codec3(data + pos + 4, _data[i]);
pos += compressed_len + 12;
}
#ifdef SYSTEM_BIG_ENDIAN
if (_format == 1)
for (int j = 0; j < _width * _height; ++j) {
((uint16 *)_data[i])[j] = SWAP_BYTES_16(((uint16 *)_data[i])[j]);
}
#endif
}
g_driver->createBitmap(this);
}
开发者ID:Templier,项目名称:residual,代码行数:52,代码来源:bitmap.cpp
示例13: MoverProcessHelper
static void MoverProcessHelper(int X, int Y, int id, PMOVER pMover) {
const FILM *pfilm;
const MULTI_INIT *pmi;
const FRAME *pFrame;
IMAGE *pim;
assert(BgPal()); // Can't start actor without a background palette
assert(pMover->walkReels[0][FORWARD]); // Starting actor process without walk reels
InitMover(pMover);
InitialPathChecks(pMover, X, Y);
pfilm = (const FILM *)LockMem(pMover->walkReels[0][FORWARD]);
pmi = (const MULTI_INIT *)LockMem(FROM_LE_32(pfilm->reels[0].mobj));
//---
pFrame = (const FRAME *)LockMem(FROM_LE_32(pmi->hMulFrame));
// get pointer to image
pim = (IMAGE *)LockMem(READ_LE_UINT32(pFrame)); // handle to image
pim->hImgPal = TO_LE_32(BgPal());
//---
pMover->actorObj = MultiInitObject(pmi);
/**/ assert(pMover->actorID == id);
pMover->actorID = id;
// add it to display list
MultiInsertObject(GetPlayfieldList(FIELD_WORLD), pMover->actorObj);
storeActorReel(id, NULL, 0, pMover->actorObj, 0, 0, 0);
InitStepAnimScript(&pMover->actorAnim, pMover->actorObj, FROM_LE_32(pfilm->reels[0].script), ONE_SECOND / FROM_LE_32(pfilm->frate));
pMover->stepCount = 0;
MultiSetAniXY(pMover->actorObj, pMover->objX, pMover->objY);
// If no path, just use first path in the scene
if (pMover->hCpath != NOPOLY)
SetMoverZ(pMover, pMover->objY, GetPolyZfactor(pMover->hCpath));
else
SetMoverZ(pMover, pMover->objY, GetPolyZfactor(FirstPathPoly()));
// Make him the right size
SetMoverStanding(pMover);
//**** if added 18/11/94, am
if (X != MAGICX && Y != MAGICY) {
HideMover(pMover, 0); // Allows a play to come in before this appears
pMover->bHidden = false; // ...but don't stay hidden
}
pMover->bActive = true;
}
开发者ID:mauimauer,项目名称:scummvm,代码行数:54,代码来源:rince.cpp
示例14: get_float
void KeyframeAnim::KeyframeEntry::loadBinary(const char *data) {
_frame = get_float(data);
_flags = READ_LE_UINT32(data + 4);
_pos = Math::Vector3d::get_vector3d(data + 8);
_pitch = get_float(data + 20);
_yaw = get_float(data + 24);
_roll = get_float(data + 28);
_dpos = Math::Vector3d::get_vector3d(data + 32);
_dpitch = get_float(data + 44);
_dyaw = get_float(data + 48);
_droll = get_float(data + 52);
}
开发者ID:YakBizzarro,项目名称:residual,代码行数:12,代码来源:keyframe.cpp
示例15: debugC
void CDROM::startTrack(const char *trackname) {
byte *curPtr, *matchPtr;
if (!_LICbuffer)
return;
debugC(1, DEBUG_MUSIC, "startTrack(%s)", trackname);
matchPtr = 0;
curPtr = _LICbuffer;
for (int i = 0; i < _numTracks; i++) {
if (!scumm_stricmp((char *)curPtr, trackname)) {
matchPtr = curPtr;
break;
}
curPtr += 22;
}
if (!matchPtr) {
error("Track %s not found", trackname);
return;
}
strcpy(_curTrack, trackname);
stopPlaying();
while (getTrackPos() != -1);
uint32 start, end;
start = READ_LE_UINT32(matchPtr + 12);
end = READ_LE_UINT32(matchPtr + 16);
play(start, end);
_startTime = _vm->_util->getTimeKey();
_trackStop = _startTime + (end - start + 1 + 150) * 40 / 3;
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:40,代码来源:cdrom.cpp
示例16: READ_LE_UINT32
uint8_t *decode_bitmap(const uint8_t *src, bool alpha, int colorKey, int *w, int *h) {
if (memcmp(src, "BM", 2) != 0) {
return 0;
}
const uint32_t imageOffset = READ_LE_UINT32(src + 0xA);
const int width = READ_LE_UINT32(src + 0x12);
const int height = READ_LE_UINT32(src + 0x16);
const int depth = READ_LE_UINT16(src + 0x1C);
const int compression = READ_LE_UINT32(src + 0x1E);
if ((depth != 8 && depth != 32) || compression != 0) {
warning("Unhandled bitmap depth %d compression %d", depth, compression);
return 0;
}
const int bpp = (!alpha && colorKey < 0) ? 3 : 4;
uint8_t *dst = (uint8_t *)malloc(width * height * bpp);
if (!dst) {
warning("Failed to allocate bitmap buffer, width %d height %d bpp %d", width, height, bpp);
return 0;
}
if (depth == 8) {
const uint8_t *palette = src + 14 /* BITMAPFILEHEADER */ + 40 /* BITMAPINFOHEADER */;
const bool flipY = true;
clut(src + imageOffset, palette, (width + 3) & ~3, width, height, bpp, flipY, colorKey, dst);
} else {
assert(depth == 32 && bpp == 3);
const uint8_t *p = src + imageOffset;
for (int y = height - 1; y >= 0; --y) {
uint8_t *q = dst + y * width * bpp;
for (int x = 0; x < width; ++x) {
const uint32_t color = READ_LE_UINT32(p); p += 4;
*q++ = (color >> 16) & 255;
*q++ = (color >> 8) & 255;
*q++ = color & 255;
}
}
}
*w = width;
*h = height;
return dst;
}
开发者ID:cyxx,项目名称:rawgl,代码行数:40,代码来源:bitmap.cpp
示例17: debug
void CUP_Player::updateSfx() {
int lastSfxChannel = _lastSfxChannel;
for (int i = 0; i < _sfxQueuePos; ++i) {
const CUP_Sfx *sfx = &_sfxQueue[i];
if (sfx->num == -1) {
debug(1, "Stopping sound channel %d", _lastSfxChannel);
if (_lastSfxChannel != -1) {
_mixer->stopHandle(_sfxChannels[_lastSfxChannel].handle);
}
continue;
}
if ((sfx->flags & kSfxFlagRestart) != 0) {
for (int ch = 0; ch < kSfxChannels; ++ch) {
if (_mixer->isSoundHandleActive(_sfxChannels[ch].handle) && _sfxChannels[ch].sfxNum == sfx->num) {
_mixer->stopHandle(_sfxChannels[ch].handle);
break;
}
}
}
CUP_SfxChannel *sfxChannel = 0;
for (int ch = 0; ch < kSfxChannels; ++ch) {
if (!_mixer->isSoundHandleActive(_sfxChannels[ch].handle)) {
lastSfxChannel = ch;
sfxChannel = &_sfxChannels[ch];
sfxChannel->sfxNum = sfx->num;
sfxChannel->flags = sfx->flags;
break;
}
}
if (sfxChannel) {
debug(1, "Start sound %d channel %d flags 0x%X", sfx->num, lastSfxChannel, sfx->flags);
int sfxIndex = sfxChannel->sfxNum - 1;
assert(sfxIndex >= 0 && sfxIndex < _sfxCount);
uint32 offset = READ_LE_UINT32(_sfxBuffer + sfxIndex * 4) - 8;
uint8 *soundData = _sfxBuffer + offset;
if (READ_BE_UINT32(soundData) == MKTAG('D','A','T','A')) {
uint32 soundSize = READ_BE_UINT32(soundData + 4);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &sfxChannel->handle,
Audio::makeLoopingAudioStream(
Audio::makeRawStream(soundData + 8, soundSize - 8,
11025, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO),
(sfx->flags & kSfxFlagLoop) ? 0 : 1
)
);
}
} else {
warning("Unable to find a free channel to play sound %d", sfx->num);
}
}
_lastSfxChannel = lastSfxChannel;
_sfxQueuePos = 0;
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:52,代码来源:cup_player_he.cpp
示例18: READ_LE_UINT32
int Lab::getIndex(std::string filename) {
for (i = 0; i < head.num_entries; i++) {
const char *fname = str_table + READ_LE_UINT32(&entries[i].fname_offset);
std::string test = std::string(fname);
if (test != filename)
continue;
else
{
return i;
}
}
return -1;
}
开发者ID:YakBizzarro,项目名称:residual-tools,代码行数:13,代码来源:lab.cpp
示例19: Object
Font::Font(const char *filename, const char *data, int len) : Object() {
_fname = filename;
_filename = filename;
_numChars = READ_LE_UINT32(data);
_dataSize = READ_LE_UINT32(data + 4);
_height = READ_LE_UINT32(data + 8);
_baseOffsetY = READ_LE_UINT32(data + 12);
_firstChar = READ_LE_UINT32(data + 24);
_lastChar = READ_LE_UINT32(data + 28);
data += 32;
// Read character indexes - are the key/value reversed?
_charIndex = new uint16[_numChars];
if (!_charIndex)
error("Could not load font %s. Out of memory", filename);
for (uint i = 0; i < _numChars; ++i) {
_charIndex[i] = READ_LE_UINT16(data + 2 * i);
}
data += _numChars * 2;
// Read character headers
_charHeaders = new CharHeader[_numChars];
if (!_charHeaders)
error("Could not load font %s. Out of memory", filename);
for (uint i = 0; i < _numChars; ++i) {
_charHeaders[i].offset = READ_LE_UINT32(data);
_charHeaders[i].width = *(int8 *)(data + 4);
_charHeaders[i].startingCol = *(int8 *)(data + 5);
_charHeaders[i].startingLine = *(int8 *)(data + 6);
_charHeaders[i].dataWidth = READ_LE_UINT32(data + 8);
_charHeaders[i].dataHeight = READ_LE_UINT32(data + 12);
data += 16;
}
// Read font data
_fontData = new byte[_dataSize];
if (!_fontData)
error("Could not load font %s. Out of memory", filename);
memcpy(_fontData, data, _dataSize);
}
开发者ID:Templier,项目名称:residual,代码行数:43,代码来源:font.cpp
示例20: assert
void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
byte *dst;
if (getGameId() == GID_DIMP) {
Common::File in;
char filename[15];
assert(sound >= 1 && sound <= 32);
sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
in.open(filename);
if (in.isOpen() == false)
error("loadSound: Can't load %s", filename);
uint32 dstSize = in.size();
dst = (byte *)malloc(dstSize);
if (in.read(dst, dstSize) != dstSize)
error("loadSound: Read failed");
in.close();
} else if (getFeatures() & GF_ZLIBCOMP) {
char filename[15];
uint32 file, offset, srcSize, dstSize;
if (getPlatform() == Common::kPlatformAmiga) {
loadOffsets((const char*)"sfxindex.dat", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
} else {
loadOffsets((const char*)"effects.wav", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
}
if (getPlatform() == Common::kPlatformAmiga)
sprintf(filename, "sfx%d.wav", file);
else
sprintf(filename, "effects.wav");
dst = (byte *)malloc(dstSize);
decompressData(filename, dst, offset, srcSize, dstSize);
} else {
if (_curSfxFile == NULL)
return;
dst = _curSfxFile + READ_LE_UINT32(_curSfxFile + sound * 4);
}
if (type == Sound::TYPE_AMBIENT)
_sound->playAmbientData(dst, sound, pan, vol);
else if (type == Sound::TYPE_SFX)
_sound->playSfxData(dst, sound, pan, vol);
else if (type == Sound::TYPE_SFX5)
_sound->playSfx5Data(dst, sound, pan, vol);
}
开发者ID:Termimad,项目名称:scummvm,代码行数:50,代码来源:res_snd.cpp
注:本文中的READ_LE_UINT32函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论