Skip to content

Commit

Permalink
Display other kills in coop tally screen (#1167)
Browse files Browse the repository at this point in the history
* Display other kills in coop tally screen

* Showing other when skipping counter
  • Loading branch information
MaartenCL committed Aug 30, 2020
1 parent 11cecf7 commit 34dd962
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 12 deletions.
14 changes: 9 additions & 5 deletions src/g_hub.cpp
Expand Up @@ -54,6 +54,7 @@ struct FHubInfo
{
int levelnum;

int totalkills;
int maxkills;
int maxitems;
int maxsecret;
Expand All @@ -63,11 +64,12 @@ struct FHubInfo

FHubInfo &operator=(const wbstartstruct_t &wbs)
{
levelnum = wbs.finished_ep;
maxkills = wbs.maxkills;
maxsecret= wbs.maxsecret;
maxitems = wbs.maxitems;
maxfrags = wbs.maxfrags;
levelnum = wbs.finished_ep;
totalkills = wbs.totalkills;
maxkills = wbs.maxkills;
maxsecret = wbs.maxsecret;
maxitems = wbs.maxitems;
maxfrags = wbs.maxfrags;
memcpy(plyr, wbs.plyr, sizeof(plyr));
return *this;
}
Expand Down Expand Up @@ -107,6 +109,7 @@ void G_LeavingHub(FLevelLocals *Level, int mode, cluster_info_t * cluster, wbsta

if (mode != FINISH_SameHub)
{
wbs->totalkills = Level->killed_monsters;
wbs->maxkills = wbs->maxitems = wbs->maxsecret = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
Expand Down Expand Up @@ -169,6 +172,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FHubInfo &h, FHubInfo
if (arc.BeginObject(key))
{
arc("levelnum", h.levelnum)
("totalkills", h.totalkills)
("maxkills", h.maxkills)
("maxitems", h.maxitems)
("maxsecret", h.maxsecret)
Expand Down
1 change: 1 addition & 0 deletions src/g_level.cpp
Expand Up @@ -926,6 +926,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
nextlevel = wminfo.next;

wminfo.next_ep = FindLevelInfo (wminfo.next)->cluster - 1;
wminfo.totalkills = killed_monsters;
wminfo.maxkills = total_monsters;
wminfo.maxitems = total_items;
wminfo.maxsecret = total_secrets;
Expand Down
1 change: 1 addition & 0 deletions src/wi_stuff.cpp
Expand Up @@ -863,6 +863,7 @@ DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, nextauthor);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, thisauthor);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName0);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName1);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, totalkills);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxkills);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxitems);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxsecret);
Expand Down
1 change: 1 addition & 0 deletions src/wi_stuff.h
Expand Up @@ -61,6 +61,7 @@ struct wbstartstruct_t
FTextureID LName0;
FTextureID LName1;

