Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Iskhodnyy_kod_Doom

.pdf
Скачиваний:
4
Добавлен:
13.02.2015
Размер:
1.01 Mб
Скачать

{

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)

791

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];

}

}

792

// 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])

{

793

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)

{

794

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]);

795

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++)

{

796

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;

}

797

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++)

{

798

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)

{

S_StartSound(0, sfx_pldeth); ng_state++;

}

}

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)

799

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;

800

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]