本文整理汇总了C++中CFile::ReadShort方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::ReadShort方法的具体用法?C++ CFile::ReadShort怎么用?C++ CFile::ReadShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::ReadShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadGameFileInfo
static int ReadGameFileInfo (CFile& cf, int nStartOffset)
{
gameTopFileInfo.fileinfo_signature = cf.ReadShort ();
gameTopFileInfo.fileinfoVersion = cf.ReadShort ();
gameTopFileInfo.fileinfo_sizeof = cf.ReadInt ();
// Check signature
if (gameTopFileInfo.fileinfo_signature != 0x6705)
return -1;
// Check version number
if (gameTopFileInfo.fileinfoVersion < GAME_COMPATIBLE_VERSION)
return -1;
// Now, Read in the fileinfo
if (cf.Seek (nStartOffset, SEEK_SET))
Error ("Error seeking to gameFileInfo in gamesave.c");
gameFileInfo.fileinfo_signature = cf.ReadShort ();
gameFileInfo.fileinfoVersion = cf.ReadShort ();
gameFileInfo.fileinfo_sizeof = cf.ReadInt ();
cf.Read (gameFileInfo.mine_filename, sizeof (char), 15);
gameFileInfo.level = cf.ReadInt ();
gameFileInfo.player.offset = cf.ReadInt (); // Player info
gameFileInfo.player.size = cf.ReadInt ();
gameFileInfo.objects.offset = cf.ReadInt (); // Object info
gameFileInfo.objects.count = cf.ReadInt ();
gameFileInfo.objects.size = cf.ReadInt ();
gameFileInfo.walls.offset = cf.ReadInt ();
gameFileInfo.walls.count = cf.ReadInt ();
gameFileInfo.walls.size = cf.ReadInt ();
gameFileInfo.doors.offset = cf.ReadInt ();
gameFileInfo.doors.count = cf.ReadInt ();
gameFileInfo.doors.size = cf.ReadInt ();
gameFileInfo.triggers.offset = cf.ReadInt ();
gameFileInfo.triggers.count = cf.ReadInt ();
gameFileInfo.triggers.size = cf.ReadInt ();
gameFileInfo.links.offset = cf.ReadInt ();
gameFileInfo.links.count = cf.ReadInt ();
gameFileInfo.links.size = cf.ReadInt ();
gameFileInfo.control.offset = cf.ReadInt ();
gameFileInfo.control.count = cf.ReadInt ();
gameFileInfo.control.size = cf.ReadInt ();
gameFileInfo.botGen.offset = cf.ReadInt ();
gameFileInfo.botGen.count = cf.ReadInt ();
gameFileInfo.botGen.size = cf.ReadInt ();
if (gameTopFileInfo.fileinfoVersion >= 29) {
gameFileInfo.lightDeltaIndices.offset = cf.ReadInt ();
gameFileInfo.lightDeltaIndices.count = cf.ReadInt ();
gameFileInfo.lightDeltaIndices.size = cf.ReadInt ();
gameFileInfo.lightDeltas.offset = cf.ReadInt ();
gameFileInfo.lightDeltas.count = cf.ReadInt ();
gameFileInfo.lightDeltas.size = cf.ReadInt ();
}
if (gameData.segs.nLevelVersion >= 17) {
gameFileInfo.equipGen.offset = cf.ReadInt ();
gameFileInfo.equipGen.count = cf.ReadInt ();
gameFileInfo.equipGen.size = cf.ReadInt ();
}
return 0;
}
示例2: ReadJointLists
/*
* reads n jointlist structs from a CFile
*/
static int ReadJointLists (jointlist *jl, int n, CFile& cf)
{
int i;
for (i = 0; i < n; i++) {
jl [i].n_joints = cf.ReadShort ();
jl [i].offset = cf.ReadShort ();
}
return i;
}
示例3: ReadReactorTriggers
int ReadReactorTriggers (CFile& cf)
{
int i, j;
for (i = 0; i < gameFileInfo.control.count; i++) {
gameData.reactor.triggers.nLinks = cf.ReadShort ();
for (j = 0; j < MAX_CONTROLCEN_LINKS; j++)
gameData.reactor.triggers.segments [j] = cf.ReadShort ();
for (j = 0; j < MAX_CONTROLCEN_LINKS; j++)
gameData.reactor.triggers.sides [j] = cf.ReadShort ();
}
return gameFileInfo.control.count;
}
示例4: ReadLevelInfo
static int ReadLevelInfo (CFile& cf)
{
if (gameTopFileInfo.fileinfoVersion >= 31) { //load mine filename
// read newline-terminated string, not sure what version this changed.
cf.GetS (gameData.missions.szCurrentLevel, sizeof (gameData.missions.szCurrentLevel));
if (gameData.missions.szCurrentLevel [strlen (gameData.missions.szCurrentLevel) - 1] == '\n')
gameData.missions.szCurrentLevel [strlen (gameData.missions.szCurrentLevel) - 1] = 0;
}
else if (gameTopFileInfo.fileinfoVersion >= 14) { //load mine filename
// read null-terminated string
char *p = gameData.missions.szCurrentLevel;
//must do read one char at a time, since no cf.GetS()
do {
*p = cf.GetC ();
} while (*p++);
}
else
gameData.missions.szCurrentLevel [0] = 0;
if (gameTopFileInfo.fileinfoVersion >= 19) { //load pof names
nSavePOFNames = cf.ReadShort ();
if ((nSavePOFNames != 0x614d) && (nSavePOFNames != 0x5547)) { // "Ma"de w/DMB beta/"GU"ILE
if (nSavePOFNames >= MAX_POLYGON_MODELS)
return -1;
cf.Read (szSavePOFNames, nSavePOFNames, SHORT_FILENAME_LEN);
}
}
return 0;
}
示例5: BitmapIndexReadN
/*
* reads n tBitmapIndex structs from a CFile
*/
int BitmapIndexReadN (tBitmapIndex *pbi, int n, CFile& cf)
{
int i;
for (i = 0; i < n; i++)
pbi [i].index = cf.ReadShort ();
return i;
}
示例6: LoadState
void CTrigger::LoadState (CFile& cf, bool bObjTrigger)
{
m_info.nType = (ubyte) cf.ReadByte ();
if (bObjTrigger && (saveGameManager.Version () >= 41))
m_info.flags = cf.ReadShort ();
else
m_info.flags = short (cf.ReadByte ());
m_info.nLinks = cf.ReadByte ();
m_info.value = cf.ReadFix ();
m_info.time = cf.ReadFix ();
for (int i = 0; i < MAX_TRIGGER_TARGETS; i++) {
m_info.segments [i] = cf.ReadShort ();
m_info.sides [i] = cf.ReadShort ();
}
m_info.nChannel = -1;
m_info.tOperated = (saveGameManager.Version () < 44) ? -1 : cf.ReadFix ();
}
示例7: ReadEffectClip
void ReadEffectClip (tEffectClip& ec, CFile& cf)
{
ReadVideoClip (ec.vClipInfo, cf);
ec.xTimeLeft = cf.ReadFix ();
ec.nCurFrame = cf.ReadInt ();
ec.changingWallTexture = cf.ReadShort ();
ec.changingObjectTexture = cf.ReadShort ();
ec.flags = cf.ReadInt ();
ec.nCritClip = cf.ReadInt ();
ec.nDestBm = cf.ReadInt ();
ec.nDestVClip = cf.ReadInt ();
ec.nDestEClip = cf.ReadInt ();
ec.xDestSize = cf.ReadFix ();
ec.nSound = cf.ReadInt ();
ec.nSegment = cf.ReadInt ();
ec.nSide = cf.ReadInt ();
}
示例8: ReadBitmapIndices
/*
* reads n tBitmapIndex structs from a CFile
*/
int ReadBitmapIndices (CArray<tBitmapIndex>& bi, int n, CFile& cf, int o)
{
int i;
for (i = 0; i < n; i++)
bi [i + o].index = cf.ReadShort ();
return i;
}
示例9: ReadTMapInfoN
/*
* reads n tTexMapInfo structs from a CFile
*/
int ReadTMapInfoN (CArray<tTexMapInfo>& ti, int n, CFile& cf)
{
int i;
for (i = 0;i < n;i++) {
ti [i].flags = cf.ReadByte ();
ti [i].pad [0] = cf.ReadByte ();
ti [i].pad [1] = cf.ReadByte ();
ti [i].pad [2] = cf.ReadByte ();
ti [i].lighting = cf.ReadFix ();
ti [i].damage = cf.ReadFix ();
ti [i].nEffectClip = cf.ReadShort ();
ti [i].destroyed = cf.ReadShort ();
ti [i].slide_u = cf.ReadShort ();
ti [i].slide_v = cf.ReadShort ();
}
return i;
}
示例10: ReadJointPositions
/*
* reads n tJointPos structs from a CFile
*/
int ReadJointPositions (CArray<tJointPos>& jp, int n, CFile& cf, int o)
{
int i;
for (i = 0; i < n; i++) {
jp [i + o].jointnum = cf.ReadShort ();
cf.ReadAngVec (jp [i + o].angles);
}
return i;
}
示例11: BMReadWeaponInfoD1N
void BMReadWeaponInfoD1N (CFile& cf, int i)
{
CD1WeaponInfo* wiP = gameData.weapons.infoD1 + i;
wiP->renderType = cf.ReadByte ();
wiP->nModel = cf.ReadByte ();
wiP->nInnerModel = cf.ReadByte ();
wiP->persistent = cf.ReadByte ();
wiP->nFlashVClip = cf.ReadByte ();
wiP->flashSound = cf.ReadShort ();
wiP->nRobotHitVClip = cf.ReadByte ();
wiP->nRobotHitSound = cf.ReadShort ();
wiP->nWallHitVClip = cf.ReadByte ();
wiP->nWallHitSound = cf.ReadShort ();
wiP->fireCount = cf.ReadByte ();
wiP->nAmmoUsage = cf.ReadByte ();
wiP->nVClipIndex = cf.ReadByte ();
wiP->destructible = cf.ReadByte ();
wiP->matter = cf.ReadByte ();
wiP->bounce = cf.ReadByte ();
wiP->homingFlag = cf.ReadByte ();
wiP->dum1 = cf.ReadByte ();
wiP->dum2 = cf.ReadByte ();
wiP->dum3 = cf.ReadByte ();
wiP->xEnergyUsage = cf.ReadFix ();
wiP->xFireWait = cf.ReadFix ();
wiP->bitmap.index = cf.ReadShort ();
wiP->blob_size = cf.ReadFix ();
wiP->xFlashSize = cf.ReadFix ();
wiP->xImpactSize = cf.ReadFix ();
for (i = 0; i < NDL; i++)
wiP->strength [i] = cf.ReadFix ();
for (i = 0; i < NDL; i++)
wiP->speed [i] = cf.ReadFix ();
wiP->mass = cf.ReadFix ();
wiP->drag = cf.ReadFix ();
wiP->thrust = cf.ReadFix ();
wiP->poLenToWidthRatio = cf.ReadFix ();
wiP->light = cf.ReadFix ();
wiP->lifetime = cf.ReadFix ();
wiP->xDamageRadius = cf.ReadFix ();
wiP->picture.index = cf.ReadShort ();
}
示例12:
grsBitmap *PiggyLoadBitmap (const char *pszFile)
{
CFile cf;
grsBitmap *bmp;
tBitmapFileHeader bfh;
tBitmapInfoHeader bih;
if (!cf.Open (pszFile, gameFolders.szDataDir, "rb", 0))
return NULL;
bfh.bfType = cf.ReadShort ();
bfh.bfSize = (unsigned int) cf.ReadInt ();
bfh.bfReserved1 = cf.ReadShort ();
bfh.bfReserved2 = cf.ReadShort ();
bfh.bfOffBits = (unsigned int) cf.ReadInt ();
bih.biSize = (unsigned int) cf.ReadInt ();
bih.biWidth = (unsigned int) cf.ReadInt ();
bih.biHeight = (unsigned int) cf.ReadInt ();
bih.biPlanes = cf.ReadShort ();
bih.biBitCount = cf.ReadShort ();
bih.biCompression = (unsigned int) cf.ReadInt ();
bih.biSizeImage = (unsigned int) cf.ReadInt ();
bih.biXPelsPerMeter = (unsigned int) cf.ReadInt ();
bih.biYPelsPerMeter = (unsigned int) cf.ReadInt ();
bih.biClrUsed = (unsigned int) cf.ReadInt ();
bih.biClrImportant = (unsigned int) cf.ReadInt ();
if (!(bmp = GrCreateBitmap (bih.biWidth, bih.biHeight, 1))) {
cf.Close ();
return NULL;
}
cf.Seek (bfh.bfOffBits, SEEK_SET);
if (cf.Read (bmp->bmTexBuf, bih.biWidth * bih.biHeight, 1) != 1) {
GrFreeBitmap (bmp);
return NULL;
}
cf.Close ();
return bmp;
}
示例13:
CBitmap *PiggyLoadBitmap (const char *pszFile)
{
CFile cf;
CBitmap *bmP;
tBitmapFileHeader bfh;
tBitmapInfoHeader bih;
if (!cf.Open (pszFile, gameFolders.szDataDir, "rb", 0))
return NULL;
bfh.bfType = cf.ReadShort ();
bfh.bfSize = (uint) cf.ReadInt ();
bfh.bfReserved1 = cf.ReadShort ();
bfh.bfReserved2 = cf.ReadShort ();
bfh.bfOffBits = (uint) cf.ReadInt ();
bih.biSize = (uint) cf.ReadInt ();
bih.biWidth = (uint) cf.ReadInt ();
bih.biHeight = (uint) cf.ReadInt ();
bih.biPlanes = cf.ReadShort ();
bih.biBitCount = cf.ReadShort ();
bih.biCompression = (uint) cf.ReadInt ();
bih.biSizeImage = (uint) cf.ReadInt ();
bih.biXPelsPerMeter = (uint) cf.ReadInt ();
bih.biYPelsPerMeter = (uint) cf.ReadInt ();
bih.biClrUsed = (uint) cf.ReadInt ();
bih.biClrImportant = (uint) cf.ReadInt ();
if (!(bmP = CBitmap::Create (0, bih.biWidth, bih.biHeight, 1))) {
cf.Close ();
return NULL;
}
cf.Seek (bfh.bfOffBits, SEEK_SET);
if (bmP->Read (cf, bih.biWidth * bih.biHeight) != bih.biWidth * bih.biHeight) {
delete bmP;
return NULL;
}
cf.Close ();
return bmP;
}
示例14: ReadType
void CSegment::ReadType (CFile& cf, ubyte flags)
{
if (flags & (1 << MAX_SIDES_PER_SEGMENT)) {
m_nType = cf.ReadByte ();
m_nMatCen = cf.ReadByte ();
m_value = char (cf.ReadShort ());
}
else {
m_nType = 0;
m_nMatCen = -1;
m_value = 0;
}
}
示例15: Read
void CSegment::Read (CFile& cf)
{
#if DBG
if (Index () == nDbgSeg)
nDbgSeg = nDbgSeg;
#endif
if (gameStates.app.bD2XLevel) {
m_owner = cf.ReadByte ();
m_group = cf.ReadByte ();
}
else {
m_owner = -1;
m_group = -1;
}
ubyte flags = bNewFileFormat ? cf.ReadByte () : 0x7f;
if (gameData.segs.nLevelVersion == 5) { // d2 SHAREWARE level
ReadType (cf, flags);
ReadVerts (cf);
ReadChildren (cf, flags);
}
else {
ReadChildren (cf, flags);
ReadVerts (cf);
if (gameData.segs.nLevelVersion <= 1) { // descent 1 level
ReadType (cf, flags);
}
}
m_objects = -1;
if (gameData.segs.nLevelVersion <= 5) // descent 1 thru d2 SHAREWARE level
m_xAvgSegLight = fix (cf.ReadShort ()) << 4;
// Read the walls as a 6 byte array
flags = bNewFileFormat ? cf.ReadByte () : 0x3f;
int i;
for (i = 0; i < MAX_SIDES_PER_SEGMENT; i++)
m_sides [i].ReadWallNum (cf, (flags & (1 << i)) != 0);
ushort sideVerts [4];
for (i = 0; i < MAX_SIDES_PER_SEGMENT; i++) {
::GetCorners (Index (), i, sideVerts);
m_sides [i].Read (cf, sideVerts, m_children [i] == -1);
}
}