⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sb_bar.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 2 页
字号:
int playerkeys = 0;extern boolean automapactive;void SB_Drawer( boolean refresh ){    int frame;    static boolean hitCenterFrame;    if( st_recalc )    {        ST_CalcPos();        refresh = 1;    }    if( refresh )        SB_state = -1;    CPlayer = &players[displayplayer];    if( !st_statusbaron )    {        if( cv_viewsize.value == 11 )        {            DrawFullScreenStuff();            SB_state = -1;        }    }    else    {        if(SB_state == -1)        {            if ( rendermode==render_soft )                V_CopyRect(0, vid.height-stbarheight, BG, vid.width, stbarheight, 0, vid.height-stbarheight, FG);                        V_DrawScaledPatch(st_x, ST_Y, fgbuffer, PatchBARBACK);            if(players[consoleplayer].cheats&CF_GODMODE)            {                V_DrawScaledPatch(st_x+16, ST_Y+9, fgbuffer, W_CachePatchName("GOD1", PU_CACHE));                V_DrawScaledPatch(st_x+287, ST_Y+9, fgbuffer, W_CachePatchName("GOD2", PU_CACHE));            }            oldhealth = -1;        }        DrawCommonBar();        if(!CPlayer->st_inventoryTics)        {            if(SB_state != 0)            {                // Main interface                V_DrawScaledPatch(st_x+34, ST_Y+2, fgbuffer, PatchSTATBAR);                oldarti = -1;                oldammo = -1;                oldarmor = -1;                oldweapon = -1;                oldfrags = -9999; //can't use -1, 'cuz of negative frags                oldlife = -1;                oldkeys = -1;            }            DrawMainBar();            SB_state = 0;        }        else        {            if(SB_state != 1)            {                V_DrawScaledPatch(st_x+34, ST_Y+2, fgbuffer, PatchINVBAR);            }            DrawInventoryBar();            SB_state = 1;        }    }    SB_PaletteFlash();        // Flight icons    if(CPlayer->powers[pw_flight])    {        if(CPlayer->powers[pw_flight] > BLINKTHRESHOLD            || !(CPlayer->powers[pw_flight]&16))        {            frame = (leveltime/3)&15;            if(CPlayer->mo->flags2&MF2_FLY)            {                if(hitCenterFrame && (frame != 15 && frame != 0))                {                    V_DrawScaledPatch(20, 17, FG, W_CachePatchNum(spinflylump+15,                        PU_CACHE));                }                else                {                    V_DrawScaledPatch(20, 17, FG, W_CachePatchNum(spinflylump+frame,                        PU_CACHE));                    hitCenterFrame = false;                }            }            else            {                if(!hitCenterFrame && (frame != 15 && frame != 0))                {                    V_DrawScaledPatch(20, 17, FG, W_CachePatchNum(spinflylump+frame,                        PU_CACHE));                    hitCenterFrame = false;                }                else                {                    V_DrawScaledPatch(20, 17, FG, W_CachePatchNum(spinflylump+15,                        PU_CACHE));                    hitCenterFrame = true;                }            }            //			BorderTopRefresh = true;            //			UpdateState |= I_MESSAGES;        }        else        {            //			BorderTopRefresh = true;            //			UpdateState |= I_MESSAGES;        }    }        if(CPlayer->powers[pw_weaponlevel2] && !CPlayer->chickenTics)    {        if(CPlayer->powers[pw_weaponlevel2] > BLINKTHRESHOLD            || !(CPlayer->powers[pw_weaponlevel2]&16))        {            frame = (leveltime/3)&15;            V_DrawScaledPatch(300, 17, FG, W_CachePatchNum(spinbooklump+frame, PU_CACHE));            //			BorderTopRefresh = true;            //			UpdateState |= I_MESSAGES;        }        else        {            //			BorderTopRefresh = true;            //			UpdateState |= I_MESSAGES;        }    }    /*    if(CPlayer->powers[pw_weaponlevel2] > BLINKTHRESHOLD    || (CPlayer->powers[pw_weaponlevel2]&8))    {    V_DrawScaledPatch(st_x+291, 0, 0, W_CachePatchName("ARTIPWBK", PU_CACHE));    }    else    {    BorderTopRefresh = true;    }    }    */}// sets the new palette based upon current values of player->damagecount// and player->bonuscountvoid SB_PaletteFlash(void){	static int sb_palette = 0;	int palette;	CPlayer = &players[consoleplayer];	if(CPlayer->damagecount)	{		palette = (CPlayer->damagecount+7)>>3;		if(palette >= NUMREDPALS)		{			palette = NUMREDPALS-1;		}		palette += STARTREDPALS;	}	else if(CPlayer->bonuscount)	{		palette = (CPlayer->bonuscount+7)>>3;		if(palette >= NUMBONUSPALS)		{			palette = NUMBONUSPALS-1;		}		palette += STARTBONUSPALS;	}	else	{		palette = 0;	}	if(palette != sb_palette)	{		sb_palette = palette;		V_SetPalette(palette);	}}//---------------------------------------------------------------------------//// PROC DrawCommonBar////---------------------------------------------------------------------------static void DrawCommonBar(void){	int chainY;	int healthPos;	V_DrawScaledPatch(st_x, ST_Y-10, fgbuffer, PatchLTFCTOP);	V_DrawScaledPatch(st_x+290, ST_Y-10, fgbuffer, PatchRTFCTOP);	if(oldhealth != HealthMarker)	{		oldhealth = HealthMarker;		healthPos = HealthMarker;		if(healthPos < 0)		{			healthPos = 0;		}		if(healthPos > 100)		{			healthPos = 100;		}		healthPos = (healthPos*256)/100;		chainY = (HealthMarker == CPlayer->mo->health) ? 0 : ChainWiggle;		V_DrawScaledPatch(st_x, ST_Y+32, fgbuffer, PatchCHAINBACK);		V_DrawScaledPatch(st_x+2+(healthPos%17), ST_Y+33+chainY, fgbuffer, PatchCHAIN);		V_DrawScaledPatch(st_x+17+healthPos, ST_Y+33+chainY, fgbuffer, PatchLIFEGEM);		V_DrawScaledPatch(st_x, ST_Y+32, fgbuffer, PatchLTFACE);		V_DrawScaledPatch(st_x+276, ST_Y+32, fgbuffer, PatchRTFACE);		ShadeChain();		UpdateState |= I_STATBAR;	}}//---------------------------------------------------------------------------//// PROC DrawMainBar////---------------------------------------------------------------------------static void DrawMainBar(void){	int temp;	// Ready artifact	if(ArtifactFlash)	{		V_DrawScaledPatch(st_x+180, ST_Y+3, fgbuffer, PatchBLACKSQ);		V_DrawScaledPatch(st_x+182, ST_Y+3, fgbuffer, W_CachePatchNum(W_GetNumForName("useartia")			+ ArtifactFlash - 1, PU_CACHE));		ArtifactFlash--;		oldarti = -1; // so that the correct artifact fills in after the flash		UpdateState |= I_STATBAR;	}	else if(oldarti != CPlayer->inv_ptr		|| oldartiCount != CPlayer->inventory[CPlayer->inv_ptr].count)	{		V_DrawScaledPatch(st_x+180, ST_Y+3, fgbuffer, PatchBLACKSQ);		if( CPlayer->inventory[CPlayer->inv_ptr].type > 0 )		{			V_DrawScaledPatch(st_x+179,ST_Y+2, fgbuffer,                             W_CachePatchName(patcharti[CPlayer->inventory[CPlayer->inv_ptr].type], PU_CACHE));			DrSmallNumber(CPlayer->inventory[CPlayer->inv_ptr].count, st_x+201, ST_Y+24);		}		oldarti = CPlayer->inv_ptr;		oldartiCount = CPlayer->inventory[CPlayer->inv_ptr].count;		UpdateState |= I_STATBAR;	}	// Frags	if(cv_deathmatch.value)	{		temp = ST_PlayerFrags(CPlayer-players);		if(temp != oldfrags)		{			V_DrawScaledPatch(st_x+57, ST_Y+13, fgbuffer, PatchARMCLEAR);			DrINumber(temp, st_x+61, ST_Y+12);			oldfrags = temp;			UpdateState |= I_STATBAR;		}	}	else	{		temp = min(max(0,HealthMarker),100);		if(oldlife != temp)		{			oldlife = temp;			V_DrawScaledPatch(st_x+57, ST_Y+13, fgbuffer, PatchARMCLEAR);			DrINumber(temp, st_x+61, ST_Y+12);			UpdateState |= I_STATBAR;		}	}	// Keys	if(oldkeys != playerkeys)	{		if(CPlayer->cards & it_yellowcard)		{			V_DrawScaledPatch(st_x+153, ST_Y+6, fgbuffer, W_CachePatchName("ykeyicon", PU_CACHE));		}		if(CPlayer->cards & it_redcard)		{			V_DrawScaledPatch(st_x+153, ST_Y+14, fgbuffer, W_CachePatchName("gkeyicon", PU_CACHE));		}		if(CPlayer->cards & it_bluecard)		{			V_DrawScaledPatch(st_x+153, ST_Y+22, fgbuffer, W_CachePatchName("bkeyicon", PU_CACHE));		}		oldkeys = playerkeys;		UpdateState |= I_STATBAR;	}	// Ammo	temp = CPlayer->ammo[wpnlev1info[CPlayer->readyweapon].ammo];	if(oldammo != temp || oldweapon != CPlayer->readyweapon)	{		V_DrawScaledPatch(st_x+108, ST_Y+3, fgbuffer, PatchBLACKSQ);		if(temp && CPlayer->readyweapon > 0 && CPlayer->readyweapon < 7)		{			DrINumber(temp, st_x+109, ST_Y+4);			V_DrawScaledPatch(st_x+111, ST_Y+14, fgbuffer, W_CachePatchName(				ammopic[CPlayer->readyweapon-1], PU_CACHE));		}		oldammo = temp;		oldweapon = CPlayer->readyweapon;		UpdateState |= I_STATBAR;	}	// Armor	if(oldarmor != CPlayer->armorpoints)	{		V_DrawScaledPatch(st_x+224, ST_Y+13, fgbuffer, PatchARMCLEAR);		DrINumber(CPlayer->armorpoints, st_x+228, ST_Y+12);		oldarmor = CPlayer->armorpoints;		UpdateState |= I_STATBAR;	}}//---------------------------------------------------------------------------//// PROC DrawInventoryBar////---------------------------------------------------------------------------static void DrawInventoryBar(void){	int i;	int x;	x = CPlayer->inv_ptr-CPlayer->st_curpos;	UpdateState |= I_STATBAR;	V_DrawScaledPatch(st_x+34, ST_Y+2, fgbuffer, PatchINVBAR);	for(i = 0; i < 7; i++)	{		//V_DrawScaledPatch(st_x+50+i*31, ST_Y+2, 0, W_CachePatchName("ARTIBOX", PU_CACHE));		if(CPlayer->inventorySlotNum > x+i			&& CPlayer->inventory[x+i].type != arti_none)		{			V_DrawScaledPatch(st_x+50+i*31, ST_Y+2, fgbuffer, W_CachePatchName(				patcharti[CPlayer->inventory[x+i].type], PU_CACHE));			DrSmallNumber(CPlayer->inventory[x+i].count, st_x+69+i*31, ST_Y+24);		}	}	V_DrawScaledPatch(st_x+50+CPlayer->st_curpos*31, ST_Y+31, fgbuffer, PatchSELECTBOX);	if(x != 0)	{		V_DrawScaledPatch(st_x+38, ST_Y+1, fgbuffer, !(leveltime&4) ? PatchINVLFGEM1 :			PatchINVLFGEM2);	}	if(CPlayer->inventorySlotNum-x > 7)	{		V_DrawScaledPatch(st_x+269, ST_Y+1, fgbuffer, !(leveltime&4) ?			PatchINVRTGEM1 : PatchINVRTGEM2);	}}static void DrawFullScreenStuff(void){	int i;	int x;	int temp;	UpdateState |= I_FULLSCRN;	if(CPlayer->mo->health > 0)		DrBNumber(CPlayer->mo->health, 5, ST_Y+22);	else		DrBNumber(0, 5, ST_Y+22);	if(cv_deathmatch.value)	{		temp = ST_PlayerFrags(CPlayer-players);		DrINumber(temp, 45, ST_Y+27);	}	if(!CPlayer->st_inventoryTics)	{		if( CPlayer->inventory[CPlayer->inv_ptr].type > 0)		{			V_DrawFuzzPatch(st_x+286, ST_Y+12, W_CachePatchName("ARTIBOX",				PU_CACHE));			V_DrawScaledPatch(st_x+286, ST_Y+12, fgbuffer, 				W_CachePatchName(patcharti[CPlayer->inventory[CPlayer->inv_ptr].type], PU_CACHE));			DrSmallNumber(CPlayer->inventory[CPlayer->inv_ptr].count, st_x+307, ST_Y+34);		}	}	else	{		x = CPlayer->inv_ptr-CPlayer->st_curpos;		for(i = 0; i < 7; i++)		{			V_DrawFuzzPatch(st_x+50+i*31, ST_Y+10, W_CachePatchName("ARTIBOX",				PU_CACHE));			if(CPlayer->inventorySlotNum > x+i				&& CPlayer->inventory[x+i].type != arti_none)			{				V_DrawScaledPatch(st_x+50+i*31, ST_Y+10, fgbuffer, W_CachePatchName(					patcharti[CPlayer->inventory[x+i].type], PU_CACHE));				DrSmallNumber(CPlayer->inventory[x+i].count, 69+i*31, ST_Y+32);			}		}		V_DrawScaledPatch(st_x+50+CPlayer->st_curpos*31, ST_Y+39, fgbuffer, PatchSELECTBOX);		if(x != 0)		{			V_DrawScaledPatch(st_x+38, ST_Y+9, fgbuffer, !(leveltime&4) ? PatchINVLFGEM1 :				PatchINVLFGEM2);		}		if(CPlayer->inventorySlotNum-x > 7)		{			V_DrawScaledPatch(st_x+269, ST_Y+9, fgbuffer, !(leveltime&4) ?				PatchINVRTGEM1 : PatchINVRTGEM2);		}	}}//--------------------------------------------------------------------------//// FUNC SB_Responder////--------------------------------------------------------------------------boolean SB_Responder(event_t *event){    return(false);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -