From: xolatile Date: Wed, 23 Jul 2025 15:33:57 +0000 (+0200) Subject: Alternative GUI, more info in scoreboard, icons, accuracy, pickup state... X-Git-Url: https://git.xolatile.top/?a=commitdiff_plain;h=a5a051f3356046fcaeaa295272d6859defebb320;p=xolatile-badassbug.git Alternative GUI, more info in scoreboard, icons, accuracy, pickup state... --- diff --git a/TODO.md b/TODO.md index c81eff7..0f657ed 100644 --- a/TODO.md +++ b/TODO.md @@ -14,6 +14,7 @@ - Balance: 0) Playtest current weapons and armours. 1) Playtest the bots (old AI). + 2) Modify armour type based on maximum. - HUD: 0) Add accuracy, frags, deaths, suicides and more. 1) Add accuracy per weapon, with icons. diff --git a/packages/icons/blue_armour.png b/packages/icons/blue_armour.png new file mode 100644 index 0000000..ba1c98a Binary files /dev/null and b/packages/icons/blue_armour.png differ diff --git a/packages/icons/chaingun.png b/packages/icons/chaingun.png new file mode 100644 index 0000000..6d16322 Binary files /dev/null and b/packages/icons/chaingun.png differ diff --git a/packages/icons/chainsaw.png b/packages/icons/chainsaw.png new file mode 100644 index 0000000..f540c6d Binary files /dev/null and b/packages/icons/chainsaw.png differ diff --git a/packages/icons/green_armour.png b/packages/icons/green_armour.png new file mode 100644 index 0000000..5f97acc Binary files /dev/null and b/packages/icons/green_armour.png differ diff --git a/packages/icons/grenade_launcher.png b/packages/icons/grenade_launcher.png new file mode 100644 index 0000000..3c4fd35 Binary files /dev/null and b/packages/icons/grenade_launcher.png differ diff --git a/packages/icons/health.png b/packages/icons/health.png new file mode 100644 index 0000000..636ad6e Binary files /dev/null and b/packages/icons/health.png differ diff --git a/packages/icons/health_boost.png b/packages/icons/health_boost.png new file mode 100644 index 0000000..684086d Binary files /dev/null and b/packages/icons/health_boost.png differ diff --git a/packages/icons/pistol.png b/packages/icons/pistol.png new file mode 100644 index 0000000..fea4049 Binary files /dev/null and b/packages/icons/pistol.png differ diff --git a/packages/icons/quad_damage.png b/packages/icons/quad_damage.png new file mode 100644 index 0000000..947e31d Binary files /dev/null and b/packages/icons/quad_damage.png differ diff --git a/packages/icons/rifle.png b/packages/icons/rifle.png new file mode 100644 index 0000000..3498f42 Binary files /dev/null and b/packages/icons/rifle.png differ diff --git a/packages/icons/rocket_launcher.png b/packages/icons/rocket_launcher.png new file mode 100644 index 0000000..6150d28 Binary files /dev/null and b/packages/icons/rocket_launcher.png differ diff --git a/packages/icons/shotgun.png b/packages/icons/shotgun.png new file mode 100644 index 0000000..4593d29 Binary files /dev/null and b/packages/icons/shotgun.png differ diff --git a/packages/icons/tiny_health.png b/packages/icons/tiny_health.png new file mode 100644 index 0000000..119c663 Binary files /dev/null and b/packages/icons/tiny_health.png differ diff --git a/packages/icons/yellow_armour.png b/packages/icons/yellow_armour.png new file mode 100644 index 0000000..5ae36eb Binary files /dev/null and b/packages/icons/yellow_armour.png differ diff --git a/src/fpsgame/entities.cpp b/src/fpsgame/entities.cpp index 63d35d0..4676ca8 100644 --- a/src/fpsgame/entities.cpp +++ b/src/fpsgame/entities.cpp @@ -1,5 +1,7 @@ #include "game.h" +int pwitemspicked[7] = { 0 }; + namespace entities { using namespace game; @@ -183,6 +185,15 @@ namespace entities } playsound(itemstats[type-I_SHELLS].sound, d!=h ? &d->o : NULL, NULL, 0, 0, 0, -1, 0, 1500); d->pickup(type); + switch(type) { + case I_TINYARMOUR: pwitemspicked[0]++; break; + case I_GREENARMOUR: pwitemspicked[1]++; break; + case I_YELLOWARMOUR: pwitemspicked[2]++; break; + case I_TINYHEALTH: pwitemspicked[3]++; break; + case I_HEALTH: pwitemspicked[4]++; break; + case I_BOOST: pwitemspicked[5]++; break; + case I_QUAD: pwitemspicked[6]++; break; + } if(d==h) switch(type) { case I_BOOST: diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp index 2f2986e..377afa3 100644 --- a/src/fpsgame/fps.cpp +++ b/src/fpsgame/fps.cpp @@ -649,6 +649,7 @@ namespace game void startmap(const char *name) // called just after a map load { + pwreset(); ai::savewaypoints(); ai::clearwaypoints(true); @@ -980,11 +981,20 @@ namespace game flushhudmatrix(); defformatstring(label, "%d", p->ammo[gun]); - int tw, th; text_bounds(label, tw, th); + int tw, th, moved, movew = 0, moveh = 0; text_bounds(label, tw, th); vec2 textdrawpos = vec2(-tw, -th).div(2); float ammoratio = (float)p->ammo[gun] / itemstats[gun-GUN_SG].add; bvec color = bvec::hexcolor(p->ammo[gun] == 0 || ammoratio >= 1.0f ? 0xFFFFFF : (ammoratio >= 0.5f ? 0xFFC040 : 0xFF0000)); draw_text(label, textdrawpos.x, textdrawpos.y, color.r, color.g, color.b, alpha); + /// ALIGN STUFF AND ADD COMMAND FOR IT... + //~text_bounds(label, movew, moveh); + //~moved = movew + 6; + //~defformatstring(damagedealt, "| %d ", pwdamagedealt[gun]); + //~draw_text(damagedealt, textdrawpos.x+moved, textdrawpos.y, color.r, color.g, color.b, alpha); + //~text_bounds(damagedealt, movew, moveh); + //~moved += movew; + //~defformatstring(accuracy, "| %d %%", pwaccuracy[gun]); + //~draw_text(accuracy, textdrawpos.x+moved, textdrawpos.y, color.r, color.g, color.b, alpha); pophudmatrix(); } diff --git a/src/fpsgame/game.h b/src/fpsgame/game.h index 3ab0447..9427864 100644 --- a/src/fpsgame/game.h +++ b/src/fpsgame/game.h @@ -268,9 +268,23 @@ static const struct guninfo { { S_RLFIRE, 800, 120, 0, 270, 10, 1024, 1, 160, 40, 0, "rocketlauncher", "rocket", 0 }, { S_RIFLE, 1200, 120, 0, 0, 30, 2048, 1, 80, 0, 0, "rifle", "rifle", 0 }, { S_FLAUNCH, 600, 90, 0, 300, 20, 1024, 1, 250, 45, 1500, "grenadelauncher", "gl", 0 }, - { S_PISTOL, 400, 60, 160, 0, 10, 1024, 1, 80, 0, 0, "pistol", "pistol", 0 }, + { S_PISTOL, 400, 60, 110, 0, 10, 1024, 1, 80, 0, 0, "pistol", "pistol", 0 }, }; +/// Rough accuracy code, client-side only. + +extern int pwshotsfired[NUMGUNS]; +extern int pwshotshit[NUMGUNS]; +extern int pwdamagedealt[NUMGUNS]; +extern int pwaccuracy[NUMGUNS]; +extern int pwavgaccuracy; +extern int pwitemspicked[7]; + +extern void pwshot(int gun); +extern void pwhit(int gun, int damage); +extern void pwcalcaccuracy(void); +extern void pwreset(void); + #include "ai.h" // inherited by fpsent and server clients @@ -318,12 +332,6 @@ struct fpsstate [[fallthrough]]; case I_YELLOWARMOUR: return maxarmour=50)return false; - //~case I_GREENARMOUR: - //~// (100h/100g only absorbs 200 damage) - //~if(armourtype==A_YELLOW && armour>=100)return false; - //~case I_YELLOWARMOUR: return !armourtype || armourarmour) ad = armour; armour -= ad; damage -= ad; diff --git a/src/fpsgame/scoreboard.cpp b/src/fpsgame/scoreboard.cpp index 40a1246..2bc82d2 100644 --- a/src/fpsgame/scoreboard.cpp +++ b/src/fpsgame/scoreboard.cpp @@ -5,15 +5,16 @@ namespace game { VARP(scoreboard2d, 0, 1, 1); VARP(showservinfo, 0, 1, 1); - VARP(showclientnum, 0, 0, 1); + VARP(showclientnum, 0, 1, 1); VARP(showpj, 0, 0, 1); VARP(showping, 0, 1, 2); VARP(showspectators, 0, 1, 1); - VARP(showspectatorping, 0, 0, 1); + VARP(showspectatorping, 0, 1, 1); VARP(highlightscore, 0, 1, 1); VARP(showconnecting, 0, 0, 1); - VARP(hidefrags, 0, 1, 1); - VARP(showdeaths, 0, 0, 1); + VARP(hidefrags, 0, 0, 1); + VARP(showdeaths, 0, 1, 1); + VARP(showdamagedealt, 0, 1, 1); static hashset teaminfos; @@ -253,13 +254,19 @@ namespace game g.poplist(); } + if(showdamagedealt) + { + g.pushlist(); + g.strut(7); + g.text("damage", fgcolor); + loopscoregroup(o, g.textf("%d", 0xFFFFDD, NULL, o->totaldamage)); + g.poplist(); + } + g.pushlist(); g.text("name", fgcolor); g.strut(12); - loopscoregroup(o, - { - g.textf("%s ", statuscolor(o, 0xFFFFDD), NULL, colorname(o)); - }); + loopscoregroup(o, { g.textf("%s ", statuscolor(o, 0xFFFFDD), NULL, colorname(o)); }); g.poplist(); if(multiplayer(false) || demoplayback) @@ -417,6 +424,28 @@ namespace game } } } + + /// PW + g.separator(); + g.pushlist(); + g.textf(" %d%% ", 0x787878, "chainsaw.png", pwaccuracy[0]); + g.textf(" %d%% ", 0xfba6a6, "shotgun.png", pwaccuracy[1]); + g.textf(" %d%% ", 0x7bc77a, "chaingun.png", pwaccuracy[2]); + g.textf(" %d%% ", 0xefd7a6, "rocket_launcher.png", pwaccuracy[3]); + g.textf(" %d%% ", 0x8f91e7, "rifle.png", pwaccuracy[4]); + g.textf(" %d%% ", 0x9ee5e5, "grenade_launcher.png", pwaccuracy[5]); + g.textf(" %d%% ", 0xc3c3c3, "pistol.png", pwaccuracy[6]); + g.poplist(); + g.separator(); + g.pushlist(); + g.textf(" x %d ", 0xffffff, "blue_armour.png", pwitemspicked[0]); + g.textf(" x %d ", 0xffffff, "green_armour.png", pwitemspicked[1]); + g.textf(" x %d ", 0xffffff, "yellow_armour.png", pwitemspicked[2]); + g.textf(" x %d ", 0xffffff, "tiny_health.png", pwitemspicked[3]); + g.textf(" x %d ", 0xffffff, "health.png", pwitemspicked[4]); + g.textf(" x %d ", 0xffffff, "health_boost.png", pwitemspicked[5]); + g.textf(" x %d ", 0xffffff, "quad_damage.png", pwitemspicked[6]); + g.poplist(); } struct scoreboardgui : g3d_callback diff --git a/src/fpsgame/weapon.cpp b/src/fpsgame/weapon.cpp index ab87ebf..f516c2e 100644 --- a/src/fpsgame/weapon.cpp +++ b/src/fpsgame/weapon.cpp @@ -363,6 +363,8 @@ namespace game if(f->type==ENT_AI || !m_mp(gamemode) || f==at) f->hitpush(damage, vel, at, gun); + pwhit(gun, damage); + if(!m_mp(gamemode)) damaged(damage, f, at); else { @@ -778,6 +780,8 @@ namespace game } if(d->gunselect) d->ammo[d->gunselect]--; + pwshot(d->gunselect); /// PW + vec from = d->o, to = targ, dir = vec(to).sub(from).safenormalize(); float dist = to.dist(from); vec kickback = vec(dir).mul(guns[d->gunselect].kickamount*-2.5f); @@ -807,8 +811,8 @@ namespace game hits.length(), hits.length()*sizeof(hitmsg)/sizeof(int), hits.getbuf()); } - d->gunwait = guns[d->gunselect].attackdelay; - if(d->gunselect == GUN_PISTOL && d->ai) d->gunwait += int(d->gunwait*(((101-d->skill)+rnd(111-d->skill))/100.f)); + d->gunwait = guns[d->gunselect].attackdelay; + if(d->gunselect == GUN_PISTOL && d->ai) d->gunwait += int(d->gunwait*(((101-d->skill)+rnd(111-d->skill))/100.f)); d->totalshots += guns[d->gunselect].damage*(d->quadmillis ? 4 : 1)*guns[d->gunselect].rays; } @@ -955,6 +959,7 @@ namespace game void updateweapons(int curtime) { updateprojectiles(curtime); + pwcalcaccuracy(); if(player1->clientnum>=0 && player1->state==CS_ALIVE) shoot(player1, worldpos); // only shoot when connected to server updatebouncers(curtime); // need to do this after the player shoots so grenades don't end up inside player's BB next frame fpsent *following = followingplayer(); @@ -983,3 +988,36 @@ namespace game } }; +/// Rough accuracy code, client-side only. + +int pwshotsfired [NUMGUNS] = { 0 }; +int pwshotshit [NUMGUNS] = { 0 }; +int pwdamagedealt [NUMGUNS] = { 0 }; +int pwaccuracy [NUMGUNS] = { 0 }; +int pwavgaccuracy = 0; + +void pwshot(int gun) { + pwshotsfired[gun]++; +} + +void pwhit(int gun, int damage) { + pwshotshit[gun]++; + pwdamagedealt[gun] += damage; +} + +void pwcalcaccuracy(void) { + pwavgaccuracy = 0; + loopi(NUMGUNS) + if(pwshotsfired[i]) + pwaccuracy[i] = (pwdamagedealt[i] * 100) / (guns[i].damage * guns[i].rays * pwshotsfired[i]); + else + pwaccuracy[i] = 0; + loopi(NUMGUNS) pwavgaccuracy += pwaccuracy[i]; + pwavgaccuracy /= NUMGUNS; +} + +void pwreset(void) { + loopi(NUMGUNS) pwshotsfired[i] = pwshotshit[i] = pwdamagedealt[i] = pwaccuracy[i] = 0; + loopi(7) pwitemspicked[i] = 0; + pwavgaccuracy = 0; +} diff --git a/temporary/action.jpg b/temporary/action.jpg new file mode 100755 index 0000000..331a14e Binary files /dev/null and b/temporary/action.jpg differ diff --git a/temporary/arrow_bw.jpg b/temporary/arrow_bw.jpg new file mode 100755 index 0000000..b2285d3 Binary files /dev/null and b/temporary/arrow_bw.jpg differ diff --git a/temporary/arrow_fw.jpg b/temporary/arrow_fw.jpg new file mode 100755 index 0000000..7c9b37d Binary files /dev/null and b/temporary/arrow_fw.jpg differ diff --git a/temporary/background.png b/temporary/background.png new file mode 100755 index 0000000..066b0d4 Binary files /dev/null and b/temporary/background.png differ diff --git a/temporary/checkbox_off.jpg b/temporary/checkbox_off.jpg new file mode 100755 index 0000000..646d1d4 Binary files /dev/null and b/temporary/checkbox_off.jpg differ diff --git a/temporary/checkbox_on.jpg b/temporary/checkbox_on.jpg new file mode 100755 index 0000000..3a96d1e Binary files /dev/null and b/temporary/checkbox_on.jpg differ diff --git a/temporary/cube.png b/temporary/cube.png new file mode 100755 index 0000000..13924e3 Binary files /dev/null and b/temporary/cube.png differ diff --git a/temporary/exit.jpg b/temporary/exit.jpg new file mode 100755 index 0000000..0b26631 Binary files /dev/null and b/temporary/exit.jpg differ diff --git a/temporary/guicursor.png b/temporary/guicursor.png new file mode 100755 index 0000000..71c0fb4 Binary files /dev/null and b/temporary/guicursor.png differ diff --git a/temporary/guioverlay.png b/temporary/guioverlay.png new file mode 100755 index 0000000..e7888e4 Binary files /dev/null and b/temporary/guioverlay.png differ diff --git a/temporary/guiskin.png b/temporary/guiskin.png new file mode 100755 index 0000000..225e13c Binary files /dev/null and b/temporary/guiskin.png differ diff --git a/temporary/guislider.png b/temporary/guislider.png new file mode 100755 index 0000000..36eb8e6 Binary files /dev/null and b/temporary/guislider.png differ diff --git a/temporary/info.jpg b/temporary/info.jpg new file mode 100755 index 0000000..3baf731 Binary files /dev/null and b/temporary/info.jpg differ diff --git a/temporary/items.png b/temporary/items.png new file mode 100755 index 0000000..d014c3d Binary files /dev/null and b/temporary/items.png differ diff --git a/temporary/loading_bar.png b/temporary/loading_bar.png new file mode 100755 index 0000000..1e2cb4c Binary files /dev/null and b/temporary/loading_bar.png differ diff --git a/temporary/loading_frame.png b/temporary/loading_frame.png new file mode 100755 index 0000000..5d8cd4b Binary files /dev/null and b/temporary/loading_frame.png differ diff --git a/temporary/logo.png b/temporary/logo.png new file mode 100755 index 0000000..5b0abe8 Binary files /dev/null and b/temporary/logo.png differ diff --git a/temporary/logo_1024.png b/temporary/logo_1024.png new file mode 100755 index 0000000..e56c00a Binary files /dev/null and b/temporary/logo_1024.png differ diff --git a/temporary/mapshot_frame.png b/temporary/mapshot_frame.png new file mode 100755 index 0000000..e7888e4 Binary files /dev/null and b/temporary/mapshot_frame.png differ diff --git a/temporary/menu.jpg b/temporary/menu.jpg new file mode 100755 index 0000000..7c9b37d Binary files /dev/null and b/temporary/menu.jpg differ diff --git a/temporary/mrfixit.jpg b/temporary/mrfixit.jpg new file mode 100755 index 0000000..ab620d0 Binary files /dev/null and b/temporary/mrfixit.jpg differ diff --git a/temporary/mrfixit_blue.jpg b/temporary/mrfixit_blue.jpg new file mode 100755 index 0000000..b136aac Binary files /dev/null and b/temporary/mrfixit_blue.jpg differ diff --git a/temporary/mrfixit_red.jpg b/temporary/mrfixit_red.jpg new file mode 100755 index 0000000..3c57dca Binary files /dev/null and b/temporary/mrfixit_red.jpg differ diff --git a/temporary/radio_off.jpg b/temporary/radio_off.jpg new file mode 100755 index 0000000..7d6280e Binary files /dev/null and b/temporary/radio_off.jpg differ diff --git a/temporary/radio_on.jpg b/temporary/radio_on.jpg new file mode 100755 index 0000000..c90fb2b Binary files /dev/null and b/temporary/radio_on.jpg differ diff --git a/temporary/server.jpg b/temporary/server.jpg new file mode 100755 index 0000000..384a3c2 Binary files /dev/null and b/temporary/server.jpg differ diff --git a/temporary/serverfull.jpg b/temporary/serverfull.jpg new file mode 100755 index 0000000..4d71200 Binary files /dev/null and b/temporary/serverfull.jpg differ diff --git a/temporary/serverlock.jpg b/temporary/serverlock.jpg new file mode 100755 index 0000000..7216db7 Binary files /dev/null and b/temporary/serverlock.jpg differ diff --git a/temporary/serverpriv.jpg b/temporary/serverpriv.jpg new file mode 100755 index 0000000..514228f Binary files /dev/null and b/temporary/serverpriv.jpg differ diff --git a/temporary/serverunk.jpg b/temporary/serverunk.jpg new file mode 100755 index 0000000..3efe1e2 Binary files /dev/null and b/temporary/serverunk.jpg differ diff --git a/temporary/spectator.jpg b/temporary/spectator.jpg new file mode 100755 index 0000000..05e0e21 Binary files /dev/null and b/temporary/spectator.jpg differ