From 4888f72ef341da2220acd7dd73cc1b6945612549 Mon Sep 17 00:00:00 2001 From: Vortex-Quake2 Date: Tue, 3 Jan 2023 09:27:12 -0500 Subject: [PATCH] Poltergeist now receives 50 cells on respawn/death, and power screen will automatically activate for berserker and brain morphs. Modified initial and addon health/armor/powercubes to be closer aligned to v4.8; in particular, engineer and knight start with 100 armor (they both have armor-focused abilities). --- lua/variables.lua | 138 +++++++++++++++++------------------ src/combat/common/v_client.c | 22 +++++- src/combat/common/v_misc.c | 2 +- src/quake2/p_client.c | 1 + src/v_shared.h | 2 + 5 files changed, 92 insertions(+), 73 deletions(-) diff --git a/lua/variables.lua b/lua/variables.lua index a170515..7fea84e 100644 --- a/lua/variables.lua +++ b/lua/variables.lua @@ -54,76 +54,74 @@ SPREE_BREAKBONUS = 100 MONSTER_MASTERY_FACTOR = 0.04 -- Character basics -INITIAL_POWERCUBES_ALIEN = 200 -LEVELUP_POWERCUBES_ALIEN = 10 -INITIAL_ARMOR_CLERIC = 50 - -INITIAL_HEALTH_CLERIC = 100 -LEVELUP_HEALTH_CLERIC = 5 -INITIAL_ARMOR_SHAMAN = 50 - -INITIAL_HEALTH_SHAMAN = 100 -LEVELUP_HEALTH_SHAMAN = 5 -INITIAL_ARMOR_NECROMANCER = 50 -LEVELUP_ARMOR_NECROMANCER = 1 -INITIAL_HEALTH_NECROMANCER = 100 -LEVELUP_HEALTH_NECROMANCER = 1 -INITIAL_HEALTH_SOLDIER = 100 -INITIAL_HEALTH_ENGINEER = 100 -INITIAL_HEALTH_VAMPIRE = 100 -INITIAL_HEALTH_POLTERGEIST = 100 -INITIAL_HEALTH_ALIEN = 100 -INITIAL_HEALTH_KNIGHT = 100 -INITIAL_HEALTH_MAGE = 100 -INITIAL_HEALTH_WEAPONMASTER = 100 -LEVELUP_HEALTH_SOLDIER = 1 -LEVELUP_HEALTH_ENGINEER = 2 -LEVELUP_HEALTH_VAMPIRE = 8 -LEVELUP_HEALTH_POLTERGEIST = 5 -LEVELUP_HEALTH_ALIEN = 5 -LEVELUP_HEALTH_KNIGHT = 6 -LEVELUP_HEALTH_MAGE = 5 -LEVELUP_HEALTH_WEAPONMASTER = 2 -INITIAL_ARMOR_SOLDIER = 35 -INITIAL_ARMOR_ENGINEER = 35 -INITIAL_ARMOR_VAMPIRE = 25 -INITIAL_ARMOR_POLTERGEIST = 0 -INITIAL_ARMOR_ALIEN = 30 -INITIAL_ARMOR_KNIGHT = 25 -INITIAL_ARMOR_MAGE = 75 -INITIAL_ARMOR_WEAPONMASTER = 50 -LEVELUP_ARMOR_SOLDIER = 5 -LEVELUP_ARMOR_ENGINEER = 6 -LEVELUP_ARMOR_POLTERGEIST = 0 -LEVELUP_ARMOR_ALIEN = 4 -LEVELUP_ARMOR_KNIGHT = 10 -LEVELUP_ARMOR_MAGE = 4 -LEVELUP_ARMOR_WEAPONMASTER = 4 -LEVELUP_ARMOR_VAMPIRE = 4 -LEVELUP_ARMOR_SHAMAN = 4 -LEVELUP_ARMOR_CLERIC = 5 - -INITIAL_POWERCUBES_SOLDIER = 200 -LEVELUP_POWERCUBES_SOLDIER = 10 -INITIAL_POWERCUBES_VAMPIRE = 200 -LEVELUP_POWERCUBES_VAMPIRE = 10 -INITIAL_POWERCUBES_KNIGHT = 200 -LEVELUP_POWERCUBES_KNIGHT = 10 -INITIAL_POWERCUBES_MAGE = 200 -LEVELUP_POWERCUBES_MAGE = 30 -INITIAL_POWERCUBES_POLTERGEIST = 200 -LEVELUP_POWERCUBES_POLTERGEIST = 10 -INITIAL_POWERCUBES_ENGINEER = 200 -LEVELUP_POWERCUBES_ENGINEER = 15 -INITIAL_POWERCUBES_WEAPONMASTER = 200 -LEVELUP_POWERCUBES_WEAPONMASTER = 10 -INITIAL_POWERCUBES_CLERIC = 200 -LEVELUP_POWERCUBES_CLERIC = 10 -INITIAL_POWERCUBES_SHAMAN = 200 -LEVELUP_POWERCUBES_SHAMAN = 10 -INITIAL_POWERCUBES_NECROMANCER = 200 -LEVELUP_POWERCUBES_NECROMANCER = 10 - +INITIAL_POWERCUBES_ALIEN = 200 +LEVELUP_POWERCUBES_ALIEN = 10 +INITIAL_POWERCUBES_SOLDIER = 200 +LEVELUP_POWERCUBES_SOLDIER = 10 +INITIAL_POWERCUBES_VAMPIRE = 200 +LEVELUP_POWERCUBES_VAMPIRE = 10 +INITIAL_POWERCUBES_KNIGHT = 200 +LEVELUP_POWERCUBES_KNIGHT = 10 +INITIAL_POWERCUBES_MAGE = 200 +LEVELUP_POWERCUBES_MAGE = 30 +INITIAL_POWERCUBES_POLTERGEIST = 200 +LEVELUP_POWERCUBES_POLTERGEIST = 10 +INITIAL_POWERCUBES_ENGINEER = 200 +LEVELUP_POWERCUBES_ENGINEER = 10 +INITIAL_POWERCUBES_WEAPONMASTER = 200 +LEVELUP_POWERCUBES_WEAPONMASTER = 10 +INITIAL_POWERCUBES_CLERIC = 200 +LEVELUP_POWERCUBES_CLERIC = 10 +INITIAL_POWERCUBES_SHAMAN = 200 +LEVELUP_POWERCUBES_SHAMAN = 10 +INITIAL_POWERCUBES_NECROMANCER = 200 +LEVELUP_POWERCUBES_NECROMANCER = 10 + +INITIAL_HEALTH_CLERIC = 100 +LEVELUP_HEALTH_CLERIC = 5 +INITIAL_HEALTH_SHAMAN = 100 +LEVELUP_HEALTH_SHAMAN = 5 +INITIAL_HEALTH_NECROMANCER = 100 +LEVELUP_HEALTH_NECROMANCER = 1 +INITIAL_HEALTH_SOLDIER = 100 +LEVELUP_HEALTH_SOLDIER = 1 +INITIAL_HEALTH_ENGINEER = 100 +LEVELUP_HEALTH_ENGINEER = 2 +INITIAL_HEALTH_VAMPIRE = 100 +LEVELUP_HEALTH_VAMPIRE = 5 +INITIAL_HEALTH_POLTERGEIST = 100 +LEVELUP_HEALTH_POLTERGEIST = 5 +INITIAL_HEALTH_ALIEN = 100 +LEVELUP_HEALTH_ALIEN = 5 +INITIAL_HEALTH_KNIGHT = 100 +LEVELUP_HEALTH_KNIGHT = 5 +INITIAL_HEALTH_MAGE = 100 +LEVELUP_HEALTH_MAGE = 5 +INITIAL_HEALTH_WEAPONMASTER = 100 +LEVELUP_HEALTH_WEAPONMASTER = 1 + +INITIAL_ARMOR_NECROMANCER = 50 +LEVELUP_ARMOR_NECROMANCER = 0 +INITIAL_ARMOR_SOLDIER = 50 +LEVELUP_ARMOR_SOLDIER = 2 +INITIAL_ARMOR_ENGINEER = 100 +LEVELUP_ARMOR_ENGINEER = 5 +INITIAL_ARMOR_VAMPIRE = 50 +LEVELUP_ARMOR_VAMPIRE = 0 +INITIAL_ARMOR_POLTERGEIST = 0 +LEVELUP_ARMOR_POLTERGEIST = 0 +INITIAL_ARMOR_ALIEN = 50 +LEVELUP_ARMOR_ALIEN = 0 +INITIAL_ARMOR_KNIGHT = 100 +LEVELUP_ARMOR_KNIGHT = 10 +INITIAL_ARMOR_MAGE = 50 +LEVELUP_ARMOR_MAGE = 0 +INITIAL_ARMOR_WEAPONMASTER = 50 +LEVELUP_ARMOR_WEAPONMASTER = 0 +INITIAL_ARMOR_SHAMAN = 50 +LEVELUP_ARMOR_SHAMAN = 2 +INITIAL_ARMOR_CLERIC = 50 +LEVELUP_ARMOR_CLERIC = 2 -- Tballs TBALLS_RESPAWN = 2 diff --git a/src/combat/common/v_client.c b/src/combat/common/v_client.c index a4d1f6c..62ad5fc 100644 --- a/src/combat/common/v_client.c +++ b/src/combat/common/v_client.c @@ -76,8 +76,14 @@ void vrx_add_respawn_items(edict_t *ent) { ent->client->pers.inventory[ITEM_INDEX(Fdi_TBALL)] = ent->myskills.inventory[ITEM_INDEX( Fdi_TBALL)] += TBALLS_RESPAWN; - if ((ent->myskills.class_num == CLASS_POLTERGEIST) && (ent->client->pers.inventory[power_cube_index] < 50)) - ent->client->pers.inventory[power_cube_index] += 50; + // poltergeist always spawns with at least 50 power cubes (for morphing) and cells (for power screen) + if (ent->myskills.class_num == CLASS_POLTERGEIST) + { + if (ent->client->pers.inventory[power_cube_index] < 50) + ent->client->pers.inventory[power_cube_index] = 50; + if (ent->client->pers.inventory[cell_index] < 50) + ent->client->pers.inventory[cell_index] = 50; + } else ent->client->pers.inventory[ITEM_INDEX(Fdi_POWERCUBE)] = ent->myskills.inventory[ITEM_INDEX( Fdi_POWERCUBE)] += POWERCUBES_RESPAWN; @@ -283,4 +289,16 @@ void vrx_pick_respawn_weapon(edict_t *ent) { ent->client->newweapon = item; ChangeWeapon(ent); +} + +void Use_PowerArmor(edict_t* ent, gitem_t* item); + +void vrx_morph_think(edict_t* ent) +{ + // only valid player-morphs should be calling this function + if (!ent || !ent->inuse || !ent->client || !ent->mtype) + return; + // activate power screen for berserk and brain automatically when player has cells for it + if ((ent->mtype == MORPH_BERSERK || ent->mtype == MORPH_BRAIN) && ent->client->pers.inventory[cell_index] && !(ent->flags & FL_POWER_ARMOR)) + Use_PowerArmor(ent, NULL); } \ No newline at end of file diff --git a/src/combat/common/v_misc.c b/src/combat/common/v_misc.c index a12475d..92dacdc 100644 --- a/src/combat/common/v_misc.c +++ b/src/combat/common/v_misc.c @@ -671,4 +671,4 @@ void ThrowShrapnel(edict_t* self, char* modelname, float speed, vec3_t origin, i else chunk->creator = self; gi.linkentity(chunk); -} \ No newline at end of file +} diff --git a/src/quake2/p_client.c b/src/quake2/p_client.c index b0947af..0eb8633 100644 --- a/src/quake2/p_client.c +++ b/src/quake2/p_client.c @@ -2867,6 +2867,7 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd) RunBerserkFrames(ent, ucmd); EatCorpses(ent); UpdateMirroredEntities(ent); + vrx_morph_think(ent); } // az: this code has been a little redundant in places diff --git a/src/v_shared.h b/src/v_shared.h index 2acf1c3..cf28289 100644 --- a/src/v_shared.h +++ b/src/v_shared.h @@ -214,6 +214,8 @@ void V_GibSound(edict_t *self, int index); void vrx_player_death(edict_t *self, edict_t *attacker, edict_t *inflictor); +void vrx_morph_think(edict_t* ent); + //************ vote.c ************* void CheckPlayerVotes(void); void V_ChangeMap(v_maplist_t *maplist, int mapindex, int gamemode);