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

📄 wi_stuff.c

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 C
📖 第 1 页 / 共 3 页
字号:
WI_drawNum( int		x,  int		y,  int		n,  int		digits ){    int		fontwidth = SHORT(num[0]->width);    int		neg;    int		temp;    if (digits < 0)    {	if (!n)	{	    // make variable-length zeros 1 digit long	    digits = 1;	}	else	{	    // figure out # of digits in #	    digits = 0;	    temp = n;	    while (temp)	    {		temp /= 10;		digits++;	    }	}    }    neg = n < 0;    if (neg)	n = -n;    // if non-number, do not draw it    if (n == 1994)	return 0;    // draw the new number    while (digits--)    {	x -= fontwidth;	V_DrawPatch(x, y, FB, num[ n % 10 ]);	n /= 10;    }    // draw a minus sign if necessary    if (neg)	V_DrawPatch(x-=8, y, FB, wiminus);    return x;}voidWI_drawPercent( int		x,  int		y,  int		p ){    if (p < 0)	return;    V_DrawPatch(x, y, FB, percent);    WI_drawNum(x, y, p, -1);}//// Display level completion time and par,//  or "sucks" message if overflow.//voidWI_drawTime( int		x,  int		y,  int		t ){    int		div;    int		n;    if (t<0)	return;    if (t <= 61*59)    {	div = 1;	do	{	    n = (t / div) % 60;	    x = WI_drawNum(x, y, n, 2) - SHORT(colon->width);	    div *= 60;	    // draw	    if (div==60 || t / div)		V_DrawPatch(x, y, FB, colon);	    	} while (t / div);    }    else    {	// "sucks"	V_DrawPatch(x - SHORT(sucks->width), y, FB, sucks);     }}void WI_End(void){    void WI_unloadData(void);    WI_unloadData();}void WI_initNoState(void){    state = NoState;    acceleratestage = 0;    cnt = 10;}void WI_updateNoState(void) {    WI_updateAnimatedBack();    if (!--cnt)    {	WI_End();	G_WorldDone();    }}static boolean		snl_pointeron = false;void WI_initShowNextLoc(void){    state = ShowNextLoc;    acceleratestage = 0;    cnt = SHOWNEXTLOCDELAY * TICRATE;    WI_initAnimatedBack();}void WI_updateShowNextLoc(void){    WI_updateAnimatedBack();    if (!--cnt || acceleratestage)	WI_initNoState();    else	snl_pointeron = (cnt & 31) < 20;}void WI_drawShowNextLoc(void){    int		i;    int		last;    WI_slamBackground();    // draw animated background    WI_drawAnimatedBack();     if ( gamemode != commercial)    {  	if (wbs->epsd > 2)	{	    WI_drawEL();	    return;	}		last = (wbs->last == 8) ? wbs->next - 1 : wbs->last;	// draw a splat on taken cities.	for (i=0 ; i<=last ; i++)	    WI_drawOnLnode(i, &splat);	// splat the secret level?	if (wbs->didsecret)	    WI_drawOnLnode(8, &splat);	// draw flashing ptr	if (snl_pointeron)	    WI_drawOnLnode(wbs->next, yah);     }    // draws which level you are entering..    if ( (gamemode != commercial)	 || wbs->next != 30)	WI_drawEL();  }void WI_drawNoState(void){    snl_pointeron = true;    WI_drawShowNextLoc();}int WI_fragSum(int playernum){    int		i;    int		frags = 0;        for (i=0 ; i<MAXPLAYERS ; i++)    {	if (playeringame[i]	    && i!=playernum)	{	    frags += plrs[playernum].frags[i];	}    }	    // JDC hack - negative frags.    frags -= plrs[playernum].frags[playernum];    // UNUSED if (frags < 0)    // 	frags = 0;    return frags;}static int		dm_state;static int		dm_frags[MAXPLAYERS][MAXPLAYERS];static int		dm_totals[MAXPLAYERS];void WI_initDeathmatchStats(void){    int		i;    int		j;    state = StatCount;    acceleratestage = 0;    dm_state = 1;    cnt_pause = TICRATE;    for (i=0 ; i<MAXPLAYERS ; i++)    {	if (playeringame[i])	{	    for (j=0 ; j<MAXPLAYERS ; j++)		if (playeringame[j])		    dm_frags[i][j] = 0;	    dm_totals[i] = 0;	}    }        WI_initAnimatedBack();}void WI_updateDeathmatchStats(void){    int		i;    int		j;        boolean	stillticking;    WI_updateAnimatedBack();    if (acceleratestage && dm_state != 4)    {	acceleratestage = 0;	for (i=0 ; i<MAXPLAYERS ; i++)	{	    if (playeringame[i])	    {		for (j=0 ; j<MAXPLAYERS ; j++)		    if (playeringame[j])			dm_frags[i][j] = plrs[i].frags[j];		dm_totals[i] = WI_fragSum(i);	    }	}		S_StartSound(0, sfx_barexp);	dm_state = 4;    }        if (dm_state == 2)    {	if (!(bcnt&3))	    S_StartSound(0, sfx_pistol);		stillticking = false;	for (i=0 ; i<MAXPLAYERS ; i++)	{	    if (playeringame[i])	    {		for (j=0 ; j<MAXPLAYERS ; j++)		{		    if (playeringame[j]			&& dm_frags[i][j] != plrs[i].frags[j])		    {			if (plrs[i].frags[j] < 0)			    dm_frags[i][j]--;			else			    dm_frags[i][j]++;			if (dm_frags[i][j] > 99)			    dm_frags[i][j] = 99;			if (dm_frags[i][j] < -99)			    dm_frags[i][j] = -99;						stillticking = true;		    }		}		dm_totals[i] = WI_fragSum(i);		if (dm_totals[i] > 99)		    dm_totals[i] = 99;				if (dm_totals[i] < -99)		    dm_totals[i] = -99;	    }	    	}	if (!stillticking)	{	    S_StartSound(0, sfx_barexp);	    dm_state++;	}    }    else if (dm_state == 4)    {	if (acceleratestage)	{	    S_StartSound(0, sfx_slop);	    if ( gamemode == commercial)		WI_initNoState();	    else		WI_initShowNextLoc();	}    }    else if (dm_state & 1)    {	if (!--cnt_pause)	{	    dm_state++;	    cnt_pause = TICRATE;	}    }}void WI_drawDeathmatchStats(void){    int		i;    int		j;    int		x;    int		y;    int		w;        int		lh;	// line height    lh = WI_SPACINGY;    WI_slamBackground();        // draw animated background    WI_drawAnimatedBack();     WI_drawLF();    // draw stat titles (top line)    V_DrawPatch(DM_TOTALSX-SHORT(total->width)/2,		DM_MATRIXY-WI_SPACINGY+10,		FB,		total);        V_DrawPatch(DM_KILLERSX, DM_KILLERSY, FB, killers);    V_DrawPatch(DM_VICTIMSX, DM_VICTIMSY, FB, victims);    // draw P?    x = DM_MATRIXX + DM_SPACINGX;    y = DM_MATRIXY;    for (i=0 ; i<MAXPLAYERS ; i++)    {	if (playeringame[i])	{	    V_DrawPatch(x-SHORT(p[i]->width)/2,			DM_MATRIXY - WI_SPACINGY,			FB,			p[i]);	    	    V_DrawPatch(DM_MATRIXX-SHORT(p[i]->width)/2,			y,			FB,			p[i]);	    if (i == me)	    {		V_DrawPatch(x-SHORT(p[i]->width)/2,			    DM_MATRIXY - WI_SPACINGY,			    FB,			    bstar);		V_DrawPatch(DM_MATRIXX-SHORT(p[i]->width)/2,			    y,			    FB,			    star);	    }	}	else	{	    // V_DrawPatch(x-SHORT(bp[i]->width)/2,	    //   DM_MATRIXY - WI_SPACINGY, FB, bp[i]);	    // V_DrawPatch(DM_MATRIXX-SHORT(bp[i]->width)/2,	    //   y, FB, bp[i]);	}	x += DM_SPACINGX;	y += WI_SPACINGY;    }    // draw stats    y = DM_MATRIXY+10;    w = SHORT(num[0]->width);    for (i=0 ; i<MAXPLAYERS ; i++)    {	x = DM_MATRIXX + DM_SPACINGX;	if (playeringame[i])	{	    for (j=0 ; j<MAXPLAYERS ; j++)	    {		if (playeringame[j])		    WI_drawNum(x+w, y, dm_frags[i][j], 2);		x += DM_SPACINGX;	    }	    WI_drawNum(DM_TOTALSX+w, y, dm_totals[i], 2);	}	y += WI_SPACINGY;    }}static int	cnt_frags[MAXPLAYERS];static int	dofrags;static int	ng_state;void WI_initNetgameStats(void){    int i;    state = StatCount;    acceleratestage = 0;    ng_state = 1;    cnt_pause = TICRATE;    for (i=0 ; i<MAXPLAYERS ; i++)    {	if (!playeringame[i])	    continue;	cnt_kills[i] = cnt_items[i] = cnt_secret[i] = cnt_frags[i] = 0;	dofrags += WI_fragSum(i);    }    dofrags = !!dofrags;    WI_initAnimatedBack();}void WI_updateNetgameStats(void){    int		i;    int		fsum;        boolean	stillticking;    WI_updateAnimatedBack();    if (acceleratestage && ng_state != 10)    {	acceleratestage = 0;	for (i=0 ; i<MAXPLAYERS ; i++)	{	    if (!playeringame[i])		continue;	    cnt_kills[i] = (plrs[i].skills * 100) / wbs->maxkills;	    cnt_items[i] = (plrs[i].sitems * 100) / wbs->maxitems;	    cnt_secret[i] = (plrs[i].ssecret * 100) / wbs->maxsecret;	    if (dofrags)		cnt_frags[i] = WI_fragSum(i);	}	S_StartSound(0, sfx_barexp);	ng_state = 10;    }    if (ng_state == 2)    {	if (!(bcnt&3))	    S_StartSound(0, sfx_pistol);	stillticking = false;	for (i=0 ; i<MAXPLAYERS ; i++)	{	    if (!playeringame[i])		continue;	    cnt_kills[i] += 2;	    if (cnt_kills[i] >= (plrs[i].skills * 100) / wbs->maxkills)		cnt_kills[i] = (plrs[i].skills * 100) / wbs->maxkills;	    else		stillticking = true;	}		if (!stillticking)	{	    S_StartSound(0, sfx_barexp);	    ng_state++;	}    }    else if (ng_state == 4)    {	if (!(bcnt&3))	    S_StartSound(0, sfx_pistol);	stillticking = false;	for (i=0 ; i<MAXPLAYERS ; i++)	{	    if (!playeringame[i])		continue;	    cnt_items[i] += 2;	    if (cnt_items[i] >= (plrs[i].sitems * 100) / wbs->maxitems)		cnt_items[i] = (plrs[i].sitems * 100) / wbs->maxitems;	    else		stillticking = true;	}	if (!stillticking)	{	    S_StartSound(0, sfx_barexp);	    ng_state++;	}    }    else if (ng_state == 6)    {	if (!(bcnt&3))	    S_StartSound(0, sfx_pistol);	stillticking = false;	for (i=0 ; i<MAXPLAYERS ; i++)	{	    if (!playeringame[i])		continue;	    cnt_secret[i] += 2;	    if (cnt_secret[i] >= (plrs[i].ssecret * 100) / wbs->maxsecret)		cnt_secret[i] = (plrs[i].ssecret * 100) / wbs->maxsecret;	    else		stillticking = true;	}		if (!stillticking)	{	    S_StartSound(0, sfx_barexp);	    ng_state += 1 + 2*!dofrags;	}    }    else if (ng_state == 8)    {	if (!(bcnt&3))	    S_StartSound(0, sfx_pistol);	stillticking = false;	for (i=0 ; i<MAXPLAYERS ; i++)	{	    if (!playeringame[i])		continue;	    cnt_frags[i] += 1;	    if (cnt_frags[i] >= (fsum = WI_fragSum(i)))		cnt_frags[i] = fsum;	    else		stillticking = true;	}		if (!stillticking)

⌨️ 快捷键说明

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