From 8a63f20c61e4b9a3a4c39f566a45e87be50e9124 Mon Sep 17 00:00:00 2001 From: xolatile Date: Tue, 22 Jul 2025 13:10:23 +0200 Subject: [PATCH] Simple frag messages and TODO... --- TODO.md | 23 +++++++++++++++++++++ autoexec.cfg | 4 +++- src/fpsgame/fps.cpp | 49 ++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..c81eff7 --- /dev/null +++ b/TODO.md @@ -0,0 +1,23 @@ +- General: + 0) Delete more code we don't need. + 1) Remove unused functions. + 2) Remove dumb global variables. + 3) Reformat to Chad coding style. + 4) Remove MD3 and IQM models. + 5) Use TGA instead of PNG? + 6) Optimize for speed instead of size? +- Frag messages: + 0) Clean up and move to a function. + 1) Make it a dynamic array? + 2) Colour the names? + 3) Add ping, accuracy and more? +- Balance: + 0) Playtest current weapons and armours. + 1) Playtest the bots (old AI). +- HUD: + 0) Add accuracy, frags, deaths, suicides and more. + 1) Add accuracy per weapon, with icons. + 2) Add player movement speed. +- Scoreboard: + 0) Add accuracy per client? + 1) Add frags, deaths, suicides and more. diff --git a/autoexec.cfg b/autoexec.cfg index d048bb0..466ad05 100755 --- a/autoexec.cfg +++ b/autoexec.cfg @@ -3,7 +3,9 @@ name xolatile -maxfps 60 +maxfps 60 +fov 120 +sensitivity 4.2 bind e [setweapon 1] // Shotgun. bind q [setweapon 2] // Chaingun. diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp index 35a5d65..2f2986e 100644 --- a/src/fpsgame/fps.cpp +++ b/src/fpsgame/fps.cpp @@ -431,6 +431,21 @@ namespace game VARP(teamcolorfrags, 0, 1, 1); + /// xolatile: HUD frag messages + +#define fragmessageduration (2000) + + string hudfragger, hudfragged; + int hudfraggun, hudfragmillis; + + void sethudfragdata(char *fragger, char *fragged, int gunid) + { + copystring(hudfragger, fragger ? fragger : ""); + copystring(hudfragged, fragged); + hudfraggun = gunid; + hudfragmillis = lastmillis; + } + void killed(fpsent *d, fpsent *actor) { if(d->state==CS_EDITING) @@ -470,11 +485,19 @@ namespace game } else { - if(d==player1) conoutf(contype, "\f2%s got fragged by %s", dname, aname); - else conoutf(contype, "\f2%s fragged %s", aname, dname); + if(d==player1) + { + conoutf(contype, "\f2%s got fragged by %s", dname, aname); + sethudfragdata(actor->name, d->name, actor->gunselect); + } + else + { + conoutf(contype, "\f2%s fragged %s", aname, dname); + sethudfragdata(actor->name, d->name, actor->gunselect); + } } deathstate(d); - ai::killed(d, actor); + ai::killed(d, actor); } void timeupdate(int secs) @@ -1039,8 +1062,24 @@ namespace game if(!m_edit) { - if(gameclock) drawgameclock(w, h); - if(hudscore) drawhudscore(w, h); + if(gameclock) drawgameclock(w, h); + if(hudscore) drawhudscore(w, h); + } + + /// Frag message. + + if(hudfragmillis+fragmessageduration > lastmillis) + { + vec2 center = vec2(0.5*w, 0.2*h); + float width = 0, height = 0; + pushhudmatrix(); + hudmatrix.scale(0.8, 0.8, 1); + flushhudmatrix(); + draw_textf("%s", center.x, center.y, hudfragger); + text_boundsf(hudfragger, width, height); + drawicon(HICON_FIST+hudfraggun, center.x+width, center.y, height); + draw_textf("%s", center.x+width+height, center.y, hudfragged); + pophudmatrix(); } } -- 2.39.5