gfxinit.c
changeset 5151 23150e1b0660
parent 5000 340be626096e
child 5156 771ed0d9f836
equal deleted inserted replaced
5150:fe410b84b302 5151:23150e1b0660
   319 	153, 153, // · medium
   319 	153, 153, // · medium
   320 	601, 601, // · large
   320 	601, 601, // · large
   321 	END
   321 	END
   322 };
   322 };
   323 
   323 
   324 static byte _sprite_page_to_load = 0xFF;
       
   325 
   324 
   326 static void LoadSpriteTables(void)
   325 static void LoadSpriteTables(void)
   327 {
   326 {
   328 	const FileList* files = _use_dos_palette ? &files_dos : &files_win;
   327 	const FileList* files = _use_dos_palette ? &files_dos : &files_win;
   329 	uint load_index;
   328 	uint load_index;
   337 
   336 
   338 	for (i = 1; files->basic[i].filename != NULL; i++) {
   337 	for (i = 1; files->basic[i].filename != NULL; i++) {
   339 		load_index += LoadGrfFile(files->basic[i].filename, load_index, i);
   338 		load_index += LoadGrfFile(files->basic[i].filename, load_index, i);
   340 	}
   339 	}
   341 
   340 
   342 	if (_sprite_page_to_load != 0) {
   341 	/* Load additional sprites for climates other than temperate */
       
   342 	if (_opt.landscape != LT_NORMAL) {
   343 		LoadGrfIndexed(
   343 		LoadGrfIndexed(
   344 			files->landscape[_sprite_page_to_load - 1].filename,
   344 			files->landscape[_opt.landscape - 1].filename,
   345 			_landscape_spriteindexes[_sprite_page_to_load - 1],
   345 			_landscape_spriteindexes[_opt.landscape - 1],
   346 			i++
   346 			i++
   347 		);
   347 		);
   348 	}
   348 	}
   349 
   349 
   350 	assert(load_index == SPR_SIGNALS_BASE);
   350 	assert(load_index == SPR_SIGNALS_BASE);
   376 }
   376 }
   377 
   377 
   378 
   378 
   379 void GfxLoadSprites(void)
   379 void GfxLoadSprites(void)
   380 {
   380 {
   381 	// Need to reload the sprites only if the landscape changed
   381 	DEBUG(spritecache, 1) ("Loading sprite set %d.", _opt.landscape);
   382 	if (_sprite_page_to_load != _opt.landscape) {
   382 
   383 		_sprite_page_to_load = _opt.landscape;
   383 	GfxInitSpriteMem();
   384 
   384 	LoadSpriteTables();
   385 		// Sprite cache
   385 	GfxInitPalettes();
   386 		DEBUG(spritecache, 1) ("Loading sprite set %d.", _sprite_page_to_load);
   386 }
   387 
       
   388 		GfxInitSpriteMem();
       
   389 		LoadSpriteTables();
       
   390 		GfxInitPalettes();
       
   391 	}
       
   392 }