📄 wi_stuff.c
字号:
}
}
else if (ng_state == 10)
{
if (acceleratestage)
{
S_StartSound(0, sfx_sgcock);
if ( gamemode == commercial )
WI_initNoState();
else
WI_initShowNextLoc();
}
}
else if (ng_state & 1)
{
if (!--cnt_pause)
{
ng_state++;
cnt_pause = TICRATE;
}
}
}
void WI_drawNetgameStats(void)
{
int i;
int x;
int y;
int pwidth = SHORT(percent->width);
WI_slamBackground();
// draw animated background
WI_drawAnimatedBack();
WI_drawLF();
// draw stat titles (top line)
V_DrawPatch(NG_STATSX+NG_SPACINGX-SHORT(kills->width),
NG_STATSY, FB, kills);
V_DrawPatch(NG_STATSX+2*NG_SPACINGX-SHORT(items->width),
NG_STATSY, FB, items);
V_DrawPatch(NG_STATSX+3*NG_SPACINGX-SHORT(secret->width),
NG_STATSY, FB, secret);
if (dofrags)
V_DrawPatch(NG_STATSX+4*NG_SPACINGX-SHORT(frags->width),
NG_STATSY, FB, frags);
// draw stats
y = NG_STATSY + SHORT(kills->height);
for (i=0 ; i<MAXPLAYERS ; i++)
{
if (!playeringame[i])
continue;
x = NG_STATSX;
V_DrawPatch(x-SHORT(p[i]->width), y, FB, p[i]);
if (i == me)
V_DrawPatch(x-SHORT(p[i]->width), y, FB, star);
x += NG_SPACINGX;
WI_drawPercent(x-pwidth, y+10, cnt_kills[i]); x += NG_SPACINGX;
WI_drawPercent(x-pwidth, y+10, cnt_items[i]); x += NG_SPACINGX;
WI_drawPercent(x-pwidth, y+10, cnt_secret[i]); x += NG_SPACINGX;
if (dofrags)
WI_drawNum(x, y+10, cnt_frags[i], -1);
y += WI_SPACINGY;
}
}
static int sp_state;
void WI_initStats(void)
{
state = StatCount;
acceleratestage = 0;
sp_state = 1;
cnt_kills[0] = cnt_items[0] = cnt_secret[0] = -1;
cnt_time = cnt_par = -1;
cnt_pause = TICRATE;
WI_initAnimatedBack();
}
void WI_updateStats(void)
{
WI_updateAnimatedBack();
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;
}
}
}
void WI_drawStats(void)
{
// line height
int lh;
lh = (3*SHORT(num[0]->height))/2;
WI_slamBackground();
// draw animated background
WI_drawAnimatedBack();
WI_drawLF();
V_DrawPatch(SP_STATSX, SP_STATSY, FB, kills);
WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY, cnt_kills[0]);
V_DrawPatch(SP_STATSX, SP_STATSY+lh, FB, items);
WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY+lh, cnt_items[0]);
V_DrawPatch(SP_STATSX, SP_STATSY+2*lh, FB, sp_secret);
WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0]);
V_DrawPatch(SP_TIMEX, SP_TIMEY, FB, d_time);
WI_drawTime(SCREENWIDTH/2 - SP_TIMEX, SP_TIMEY, cnt_time);
if (wbs->epsd < 3)
{
V_DrawPatch(SCREENWIDTH/2 + SP_TIMEX, SP_TIMEY, FB, par);
WI_drawTime(SCREENWIDTH - SP_TIMEX, SP_TIMEY, cnt_par);
}
}
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 tick
void 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 (deathmatch) WI_updateDeathmatchStats();
else if (netgame) WI_updateNetgameStats();
else WI_updateStats();
break;
case ShowNextLoc:
WI_updateShowNextLoc();
break;
case NoState:
WI_updateNoState();
break;
}
}
void WI_loadData(void)
{
int i;
int j;
int x, y;
char name[9];
anim_t* a;
if (gamemode == commercial)
strcpy(name, "INTERPIC");
else
sprintf(name, "WIMAP%d", wbs->epsd);
if ( gamemode == retail )
{
if (wbs->epsd == 3)
strcpy(name,"INTERPIC");
}
// background
bg = W_CacheLumpName(name, PU_CACHE);
x = (SCREENWIDTH - bg->width) / 2;
y = (SCREENHEIGHT - bg->height) / 2;
V_DrawPatch(x, y, 1, bg); //was 0 //Cetrify it - Markus
// 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_CacheLumpName(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_CacheLumpName(name, PU_STATIC);
}
// you are here
yah[0] = W_CacheLumpName("WIURH0", PU_STATIC);
// you are here (alt.)
yah[1] = W_CacheLumpName("WIURH1", PU_STATIC);
// splat
splat = W_CacheLumpName("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_CacheLumpName(name, PU_STATIC);
}
else
{
// HACK ALERT!
a->p[i] = anims[1][4].p[i];
}
}
}
}
}
// More hacks on minus sign.
wiminus = W_CacheLumpName("WIMINUS", PU_STATIC);
for (i=0;i<10;i++)
{
// numbers 0-9
sprintf(name, "WINUM%d", i);
num[i] = W_CacheLumpName(name, PU_STATIC);
}
// percent sign
percent = W_CacheLumpName("WIPCNT", PU_STATIC);
// "finished"
finished = W_CacheLumpName("WIF", PU_STATIC);
// "entering"
entering = W_CacheLumpName("WIENTER", PU_STATIC);
// "kills"
kills = W_CacheLumpName("WIOSTK", PU_STATIC);
// "scrt"
secret = W_CacheLumpName("WIOSTS", PU_STATIC);
// "secret"
sp_secret = W_CacheLumpName("WISCRT2", PU_STATIC);
// Yuck.
if (french)
{
// "items"
if (netgame && !deathmatch)
items = W_CacheLumpName("WIOBJ", PU_STATIC);
else
items = W_CacheLumpName("WIOSTI", PU_STATIC);
} else
items = W_CacheLumpName("WIOSTI", PU_STATIC);
// "frgs"
frags = W_CacheLumpName("WIFRGS", PU_STATIC);
// ":"
colon = W_CacheLumpName("WICOLON", PU_STATIC);
// "time"
d_time = W_CacheLumpName("WITIME", PU_STATIC);
// "sucks"
sucks = W_CacheLumpName("WISUCKS", PU_STATIC);
// "par"
par = W_CacheLumpName("WIPAR", PU_STATIC);
// "killers" (vertical)
killers = W_CacheLumpName("WIKILRS", PU_STATIC);
// "victims" (horiz)
victims = W_CacheLumpName("WIVCTMS", PU_STATIC);
// "total"
total = W_CacheLumpName("WIMSTT", PU_STATIC);
// your face
star = W_CacheLumpName("STFST01", PU_STATIC);
// dead face
bstar = W_CacheLumpName("STFDEAD0", PU_STATIC);
for (i=0 ; i<MAXPLAYERS ; i++)
{
// "1,2,3,4"
sprintf(name, "STPB%d", i);
p[i] = W_CacheLumpName(name, PU_STATIC);
// "1,2,3,4"
sprintf(name, "WIBP%d", i+1);
bp[i] = W_CacheLumpName(name, PU_STATIC);
}
}
void WI_unloadData(void)
{
int i;
int j;
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);
Z_ChangeTag(percent, PU_CACHE);
Z_ChangeTag(colon, PU_CACHE);
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(d_time, 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);
// Z_ChangeTag(star, PU_CACHE);
// Z_ChangeTag(bstar, PU_CACHE);
for (i=0 ; i<MAXPLAYERS ; i++)
Z_ChangeTag(p[i], PU_CACHE);
for (i=0 ; i<MAXPLAYERS ; i++)
Z_ChangeTag(bp[i], PU_CACHE);
}
void WI_Drawer (void)
{
switch (state)
{
case StatCount:
if (deathmatch)
WI_drawDeathmatchStats();
else if (netgame)
WI_drawNetgameStats();
else
WI_drawStats();
break;
case ShowNextLoc:
WI_drawShowNextLoc();
break;
case NoState:
WI_drawNoState();
break;
}
}
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 (deathmatch)
WI_initDeathmatchStats();
else if (netgame)
WI_initNetgameStats();
else
WI_initStats();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -