📄 wi_stuff.c
字号:
point_t *lnodes; lnodes = &doomlnodes[wbs->epsd][n]; i = 0; do { left = lnodes->x - (c[i]->leftoffset); top = lnodes->y - (c[i]->topoffset); right = left + (c[i]->width); bottom = top + (c[i]->height); if (left >= 0 && right < BASEVIDWIDTH && top >= 0 && bottom < BASEVIDHEIGHT) { fits = true; } else { i++; } } while (!fits && i!=2); if (fits && i<2) V_DrawScaledPatch(lnodes->x, lnodes->y, FB, c[i]); else // DEBUG CONS_Printf("Could not place patch on level %d", n+1);}//========================================================================//// IN_DrawYAH////========================================================================static void IN_DrawYAH(void){ int i; int x; int prevmap; x = (BASEVIDWIDTH-V_StringWidth("NOW ENTERING:"))/2; V_DrawString(x, 10, "NOW ENTERING:");/* x = (BASEVIDWIDTH-V_TextBWidth(P_LevelName()))/2; V_DrawTextB(P_LevelName(), x, 20);*/ prevmap = (wbs->last == 8) ? wbs->next - 1 : wbs->last; for(i=0; i<=prevmap; i++) { V_DrawScaledPatch(YAHspot[gameepisode-1][i].x, YAHspot[gameepisode-1][i].y, 0, splat); } if(players[consoleplayer].didsecret) { V_DrawScaledPatch(YAHspot[gameepisode-1][8].x, YAHspot[gameepisode-1][8].y, 0, splat); } if(!(bcnt&16) || state == ShowNextLoc) { // draw the destination 'X' V_DrawScaledPatch(YAHspot[gameepisode-1][wbs->next].x, YAHspot[gameepisode-1][wbs->next].y, 0, yah[0]); }}static void WI_initAnimatedBack(void){ int i; anim_t* a; if (gamemode == commercial || gamemode == heretic) return; if (wbs->epsd > 2) return; for (i=0;i<NUMANIMS[wbs->epsd];i++) { a = &anims[wbs->epsd][i]; // init variables a->ctr = -1; // specify the next time to draw it if (a->type == ANIM_ALWAYS) a->nexttic = bcnt + 1 + (M_Random()%a->period); else if (a->type == ANIM_RANDOM) a->nexttic = bcnt + 1 + a->data2+(M_Random()%a->data1); else if (a->type == ANIM_LEVEL) a->nexttic = bcnt + 1; }}static void WI_updateAnimatedBack(void){ int i; anim_t* a; if (gamemode == commercial || gamemode == heretic) return; if (wbs->epsd > 2) return; for (i=0;i<NUMANIMS[wbs->epsd];i++) { a = &anims[wbs->epsd][i]; if (bcnt >= a->nexttic) { switch (a->type) { case ANIM_ALWAYS: if (++a->ctr >= a->nanims) a->ctr = 0; a->nexttic = bcnt + a->period; break; case ANIM_RANDOM: a->ctr++; if (a->ctr == a->nanims) { a->ctr = -1; a->nexttic = bcnt+a->data2+(M_Random()%a->data1); } else a->nexttic = bcnt + a->period; break; case ANIM_LEVEL: // gawd-awful hack for level anims if (!(state == StatCount && i == 7) && wbs->next == a->data1) { a->ctr++; if (a->ctr == a->nanims) a->ctr--; a->nexttic = bcnt + a->period; } break; } } }}static void WI_drawAnimatedBack(void){ int i; anim_t* a; //BP: fixed it was "if (commercial)" if (gamemode == commercial || gamemode == heretic) return; if (wbs->epsd > 2) return; for (i=0 ; i<NUMANIMS[wbs->epsd] ; i++) { a = &anims[wbs->epsd][i]; if (a->ctr >= 0) V_DrawScaledPatch(a->loc.x, a->loc.y, FB, a->p[a->ctr]); }}//// Draws a number.// If digits > 0, then use that many digits minimum,// otherwise only use as many as necessary.// Returns new x position.//static int WI_drawNum ( int x, int y, int n, int digits ){ int fontwidth = (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_DrawScaledPatch(x, y, FB, num[ n % 10 ]); n /= 10; } // draw a minus sign if necessary if (neg) V_DrawScaledPatch(x-=8, y, FB, wiminus); return x;}static void WI_drawPercent( int x, int y, int p ){ if (p < 0) return; V_DrawScaledPatch(x, y, FB, percent); WI_drawNum(x, y, p, -1);}//// Display level completion time and par,// or "sucks" message if overflow.//static void WI_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) - (colon->width); div *= 60; // draw if (div==60 || t / div) V_DrawScaledPatch(x, y, FB, colon); } while (t / div); } else { // "sucks" V_DrawScaledPatch(x - SHORT(sucks->width), y, FB, sucks); }}static void WI_unloadData(void);static void WI_End(void){ WI_unloadData();}// used for write introduce next levelstatic void WI_initNoState(void){ state = NoState; acceleratestage = 0; cnt = 10;}static void WI_updateNoState(void) { WI_updateAnimatedBack(); if (--cnt==0) { WI_End(); G_NextLevel(); }}static boolean snl_pointeron = false;static void WI_initShowNextLoc(void){ state = ShowNextLoc; acceleratestage = 0; cnt = SHOWNEXTLOCDELAY * TICRATE; WI_initAnimatedBack();}static void WI_updateShowNextLoc(void){ WI_updateAnimatedBack(); if (!--cnt || acceleratestage) WI_initNoState(); else snl_pointeron = (cnt & 31) < 20;}static void WI_drawShowNextLoc(void){ int i; int last; if (cnt<=0) // all removed no draw !!! return; WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); if( gamemode == heretic ) { if( gameepisode < 4 ) IN_DrawYAH(); } else 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();}static void WI_drawNoState(void){ snl_pointeron = true; WI_drawShowNextLoc();}static int dm_frags[MAXPLAYERS][MAXPLAYERS];static int dm_totals[MAXPLAYERS];static void WI_initDeathmatchStats(void){ int i; int j; state = StatCount; acceleratestage = 0; cnt_pause = TICRATE*DM_WAIT; 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] = ST_PlayerFrags(i); } WI_initAnimatedBack();}static void WI_updateDeathmatchStats(void){ WI_updateAnimatedBack(); if( paused ) return; if (cnt_pause>0) cnt_pause--; if (cnt_pause==0) { S_StartSound(0, sfx_slop); WI_initNoState(); }}// Quick-patch for the Cave party 19-04-1998 !!//void WI_drawRancking(char *title,int x,int y,fragsort_t *fragtable , int scorelines, boolean large, int white){ int i,j; int color; char num[12]; int plnum; int frags; int colornum; fragsort_t temp; if( gamemode == heretic ) colornum = 230; else colornum = 0x78; // sort the frags count for (i=0; i<scorelines; i++) for(j=0; j<scorelines-1-i; j++) if( fragtable[j].count < fragtable[j+1].count ) { temp = fragtable[j]; fragtable[j] = fragtable[j+1]; fragtable[j+1] = temp; } if(title) V_DrawString (x, y-14, title); // draw rankings for (i=0; i<scorelines; i++) { frags = fragtable[i].count; plnum = fragtable[i].num; // draw color background color = fragtable[i].color; if (!color) color = *( (byte *)colormaps + colornum ); else color = *( (byte *)translationtables - 256 + (color<<8) + colornum ); V_DrawFill (x-1,y-1,large ? 40 : 26,9,color); // draw frags count sprintf(num,"%3i", frags ); V_DrawString (x+(large ? 32 : 24)-V_StringWidth(num), y, num); // draw name if (plnum == white) V_DrawStringWhite (x+(large ? 64 : 29), y, fragtable[i].name); else V_DrawString (x+(large ? 64 : 29), y, fragtable[i].name); y += 12; if (y>=BASEVIDHEIGHT) break; // dont draw past bottom of screen }}#define RANKINGY 60static void WI_drawDeathmatchStats(void){ int i,j; int scorelines; int whiteplayer; fragsort_t fragtab[MAXPLAYERS]; char *timeleft; WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); //Fab:25-04-98: when you play, you quickly see your frags because your // name is displayed white, when playback demo, you quicly see who's the // view. whiteplayer = demoplayback ? displayplayer : consoleplayer; // count frags for each present player scorelines = 0; for (i=0; i<MAXPLAYERS; i++) if (playeringame[i]) { fragtab[scorelines].count = dm_totals[i]; fragtab[scorelines].num = i; fragtab[scorelines].color = players[i].skincolor; fragtab[scorelines].name = player_names[i]; scorelines++; } WI_drawRancking("Frags",5,RANKINGY,fragtab,scorelines,false,whiteplayer); // count buchholz scorelines = 0; for (i=0; i<MAXPLAYERS; i++) if (playeringame[i]) { fragtab[scorelines].count = 0; for (j=0; j<MAXPLAYERS; j++) if (playeringame[j] && i!=j) fragtab[scorelines].count+= dm_frags[i][j]*(dm_totals[j]+dm_frags[j][j]); fragtab[scorelines].num = i; fragtab[scorelines].color = players[i].skincolor; fragtab[scorelines].name = player_names[i]; scorelines++; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -