예제 #1
0
void AGOSEngine::loadVoice(uint speechId) {
	if (getGameType() == GType_PP && speechId == 99) {
		_sound->stopVoice();
		return;
	}

	if (getFeatures() & GF_ZLIBCOMP) {
		char filename[15];

		uint32 file, offset, srcSize, dstSize;
		if (getPlatform() == Common::kPlatformAmiga) {
			loadOffsets((const char*)"spindex.dat", speechId, file, offset, srcSize, dstSize);
		} else {
			loadOffsets((const char*)"speech.wav", speechId, file, offset, srcSize, dstSize);
		}

		// Voice segment doesn't exist
		if (offset == 0xFFFFFFFF && srcSize == 0xFFFFFFFF && dstSize == 0xFFFFFFFF) {
			debug(0, "loadVoice: speechId %d removed", speechId);
			return;
		}

		if (getPlatform() == Common::kPlatformAmiga)
			sprintf(filename, "sp%d.wav", file);
		else
			sprintf(filename, "speech.wav");

		byte *dst = (byte *)malloc(dstSize);
		decompressData(filename, dst, offset, srcSize, dstSize);
		_sound->playVoiceData(dst, speechId);
	} else {
		_sound->playVoice(speechId);
	}
}
예제 #2
0
void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
	byte *dst;

	if (getGameId() == GID_DIMP) {
		Common::File in;
		char filename[15];

		assert(sound >= 1 && sound <= 32);
		sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);

		in.open(filename);
		if (in.isOpen() == false)
			error("loadSound: Can't load %s", filename);

		uint32 dstSize = in.size();
		dst = (byte *)malloc(dstSize);
		if (in.read(dst, dstSize) != dstSize)
			error("loadSound: Read failed");
		in.close();
	} else if (getFeatures() & GF_ZLIBCOMP) {
		char filename[15];

		uint32 file, offset, srcSize, dstSize;
		if (getPlatform() == Common::kPlatformAmiga) {
			loadOffsets((const char*)"sfxindex.dat", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
		} else {
			loadOffsets((const char*)"effects.wav", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
		}

		if (getPlatform() == Common::kPlatformAmiga)
			sprintf(filename, "sfx%d.wav", file);
		else
			sprintf(filename, "effects.wav");

		dst = (byte *)malloc(dstSize);
		decompressData(filename, dst, offset, srcSize, dstSize);
	} else {
		if (_curSfxFile == NULL)
			return;

		dst = _curSfxFile + READ_LE_UINT32(_curSfxFile + sound * 4);
	}

	if (type == Sound::TYPE_AMBIENT)
		_sound->playAmbientData(dst, sound, pan, vol);
	else if (type == Sound::TYPE_SFX)
		_sound->playSfxData(dst, sound, pan, vol);
	else if (type == Sound::TYPE_SFX5)
		_sound->playSfx5Data(dst, sound, pan, vol);
}
예제 #3
0
void MiniMap::firstInit(ARXCHARACTER *pl, PakReader *pakRes, EntityManager *entityMng) {
	
	m_pTexDetect = NULL;
	m_mapMarkerTexCont = NULL;
	
	m_player = pl;
	m_playerLastPosX = -999999.f;
	m_playerLastPosZ = -999999.f;
	
	m_modX = (float)MAX_BKGX / (float)MINIMAP_MAX_X;
	m_modZ = (float)MAX_BKGZ / (float)MINIMAP_MAX_Z;
	
	m_currentLevel = 0;
	m_entities = entityMng;
	m_activeBkg = NULL;

    m_mapVertices.reserve(MINIMAP_MAX_X * MINIMAP_MAX_Z);

	resetLevels();
	
	for(int i = 0; i < MAX_MINIMAP_LEVELS; i++) {
		m_miniOffsetX[i] = 0;
		m_miniOffsetY[i] = 0;
	}
	
	loadOffsets(pakRes);
}
예제 #4
0
bool WorkingBuffers::loadTempImages(int level, int frame, int pass)
{
    if (!_is_initialized)
        initialize();

    // Zero out everything
    clearHistory();
    offsets.reset();
    residualCache.reset();
    canvasOutputCache.reset();
    //canvasInputCache.reset();
    canvasVelFCache.reset();
    canvasVelBCache.reset();
    distTransCache.reset();
    offsetsHistogram.reset();

    advectedF.reset();
    advectedB.reset();

    // Load the buffers that we save to disk.
    if (!loadOutput(level, frame, pass))
        return false;
    loadOffsets(level, frame, pass);
    loadResidual(level, frame, pass);

    _current_level = level;

    return true;
}
예제 #5
0
NitroFile::NitroFile(int id, int begOffs, int endOffs, NitroFilesystem* parent, NitroFile* allocFile, bool fixedBeg, bool fixedEnd, bool endsize, string name)
{
    this->fixedBeg = fixedBeg;
    this->fixedEnd = fixedEnd;
    this->parent = parent;
    this->name = name;
    this->id = id;
    this->allocFile = allocFile;
    cached = false;
    cacheModified = false;
    
    if(fixedBeg)
        this -> begOffs = begOffs;
    else
        this -> begPtrOffs = begOffs;
        
    if(fixedEnd)
        this -> endOffs = endOffs;
    else
        this -> endPtrOffs = endOffs;

    this->endsize = endsize;
    loadOffsets();
}
예제 #6
0
void ourInit(int Width, int Height)
{
   int n,i,j;

  loadOffsets();

  struct jpeg_decompress_struct cinfo;
  struct jpeg_error_mgr jerr;
  JSAMPROW row_pointer[1];
  unsigned long location = 0;

  cinfo.err = jpeg_std_error(&jerr);
  jpeg_create_decompress(&cinfo);

  for (i = 0; i<2; i++)
  for (n = 0; n<NUM_PIC[i]; n++)
  {
    jpeg_stdio_src(&cinfo, fd[i][n]);
    jpeg_read_header(&cinfo, 0);
    cinfo.scale_num = 1;
    cinfo.scale_denom = SCALE;
    jpeg_start_decompress(&cinfo);
    wid[i][n] = cinfo.output_width;
    hei[i][n] = cinfo.output_height;
    dep[i][n] = cinfo.num_components; //should always be 3
    image[i][n] = (unsigned char *) malloc(wid[i][n] * hei[i][n] * dep[i][n]);
    row_pointer[0] = (unsigned char *) malloc(wid[i][n] * dep[i][n]);
    /* read one scan line at a time */
    while( cinfo.output_scanline < cinfo.output_height )
    {
        jpeg_read_scanlines( &cinfo, row_pointer, 1 );
        for( j=0; j< (wid[i][n] * dep[i][n]); j++)
                image[i][n][location++] = row_pointer[0][j];
    }
    location = 0;
    fclose(fd[i][n]);
    jpeg_finish_decompress(&cinfo);
  }

  jpeg_destroy_decompress(&cinfo);

  ourBuildTextures();


   // Color to clear color buffer to.
   glClearColor(0.1f, 0.1f, 0.1f, 0.0f);

   // Depth to clear depth buffer to; type of test.
   glClearDepth(1.0);
   glDepthFunc(GL_LESS);

   // Enables Smooth Color Shading; try GL_FLAT for (lack of) fun.
   glShadeModel(GL_SMOOTH);

   // Load up the correct perspective matrix; using a callback directly.
   cbResizeScene(Width,Height);

   // Set up a light, turn it on.
   glLightfv(GL_LIGHT1, GL_POSITION, Light_Position);
   glLightfv(GL_LIGHT1, GL_AMBIENT,  Light_Ambient);
//   glLightfv(GL_LIGHT1, GL_DIFFUSE,  Light_Diffuse);
   glEnable (GL_LIGHT1);

   // A handy trick -- have surface material mirror the color.
   glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
   glEnable(GL_COLOR_MATERIAL);
   
   glutSetCursor(GLUT_CURSOR_NONE);
   

      glEnable(GL_TEXTURE_RECTANGLE_ARB);


      glDisable(GL_LIGHTING);
      glEnable(GL_LIGHTING);

       glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

    // If we're blending, we don't want z-buffering.

       glDisable(GL_DEPTH_TEST);
       glEnable(GL_BLEND);



       glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,
                                           GL_NEAREST_MIPMAP_NEAREST);
       glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
  
   
}