📄 wi_stuff.c
字号:
if (acceleratestage && sp_state != 10) { acceleratestage = 0; cnt_kills[0] = (plrs[me].skills * 100) / wbs->maxkills; cnt_items[0] = (plrs[me].sitems * 100) / wbs->maxitems; cnt_secret[0] = (plrs[me].ssecret * 100) / wbs->maxsecret; cnt_time = plrs[me].stime / TICRATE; cnt_par = wbs->partime / TICRATE; S_StartSound(0, sfx_barexp); sp_state = 10; } if (sp_state == 2) { cnt_kills[0] += 2; if (!(bcnt&3)) S_StartSound(0, sfx_pistol); if (cnt_kills[0] >= (plrs[me].skills * 100) / wbs->maxkills) { cnt_kills[0] = (plrs[me].skills * 100) / wbs->maxkills; S_StartSound(0, sfx_barexp); sp_state++; } } else if (sp_state == 4) { cnt_items[0] += 2; if (!(bcnt&3)) S_StartSound(0, sfx_pistol); if (cnt_items[0] >= (plrs[me].sitems * 100) / wbs->maxitems) { cnt_items[0] = (plrs[me].sitems * 100) / wbs->maxitems; S_StartSound(0, sfx_barexp); sp_state++; } } else if (sp_state == 6) { cnt_secret[0] += 2; if (!(bcnt&3)) S_StartSound(0, sfx_pistol); if (cnt_secret[0] >= (plrs[me].ssecret * 100) / wbs->maxsecret) { cnt_secret[0] = (plrs[me].ssecret * 100) / wbs->maxsecret; S_StartSound(0, sfx_barexp); sp_state++; } } else if (sp_state == 8) { if (!(bcnt&3)) S_StartSound(0, sfx_pistol); cnt_time += 3; if (cnt_time >= plrs[me].stime / TICRATE) cnt_time = plrs[me].stime / TICRATE; cnt_par += 3; if (cnt_par >= wbs->partime / TICRATE) { cnt_par = wbs->partime / TICRATE; if (cnt_time >= plrs[me].stime / TICRATE) { S_StartSound(0, sfx_barexp); sp_state++; } } } else if (sp_state == 10) { if (acceleratestage) { S_StartSound(0, sfx_sgcock); if (gamemode == commercial) WI_initNoState(); else WI_initShowNextLoc(); } } else if (sp_state & 1) { if (!--cnt_pause) { sp_state++; cnt_pause = TICRATE; } }}static void WI_drawStats(void){ // line height int lh; lh = (3*(num[0]->height))/2; WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); if( FontBBaseLump ) { // use FontB if any V_DrawTextB("Kills", SP_STATSX, SP_STATSY); V_DrawTextB("Items", SP_STATSX, SP_STATSY+lh); V_DrawTextB("Secrets", SP_STATSX, SP_STATSY+2*lh); V_DrawTextB("Time", SP_TIMEX, SP_TIMEY); if (wbs->epsd < 3 && gamemode!=heretic) V_DrawTextB("Par", BASEVIDWIDTH/2 + SP_TIMEX, SP_TIMEY); } else { V_DrawScaledPatch(SP_STATSX, SP_STATSY, FB, kills); V_DrawScaledPatch(SP_STATSX, SP_STATSY+lh, FB, items); V_DrawScaledPatch(SP_STATSX, SP_STATSY+2*lh, FB, sp_secret); V_DrawScaledPatch(SP_TIMEX, SP_TIMEY, FB, timePatch); if (wbs->epsd < 3 && gamemode!=heretic) V_DrawScaledPatch(BASEVIDWIDTH/2 + SP_TIMEX, SP_TIMEY, FB, par); } WI_drawPercent(BASEVIDWIDTH - SP_STATSX, SP_STATSY, cnt_kills[0]); WI_drawPercent(BASEVIDWIDTH - SP_STATSX, SP_STATSY+lh, cnt_items[0]); WI_drawPercent(BASEVIDWIDTH - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0]); WI_drawTime(BASEVIDWIDTH/2 - SP_TIMEX, SP_TIMEY, cnt_time); if (wbs->epsd < 3 && gamemode!=heretic) WI_drawTime(BASEVIDWIDTH - SP_TIMEX, SP_TIMEY, cnt_par);}static void WI_checkForAccelerate(void){ int i; player_t *player; // check for button presses to skip delays for (i=0, player = players ; i<MAXPLAYERS ; i++, player++) { if (playeringame[i]) { if (player->cmd.buttons & BT_ATTACK) { if (!player->attackdown) acceleratestage = 1; player->attackdown = true; } else player->attackdown = false; if (player->cmd.buttons & BT_USE) { if (!player->usedown) acceleratestage = 1; player->usedown = true; } else player->usedown = false; } }}// Updates stuff each tickvoid WI_Ticker(void){ // counter for general background animation bcnt++; if (bcnt == 1) { // intermission music if ( gamemode == commercial ) S_ChangeMusic(mus_dm2int, true); else S_ChangeMusic(mus_inter, true); } WI_checkForAccelerate(); switch (state) { case StatCount: if (cv_deathmatch.value) WI_updateDeathmatchStats(); else if (multiplayer) WI_updateNetgameStats(); else WI_updateStats(); break; case ShowNextLoc: WI_updateShowNextLoc(); break; case NoState: WI_updateNoState(); break; }}static void WI_loadData(void){ int i; int j; anim_t* a; char name[9]; // choose the background of the intermission if (*info_interpic) strcpy(bgname, info_interpic); else if (gamemode == commercial) strcpy(bgname, "INTERPIC"); else if( gamemode == heretic ) sprintf(bgname, "MAPE%d", wbs->epsd+1); else sprintf(bgname, "WIMAP%d", wbs->epsd); if ( gamemode == retail ) { if (wbs->epsd == 3) strcpy(bgname,"INTERPIC"); } if (rendermode == render_soft) { memset(screens[0],0,vid.width*vid.height*vid.bpp); // clear backbuffer from status bar stuff and borders memset(screens[1],0,vid.width*vid.height*vid.bpp); // background stored in backbuffer V_DrawScaledPatch(0, 0, 1, W_CachePatchName(bgname, PU_CACHE)); } // UNUSED unsigned char *pic = screens[1]; // if (gamemode == commercial) // { // darken the background image // while (pic != screens[1] + SCREENHEIGHT*SCREENWIDTH) // { // *pic = colormaps[256*25 + *pic]; // pic++; // } //} if (gamemode == commercial) { NUMCMAPS = 32; lnames = (patch_t **) Z_Malloc(sizeof(patch_t*) * NUMCMAPS, PU_STATIC, 0); for (i=0 ; i<NUMCMAPS ; i++) { sprintf(name, "CWILV%2.2d", i); lnames[i] = W_CachePatchName(name, PU_STATIC); } } else { lnames = (patch_t **) Z_Malloc(sizeof(patch_t*) * NUMMAPS, PU_STATIC, 0); for (i=0 ; i<NUMMAPS ; i++) { sprintf(name, "WILV%d%d", wbs->epsd, i); lnames[i] = W_CachePatchName(name, PU_STATIC); } // you are here yah[0] = W_CachePatchName(gamemode == heretic ? "IN_YAH" : "WIURH0", PU_STATIC); // you are here (alt.) yah[1] = W_CachePatchName("WIURH1", PU_STATIC); // splat splat = W_CachePatchName(gamemode == heretic ? "IN_X" : "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_CachePatchName(name, PU_STATIC); } else { // HACK ALERT! a->p[i] = anims[1][4].p[i]; } } } } } // More hacks on minus sign. wiminus = W_CachePatchName(gamemode == heretic ? "FONTB13" : "WIMINUS", PU_STATIC); for (i=0;i<10;i++) { // numbers 0-9 if( gamemode == heretic ) sprintf(name, "FONTB%d", 16+i); else sprintf(name, "WINUM%d", i); num[i] = W_CachePatchName(name, PU_STATIC); } // percent sign percent = W_CachePatchName(gamemode == heretic ? "FONTB05" : "WIPCNT", PU_STATIC); if( gamemode != heretic ) { // "finished" finished = W_CachePatchName("WIF", PU_STATIC); // "entering" entering = W_CachePatchName("WIENTER", PU_STATIC); // "kills" kills = W_CachePatchName("WIOSTK", PU_STATIC); // "scrt" secret = W_CachePatchName("WIOSTS", PU_STATIC); // "secret" sp_secret = W_CachePatchName("WISCRT2", PU_STATIC); // "items" items = W_CachePatchName("WIOSTI", PU_STATIC); // "frgs" frags = W_CachePatchName("WIFRGS", PU_STATIC); // "time" timePatch = W_CachePatchName("WITIME", PU_STATIC); // "sucks" sucks = W_CachePatchName("WISUCKS", PU_STATIC); // "par" par = W_CachePatchName("WIPAR", PU_STATIC); // "killers" (vertical) killers = W_CachePatchName("WIKILRS", PU_STATIC); // "victims" (horiz) victims = W_CachePatchName("WIVCTMS", PU_STATIC); // "total" total = W_CachePatchName("WIMSTT", PU_STATIC); } // ":" colon = W_CachePatchName(gamemode == heretic ? "FONTB26" : "WICOLON", PU_STATIC); // your face star = W_CachePatchName("STFST01", PU_STATIC); // dead face bstar = W_CachePatchName("STFDEAD0", PU_STATIC); //added:08-02-98: now uses a single STPB0 which is remapped to the // player translation table. Whatever new colors we add // since we'll have to define a translation table for // it, we'll have the right colors here automatically. stpb = W_CachePatchName("STPB0", PU_STATIC);}static void WI_unloadData(void){ int i; int j; //faB: never Z_ChangeTag() a pointer returned by W_CachePatchxxx() // it doesn't work and is unecessary if (rendermode==render_soft) { Z_ChangeTag(wiminus, PU_CACHE); for (i=0 ; i<10 ; i++) Z_ChangeTag(num[i], PU_CACHE); if (gamemode == commercial) { for (i=0 ; i<NUMCMAPS ; i++) Z_ChangeTag(lnames[i], PU_CACHE); } else { Z_ChangeTag(yah[0], PU_CACHE); Z_ChangeTag(yah[1], PU_CACHE); Z_ChangeTag(splat, PU_CACHE); for (i=0 ; i<NUMMAPS ; i++) Z_ChangeTag(lnames[i], PU_CACHE); if (wbs->epsd < 3) { for (j=0;j<NUMANIMS[wbs->epsd];j++) { if (wbs->epsd != 1 || j != 8) for (i=0;i<anims[wbs->epsd][j].nanims;i++) Z_ChangeTag(anims[wbs->epsd][j].p[i], PU_CACHE); } } } } Z_Free(lnames); if (rendermode==render_soft) { Z_ChangeTag(percent, PU_CACHE); Z_ChangeTag(colon, PU_CACHE); if( gamemode != heretic ) { Z_ChangeTag(finished, PU_CACHE); Z_ChangeTag(entering, PU_CACHE); Z_ChangeTag(kills, PU_CACHE); Z_ChangeTag(secret, PU_CACHE); Z_ChangeTag(sp_secret, PU_CACHE); Z_ChangeTag(items, PU_CACHE); Z_ChangeTag(frags, PU_CACHE); Z_ChangeTag(timePatch, PU_CACHE); Z_ChangeTag(sucks, PU_CACHE); Z_ChangeTag(par, PU_CACHE); Z_ChangeTag(victims, PU_CACHE); Z_ChangeTag(killers, PU_CACHE); Z_ChangeTag(total, PU_CACHE); } }}void WI_Drawer (void){ switch (state) { case StatCount: if (cv_deathmatch.value) { if(cv_teamplay.value) WI_drawTeamsStats(); else WI_drawDeathmatchStats(); } else if (multiplayer) WI_drawNetgameStats(); else WI_drawStats(); break; case ShowNextLoc: WI_drawShowNextLoc(); break; case NoState: WI_drawNoState(); break; }}static void WI_initVariables(wbstartstruct_t* wbstartstruct){ wbs = wbstartstruct;#ifdef RANGECHECKING if (gamemode != commercial) { if ( gamemode == retail ) RNGCHECK(wbs->epsd, 0, 3); else RNGCHECK(wbs->epsd, 0, 2); } else { RNGCHECK(wbs->last, 0, 8); RNGCHECK(wbs->next, 0, 8); } RNGCHECK(wbs->pnum, 0, MAXPLAYERS); RNGCHECK(wbs->pnum, 0, MAXPLAYERS);#endif acceleratestage = 0; cnt = bcnt = 0; firstrefresh = 1; me = wbs->pnum; plrs = wbs->plyr; if (!wbs->maxkills) wbs->maxkills = 1; if (!wbs->maxitems) wbs->maxitems = 1; if (!wbs->maxsecret) wbs->maxsecret = 1; if ( gamemode != retail ) if (wbs->epsd > 2) wbs->epsd -= 3;}void WI_Start(wbstartstruct_t* wbstartstruct){ WI_initVariables(wbstartstruct); WI_loadData(); if (cv_deathmatch.value) WI_initDeathmatchStats(); else if (multiplayer) WI_initNetgameStats(); else WI_initStats();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -