Exemple #1
0
//
// D_Close
//
void STACK_ARGS D_Close (void)
{
    if(page)
    {
        I_FreeScreen(page);
        page = NULL;
    }
}
Exemple #2
0
void WI_End (void)
{
    WI_unloadData();

    if(background)
    {
        I_FreeScreen(background);
        background = NULL;
    }
}
Exemple #3
0
// Convert the CONCHARS patch into the internal format used by
// the console font drawer.
void V_InitConChars (byte transcolor)
{
	// Load the CONCHARS lump and convert it from patch_t format
	// to a raw linear byte buffer with a background color of 'transcolor'
	DCanvas* temp_screen = I_AllocateScreen(128, 128, 8);

	patch_t* chars_patch = W_CachePatch("CONCHARS");
	temp_screen->Lock();

	// fill with color 'transcolor'
	for (int y = 0; y < 128; y++)
		memset(temp_screen->buffer + temp_screen->pitch * y, transcolor, 128);

	// paste the patch into the linear byte bufer
	temp_screen->DrawPatch(chars_patch, 0, 0);

	ConChars = new byte[256*8*8*2];

	byte* dest = ConChars;	

	for (int y = 0; y < 16; y++)
	{
		for (int x = 0; x < 16; x++)
		{
			const byte* source = temp_screen->buffer + x * 8 + (y * 8 * temp_screen->pitch);
			for (int z = 0; z < 8; z++)
			{
				for (int a = 0; a < 8; a++)
				{
					byte val = source[a];
					if (val == transcolor)
					{
						dest[a] = 0x00;
						dest[a + 8] = 0xff;
					}
					else
					{
						dest[a] = val;
						dest[a + 8] = 0x00;
					}
				}

				dest += 16;
				source += temp_screen->pitch;
			}
		}
	}

	temp_screen->Unlock();

	I_FreeScreen(temp_screen);
}
Exemple #4
0
//
// Read This Menus
// Had a "quick hack to fix romero bug"
//
void M_DrawReadThis1 (void)
{
	if (gameinfo.flags & GI_PAGESARERAW)
	{
		if (readpage && (readpage->width != pwidth || readpage->height != pheight))
		{
			I_FreeScreen(readpage);
			readpage = NULL;
		}

		if (readpage == NULL)
			readpage = I_AllocateScreen(pwidth,pheight,screen->bits);

		readpage->Lock ();
		readpage->DrawBlock (0, 0, pwidth, pheight, (byte *)W_CachePatch (gameinfo.info.infoPage[0]));
		readpage->Unlock ();

		readpage->Blit (0, 0, readpage->width, readpage->height, screen, 0, 0, screen->width, screen->height);
	}
	else
		screen->DrawPatchIndirect ((patch_t *)W_CacheLumpName (gameinfo.info.infoPage[0], PU_CACHE), 0, 0);
}
Exemple #5
0
// Convert the CONCHARS patch into the internal format used by
// the console font drawer.
void V_InitConChars (byte transcolor)
{
	byte *d, *s, v, *src;
	patch_t *chars;
	int x, y, z, a;
	DCanvas *scrn = I_AllocateScreen(128, 128, 8);
	DCanvas &temp = *scrn;

	chars = W_CachePatch ("CONCHARS");
	temp.Lock ();

	{
		DWORD *scrn, fill;

		fill = (transcolor << 24) | (transcolor << 16) | (transcolor << 8) | transcolor;
		for (y = 0; y < 128; y++)
		{
			scrn = (DWORD *)(temp.buffer + temp.pitch * y);
			for (x = 0; x < 128/4; x++)
			{
				*scrn++ = fill;
			}
		}
		temp.DrawPatch (chars, 0, 0);
	}

	src = temp.buffer;

	if ( (ConChars = new byte[256*8*8*2]) )
	{
		d = ConChars;
		for (y = 0; y < 16; y++)
		{
			for (x = 0; x < 16; x++)
			{
				s = src + x * 8 + (y * 8 * temp.pitch);
				for (z = 0; z < 8; z++)
				{
					for (a = 0; a < 8; a++)
					{
						v = s[a];
						if (v == transcolor)
						{
							d[a] = 0x00;
							d[a+8] = 0xff;
						}
						else
						{
							d[a] = v;
							d[a+8] = 0x00;
						}
					}
					d += 16;
					s += temp.pitch;
				}
			}
		}
	}

	temp.Unlock ();
	I_FreeScreen(scrn);
}
Exemple #6
0
//
// This cycles through the demo sequences.
//
void D_DoAdvanceDemo (void)
{
    const char *pagename = NULL;

    consoleplayer().playerstate = PST_LIVE;	// not reborn
    advancedemo = false;
    usergame = false;				// no save / end game here
    paused = false;
    gameaction = ga_nothing;

    // [Russell] - Old demo sequence used in original games, zdoom's
    // dynamic one was too dynamic for its own good
    // [Nes] - Newer demo sequence with better flow.
    if (W_CheckNumForName("DEMO4") >= 0 && gamemode != retail_chex)
        demosequence = (demosequence+1)%8;
    else
        demosequence = (demosequence+1)%6;

    switch (demosequence)
    {
    case 0:
        if (gamemode == commercial)
            pagetic = TICRATE * 11;
        else
            pagetic = 170;

        gamestate = GS_DEMOSCREEN;
        pagename = "TITLEPIC";

        S_StartMusic(gameinfo.titleMusic);

        break;
    case 1:
        G_DeferedPlayDemo("DEMO1");

        break;
    case 2:
        pagetic = 200;
        gamestate = GS_DEMOSCREEN;
        pagename = "CREDIT";

        break;
    case 3:
        G_DeferedPlayDemo("DEMO2");

        break;
    case 4:
        gamestate = GS_DEMOSCREEN;

        if (gamemode == commercial || gamemode == retail)
        {
            if (gamemode == commercial)
                pagetic = TICRATE * 11;
            else
                pagetic = 170;
            pagename = "TITLEPIC";
            S_StartMusic(gameinfo.titleMusic);
        }
        else
        {
            pagetic = 200;
            if (gamemode == retail_chex)	// [ML] Chex mode just cycles this screen
                pagename = "CREDIT";
            else
                pagename = "HELP2";
        }

        break;
    case 5:
        G_DeferedPlayDemo("DEMO3");

        break;
    case 6:
        pagetic = 200;
        gamestate = GS_DEMOSCREEN;
        pagename = "CREDIT";

        break;
    case 7:
        G_DeferedPlayDemo("DEMO4");

        break;
    }

    // [Russell] - Still need this toilet humor for now unfortunately
    if (pagename)
    {
        int width, height;
        patch_t *data;

        if (gameinfo.flags & GI_PAGESARERAW)
        {
            data = W_CachePatch (pagename);
            width = 320;
            height = 200;
        }
        else
        {
            data = W_CachePatch (pagename);
            width = data->width();
            height = data->height();
        }

        if (page && (page->width != width || page->height != height))
        {
            I_FreeScreen(page);
            page = NULL;
        }

        if (page == NULL)
            page = I_AllocateScreen (width, height, 8);

        page->Lock ();
        if (gameinfo.flags & GI_PAGESARERAW)
            page->DrawBlock (0, 0, 320, 200, (byte *)data);
        else
            page->DrawPatch (data, 0, 0);
        page->Unlock ();
    }
}
Exemple #7
0
//
// This cycles through the demo sequences.
//
void D_DoAdvanceDemo (void)
{
	const char *pagename = NULL;

	consoleplayer().playerstate = PST_LIVE;	// not reborn
	advancedemo = false;
	usergame = false;				// no save / end game here
	paused = false;
	gameaction = ga_nothing;

    // [Russell] - Old demo sequence used in original games, zdoom's
    // dynamic one was too dynamic for its own good
    // [Nes] - Newer demo sequence with better flow.
    if (W_CheckNumForName("DEMO4") >= 0 && gamemode != retail_chex)
        demosequence = (demosequence+1)%8;
    else
        demosequence = (demosequence+1)%6;

    switch (demosequence)
    {
        case 0:
            if (gameinfo.flags & GI_MAPxx)
                pagetic = TICRATE * 11;
            else
                pagetic = 170;

            gamestate = GS_DEMOSCREEN;
            pagename = gameinfo.titlePage;

            S_StartMusic(gameinfo.titleMusic);

            break;
        case 1:
            G_DeferedPlayDemo("DEMO1");

            break;
        case 2:
            pagetic = 200;
            gamestate = GS_DEMOSCREEN;
            pagename = gameinfo.creditPage1;

            break;
        case 3:
            G_DeferedPlayDemo("DEMO2");

            break;
        case 4:
            gamestate = GS_DEMOSCREEN;

            if ((gameinfo.flags & GI_MAPxx) || (gameinfo.flags & GI_MENUHACK_RETAIL))
            {
				if (gameinfo.flags & GI_MAPxx)
					pagetic = TICRATE * 11;
				else
					pagetic = 170;
                pagename = gameinfo.titlePage;
                S_StartMusic(gameinfo.titleMusic);
            }
            else
            {
                pagetic = 200;
				if (gamemode == retail_chex)	// [ML] Chex mode just cycles this screen
					pagename = gameinfo.creditPage1;
				else
					pagename = gameinfo.creditPage2;
            }

            break;
        case 5:
            G_DeferedPlayDemo("DEMO3");

            break;
        case 6:
            pagetic = 200;
            gamestate = GS_DEMOSCREEN;
            pagename = gameinfo.creditPage2;

            break;
        case 7:
            G_DeferedPlayDemo("DEMO4");

            break;
    }

    // [Russell] - Still need this toilet humor for now unfortunately
	if (pagename)
	{
		const int width = 320, height = 200;
		patch_t *data;

		if (page && (page->width != screen->width || page->height != screen->height))
		{
			I_FreeScreen(page);
			page = NULL;
		}

		data = W_CachePatch (pagename);

		if (page == NULL)
        {
            if (screen->isProtectedRes())
                page = I_AllocateScreen(data->width(), data->height(), 8);
            else
                page = I_AllocateScreen(screen->width, screen->height, 8);
        }

		page->Lock ();

		if (gameinfo.flags & GI_PAGESARERAW)
            page->DrawBlock (0, 0, width, height, (byte *)data);
		else
			page->DrawPatchFullScreen(data);

		page->Unlock ();
	}
}