Beispiel #1
0
bool BMPImageReader::processColorTable() {
  // Fail if we don't have enough file space for the color table.
  const size_t headerEnd = m_headerOffset + m_infoHeader.biSize;
  const size_t tableSizeInBytes = m_infoHeader.biClrUsed * (m_isOS21x ? 3 : 4);
  const size_t tableEnd = headerEnd + tableSizeInBytes;
  if ((tableEnd < headerEnd) ||
      (m_imgDataOffset && (m_imgDataOffset < tableEnd)))
    return m_parent->setFailed();

  // Read color table.
  if ((m_decodedOffset > m_data->size()) ||
      ((m_data->size() - m_decodedOffset) < tableSizeInBytes))
    return false;
  m_colorTable.resize(m_infoHeader.biClrUsed);

  // On non-OS/2 1.x, an extra padding byte is present, which we need to skip.
  const size_t bytesPerColor = m_isOS21x ? 3 : 4;
  for (size_t i = 0; i < m_infoHeader.biClrUsed; ++i) {
    m_colorTable[i].rgbBlue = readUint8(0);
    m_colorTable[i].rgbGreen = readUint8(1);
    m_colorTable[i].rgbRed = readUint8(2);
    m_decodedOffset += bytesPerColor;
  }

  // We've now decoded all the non-image data we care about.  Skip anything
  // else before the actual raster data.
  if (m_imgDataOffset)
    m_decodedOffset = m_imgDataOffset;
  m_needToProcessColorTable = false;

  return true;
}
Beispiel #2
0
ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() {
  // Read icon data.
  // The following calls to readUint8() return a uint8_t, which is appropriate
  // because that's the on-disk type of the width and height values.  Storing
  // them in ints (instead of matching uint8_ts) is so we can record dimensions
  // of size 256 (which is what a zero byte really means).
  int width = readUint8(0);
  if (!width)
    width = 256;
  int height = readUint8(1);
  if (!height)
    height = 256;
  IconDirectoryEntry entry;
  entry.m_size = IntSize(width, height);
  if (m_fileType == CURSOR) {
    entry.m_bitCount = 0;
    entry.m_hotSpot = IntPoint(readUint16(4), readUint16(6));
  } else {
    entry.m_bitCount = readUint16(6);
    entry.m_hotSpot = IntPoint();
  }
  entry.m_byteSize = readUint32(8);
  entry.m_imageOffset = readUint32(12);

  // Some icons don't have a bit depth, only a color count.  Convert the
  // color count to the minimum necessary bit depth.  It doesn't matter if
  // this isn't quite what the bitmap info header says later, as we only use
  // this value to determine which icon entry is best.
  if (!entry.m_bitCount) {
    int colorCount = readUint8(2);
    if (!colorCount)
      colorCount = 256;  // Vague in the spec, needed by real-world icons.
    for (--colorCount; colorCount; colorCount >>= 1)
      ++entry.m_bitCount;
  }
Beispiel #3
0
/*
 * readUint16
 * 从EDP包中读出16bit的字段
 */
uint16 readUint16(edp_pkt* pkt)
{
  uint16 tmp;
  uint8 msb, lsb;
  
  msb = readUint8(pkt);
  lsb = readUint8(pkt);

  tmp = (msb<<8) | lsb;
  return tmp;
}
void Script_v6::o6_assign(FuncParams &params) {
	uint8 type = peekUint8();
	uint16 var_0, var_4;
	std::string varIndex = readVarIndex(&var_0, &var_4);

	if (var_0 != 0) {
		std::string varIndex2;
		uint16 var_6;

		uint32 savedPos = getPos();

		varIndex2 = readVarIndex(&var_6, 0);

		printIndent();
		print("memcpy(%s, %s, %d);\n", varIndex.c_str(), varIndex2.c_str(), var_6 * 4);

		seek(savedPos);
		skipExpr(99);

		return;
	}

	if (peekUint8() == 98) {
		skip(1);
		uint8 loopCount = readUint8();

		uint32 off = 0;
		for (uint16 i = 0; i < loopCount; i++) {
			uint8 c = readUint8();
			uint16 n = readUint16();

			printIndent();
			print("memset(%s + %d, %d, %d);\n", varIndex.c_str(), off, c, n);

			off += n;
		}
	} else if (peekUint8() == 99) {
		skip(1);
		uint8 loopCount = readUint8();

		for (uint16 i = 0; i < loopCount; i++) {
			std::string expr = readExpr();
			printIndent();
			print("%s[%d] = %s;\n", varIndex.c_str(), (type == 24) ? (i * 2) : i, expr.c_str());
		}
	} else {
		std::string expr = readExpr();

		printIndent();
		print("%s = %s;\n", varIndex.c_str(), expr.c_str());
	}
}
void Script_v2::o2_totSub(FuncParams &params) {
	startFunc(params);

	uint8 length = readUint8();
	if (!(length & 0x80)) {
		for (uint16 i = 0; i < length; i++)
			print("%c", (char) readUint8());
	} else
		print("%s", readExpr().c_str());

	print(", %d", readUint8());

	endFunc();
}
void Script_v2::o2_popVars(FuncParams &params) {
	uint8 count = readUint8();

	for (uint16 i = 0; i < count; i++) {
		printIndent();
		print("pop(%s);\n", readVarIndex().c_str());
	}
}
Beispiel #7
0
/*
 * edpCommandReqParse
 * 按照EDP命令请求协议,解析数据
 */
int edpCommandReqParse(edp_pkt* pkt, char *id, char *cmd, int32 *rmlen, int32 *id_len, int32 *cmd_len)
{
  readUint8(pkt);     /* 包类型 */
  *rmlen = readRemainlen(pkt);    /* 剩余长度 */
  *id_len = readUint16(pkt);      /* ID长度 */
  readStr(pkt, id, *id_len);      /* 命令ID */
  *cmd_len = readUint32(pkt);     /* 命令长度 */
  readStr(pkt, cmd, *cmd_len);    /* 命令内容 */
}
void Script_v6::o6_loadCursor(FuncParams &params) {
	int16 id = (int16) readUint16();

	startFunc(params);
	print("%d, ", id);
	if (id == -1) {
		print("%s, ", peekString());
		skip(9);
		print("%d, ", readUint16());
		print("%d", (int8) readUint8());
	} else if (id == -2) {
		print("%d, ", readUint16());
		print("%d, ", readUint16());
		print("%d", (int8) readUint8());
	} else {
		print("%d", (int8) readUint8());
	}
	endFunc();
}
Beispiel #9
0
/*
 * edpPushDataParse
 * 按照EDP透传数据格式,解析数据
 */
int edpPushDataParse(edp_pkt* pkt, char *srcId, char *data)
{
  uint32 remain_len;
  uint16 id_len;
  
  readUint8(pkt);     /* 包类型 */
  remain_len = readRemainlen(pkt);    /* 剩余长度 */
  id_len = readUint16(pkt);           /* 源ID长度 */
  readStr(pkt, srcId, id_len);    /* 源ID */
  readStr(pkt, data, remain_len - 2 - id_len);    /* 数据内容 */
}
Beispiel #10
0
/*
 * readUint32
 * 从EDP包中读出4个字节的字段
 */
uint32 readUint32(edp_pkt* pkt)
{
  uint32 tmp = 0;
  int i = 4;

  while (--i >= 0) 
  {
    tmp <<= 8;
    tmp |= readUint8(pkt);
  }
  return tmp;
}
void Script_v2::o2_pushVars(FuncParams &params) {
	uint8 count = readUint8();

	for (uint16 i = 0; i < count; i++) {
		printIndent();
		if ((peekUint8() == 25) || (peekUint8() == 28)) {
			print("push(%s, animDataSize);\n", readVarIndex().c_str());
			skip(1);
		} else
			print("push(%s, 4);\n", readExpr().c_str());
	}
}
Beispiel #12
0
void Game::loadOthers()
{
#ifdef NSPIRE
	FILE* exe = openFile("/documents/liero/data/others.dat.tns");
#else
	FILE* exe = openFile(joinPath(lieroDataRoot, "others.dat"));
#endif

	for(int i = 0; i < 2; ++i)
	for(int j = 0; j < 2; ++j)
		bonusRandTimer[j][i] = readUint16(exe);

	for(int i = 0; i < 2; ++i)
	for(int j = 0; j < 7; ++j)
		aiParams.k[i][j] = readUint16(exe);

	for(int i = 0; i < 2; ++i)
		bonusSObjects[i] = readUint8(exe) - 1;
}
void Script_v2::o2_assign(FuncParams &params) {
	uint8 type = peekUint8();
	std::string varIndex = readVarIndex();

	if (peekUint8() == 99) {
		skip(1);
		uint8 loopCount = readUint8();

		for (uint16 i = 0; i < loopCount; i++) {
			std::string expr = readExpr();
			printIndent();
			print("%s[%d] = %s;\n", varIndex.c_str(), (type == 24) ? (i * 2) : i, expr.c_str());
		}
	} else {
		std::string expr = readExpr();

		printIndent();
		print("%s = %s;\n", varIndex.c_str(), expr.c_str());
	}
}
Beispiel #14
0
/*
 * readRemainlen
 * 从EDP包中读出剩余长度
 */
int32 readRemainlen(edp_pkt* pkt)
{
  uint32 multiplier = 1;
  uint32 len_len = 0;
  uint8 onebyte = 0;
  int32 len_val = 0;
  do 
  {
    onebyte = readUint8(pkt);

    len_val += (onebyte & 0x7f) * multiplier;
    multiplier *= 0x80;

    len_len++;
    if (len_len > 4) 
    {
      return -1; /*len of len more than 4;*/
    }
  } while((onebyte & 0x80) != 0);
  return len_val;
}
Beispiel #15
0
char* Packet_parse(char* buffer, struct Packet* p, int ascii) {
    uint8_t id;
    if (!ascii) {
        buffer = readUint8(&id, buffer);
    } else {
        buffer = readUint8Ascii((char*) &id, buffer);
    }
    //IF - ELSE-IF for each existing packet
    p->id = id;
    if (id == Dummy_Payload_ID) {
        Dummy_Payload_read(p, buffer, ascii);
    } else if (id == Dumb_Payload_ID) {
        Dumb_Payload_read(p, buffer, ascii);
    } else if (id == State_Payload_ID) {
        State_Payload_read(p, buffer, ascii);
    } else if (id == Speed_Payload_ID) {
        Speed_Payload_read(p, buffer, ascii);
    } else if (id == Init_Payload_ID) {
        Init_Payload_read(p, buffer, ascii);
    }else if (id == Heartbeat_Payload_ID) {
        Heartbeat_Payload_read(p, buffer, ascii);
    }
    return buffer;
}
Beispiel #16
0
bool Settings::load(std::string const& path)
{
	FILE* opt = tolerantFOpen(path.c_str(), "rb");
	
	if(!opt)
		return false;
		
	std::size_t size = fileLength(opt);
	
	if(size < 155)
		return false; // .dat is too short
	
	maxBonuses = readUint8(opt);
	loadingTime = readUint16(opt);
	lives = readUint16(opt);
	timeToLose = readUint16(opt);
	flagsToWin = readUint16(opt);
	
	screenSync = readUint8(opt) != 0;
	map = readUint8(opt) != 0;
	wormSettings[0].controller = readUint8(opt) & 0x1;
	wormSettings[1].controller = readUint8(opt) & 0x1;
	randomLevel = readUint8(opt) != 0;
	blood = readUint16(opt);
	gameMode = readUint8(opt);
	namesOnBonuses = readUint8(opt) != 0;
	regenerateLevel = readUint8(opt) != 0;
	shadow = readUint8(opt) != 0;
	
	//fread(weapTable, 1, 40, opt);
	
	for(int i = 0; i < 40; ++i)
	{
		weapTable[i] = limit<0, 3>(fgetc(opt));
	}
	
	for(int i = 0; i < 2; ++i)
	for(int j = 0; j < 3; ++j)
		wormSettings[i].rgb[j] = readUint8(opt) & 63;
		
	for(int i = 0; i < 2; ++i)
	{
		for(int j = 0; j < 5; ++j)
		{
			wormSettings[i].weapons[j] = readUint8(opt);
		}
	}

	wormSettings[0].health = readUint16(opt);
	wormSettings[1].health = readUint16(opt);

	for(int i = 0; i < 2; ++i)
	{
		wormSettings[i].name = readPascalString(opt, 21);
	}
	
	//fgetc(opt); // What's this?
	
	loadChange = readUint8(opt) != 0;
	
	// 0x7B-83 is the string LIERO
	
	fseek(opt, 0x84, SEEK_SET);
	for(int i = 0; i < 2; ++i)
	{
		for(int j = 0; j < 7; ++j)
		{
			wormSettings[i].controls[j] = limit<0, 177>(readUint8(opt));
		}
	}
	
	levelFile = readPascalString(opt, 9);
	
	for(int i = 0; i < 2; ++i)
	{
		if(wormSettings[i].name.empty())
			generateName(wormSettings[i]);
		else
			wormSettings[i].randomName = false;
	}
	
	fclose(opt);
	
	return true;
}
Beispiel #17
0
	static inline int run(FILE* f)
	{
		return readUint8(f);
	}
Beispiel #18
0
BMPImageReader::ProcessingResult BMPImageReader::processRLEData() {
  if (m_decodedOffset > m_data->size())
    return InsufficientData;

  // RLE decoding is poorly specified.  Two main problems:
  // (1) Are EOL markers necessary?  What happens when we have too many
  //     pixels for one row?
  //     http://www.fileformat.info/format/bmp/egff.htm says extra pixels
  //     should wrap to the next line.  Real BMPs I've encountered seem to
  //     instead expect extra pixels to be ignored until the EOL marker is
  //     seen, although this has only happened in a few cases and I suspect
  //     those BMPs may be invalid.  So we only change lines on EOL (or Delta
  //     with dy > 0), and fail in most cases when pixels extend past the end
  //     of the line.
  // (2) When Delta, EOL, or EOF are seen, what happens to the "skipped"
  //     pixels?
  //     http://www.daubnet.com/formats/BMP.html says these should be filled
  //     with color 0.  However, the "do nothing" and "don't care" comments
  //     of other references suggest leaving these alone, i.e. letting them
  //     be transparent to the background behind the image.  This seems to
  //     match how MSPAINT treats BMPs, so we do that.  Note that when we
  //     actually skip pixels for a case like this, we need to note on the
  //     framebuffer that we have alpha.

  // Impossible to decode row-at-a-time, so just do things as a stream of
  // bytes.
  while (true) {
    // Every entry takes at least two bytes; bail if there isn't enough
    // data.
    if ((m_data->size() - m_decodedOffset) < 2)
      return InsufficientData;

    // For every entry except EOF, we'd better not have reached the end of
    // the image.
    const uint8_t count = readUint8(0);
    const uint8_t code = readUint8(1);
    if ((count || (code != 1)) && pastEndOfImage(0))
      return Failure;

    // Decode.
    if (!count) {
      switch (code) {
        case 0:  // Magic token: EOL
          // Skip any remaining pixels in this row.
          if (m_coord.x() < m_parent->size().width())
            m_buffer->setHasAlpha(true);
          moveBufferToNextRow();

          m_decodedOffset += 2;
          break;

        case 1:  // Magic token: EOF
          // Skip any remaining pixels in the image.
          if ((m_coord.x() < m_parent->size().width()) ||
              (m_isTopDown ? (m_coord.y() < (m_parent->size().height() - 1))
                           : (m_coord.y() > 0)))
            m_buffer->setHasAlpha(true);
          // There's no need to move |m_coord| here to trigger the caller
          // to call setPixelsChanged().  If the only thing that's changed
          // is the alpha state, that will be properly written into the
          // underlying SkBitmap when we mark the frame complete.
          return Success;

        case 2: {  // Magic token: Delta
          // The next two bytes specify dx and dy.  Bail if there isn't
          // enough data.
          if ((m_data->size() - m_decodedOffset) < 4)
            return InsufficientData;

          // Fail if this takes us past the end of the desired row or
          // past the end of the image.
          const uint8_t dx = readUint8(2);
          const uint8_t dy = readUint8(3);
          if (dx || dy)
            m_buffer->setHasAlpha(true);
          if (((m_coord.x() + dx) > m_parent->size().width()) ||
              pastEndOfImage(dy))
            return Failure;

          // Skip intervening pixels.
          m_coord.move(dx, m_isTopDown ? dy : -dy);

          m_decodedOffset += 4;
          break;
        }

        default: {  // Absolute mode
          // |code| pixels specified as in BI_RGB, zero-padded at the end
          // to a multiple of 16 bits.
          // Because processNonRLEData() expects m_decodedOffset to
          // point to the beginning of the pixel data, bump it past
          // the escape bytes and then reset if decoding failed.
          m_decodedOffset += 2;
          const ProcessingResult result = processNonRLEData(true, code);
          if (result != Success) {
            m_decodedOffset -= 2;
            return result;
          }
          break;
        }
      }
    } else {  // Encoded mode
      // The following color data is repeated for |count| total pixels.
      // Strangely, some BMPs seem to specify excessively large counts
      // here; ignore pixels past the end of the row.
      const int endX = std::min(m_coord.x() + count, m_parent->size().width());

      if (m_infoHeader.biCompression == RLE24) {
        // Bail if there isn't enough data.
        if ((m_data->size() - m_decodedOffset) < 4)
          return InsufficientData;

        // One BGR triple that we copy |count| times.
        fillRGBA(endX, readUint8(3), readUint8(2), code, 0xff);
        m_decodedOffset += 4;
      } else {
        // RLE8 has one color index that gets repeated; RLE4 has two
        // color indexes in the upper and lower 4 bits of the byte,
        // which are alternated.
        size_t colorIndexes[2] = {code, code};
        if (m_infoHeader.biCompression == RLE4) {
          colorIndexes[0] = (colorIndexes[0] >> 4) & 0xf;
          colorIndexes[1] &= 0xf;
        }
        for (int which = 0; m_coord.x() < endX;) {
          // Some images specify color values past the end of the
          // color table; set these pixels to black.
          if (colorIndexes[which] < m_infoHeader.biClrUsed)
            setI(colorIndexes[which]);
          else
            setRGBA(0, 0, 0, 255);
          which = !which;
        }

        m_decodedOffset += 2;
      }
    }
  }
Beispiel #19
0
	static inline bool run(FILE* f)
	{
		return readUint8(f) != 0;
	}
Beispiel #20
0
void Game::loadWeapons()
{
	const char *weaponsText[] =
	{
		"SHOTGUN",
		"CHAINGUN",
		"RIFLE",
		"BAZOOKA",
		"DIRTBALL",
		"EXPLOSIVES",
		"MINE",
		"WINCHESTER",
		"DOOMSDAY",
		"FLAMER",
		"GRENADE",
		"LARPA",
		"BLASTER",
		"BOUNCY MINE",
		"MINIGUN",
		"CLUSTER BOMB",
		"SUPER SHOTGUN",
		"HANDGUN",
		"GREENBALL",
		"BIG NUKE",
		"CRACKLER",
		"ZIMM",
		"MINI NUKE",
		"FLOAT MINE",
		"FAN",
		"HELLRAIDER",
		"CANNON",
		"BOUNCY LARPA",
		"LASER",
		"SPIKEBALLS",
		"NAPALM",
		"UZI",
		"MISSILE",
		"CHIQUITA BOMB",
		"BOOBY TRAP",
		"GRASSHOPPER",
		"MINI ROCKETS",
		"DART",
		"RB RAMPAGE",
		"GAUSS GUN",
	};

#ifdef NSPIRE
	FILE* exe = openFile(joinPath(lieroDataRoot, "weapons.dat.tns"));
#else
	FILE* exe = openFile(joinPath(lieroDataRoot, "weapons.dat"));
#endif
	
	readMembers<Read8>(exe, weapons, &Weapon::detectDistance);
	readMembers<ReadBool>(exe, weapons, &Weapon::affectByWorm);
	readMembers<Read8>(exe, weapons, &Weapon::blowAway);
	
	for(int i = 0; i < 40; ++i)
	{
		weapOrder[i + 1] = readUint8(exe) - 1;
	}
	
	readMembers<Read16>(exe, weapons, &Weapon::gravity);
	readMembers<ReadBool>(exe, weapons, &Weapon::shadow);
	readMembers<ReadBool>(exe, weapons, &Weapon::laserSight);
	readMembers<Dec<Read8> >(exe, weapons, &Weapon::launchSound);
	readMembers<ReadBool>(exe, weapons, &Weapon::loopSound);
	readMembers<Dec<Read8> >(exe, weapons, &Weapon::exploSound);
	readMembers<Read16>(exe, weapons, &Weapon::speed);
	readMembers<Read16>(exe, weapons, &Weapon::addSpeed);
	readMembers<Read16>(exe, weapons, &Weapon::distribution);
	readMembers<Read8>(exe, weapons, &Weapon::parts);
	readMembers<Read8>(exe, weapons, &Weapon::recoil);
	readMembers<Read16>(exe, weapons, &Weapon::multSpeed);
	readMembers<Read16>(exe, weapons, &Weapon::delay);
	readMembers<Read16>(exe, weapons, &Weapon::loadingTime);
	readMembers<Read8>(exe, weapons, &Weapon::ammo);
	readMembers<Dec<Read8> >(exe, weapons, &Weapon::createOnExp);
	readMembers<Dec<Read8> >(exe, weapons, &Weapon::dirtEffect);
	readMembers<Read8>(exe, weapons, &Weapon::leaveShells);
	readMembers<Read8>(exe, weapons, &Weapon::leaveShellDelay);
	readMembers<ReadBool>(exe, weapons, &Weapon::playReloadSound);
	readMembers<ReadBool>(exe, weapons, &Weapon::wormExplode);
	readMembers<ReadBool>(exe, weapons, &Weapon::explGround);
	readMembers<ReadBool>(exe, weapons, &Weapon::wormCollide);
	readMembers<Read8>(exe, weapons, &Weapon::fireCone);
	readMembers<ReadBool>(exe, weapons, &Weapon::collideWithObjects);
	readMembers<ReadBool>(exe, weapons, &Weapon::affectByExplosions);
	readMembers<Read8>(exe, weapons, &Weapon::bounce);
	readMembers<Read16>(exe, weapons, &Weapon::timeToExplo);
	readMembers<Read16>(exe, weapons, &Weapon::timeToExploV);
	readMembers<Read8>(exe, weapons, &Weapon::hitDamage);
	readMembers<Read8>(exe, weapons, &Weapon::bloodOnHit);
	readMembers<Read16>(exe, weapons, &Weapon::startFrame);
	readMembers<Read8>(exe, weapons, &Weapon::numFrames);
	readMembers<ReadBool>(exe, weapons, &Weapon::loopAnim);
	readMembers<Read8>(exe, weapons, &Weapon::shotType);
	readMembers<Read8>(exe, weapons, &Weapon::colourBullets);
	readMembers<Read8>(exe, weapons, &Weapon::splinterAmount);
	readMembers<Read8>(exe, weapons, &Weapon::splinterColour);
	readMembers<Dec<Read8> >(exe, weapons, &Weapon::splinterType);
	readMembers<Read8>(exe, weapons, &Weapon::splinterScatter);
	readMembers<Dec<Read8> >(exe, weapons, &Weapon::objTrailType);
	readMembers<Read8>(exe, weapons, &Weapon::objTrailDelay);
	readMembers<Read8>(exe, weapons, &Weapon::partTrailType);
	readMembers<Dec<Read8> >(exe, weapons, &Weapon::partTrailObj);
	readMembers<Read8>(exe, weapons, &Weapon::partTrailDelay);

	for(int i = 0; i < 40; ++i)
	{
		weapons[i].name = weaponsText[i];
		weapons[i].id = i;
	}

	// Special objects
	readMembers<Dec<Read8> >(exe, sobjectTypes, &SObjectType::startSound);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::numSounds);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::animDelay);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::startFrame);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::numFrames);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::detectRange);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::damage);
	readMembers<Read32>(exe, sobjectTypes, &SObjectType::blowAway); // blowAway has 13 slots, not 14. The last value will overlap with shadow.
	readMembers<ReadBool>(exe, sobjectTypes, &SObjectType::shadow);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::shake);
	readMembers<Read8>(exe, sobjectTypes, &SObjectType::flash);
	readMembers<Dec<Read8> >(exe, sobjectTypes, &SObjectType::dirtEffect);
	
	for(int i = 0; i < 14; ++i) // TODO: Unhardcode
	{
		sobjectTypes[i].id = i;
	}

	readMembers<Read8>(exe, nobjectTypes, &NObjectType::detectDistance);
	readMembers<Read16>(exe, nobjectTypes, &NObjectType::gravity);
	readMembers<Read16>(exe, nobjectTypes, &NObjectType::speed);
	readMembers<Read16>(exe, nobjectTypes, &NObjectType::speedV);
	readMembers<Read16>(exe, nobjectTypes, &NObjectType::distribution);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::blowAway);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::bounce);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::hitDamage);
	readMembers<ReadBool>(exe, nobjectTypes, &NObjectType::wormExplode);
	readMembers<ReadBool>(exe, nobjectTypes, &NObjectType::explGround);
	readMembers<ReadBool>(exe, nobjectTypes, &NObjectType::wormDestroy);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::bloodOnHit);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::startFrame);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::numFrames);
	readMembers<ReadBool>(exe, nobjectTypes, &NObjectType::drawOnMap);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::colourBullets);
	readMembers<Dec<Read8> >(exe, nobjectTypes, &NObjectType::createOnExp);
	readMembers<ReadBool>(exe, nobjectTypes, &NObjectType::affectByExplosions);
	readMembers<Dec<Read8> >(exe, nobjectTypes, &NObjectType::dirtEffect);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::splinterAmount);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::splinterColour);
	readMembers<Dec<Read8> >(exe, nobjectTypes, &NObjectType::splinterType);
	readMembers<ReadBool>(exe, nobjectTypes, &NObjectType::bloodTrail);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::bloodTrailDelay);
	readMembers<Dec<Read8> >(exe, nobjectTypes, &NObjectType::leaveObj);
	readMembers<Read8>(exe, nobjectTypes, &NObjectType::leaveObjDelay);
	readMembers<Read16>(exe, nobjectTypes, &NObjectType::timeToExplo);
	readMembers<Read16>(exe, nobjectTypes, &NObjectType::timeToExploV);
	
	for(int i = 0; i < 24; ++i) // TODO: Unhardcode
	{
		nobjectTypes[i].id = i;
	}
}
Beispiel #21
0
int8_t BufferReader::readInt8()
{
	return (int8_t)readUint8();
}
Beispiel #22
0
void BufferReader::readUint8s(uint8_t data[], unsigned dataLen)
{
	for (int i = 0; i < dataLen; ++i) {
		data[i] = readUint8();
	}
}
Beispiel #23
0
bool IFileStream::readBool()
{
	return (readUint8() == 1 ? true : false);
}