int totalkills;
int maxkills;
int maxitems;
int maxsecret;
Expand Down
7 changes: 4 additions & 3 deletions wadsrc/static/language.csv
Expand Up @@ -1172,14 +1172,15 @@ Color,SCORE_COLOR,,,Colour,Barva,Farbe,Χρώμα,Koloro,,,Väri,Couleur,Szín,C
Secret,SCORE_SECRET,,,,Tajemství,Geheimnis,Μυστικό,Sekreta,Secreto,,Salat,,Rejtély,Segreto,シークレット,밝혀낸 비밀,Geheim,Sekret,Segredo,,Secret,Тайники,Тајна
Name,SCORE_NAME,,,,Jméno,Name,Όνομα,Nomo,Nombre,,Nimi,Nom,Név,Nome,名前,이름,Naam,Nazwa,Nome,,Nume,Имя,Име
Delay (ms),SCORE_DELAY,,,,Zpoždění (ms),Verzögerung (ms),Kαθυστέρηση (μδ),Prokrasto (ms),Retraso (ms),,Viive (ms),Délai (ms),Késleltetés (ms),Ritardo (ms) ,ping,핑 (밀리초당),Vertraging (ms),Opóźnienie (ms),Atraso (ms),,Întârziere (ms),Задержка (мс),Кашњење (мс)
Kills,SCORE_KILLS,,,,Zabití,,Σκοτομοί,Mortigoj,Asesinatos,,Tapot,Victimes,Ölések,Uccisioni,キル,킬수,Doodt,Zabójstwa,Vítimas,,Ucideri,Убийства,Убиства
Kills,SCORE_KILLS,,,,Zabití,,Σκοτομοί,Mortigoj,Asesinatos,,Tapot,Victimes,Ölések,Uccisioni,キル,킬수,Dood,Zabójstwa,Vítimas,,Ucideri,Убийства,Убиства
Frags,SCORE_FRAGS,,,,Fragy,,Κοματιασμοί,Ĉesoj,Bajas,,Frägit,,Fragek,Frags,フラグ,플레이어 킬수,Frags,Fragi,,,Victime,Фраги,Фрагови
Deaths,SCORE_DEATHS,,,,Smrti,Tode,Θάνατοι,Mortoj,Muertes,,Kuolemat,Morts,Halálok,Morti,デス,사망한 횟수,Overlijden,Śmierci,Mortes,,Decese,Смерти,Смрти
Deaths,SCORE_DEATHS,,,,Smrti,Tode,Θάνατοι,Mortoj,Muertes,,Kuolemat,Morts,Halálok,Morti,デス,사망한 횟수,Doden,Śmierci,Mortes,,Decese,Смерти,Смрти
Other,SCORE_OTHER,,,,,Anders,,,,,Muu,Autre,,,,,Anders,,,,,,
Missed,SCORE_MISSED,,,,Minuto,Verfehlt,Ξεχάστηκαν,Mankita,Pérdidas,,Hudit,Ratés,Kihagyva,Mancati ,ミス,놓친 수,Gemist,Ominięte,Perdido,,Ratate,Пропущено,Промашаји
Total,SCORE_TOTAL,,,,Celkem,Gesamt,Συνολικό,Tuta,,,Yhteensä,Total,Összesen,Totale,合計,총점,Totaal,Totalne,Total,,Total,Всего,Укупно
Level Time,SCORE_LVLTIME,,,,Čas v levelu,Levelzeit,Χρόνος Πίστας,Nivel Daŭro,Tiempo de nivel,,Tasoaika,Temps niveau,Szint Idő,Tempo Livello ,時間,레벨 시간,Niveau Tijd,Czas,Tempo de Fase,Tempo do Nível,Timp Petrecut,Время уровня,Време нивоа
,,Level Summary,,,,,,,,,,,,,,,,,,,,,
Kills,TXT_IMKILLS,,,,Zabití,,Σκοτομοί,Mortigoj,Muertes,,Tapot,Morts,Áldozatok,Uccisioni,キル,킬수,Doodt,Zabójstwa,Vítimas,,Ucideri,Враги,Убиства
Kills,TXT_IMKILLS,,,,Zabití,,Σκοτομοί,Mortigoj,Muertes,,Tapot,Morts,Áldozatok,Uccisioni,キル,킬수,Dood,Zabójstwa,Vítimas,,Ucideri,Враги,Убиства
Items,TXT_IMITEMS,,,,Předměty,Gegenstände,Αντεικείμενα,Aĵoj,Objetos,,Esineet,Objets,Tárgyak,Oggetti,アイテム,획득한 아이템,Artikelen,Przedmioty,Itens,,Obiecte,Предметы,Ставке
Secrets,TXT_IMSECRETS,,,,Tajemství,Geheimnisse,Μυστικά,Sekretoj,Secretos,,Salat,,Rejtekhelyek,Segreti,シークレット,밝혀낸 비밀,Geheimen,Sekrety,Segredos,,Secrete,Тайники,Тајне
Time,TXT_IMTIME,,,,Čas,Zeit,Χρόνος,Daŭro,Tiempo,,Aika,Temps,Idő,Tempo,経過時間,소모한 시간,Tijd,Czas,Tempo,,Timp,Время,Време
Expand Down
9 changes: 8 additions & 1 deletion wadsrc/static/zscript/ui/statscreen/statscreen.zs
Expand Up @@ -86,7 +86,9 @@ class StatusScreen abstract play version("2.5")
int CurState; // specifies current CurState
wbstartstruct wbs; // contains information passed into intermission
wbplayerstruct Plrs[MAXPLAYERS]; // wbs.plyr[]
int otherkills;
int cnt; // used for general timing
int cnt_otherkills;
int cnt_kills[MAXPLAYERS];
int cnt_items[MAXPLAYERS];
int cnt_secret[MAXPLAYERS];
Expand Down Expand Up @@ -842,7 +844,12 @@ class StatusScreen abstract play version("2.5")
acceleratestage = 0;
cnt = bcnt = 0;
me = wbs.pnum;
for (int i = 0; i < MAXPLAYERS; i++) Plrs[i] = wbs.plyr[i];
otherkills = wbs.totalkills;
for (int i = 0; i < MAXPLAYERS; i++)
{
Plrs[i] = wbs.plyr[i];
otherkills -= Plrs[i].skills;
}

