コード例 #1
0
ファイル: v_text.cpp プロジェクト: WChrisK/OdaStats
// 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);
}
コード例 #2
0
ファイル: m_menu.cpp プロジェクト: JohnnyonFlame/odamex
//
// 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);
}
コード例 #3
0
ファイル: wi_stuff.cpp プロジェクト: JohnnyonFlame/odamex
void WI_loadData (void)
{
    int i, j;
    char name[9];
    anim_t *a;
    patch_t *bg;

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

    // background
    bg = W_CachePatch (name);
    background = I_AllocateScreen (bg->width(), bg->height(), 8);
    background->Lock ();
    background->DrawPatch (bg, 0, 0);
    background->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);
    }
}
コード例 #4
0
ファイル: v_text.cpp プロジェクト: JohnnyonFlame/odamex
// 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);
}
コード例 #5
0
ファイル: d_main.cpp プロジェクト: JohnnyonFlame/odamex
//
// 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 ();
    }
}
コード例 #6
0
ファイル: d_main.cpp プロジェクト: JohnnyonFlame/odamex
//
// 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 ();
	}
}