Skip to content

Commit

Permalink
Japro update (JACoders#95)
Browse files Browse the repository at this point in the history
* tribesclass health rework

(cherry picked from commit 357c126)

* fix

(cherry picked from commit 855660c)

* tribes health regen, armor pickup fix

(cherry picked from commit 447f09e)

* tribes light mass fix, regen fix, kb fix

(cherry picked from commit 53256b9)

* fix health scaling, kb

(cherry picked from commit 12778a9)

* protect fix

(cherry picked from commit cccf7c0)

* dmg tribesmode tweaks

(cherry picked from commit 659233a)

* tribes weps

(cherry picked from commit d3bc705)

* crashfix, npc damage fix

(cherry picked from commit 09b8aae)

* vehicle damage scaling

(cherry picked from commit 0d6861c)

* better npc health fix

(cherry picked from commit c0bb404)

* Fixup warnings

* [jaPRO clientside] CG_Missile tweaks

---------

Co-authored-by: videoP <videoprofess@gmail.com>
  • Loading branch information
taysta and videoP authored Jan 15, 2024
1 parent f8a6189 commit 7629ca8
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 150 deletions.
43 changes: 36 additions & 7 deletions codemp/cgame/cg_ents.c
Original file line number Diff line number Diff line change
Expand Up @@ -2791,7 +2791,7 @@ static void CG_Missile( centity_t *cent ) {
return;
}
else if ((cgs.serverMod == SVMOD_JAPRO && cent->currentState.weapon == WP_BRYAR_PISTOL && cent->currentState.saberInFlight) ||
(cgs.serverMod == SVMOD_JAPLUS && cent->currentState.weapon == WP_STUN_BATON))
(cgs.serverMod == SVMOD_JAPLUS && cent->currentState.weapon == WP_STUN_BATON))
{
CG_GrappleTrail(cent);
return;
Expand Down Expand Up @@ -2896,14 +2896,22 @@ static void CG_Missile( centity_t *cent ) {
// add trails
if ( weapon->altMissileTrailFunc )
{
weapon->altMissileTrailFunc( cent, weapon );
if (cent->currentState.pos.trType == TR_GRAVITY) {
float speed = 800 * ((cg.time - s1->pos.trTime) * 0.001f);
cent->currentState.pos.trDelta[2] -= speed;
weapon->missileTrailFunc(cent, weapon);
cent->currentState.pos.trDelta[2] += speed;
}
else {
weapon->altMissileTrailFunc(cent, weapon);
}
}

// add dynamic light
if ( weapon->altMissileDlight )
{
trap->R_AddLightToScene(cent->lerpOrigin, weapon->altMissileDlight,
weapon->altMissileDlightColor[0], weapon->altMissileDlightColor[1], weapon->altMissileDlightColor[2] );
weapon->altMissileDlightColor[0], weapon->altMissileDlightColor[1], weapon->altMissileDlightColor[2] );
}

// add missile sound
Expand All @@ -2924,14 +2932,23 @@ static void CG_Missile( centity_t *cent ) {
// add trails
if ( weapon->missileTrailFunc )
{
weapon->missileTrailFunc( cent, weapon );
if (cent->currentState.pos.trType == TR_GRAVITY) {
float speed = 800 * ((cg.time - s1->pos.trTime) * 0.001f);
cent->currentState.pos.trDelta[2] -= speed;
weapon->missileTrailFunc(cent, weapon);
cent->currentState.pos.trDelta[2] += speed;
}
else {
weapon->missileTrailFunc(cent, weapon);
}
//Scale this how?
}

// add dynamic light
if ( weapon->missileDlight )
{
trap->R_AddLightToScene(cent->lerpOrigin, weapon->missileDlight,
weapon->missileDlightColor[0], weapon->missileDlightColor[1], weapon->missileDlightColor[2] );
weapon->missileDlightColor[0], weapon->missileDlightColor[1], weapon->missileDlightColor[2] );
}

// add missile sound
Expand Down Expand Up @@ -2999,8 +3016,20 @@ Ghoul2 Insert End
if ( s1->apos.trType != TR_INTERPOLATE )
{
// convert direction of travel into axis
if ( VectorNormalize2( s1->pos.trDelta, ent.axis[0] ) == 0 ) {
ent.axis[0][2] = 1;
if (s1->pos.trType == TR_GRAVITY) {
float speed = 800*((cg.time - s1->pos.trTime) * 0.001f);
vec3_t fakeDelta;
VectorCopy(s1->pos.trDelta, fakeDelta);
fakeDelta[2] -= speed;

if (VectorNormalize2(fakeDelta, ent.axis[0]) == 0) {
ent.axis[0][2] = 1;
}
}
else {
if (VectorNormalize2(s1->pos.trDelta, ent.axis[0]) == 0) {
ent.axis[0][2] = 1;
}
}

// spin as it moves
Expand Down
2 changes: 2 additions & 0 deletions codemp/game/FighterNPC.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ void FighterYawAdjust(Vehicle_t *pVeh, playerState_t *riderPS, playerState_t *pa
{
angDif = -maxDif;
}
//pVeh->m_vOrientation[YAW] = (AngleSubtract(pVeh->m_vOrientation[YAW], (angDif*(pVeh->m_fTimeModifier*0.2f))));
pVeh->m_vOrientation[YAW] = AngleNormalize180(pVeh->m_vOrientation[YAW] - (angDif*(pVeh->m_fTimeModifier*0.2f)) );
}
}
Expand Down Expand Up @@ -1187,6 +1188,7 @@ void FighterPitchAdjust(Vehicle_t *pVeh, playerState_t *riderPS, playerState_t *
{
angDif = -maxDif;
}
//pVeh->m_vOrientation[PITCH] = (AngleSubtract(pVeh->m_vOrientation[PITCH], (angDif*(pVeh->m_fTimeModifier*0.2f))));
pVeh->m_vOrientation[PITCH] = AngleNormalize180(pVeh->m_vOrientation[PITCH] - (angDif*(pVeh->m_fTimeModifier*0.2f)) );
}
}
Expand Down
2 changes: 2 additions & 0 deletions codemp/game/NPC_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,8 @@ qboolean NPC_ParseParms( const char *NPCName, gentity_t *NPC )
}
if ( NPC->NPC )
{
if (g_tribesMode.integer)
n *= 5;
stats->health = n;
}
else if ( parsingPlayer )
Expand Down
9 changes: 8 additions & 1 deletion codemp/game/bg_slidemove.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ void PM_VehicleImpact(bgEntity_t *pEnt, trace_t *trace)
if (pSelfVeh->m_pVehicleInfo->type == VH_FIGHTER)
{ //player die good.. if me fighter
if (g_tweakWeapons.integer & WT_TRIBES)
pmult = 7.0f;
pmult = 7.0f * g_weaponDamageScale.value;
else
pmult = 2000.0f;
}
Expand Down Expand Up @@ -858,8 +858,12 @@ qboolean PM_SlideMove( qboolean gravity ) {
int damage;
VectorSubtract(g_entities[trace.entityNum].client->ps.velocity, pm->ps->velocity, diffVelocity);
damage = VectorLength(diffVelocity);

damage *= 0.049f;
if (damage > 30 && g_entities[trace.entityNum].client->lastKickTime < level.time) { //Debounce as well
if (g_tribesMode.integer)
damage *= 0.2f;

damage -= 30;
if (damage > 150)
damage = 150;
Expand All @@ -869,6 +873,9 @@ qboolean PM_SlideMove( qboolean gravity ) {
else
G_Sound((gentity_t *)pm_entSelf, CHAN_AUTO, G_SoundIndex("sound/effects/body_slam2.mp3"));

if (g_tribesMode.integer)
damage *= 5;

G_Damage((gentity_t *)pm_entSelf, &g_entities[trace.entityNum], &g_entities[trace.entityNum], NULL, pm->ps->origin, damage, 0, MOD_MELEE);//FIXME: MOD_IMPACT
//Com_Printf("Protector speed: %2f, Target speed %.2f, Diff speed %.2f, damage %i\n", VectorLength(g_entities[trace.entityNum].s.pos.trDelta), VectorLength(pm->ps->velocity), VectorLength(diffVelocity), damage);
g_entities[trace.entityNum].client->lastKickTime = level.time + 500;
Expand Down
13 changes: 0 additions & 13 deletions codemp/game/g_active.c
Original file line number Diff line number Diff line change
Expand Up @@ -4301,24 +4301,11 @@ void ClientThink_real( gentity_t *ent ) {
client->ps.speed *= 1.28f;

if (!client->ps.stats[STAT_RACEMODE]) {
if (!g_tribesClass.integer)
client->pers.tribesClass = 0;
else if (!client->pers.tribesClass)
client->pers.tribesClass = 1;

if (client->pers.tribesClass == 1) {
client->ps.speed *= 1.05f;
client->ps.iModelScale = 94;
VectorSet(ent->modelScale, 0.92f, 0.94f, 0.94f);
VectorScale(ent->r.mins, 0.94f, ent->r.mins);
VectorScale(ent->r.maxs, 0.94f, ent->r.maxs);
}
if (client->pers.tribesClass == 3) {
client->ps.speed *= 0.78125f;
client->ps.iModelScale = 125;
VectorSet(ent->modelScale, 1.25f, 1.25f, 1.25f);
VectorScale(ent->r.mins, 1.25f, ent->r.mins);
VectorScale(ent->r.maxs, 1.25f, ent->r.maxs);
}
} //Tribesclass = 0 else?

Expand Down
122 changes: 82 additions & 40 deletions codemp/game/g_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2259,37 +2259,46 @@ void G_ValidateCosmetics(gclient_t *client, char *cosmeticString, size_t cosmeti
}


void DetectTribesClass(gentity_t *ent, const char *model) {
void DetectTribesClass(gentity_t *ent, char *model) {
//WT_TRIBES
if (!ent || !ent->client)
return;
if (g_tribesClass.integer && (!ent->client->sess.raceMode || (level.gametype >= GT_TEAM && ent->client->sess.sessionTeam > TEAM_FREE))) {
if (!Q_strncmp("tribesheavy", model, 16) || !Q_strncmp("reborn_twin", model, 11) || !Q_strncmp("reelo", model, 5) || !Q_strncmp("noghri", model, 6) || !Q_strncmp("rax_joris", model, 9)) {
//Com_Printf("Detetcting heavy\n");
if (ent->client->pers.tribesClass != 3) {
if (ent->health > 0 && ent->client->sess.sessionTeam != TEAM_SPECTATOR)
G_Kill(ent);
ent->client->pers.tribesClass = 3;
trap->SendServerCommand(ent - g_entities, va("print \"Spawning as Tribes heavy class\n\""));
if (!ent->client->sess.raceMode || (level.gametype >= GT_TEAM && ent->client->sess.sessionTeam > TEAM_FREE)) {
Q_strlwr(model);
if (g_tribesMode.integer == 1) {
if (!Q_strncmp("tribesheavy", model, 16) || !Q_strncmp("reborn_twin", model, 11) || !Q_strncmp("reelo", model, 5) || !Q_strncmp("noghri", model, 6) || !Q_strncmp("rax_joris", model, 9)) {
//Com_Printf("Detetcting heavy\n");
if (ent->client->pers.tribesClass != 3) {
if (ent->health > 0 && ent->client->sess.sessionTeam != TEAM_SPECTATOR)
G_Kill(ent);
ent->client->pers.tribesClass = 3;
trap->SendServerCommand(ent - g_entities, va("print \"Spawning as Tribes heavy class\n\""));
}
}
}
else if (!Q_strncmp("tavion_new", model, 10) || !Q_strncmp("tavion", model, 6) || !Q_strncmp("jan", model, 3) || !Q_strncmp("alora", model, 5) || !Q_strncmp("alora2", model, 6) || !Q_strncmp("jedi_tf", model, 7) || !Q_strncmp("jedi_zf", model, 7) || !Q_strncmp("jedi_hf", model, 7)) {
//Com_Printf("Detetcting heavy\n");
if (ent->client->pers.tribesClass != 1) {
if (ent->health > 0 && ent->client->sess.sessionTeam != TEAM_SPECTATOR)
G_Kill(ent);
ent->client->pers.tribesClass = 1;
trap->SendServerCommand(ent - g_entities, va("print \"Spawning as Tribes light class\n\""));
else if (!Q_strncmp("tavion_new", model, 10) || !Q_strncmp("tavion", model, 6) || !Q_strncmp("jan", model, 3) || !Q_strncmp("alora", model, 5) || !Q_strncmp("alora2", model, 6) || !Q_strncmp("jedi_tf", model, 7) || !Q_strncmp("jedi_zf", model, 7) || !Q_strncmp("jedi_hf", model, 7)) {
//Com_Printf("Detetcting heavy\n");
if (ent->client->pers.tribesClass != 1) {
if (ent->health > 0 && ent->client->sess.sessionTeam != TEAM_SPECTATOR)
G_Kill(ent);
ent->client->pers.tribesClass = 1;
trap->SendServerCommand(ent - g_entities, va("print \"Spawning as Tribes light class\n\""));
}
}
else {
//Com_Printf("Detetcting medium \n");
if (ent->client->pers.tribesClass != 2) {
if (ent->health > 0 && ent->client->sess.sessionTeam != TEAM_SPECTATOR)
G_Kill(ent);
ent->client->pers.tribesClass = 2;
trap->SendServerCommand(ent - g_entities, va("print \"Spawning as Tribes medium class\n\""));
}
}
}
else {
//Com_Printf("Detetcting medium \n");
if (ent->client->pers.tribesClass != 2) {
if (ent->health > 0 && ent->client->sess.sessionTeam != TEAM_SPECTATOR)
G_Kill(ent);
ent->client->pers.tribesClass = 2;
trap->SendServerCommand(ent - g_entities, va("print \"Spawning as Tribes medium class\n\""));
}
trap->SendServerCommand(ent - g_entities, va("print \"Spawning as non tribes class\n\""));
ent->client->pers.tribesClass = 0;
if (ent->health > 0 && ent->client->sess.sessionTeam != TEAM_SPECTATOR)
G_Kill(ent);
}
}
}
Expand Down Expand Up @@ -2519,7 +2528,7 @@ qboolean ClientUserinfoChanged( int clientNum ) { //I think anything treated as
}

//WT_TRIBES
if (g_tribesClass.integer && (!client->sess.raceMode || (level.gametype >= GT_TEAM && client->sess.sessionTeam > TEAM_FREE))) {
if (g_tribesMode.integer && (!client->sess.raceMode || (level.gametype >= GT_TEAM && client->sess.sessionTeam > TEAM_FREE))) {
DetectTribesClass(ent, model);
}
else if (client->pers.tribesClass) {
Expand Down Expand Up @@ -2627,22 +2636,29 @@ qboolean ClientUserinfoChanged( int clientNum ) { //I think anything treated as
G_SetSaber( ent, 1, Info_ValueForKey( userinfo, "saber2" ), qfalse );
}

// set max health
if ( level.gametype == GT_SIEGE && client->siegeClass != -1 ) {
siegeClass_t *scl = &bgSiegeClasses[client->siegeClass];
//Don't even do this in tribes mode? We only do this on client spawn
if (!g_tribesMode.integer) {
// set max health
if (level.gametype == GT_SIEGE && client->siegeClass != -1)
{
siegeClass_t *scl = &bgSiegeClasses[client->siegeClass];
maxHealth = 100;

if ( scl->maxhealth )
maxHealth = scl->maxhealth;
if (scl->maxhealth)
maxHealth = scl->maxhealth;

health = maxHealth;
health = maxHealth;
}
else
{
maxHealth = 100;
health = Com_Clampi(1, 100, atoi(Info_ValueForKey(userinfo, "handicap")));
}
client->pers.maxHealth = health;
if (client->pers.maxHealth < 1 || client->pers.maxHealth > maxHealth)
client->pers.maxHealth = 100;
client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth;
}
else
health = Com_Clampi( 1, 100, atoi( Info_ValueForKey( userinfo, "handicap" ) ) );

client->pers.maxHealth = health;
if ( client->pers.maxHealth < 1 || client->pers.maxHealth > maxHealth )
client->pers.maxHealth = 100;
client->ps.stats[STAT_MAX_HEALTH] = client->pers.maxHealth;

if ( level.gametype >= GT_TEAM )
client->pers.teamInfo = qtrue;
Expand Down Expand Up @@ -4162,9 +4178,29 @@ void ClientSpawn(gentity_t *ent) {
else
{
//maxHealth = Com_Clampi( 1, 100, atoi( Info_ValueForKey( userinfo, "handicap" ) ) );
maxHealth = 100;//i dont think we want handicap to work..?
if (client->pers.tribesClass == 3) {
maxHealth = maxHealth = 1000;
client->ps.iModelScale = 125;
VectorSet(ent->modelScale, 1.25f, 1.25f, 1.25f);
VectorScale(ent->r.mins, 1.25f, ent->r.mins);
VectorScale(ent->r.maxs, 1.25f, ent->r.maxs);
}
else if (client->pers.tribesClass == 2 || (g_tribesMode.integer == 2)) {
maxHealth = maxHealth = 700;
}
else if (client->pers.tribesClass == 1) {
maxHealth = maxHealth = 500;
client->ps.iModelScale = 94;
VectorSet(ent->modelScale, 0.92f, 0.94f, 0.94f);
VectorScale(ent->r.mins, 0.94f, ent->r.mins);
VectorScale(ent->r.maxs, 0.94f, ent->r.maxs);
}
else {
maxHealth = 100;//i dont think we want handicap to work..?
}

if (g_showHealth.integer && !client->sess.raceMode)
ent->maxHealth = 100;//JAPRO , kay...
ent->maxHealth = maxHealth;//JAPRO , kay...
else
ent->maxHealth = 0;
}
Expand Down Expand Up @@ -4593,6 +4629,11 @@ void ClientSpawn(gentity_t *ent) {
}
else
{//Clan Arena starting armor/hp here
if (g_tweakWeapons.integer & WT_TRIBES) {
ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH];
client->ps.stats[STAT_ARMOR] = 0;
}
/*
if (client->pers.tribesClass == 1) {//light
ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH];
client->ps.stats[STAT_ARMOR] = 0;
Expand All @@ -4605,6 +4646,7 @@ void ClientSpawn(gentity_t *ent) {
ent->health = client->ps.stats[STAT_HEALTH] = client->ps.stats[STAT_MAX_HEALTH];
client->ps.stats[STAT_ARMOR] = 100;
}
*/
else if (g_startingItems.integer & (1 << (HI_NUM_HOLDABLE + 2)))//sad
client->ps.stats[STAT_ARMOR] = client->ps.stats[STAT_MAX_HEALTH];
else
Expand Down
2 changes: 1 addition & 1 deletion codemp/game/g_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -7654,7 +7654,7 @@ void Cmd_Race_f(gentity_t *ent)
Q_strncpyz(model, Info_ValueForKey(userinfo, "model"), sizeof(model));

if (!ent->client->sess.raceMode) {
if (g_tribesClass.integer) {
if (g_tribesMode.integer) {
DetectTribesClass(ent, model);
}
else if (ent->client->pers.tribesClass) {
Expand Down
Loading

0 comments on commit 7629ca8

Please sign in to comment.