entering.Init(gameinfo.mStatscreenEnteringFont);
finished.Init(gameinfo.mStatscreenFinishedFont);
Expand Down
23 changes: 20 additions & 3 deletions wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs
Expand Up @@ -36,6 +36,8 @@ class CoopStatusScreen : StatusScreen
dofrags += fragSum (i);
}

cnt_otherkills = 0;

dofrags = !!dofrags;
}

Expand Down Expand Up @@ -69,6 +71,7 @@ class CoopStatusScreen : StatusScreen
if (dofrags)
cnt_frags[i] = fragSum (i);
}
cnt_otherkills = otherkills;
PlaySound("intermission/nextstage");
ng_state = 10;
}
Expand All @@ -92,7 +95,14 @@ class CoopStatusScreen : StatusScreen
else
stillticking = true;
}


cnt_otherkills += 2;

if (cnt_otherkills > otherkills)
cnt_otherkills = otherkills;
else
stillticking = true;

if (!stillticking)
{
PlaySound("intermission/nextstage");
Expand Down Expand Up @@ -215,7 +225,7 @@ class CoopStatusScreen : StatusScreen
int pwidth = IntermissionFont.GetCharWidth("%");
int icon_x, name_x, kills_x, bonus_x, secret_x;
int bonus_len, secret_len;
int missed_kills, missed_items, missed_secrets;
int other_kills, missed_kills, missed_items, missed_secrets;
float h, s, v, r, g, b;
int color;
String text_bonus, text_secret, text_kills;
Expand Down Expand Up @@ -258,6 +268,7 @@ class CoopStatusScreen : StatusScreen
drawTextScaled(displayFont, secret_x - secret_len * FontScale, y, text_secret, FontScale, textcolor);
y += int(height + 6 * FontScale);

other_kills = cnt_otherkills;
missed_kills = wbs.maxkills;
missed_items = wbs.maxitems;
missed_secrets = wbs.maxsecret;
Expand Down Expand Up @@ -296,8 +307,14 @@ class CoopStatusScreen : StatusScreen
y += lineheight + CleanYfac;
}

// Draw "MISSED" line
// Draw "OTHER" line
y += 3 * CleanYfac;
drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_OTHER"), FontScale, Font.CR_DARKGRAY);
drawPercentScaled(displayFont, kills_x, y, other_kills, wbs.maxkills, FontScale, Font.CR_DARKGRAY);
missed_kills -= cnt_otherkills;

// Draw "MISSED" line
y += height + 3 * CleanYfac;
drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_MISSED"), FontScale, Font.CR_DARKGRAY);
drawPercentScaled(displayFont, kills_x, y, missed_kills, wbs.maxkills, FontScale, Font.CR_DARKGRAY);
if (ng_state >= 4)
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/ui/statscreen/types.zs
Expand Up @@ -30,6 +30,7 @@ struct WBStartStruct native version("2.4")
native TextureID LName0;
native TextureID LName1;

native int totalkills;
native int maxkills;
native int maxitems;
native int maxsecret;
Expand Down

0 comments on commit 34dd962

Please sign in to comment.