⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stripcol.cpp

📁 空战游戏flacon源码
💻 CPP
字号:
#include "header.h"

void main (int argc, char *argv[])
{
	if (argc < 3) {
		puts ("\nStripCol v1.0 by Erick Jap\n");
		puts ("Usage: StripCol inputfile outputfile");
		exit (1);
	}
	char infile[80], outfile[80];
	glConcatFileExtension ((GLbyte *) infile, (GLbyte *) argv[1], (GLbyte *) "FLT");
	glConcatFileExtension ((GLbyte *) outfile, (GLbyte *) argv[2], (GLbyte *) "FLT");

	CFileIO myfile;
	if (!myfile.openread (infile)) {
		printf ("Can not open input file %s\n", infile);
		exit (1);
	}
	if (!myfile.openwrite (outfile, 1)) {
		printf ("Can not open output file %s\n", outfile);
		exit (1);
	}

	printf ("Stripping vertex color...");
	while (!myfile.eof()) {
		short rtype = myfile.read_short ();
		myfile.writedata ((char *) &rtype, 2);
		short rlen = myfile.read_short ();
		myfile.writedata ((char *) &rlen, 2);
		short rectype = swap_short (rtype);
		short reclen = swap_short (rlen);
		if ((rectype == OPCODE_VERTEX_COORDINATE) ||
			(rectype == OPCODE_VERTEX_WITH_NORMAL) ||
			(rectype == OPCODE_VERTEX_WITH_UV) ||
			(rectype == OPCODE_VERTEX_WITH_NORMAL_AND_UV)) {
			short i = myfile.read_short ();
			myfile.writedata ((char *) &i, 2);
			i = swap_short (myfile.read_short ());
			i |= 0x2000;
			i = swap_short (i);
			myfile.writedata ((char *) &i, 2);
			reclen -= 4;
		}
		reclen -= 4;
		if (reclen > 0) {
			char *buf = (char *) glAllocateMemory (reclen);
			myfile.readdata (buf, reclen);
			myfile.writedata (buf, reclen);
			glReleaseMemory (buf);
		}
	}

	printf ("\nDone.\n");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -