Example #1
0
int main(int argc, char **argv)
{
    SHPView* sview;
    char* binpath, *lf;

    if (argc < 3) {
        usage(argv[0]);
        exit(1);
    }
    if ((strcasecmp(argv[1],"-h")==0)||(strcasecmp(argv[1],"-help")==0)||
            (strcasecmp(argv[1],"--help")==0)) {
        usage(argv[0]);
        exit(1);
    }
    binpath = determineBinaryLocation(argv[0]);
    lf = new char[strlen(binpath)+strlen("shpview.log")+2];
    sprintf(lf, "%s/shpview.log", binpath);
    VFS_PreInit(binpath);
    logger = new Logger(lf,0);
    delete[] lf;
    VFS_Init(binpath);
    delete[] binpath;
    loadPal("temperat.pal");
    try {
        sview = new SHPView(argv[1],atoi(argv[2]));
    } catch (int) {
        delete logger;
        VFS_Destroy();
        SDL_Quit();
        exit(1);
    }
    if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
        logger->error("Couldn't initialize SDL: %s\n", SDL_GetError() );
        delete sview;
        delete logger;
        VFS_Destroy();
        SDL_Quit();
        exit(1);
    }
    switch (argc) {
    case 3:
        sview->run(0);
        break;
    case 4:
        sview->run(atoi(argv[3]));
        break;
    case 5:
        sview->run_anim(atoi(argv[3]),atoi(argv[4]));
        break;
    default:
        usage(argv[0]);
        break;
    }
    delete sview;
    delete logger;
    VFS_Destroy();
    SDL_Quit();
    exit(0);
}
Example #2
0
int getVolumeDataEntry(volumeDataStruct *entry) {
	char buffer[256];
	int i;

	volumeNumEntry = 0;
	volumeNumberOfEntry = 0;

	if (_vm->_currentVolumeFile.isOpen()) {
		freeDisk();
	}

	askDisk(-1);

	strcpy(buffer, entry->ident);

	_vm->_currentVolumeFile.open(buffer);

	if (!_vm->_currentVolumeFile.isOpen()) {
		return (-14);
	}

	changeCursor(CURSOR_DISK);

	volumeNumberOfEntry = _vm->_currentVolumeFile.readSint16BE();
	volumeSizeOfEntry = _vm->_currentVolumeFile.readSint16BE();

	volumeNumEntry = volumeNumberOfEntry;

	assert(volumeSizeOfEntry == 14 + 4 + 4 + 4 + 4);

	volumePtrToFileDescriptor = (fileEntry *) mallocAndZero(sizeof(fileEntry) * volumeNumEntry);

	for (i = 0; i < volumeNumEntry; i++) {
		volumePtrToFileDescriptor[i].name[0] = 0;
		volumePtrToFileDescriptor[i].offset = 0;
		volumePtrToFileDescriptor[i].size = 0;
		volumePtrToFileDescriptor[i].extSize = 0;
		volumePtrToFileDescriptor[i].unk3 = 0;
	}

	for (i = 0; i < volumeNumEntry; i++) {
		_vm->_currentVolumeFile.read(&volumePtrToFileDescriptor[i].name, 14);
		volumePtrToFileDescriptor[i].offset = _vm->_currentVolumeFile.readSint32BE();
		volumePtrToFileDescriptor[i].size = _vm->_currentVolumeFile.readSint32BE();
		volumePtrToFileDescriptor[i].extSize = _vm->_currentVolumeFile.readSint32BE();
		volumePtrToFileDescriptor[i].unk3 = _vm->_currentVolumeFile.readSint32BE();
	}

	strcpy(currentBaseName, entry->ident);

	loadPal(entry);

	return 0;
}
Example #3
0
int GFXEngine::init()
{
    NC_STACK_win3d::initfirst();

    memset(gfx_palette, 0, 128);
    memset(gfx_display, 0, 128);
    memset(gfx_display2, 0, 128);
    get_keyvalue_from_ini(0, gfx_keys, 6);

    if ( sub_422CE8((const char *)gfx_keys[4].value.pval, (const char *)gfx_keys[5].value.pval, 0) )
    {
        loadPal((const char *)gfx_keys[3].value.pval);
        return 1;
    }
    return 0;
}