示例#1
0
//
// I_BlitLoadingIcon
//
// Takes care of the actual drawing of the loading icon.
//
static void I_BlitLoadingIcon()
{
	const patch_t* diskpatch = W_CachePatch("STDISK");
	IWindowSurface* surface = I_GetPrimarySurface();

	surface->lock();

	int bpp = surface->getBitsPerPixel();
	int scale = std::min(CleanXfac, CleanYfac);
	int w = diskpatch->width() * scale;
	int h = diskpatch->height() * scale;
	int x = surface->getWidth() - w;
	int y = surface->getHeight() - h;

	// offset x and y for the lower right corner of the screen
	int ofsx = x + (scale * diskpatch->leftoffset());
	int ofsy = y + (scale * diskpatch->topoffset());

	// save the area where the icon will be drawn to an off-screen surface
	// so that it can be restored after the frame is blitted
	if (!loading_icon_background_surface ||
		loading_icon_background_surface->getWidth() != w ||
		loading_icon_background_surface->getHeight() != h ||
		loading_icon_background_surface->getBitsPerPixel() != bpp)
	{
		if (loading_icon_background_surface)
			I_FreeSurface(loading_icon_background_surface);

		loading_icon_background_surface = I_AllocateSurface(w, h, bpp);
	}

	loading_icon_background_surface->lock();

	loading_icon_background_surface->blit(surface, x, y, w, h, 0, 0, w, h);
	surface->getDefaultCanvas()->DrawPatchStretched(diskpatch, ofsx, ofsy, w, h);

	loading_icon_background_surface->unlock();
	surface->unlock();
}
示例#2
0
void WI_loadData (void)
{
	int i, j;
	char name[9];
	animinfo_t *a;

	if ((gameinfo.flags & GI_MAPxx) || ((gameinfo.flags & GI_MENUHACK_RETAIL) && wbs->epsd >= 3))
		strcpy(name, "INTERPIC");
	else
		sprintf(name, "WIMAP%d", wbs->epsd);

	// background
	const patch_t* bg_patch = W_CachePatch(name);
	background_surface = I_AllocateSurface(bg_patch->width(), bg_patch->height(), 8);
	DCanvas* canvas = background_surface->getDefaultCanvas();

	background_surface->lock();
	canvas->DrawPatch(bg_patch, 0, 0);
	background_surface->unlock();

	for (i = 0; i < 2; i++)
	{
		char *lname = (i == 0 ? wbs->lname0 : wbs->lname1);

		if (lname)
			j = W_CheckNumForName (lname);
		else
			j = -1;

		if (j >= 0)
		{
			lnames[i] = W_CachePatch (j, PU_STATIC);
		}
		else
		{
			lnames[i] = NULL;
			lnametexts[i] = FindLevelInfo (i == 0 ? wbs->current : wbs->next)->level_name;
			lnamewidths[i] = WI_CalcWidth (lnametexts[i]);
		}
	}

	if (gamemode != commercial && gamemode != commercial_bfg)
	{
		// you are here
		yah[0] = W_CachePatch ("WIURH0", PU_STATIC);

		// you are here (alt.)
		yah[1] = W_CachePatch ("WIURH1", PU_STATIC);

		// splat
		splat = W_CachePatch ("WISPLAT", PU_STATIC);

		if (wbs->epsd < 3)
		{
			for (j=0;j<NUMANIMS[wbs->epsd];j++)
			{
				a = &anims[wbs->epsd][j];
				for (i=0;i<a->nanims;i++)
				{
					// MONDO HACK!
					if (wbs->epsd != 1 || j != 8)
					{
						// animations
						sprintf (name, "WIA%d%.2d%.2d", wbs->epsd, j, i);
						a->p[i] = W_CachePatch (name, PU_STATIC);
					}
					else
					{
						// HACK ALERT!
						a->p[i] = anims[1][4].p[i];
					}
				}
			}
		}
	}

	for (i=0;i<10;i++)
    {
		 // numbers 0-9
		sprintf(name, "WINUM%d", i);
		num[i] = W_CachePatch (name, PU_STATIC);
    }

    wiminus = W_CachePatch ("WIMINUS", PU_STATIC);

	// percent sign
    percent = W_CachePatch ("WIPCNT", PU_STATIC);

	// ":"
    colon = W_CachePatch ("WICOLON", PU_STATIC);

	// "finished"
	finished = W_CachePatch ("WIF", PU_STATIC); // (Removed) Dan - Causes GUI Issues |FIX-ME|

	// "entering"
	entering = W_CachePatch ("WIENTER", PU_STATIC);

	// "kills"
    kills = W_CachePatch ("WIOSTK", PU_STATIC);

	// "items"
    items = W_CachePatch ("WIOSTI", PU_STATIC);

    // "scrt"
    scrt = W_CachePatch ("WIOSTS", PU_STATIC);

	// "secret"
    secret = W_CachePatch ("WISCRT2", PU_STATIC);

	// "frgs"
	frags = (patch_t *)W_CachePatch ("WIFRGS", PU_STATIC);

	// "time"
    timepatch = W_CachePatch ("WITIME", PU_STATIC);

    // "sucks"
    sucks =W_CachePatch ("WISUCKS", PU_STATIC);

    // "par"
    par = W_CachePatch ("WIPAR", PU_STATIC);

	// "total"
	total = (patch_t *)W_CachePatch ("WIMSTT", PU_STATIC);

	// your face
	star = (patch_t *)W_CachePatch ("STFST01", PU_STATIC);

	// dead face
	bstar = (patch_t *)W_CachePatch("STFDEAD0", PU_STATIC);

	p = W_CachePatch ("STPBANY", PU_STATIC);

	// [Nes] Classic vanilla lifebars.
	for (i = 0; i < 4; i++) {
		sprintf(name, "STPB%d", i);
		faceclassic[i] = W_CachePatch(name, PU_STATIC);
	}
}