本文整理汇总了C++中CFile::ReadVector方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::ReadVector方法的具体用法?C++ CFile::ReadVector怎么用?C++ CFile::ReadVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::ReadVector方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadReactor
void ReadReactor (tReactorProps& reactor, CFile& cf)
{
int i;
reactor.nModel = cf.ReadInt ();
reactor.nGuns = cf.ReadInt ();
for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
cf.ReadVector (reactor.gunPoints [i]);
for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
cf.ReadVector (reactor.gunDirs [i]);
}
示例2: PlayerShipRead
void PlayerShipRead (tPlayerShip *ps, CFile& cf)
{
int i;
ps->nModel = cf.ReadInt ();
ps->nExplVClip = cf.ReadInt ();
ps->mass = cf.ReadFix ();
ps->drag = cf.ReadFix ();
ps->maxThrust = cf.ReadFix ();
ps->reverseThrust = cf.ReadFix ();
ps->brakes = cf.ReadFix ();
ps->wiggle = cf.ReadFix ();
ps->maxRotThrust = cf.ReadFix ();
for (i = 0; i < N_PLAYER_GUNS; i++)
cf.ReadVector (ps->gunPoints[i]);
}
示例3: Read
void CObject::Read (CFile& cf)
{
#if DBG
if (OBJ_IDX (this) == nDbgObj)
nDbgObj = nDbgObj;
#endif
info.nType = cf.ReadByte ();
info.nId = cf.ReadByte ();
info.controlType = cf.ReadByte ();
info.movementType = cf.ReadByte ();
info.renderType = cf.ReadByte ();
info.nFlags = cf.ReadByte ();
info.nSegment = cf.ReadShort ();
info.nAttachedObj = -1;
cf.ReadVector (info.position.vPos);
cf.ReadMatrix (info.position.mOrient);
info.xSize = cf.ReadFix ();
info.xShields = cf.ReadFix ();
cf.ReadVector (info.vLastPos);
info.contains.nType = cf.ReadByte ();
info.contains.nId = cf.ReadByte ();
info.contains.nCount = cf.ReadByte ();
switch (info.movementType) {
case MT_PHYSICS:
cf.ReadVector (mType.physInfo.velocity);
cf.ReadVector (mType.physInfo.thrust);
mType.physInfo.mass = cf.ReadFix ();
mType.physInfo.drag = cf.ReadFix ();
mType.physInfo.brakes = cf.ReadFix ();
cf.ReadVector (mType.physInfo.rotVel);
cf.ReadVector (mType.physInfo.rotThrust);
mType.physInfo.turnRoll = cf.ReadFixAng ();
mType.physInfo.flags = cf.ReadShort ();
break;
case MT_SPINNING:
cf.ReadVector (mType.spinRate);
break;
case MT_NONE:
break;
default:
Int3();
}
int i;
switch (info.controlType) {
case CT_AI:
cType.aiInfo.behavior = cf.ReadByte ();
for (i = 0; i < MAX_AI_FLAGS; i++)
cType.aiInfo.flags [i] = cf.ReadByte ();
cType.aiInfo.nHideSegment = cf.ReadShort ();
cType.aiInfo.nHideIndex = cf.ReadShort ();
cType.aiInfo.nPathLength = cf.ReadShort ();
cType.aiInfo.nCurPathIndex = (char) cf.ReadShort ();
if (gameTopFileInfo.fileinfoVersion <= 25) {
cf.ReadShort (); // cType.aiInfo.follow_path_start_seg =
cf.ReadShort (); // cType.aiInfo.follow_path_end_seg =
}
break;
case CT_EXPLOSION:
cType.explInfo.nSpawnTime = cf.ReadFix ();
cType.explInfo.nDeleteTime = cf.ReadFix ();
cType.explInfo.nDeleteObj = cf.ReadShort ();
cType.explInfo.attached.nNext = cType.explInfo.attached.nPrev = cType.explInfo.attached.nParent = -1;
break;
case CT_WEAPON: //do I really need to read these? Are they even saved to disk?
cType.laserInfo.parent.nType = cf.ReadShort ();
cType.laserInfo.parent.nObject = cf.ReadShort ();
cType.laserInfo.parent.nSignature = cf.ReadInt ();
break;
case CT_LIGHT:
cType.lightInfo.intensity = cf.ReadFix ();
break;
case CT_POWERUP:
if (gameTopFileInfo.fileinfoVersion >= 25)
cType.powerupInfo.nCount = cf.ReadInt ();
else
cType.powerupInfo.nCount = 1;
if (info.nId == POW_VULCAN)
cType.powerupInfo.nCount = VULCAN_WEAPON_AMMO_AMOUNT;
else if (info.nId == POW_GAUSS)
cType.powerupInfo.nCount = VULCAN_WEAPON_AMMO_AMOUNT;
else if (info.nId == POW_OMEGA)
cType.powerupInfo.nCount = MAX_OMEGA_CHARGE;
break;
case CT_NONE:
case CT_FLYING:
case CT_DEBRIS:
break;
case CT_SLEW: //the CPlayerData is generally saved as slew
break;
//.........这里部分代码省略.........
示例4: LoadState
void CObject::LoadState (CFile& cf)
{
info.nSignature = cf.ReadInt ();
info.nType = (ubyte) cf.ReadByte ();
info.nId = (ubyte) cf.ReadByte ();
info.nNextInSeg = cf.ReadShort ();
info.nPrevInSeg = cf.ReadShort ();
info.controlType = (ubyte) cf.ReadByte ();
info.movementType = (ubyte) cf.ReadByte ();
info.renderType = (ubyte) cf.ReadByte ();
info.nFlags = (ubyte) cf.ReadByte ();
info.nSegment = cf.ReadShort ();
info.nAttachedObj = cf.ReadShort ();
cf.ReadVector (info.position.vPos);
cf.ReadMatrix (info.position.mOrient);
info.xSize = cf.ReadFix ();
info.xShields = cf.ReadFix ();
cf.ReadVector (info.vLastPos);
info.contains.nType = cf.ReadByte ();
info.contains.nId = cf.ReadByte ();
info.contains.nCount = cf.ReadByte ();
info.nCreator = cf.ReadByte ();
info.xLifeLeft = cf.ReadFix ();
if (info.movementType == MT_PHYSICS) {
cf.ReadVector (mType.physInfo.velocity);
cf.ReadVector (mType.physInfo.thrust);
mType.physInfo.mass = cf.ReadFix ();
mType.physInfo.drag = cf.ReadFix ();
mType.physInfo.brakes = cf.ReadFix ();
cf.ReadVector (mType.physInfo.rotVel);
cf.ReadVector (mType.physInfo.rotThrust);
mType.physInfo.turnRoll = cf.ReadFixAng ();
mType.physInfo.flags = (ushort) cf.ReadShort ();
}
else if (info.movementType == MT_SPINNING) {
cf.ReadVector (mType.spinRate);
}
switch (info.controlType) {
case CT_WEAPON:
cType.laserInfo.parent.nType = cf.ReadShort ();
cType.laserInfo.parent.nObject = cf.ReadShort ();
cType.laserInfo.parent.nSignature = cf.ReadInt ();
cType.laserInfo.xCreationTime = cf.ReadFix ();
cType.laserInfo.nLastHitObj = cf.ReadShort ();
if (cType.laserInfo.nLastHitObj < 0)
cType.laserInfo.nLastHitObj = 0;
else {
gameData.objs.nHitObjects [Index () * MAX_HIT_OBJECTS] = cType.laserInfo.nLastHitObj;
cType.laserInfo.nLastHitObj = 1;
}
cType.laserInfo.nHomingTarget = cf.ReadShort ();
cType.laserInfo.xScale = cf.ReadFix ();
break;
case CT_EXPLOSION:
cType.explInfo.nSpawnTime = cf.ReadFix ();
cType.explInfo.nDeleteTime = cf.ReadFix ();
cType.explInfo.nDeleteObj = cf.ReadShort ();
cType.explInfo.attached.nParent = cf.ReadShort ();
cType.explInfo.attached.nPrev = cf.ReadShort ();
cType.explInfo.attached.nNext = cf.ReadShort ();
break;
case CT_AI:
cType.aiInfo.behavior = (ubyte) cf.ReadByte ();
cf.Read (cType.aiInfo.flags, 1, MAX_AI_FLAGS);
cType.aiInfo.nHideSegment = cf.ReadShort ();
cType.aiInfo.nHideIndex = cf.ReadShort ();
cType.aiInfo.nPathLength = cf.ReadShort ();
cType.aiInfo.nCurPathIndex = cf.ReadByte ();
cType.aiInfo.bDyingSoundPlaying = cf.ReadByte ();
cType.aiInfo.nDangerLaser = cf.ReadShort ();
cType.aiInfo.nDangerLaserSig = cf.ReadInt ();
cType.aiInfo.xDyingStartTime = cf.ReadFix ();
break;
case CT_LIGHT:
cType.lightInfo.intensity = cf.ReadFix ();
break;
case CT_POWERUP:
cType.powerupInfo.nCount = cf.ReadInt ();
cType.powerupInfo.xCreationTime = cf.ReadFix ();
cType.powerupInfo.nFlags = cf.ReadInt ();
break;
}
switch (info.renderType) {
case RT_MORPH:
case RT_POLYOBJ: {
int i;
rType.polyObjInfo.nModel = cf.ReadInt ();
for (i = 0; i < MAX_SUBMODELS; i++)
cf.ReadAngVec (rType.polyObjInfo.animAngles [i]);
rType.polyObjInfo.nSubObjFlags = cf.ReadInt ();
rType.polyObjInfo.nTexOverride = cf.ReadInt ();
rType.polyObjInfo.nAltTextures = cf.ReadInt ();
break;
}
case RT_WEAPON_VCLIP:
case RT_HOSTAGE:
//.........这里部分代码省略.........
示例5: ReadRobotInfos
/*
* reads n tRobotInfo structs from a CFile
*/
int ReadRobotInfos (CArray<tRobotInfo>& botInfo, int n, CFile& cf, int o)
{
int h, i, j;
for (i = 0; i < n; i++) {
h = i + o;
botInfo [h].nModel = cf.ReadInt ();
for (j = 0; j < MAX_GUNS; j++)
cf.ReadVector (botInfo [h].gunPoints [j]);
cf.Read (botInfo [h].gunSubModels, MAX_GUNS, 1);
botInfo [h].nExp1VClip = cf.ReadShort ();
botInfo [h].nExp1Sound = cf.ReadShort ();
botInfo [h].nExp2VClip = cf.ReadShort ();
botInfo [h].nExp2Sound = cf.ReadShort ();
botInfo [h].nWeaponType = cf.ReadByte ();
botInfo [h].nSecWeaponType = cf.ReadByte ();
botInfo [h].nGuns = cf.ReadByte ();
botInfo [h].containsId = cf.ReadByte ();
botInfo [h].containsCount = cf.ReadByte ();
botInfo [h].containsProb = cf.ReadByte ();
botInfo [h].containsType = cf.ReadByte ();
botInfo [h].kamikaze = cf.ReadByte ();
botInfo [h].scoreValue = cf.ReadShort ();
botInfo [h].badass = cf.ReadByte ();
botInfo [h].energyDrain = cf.ReadByte ();
botInfo [h].lighting = cf.ReadFix ();
botInfo [h].strength = cf.ReadFix ();
botInfo [h].mass = cf.ReadFix ();
botInfo [h].drag = cf.ReadFix ();
for (j = 0; j < NDL; j++)
botInfo [h].fieldOfView [j] = cf.ReadFix ();
for (j = 0; j < NDL; j++)
botInfo [h].primaryFiringWait [j] = cf.ReadFix ();
for (j = 0; j < NDL; j++)
botInfo [h].secondaryFiringWait [j] = cf.ReadFix ();
for (j = 0; j < NDL; j++)
botInfo [h].turnTime [j] = cf.ReadFix ();
for (j = 0; j < NDL; j++)
botInfo [h].xMaxSpeed [j] = cf.ReadFix ();
for (j = 0; j < NDL; j++)
botInfo [h].circleDistance [j] = cf.ReadFix ();
cf.Read (botInfo [h].nRapidFireCount, NDL, 1);
cf.Read (botInfo [h].evadeSpeed, NDL, 1);
botInfo [h].cloakType = cf.ReadByte ();
botInfo [h].attackType = cf.ReadByte ();
botInfo [h].seeSound = cf.ReadByte ();
botInfo [h].attackSound = cf.ReadByte ();
botInfo [h].clawSound = cf.ReadByte ();
botInfo [h].tauntSound = cf.ReadByte ();
botInfo [h].bossFlag = cf.ReadByte ();
botInfo [h].companion = cf.ReadByte ();
botInfo [h].smartBlobs = cf.ReadByte ();
botInfo [h].energyBlobs = cf.ReadByte ();
botInfo [h].thief = cf.ReadByte ();
botInfo [h].pursuit = cf.ReadByte ();
botInfo [h].lightcast = cf.ReadByte ();
botInfo [h].bDeathRoll = cf.ReadByte ();
botInfo [h].flags = cf.ReadByte ();
cf.Read(botInfo [h].pad, 3, 1);
botInfo [h].deathrollSound = cf.ReadByte ();
botInfo [h].glow = cf.ReadByte ();
botInfo [h].behavior = cf.ReadByte ();
botInfo [h].aim = cf.ReadByte ();
for (j = 0; j < MAX_GUNS + 1; j++)
ReadJointLists (botInfo [h].animStates [j], N_ANIM_STATES, cf);
botInfo [h].always_0xabcd = cf.ReadInt ();
}
return i;
}
示例6: LoadMineSegmentsCompiled
int LoadMineSegmentsCompiled (CFile& cf)
{
int i, nSegments, nVertices;
ubyte nCompiledVersion;
char *psz;
gameData.segs.vMin.Set (0x7fffffff, 0x7fffffff, 0x7fffffff);
/* [X] =
gameData.segs.vMin[Y] =
gameData.segs.vMin[Y] = 0x7fffffff;*/
gameData.segs.vMax.Set (-0x7fffffff, -0x7fffffff, -0x7fffffff);
/*[X] =
gameData.segs.vMax[X] =
gameData.segs.vMax[Y] =
gameData.segs.vMax[Y] = -0x7fffffff;*/
gameStates.render.bColored = 0;
bD1PigPresent = CFile::Exist (D1_PIGFILE, gameFolders.szDataDir, 0);
psz = strchr (gameData.segs.szLevelFilename, '.');
bNewFileFormat = !psz || strcmp (psz, ".sdl");
// For compiled levels, textures map to themselves, prevent nTexOverride always being gray,
// bug which Matt and John refused to acknowledge, so here is Mike, fixing it.
//=============================== Reading part ==============================
nCompiledVersion = cf.ReadByte ();
//Assert ( nCompiledVersion==COMPILED_MINE_VERSION );
#if TRACE
if (nCompiledVersion != COMPILED_MINE_VERSION)
console.printf (CON_DBG, "compiled mine version=%i\n", nCompiledVersion); //many levels have "wrong" versions. Theres no point in aborting because of it, I think.
console.printf (CON_DBG, " compiled mine version = %d\n", nCompiledVersion);
#endif
nVertices = bNewFileFormat ? cf.ReadShort () : cf.ReadInt ();
Assert (nVertices <= MAX_VERTICES);
#if TRACE
console.printf (CON_DBG, " %d vertices\n", gameData.segs.nVertices);
#endif
nSegments = bNewFileFormat ? cf.ReadShort () : cf.ReadInt ();
if (nSegments >= MAX_SEGMENTS) {
Warning (TXT_LEVEL_TOO_LARGE);
return -1;
}
if (!InitGame (nSegments, nVertices))
return -1;
#if TRACE
console.printf (CON_DBG, " %d segments\n", gameData.segs.nSegments);
#endif
for (i = 0; i < gameData.segs.nVertices; i++) {
cf.ReadVector (gameData.segs.vertices [i]);
#if !FLOAT_COORD
gameData.segs.fVertices [i][X] = X2F (gameData.segs.vertices [i][X]);
gameData.segs.fVertices [i][Y] = X2F (gameData.segs.vertices [i][Y]);
gameData.segs.fVertices [i][Z] = X2F (gameData.segs.vertices [i][Z]);
#endif
if (gameData.segs.vMin [X] > gameData.segs.vertices [i][X])
gameData.segs.vMin [X] = gameData.segs.vertices [i][X];
if (gameData.segs.vMin [Y] > gameData.segs.vertices [i][Y])
gameData.segs.vMin [Y] = gameData.segs.vertices [i][Y];
if (gameData.segs.vMin [Z] > gameData.segs.vertices [i][Z])
gameData.segs.vMin [Z] = gameData.segs.vertices [i][Z];
if (gameData.segs.vMax [X] < gameData.segs.vertices [i][X])
gameData.segs.vMax [X] = gameData.segs.vertices [i][X];
if (gameData.segs.vMax [Y] < gameData.segs.vertices [i][Y])
gameData.segs.vMax [Y] = gameData.segs.vertices [i][Y];
if (gameData.segs.vMax [Z] < gameData.segs.vertices [i][Z])
gameData.segs.vMax [Z] = gameData.segs.vertices [i][Z];
}
SEGMENTS.Clear ();
#if TRACE
console.printf (CON_DBG, " loading segments ...\n");
#endif
gameData.segs.nLastVertex = gameData.segs.nVertices - 1;
gameData.segs.nLastSegment = gameData.segs.nSegments - 1;
if (gameStates.app.bProgressBars && gameOpts->menus.nStyle)
LoadSegmentsGauge (cf);
else {
LoadSegmentsCompiled (-1, cf);
SetupSegments (); // Fill in side type and normals.
LoadExtSegmentsCompiled (cf);
LoadVertLightsCompiled (-1, cf);
LoadSideLightsCompiled (-1, cf);
LoadTexColorsCompiled (-1, cf);
ComputeSegSideCenters (-1);
}
gameData.segs.fRad = X2F (CFixVector::Dist(gameData.segs.vMax, gameData.segs.vMin));
ResetObjects (1); //one CObject, the player
return 0;
}