From 4446715aafef52cfc792298fcd25ce3af6929ca8 Mon Sep 17 00:00:00 2001 From: otta8634 Date: Sat, 17 May 2025 15:14:41 +0800 Subject: [PATCH] Add default values to most Items guide entries Knowing how much health/armor you get from a MA/MH and whatnot seems useful for a newbie. Same for ammo from ammo pickups. --- qcsrc/common/items/item/ammo.qc | 4 ++++ qcsrc/common/items/item/armor.qc | 21 +++++++++++++-------- qcsrc/common/items/item/health.qc | 21 +++++++++++++-------- qcsrc/common/items/item/jetpack.qc | 5 ++++- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/qcsrc/common/items/item/ammo.qc b/qcsrc/common/items/item/ammo.qc index 24f76b60e6..a6d6662fe2 100644 --- a/qcsrc/common/items/item/ammo.qc +++ b/qcsrc/common/items/item/ammo.qc @@ -11,6 +11,10 @@ METHOD(Ammo, describe, string(Ammo this)) FOREACH(Weapons, it.ammo_type == ammo, { s = strcat(s, "\n ", COLORED_NAME(it)); }); + const string nname = this.netname == "bullets" ? "nails" : this.netname; + s = sprintf(_("%s\n\nBy default, the pickup gives you %s ammo, to a maximum of %s."), + s, cvar_defstring(strcat("g_pickup_", nname)), cvar_defstring(sprintf("g_pickup_%s_max", nname))); + // TODO: rename all *nails* cvars to bullets return s; } #endif diff --git a/qcsrc/common/items/item/armor.qc b/qcsrc/common/items/item/armor.qc index 737939ee12..150d410828 100644 --- a/qcsrc/common/items/item/armor.qc +++ b/qcsrc/common/items/item/armor.qc @@ -3,28 +3,31 @@ #ifdef MENUQC #include +#define DEFAULT_PICKUP_ARMOR(s) \ + sprintf(_("By default, the pickup gives you %s armor."), cvar_defstring(strcat("g_pickup_armor", s))) + METHOD(ArmorSmall, describe, string(ArmorSmall this)) { TC(ArmorSmall, this); return sprintf(_("The %s provides you a small amount of armor when picked up, " - "protecting you from damage by absorbing incoming hits until it is depleted."), - COLORED_NAME(this)); + "protecting you from damage by absorbing incoming hits until it is depleted.\n\n%s"), + COLORED_NAME(this), DEFAULT_PICKUP_ARMOR("small")); } METHOD(ArmorMedium, describe, string(ArmorMedium this)) { TC(ArmorMedium, this); return sprintf(_("The %s provides you a medium amount of armor when picked up, " - "protecting you from damage by absorbing incoming hits until it is depleted."), - COLORED_NAME(this)); + "protecting you from damage by absorbing incoming hits until it is depleted.\n\n%s"), + COLORED_NAME(this), DEFAULT_PICKUP_ARMOR("medium")); } METHOD(ArmorBig, describe, string(ArmorBig this)) { TC(ArmorBig, this); return sprintf(_("The %s provides you a large amount of armor when picked up, " - "protecting you from damage by absorbing incoming hits until it is depleted."), - COLORED_NAME(this)); + "protecting you from damage by absorbing incoming hits until it is depleted.\n\n%s"), + COLORED_NAME(this), DEFAULT_PICKUP_ARMOR("big")); } METHOD(ArmorMega, describe, string(ArmorMega this)) @@ -32,7 +35,9 @@ METHOD(ArmorMega, describe, string(ArmorMega this)) TC(ArmorMega, this); return sprintf(_("The %s provides you a huge amount of armor when picked up, " "protecting you from damage by absorbing incoming hits until it is depleted.\n\n" - "It tends to be one of the most highly contested items on a map, particularly in game modes like %s."), - COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL)); + "It tends to be one of the most highly contested items on a map, particularly in game modes like %s.\n\n%s"), + COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL), DEFAULT_PICKUP_ARMOR("mega")); } + +#undef DEFAULT_PICKUP_ARMOR #endif diff --git a/qcsrc/common/items/item/health.qc b/qcsrc/common/items/item/health.qc index 8f48e81ef3..e2408077db 100644 --- a/qcsrc/common/items/item/health.qc +++ b/qcsrc/common/items/item/health.qc @@ -3,28 +3,31 @@ #ifdef MENUQC #include +#define DEFAULT_PICKUP_HEALTH(s) \ + sprintf(_("By default, the pickup gives you %s health."), cvar_defstring(strcat("g_pickup_health", s))) + METHOD(HealthSmall, describe, string(HealthSmall this)) { TC(HealthSmall, this); return sprintf(_("The %s restores a small amount of health when picked up, " - "helping you recover from damage taken during combat."), - COLORED_NAME(this)); + "helping you recover from damage taken during combat.\n\n%s"), + COLORED_NAME(this), DEFAULT_PICKUP_HEALTH("small")); } METHOD(HealthMedium, describe, string(HealthMedium this)) { TC(HealthMedium, this); return sprintf(_("The %s restores a medium amount of health when picked up, " - "helping you recover from damage taken during combat."), - COLORED_NAME(this)); + "helping you recover from damage taken during combat.\n\n%s"), + COLORED_NAME(this), DEFAULT_PICKUP_HEALTH("medium")); } METHOD(HealthBig, describe, string(HealthBig this)) { TC(HealthBig, this); return sprintf(_("The %s restores a large amount of health when picked up, " - "helping you recover from damage taken during combat."), - COLORED_NAME(this)); + "helping you recover from damage taken during combat.\n\n%s"), + COLORED_NAME(this), DEFAULT_PICKUP_HEALTH("big")); } METHOD(HealthMega, describe, string(HealthMega this)) @@ -32,7 +35,9 @@ METHOD(HealthMega, describe, string(HealthMega this)) TC(HealthMega, this); return sprintf(_("The %s restores a huge amount of health when picked up, " "helping you recover from damage taken during combat.\n\n" - "It tends to be one of the most highly contested items on a map, particularly in game modes like %s."), - COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL)); + "It tends to be one of the most highly contested items on a map, particularly in game modes like %s.\n\n%s"), + COLORED_NAME(this), COLORED_NAME(MAPINFO_TYPE_DUEL), DEFAULT_PICKUP_HEALTH("mega")); } + +#undef DEFAULT_PICKUP_HEALTH #endif diff --git a/qcsrc/common/items/item/jetpack.qc b/qcsrc/common/items/item/jetpack.qc index 9370e7c03c..fc9cea992a 100644 --- a/qcsrc/common/items/item/jetpack.qc +++ b/qcsrc/common/items/item/jetpack.qc @@ -29,8 +29,11 @@ METHOD(Jetpack, describe, string(Jetpack this)) METHOD(JetpackFuel, describe, string(JetpackFuel this)) { TC(JetpackFuel, this); - return sprintf(_("The %s ammo type is used by the %s."), + string s = sprintf(_("The %s ammo type is used by the %s."), COLORED_NAME(this), COLORED_NAME(ITEM_Jetpack)); + s = sprintf(_("%s\n\nBy default, the pickup gives you %s ammo, to a maximum of %s."), + s, cvar_defstring("g_pickup_fuel"), cvar_defstring("g_pickup_fuel_max")); + return s; } METHOD(JetpackRegen, describe, string(JetpackRegen this)) -- 2.39.5