Skip to content

Commit

Permalink
custom changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TwelveEyes committed Jun 3, 2024
1 parent 7b9dfe7 commit 18273f3
Show file tree
Hide file tree
Showing 23 changed files with 197 additions and 63 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ jobs:
shell: bash
run: cmake --build . --config ${{ matrix.build_type }} -j $NUMBER_OF_PROCESSORS

- name: Copy PK3s
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}
shell: bash
run: |
mkdir -p ./build/bin/JediAcademy/base/
cp ./pk3/assets_fpls.pk3 ./build/bin/JediAcademy/base/
- name: Install
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/build
Expand Down Expand Up @@ -137,6 +145,12 @@ jobs:
shell: bash
run: cmake --install .

- name: Copy PK3s
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}
shell: bash
run: cp ./pk3/assets_fpls.pk3 ./install/JediAcademy/base/

- name: Create OpenJK binary archive
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/install/JediAcademy
Expand Down Expand Up @@ -210,6 +224,14 @@ jobs:
shell: bash
run: cmake --install .

- name: Copy PK3s
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}
shell: bash
run: |
mkdir -p ./install/JediAcademy/openjk_sp.${{ matrix.arch }}.app/Contents/MacOS/base/
cp ./pk3/assets_fpls.pk3 ./install/JediAcademy/openjk_sp.${{ matrix.arch }}.app/Contents/MacOS/base/
- name: Create OpenJK binary archive
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/install/JediAcademy
Expand Down
12 changes: 12 additions & 0 deletions code/cgame/cg_consolecmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ void CG_ToggleLAGoggles( void )

cg.zoomMode = 3;
cg.zoomLocked = qfalse;

if ( cg.weaponSelect == WP_SABER )
{
cg.weaponSelect = WP_NONE;
}

if ( cg.overrides.active & CG_OVERRIDE_FOV )
{
cg_zoomFov = cg.overrides.fov;
Expand All @@ -193,6 +199,12 @@ void CG_ToggleLAGoggles( void )
cg.zoomMode = 0;
cg.zoomTime = cg.time;
cgi_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.media.zoomEnd );

if( cg.weaponSelect == WP_NONE && cg.snap->ps.stats[STAT_WEAPONS] & ( 1 << WP_SABER ) )
{
// FIXME: this is pretty damn ugly but whatever
cg.weaponSelect = WP_SABER;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ extern vmCvar_t cg_thirdPersonPitchOffset;
extern vmCvar_t cg_thirdPersonVertOffset;
extern vmCvar_t cg_thirdPersonCameraDamp;
extern vmCvar_t cg_thirdPersonTargetDamp;
extern vmCvar_t cg_saberAutoThird;
extern vmCvar_t cg_gunAutoFirst;

extern vmCvar_t cg_stereoSeparation;
Expand Down
2 changes: 2 additions & 0 deletions code/cgame/cg_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ vmCvar_t cg_thirdPersonPitchOffset;
vmCvar_t cg_thirdPersonVertOffset;
vmCvar_t cg_thirdPersonCameraDamp;
vmCvar_t cg_thirdPersonTargetDamp;
vmCvar_t cg_saberAutoThird;
vmCvar_t cg_gunAutoFirst;

vmCvar_t cg_thirdPersonAlpha;
Expand Down Expand Up @@ -424,6 +425,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_thirdPersonAlpha, "cg_thirdPersonAlpha", "1.0", CVAR_ARCHIVE },
{ &cg_thirdPersonAutoAlpha, "cg_thirdPersonAutoAlpha", "0", 0 },
// NOTE: also declare this in UI_Init
{ &cg_saberAutoThird, "cg_saberAutoThird", "1", CVAR_ARCHIVE },
{ &cg_gunAutoFirst, "cg_gunAutoFirst", "1", CVAR_ARCHIVE },

{ &cg_pano, "pano", "0", 0 },
Expand Down
15 changes: 14 additions & 1 deletion code/cgame/cg_players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6838,7 +6838,7 @@ void CG_Player( centity_t *cent ) {
return;
}

if( cent->gent->s.number == 0 && cg.weaponSelect == WP_NONE && cg.zoomMode == 1 )
if( cent->gent->s.number == 0 && cg.weaponSelect == WP_NONE && (cg.zoomMode == 1 || cg.zoomMode == 3) )
{
// HACK
return;
Expand Down Expand Up @@ -7233,6 +7233,19 @@ extern vmCvar_t cg_thirdPersonAlpha;
}
}

extern cvar_t g_char_model;

if ( !cg.renderingThirdPerson
&& ( cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE )
&& !cent->gent->s.number )
{// Yeah um, this needs to not do this quite this way
ent.customSkin = cgi_R_RegisterSkin( va( "models/players/%s/model_fpls.skin", g_char_model->string ) ); //precached in g_client.cpp
}
else
{
ent.customSkin = 0;
}

if ( cg_debugHealthBars.integer )
{
if ( cent->gent && cent->gent->health > 0 && cent->gent->max_health > 0 )
Expand Down
6 changes: 3 additions & 3 deletions code/cgame/cg_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ static void CG_CalcIdealThirdPersonViewLocation(void)
VectorMA(cameraIdealTarget, -(cg_thirdPersonRange.value), camerafwd, cameraIdealLoc);
}

if ( cg.renderingThirdPerson && (cg.snap->ps.forcePowersActive&(1<<FP_SPEED)) && player->client->ps.forcePowerDuration[FP_SPEED] )
/*if ( cg.renderingThirdPerson && (cg.snap->ps.forcePowersActive&(1<<FP_SPEED)) && player->client->ps.forcePowerDuration[FP_SPEED] )
{
float timeLeft = player->client->ps.forcePowerDuration[FP_SPEED] - cg.time;
float length = FORCE_SPEED_DURATION*forceSpeedValue[player->client->ps.forcePowerLevel[FP_SPEED]];
Expand All @@ -480,7 +480,7 @@ static void CG_CalcIdealThirdPersonViewLocation(void)
{
VectorMA(cameraIdealLoc, amt, camerafwd, cameraIdealLoc);
}
}
}*/
}


Expand Down Expand Up @@ -2092,7 +2092,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|| (cg.snap->ps.stats[STAT_HEALTH] <= 0)
|| (cg.snap->ps.eFlags&EF_HELD_BY_SAND_CREATURE)
|| ((g_entities[0].client&&g_entities[0].client->NPC_class==CLASS_ATST)
|| (cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE) ));
/*|| (cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE)*/ ));

if ( cg.zoomMode )
{
Expand Down
15 changes: 13 additions & 2 deletions code/game/bg_pmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6710,6 +6710,17 @@ qboolean PM_InRoll( playerState_t *ps )
return qfalse;
}

qboolean PM_RestAnim( int anim )
{
switch ( anim )
{
case BOTH_MEDITATE: // default taunt
return qtrue;
break;
}
return qfalse;
}

qboolean PM_CrouchAnim( int anim )
{
switch ( anim )
Expand Down Expand Up @@ -8916,7 +8927,7 @@ static void PM_BeginWeaponChange( int weapon ) {
// eezstreet edit: also ignore if we change to WP_NONE..sorta hacky fix for binoculars using WP_SABER
if ( pm->ps->clientNum == 0 && cg.weaponSelect != WP_NONE )
{
if ( cg.zoomMode > 0 && cg.zoomMode < 3 )
if ( (cg.zoomMode > 0 && cg.zoomMode < 3) || (cg.zoomMode == 3 && cg.weaponSelect == WP_SABER) )
{
cg.zoomMode = 0;
cg.zoomTime = cg.time;
Expand Down Expand Up @@ -9034,7 +9045,7 @@ static void PM_FinishWeaponChange( void ) {
if ( pm->gent )
{
WP_SaberInitBladeData( pm->gent );
if ( (pm->ps->clientNum < MAX_CLIENTS||PM_ControlledByPlayer()) )
if ( (pm->ps->clientNum < MAX_CLIENTS||PM_ControlledByPlayer()) && cg_saberAutoThird.integer )
{
gi.cvar_set( "cg_thirdperson", "1" );
}
Expand Down
11 changes: 9 additions & 2 deletions code/game/g_active.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,13 @@ void ClientTimerActions( gentity_t *ent, int msec ) {
ent->flags &= ~FL_OVERCHARGED_HEALTH;
}
}
if ( (ent->health > 0 && ent->health < ent->client->ps.stats[STAT_MAX_HEALTH]/4) &&
(ent->client->ps.forcePowerLevel[FP_SEE] >= FORCE_LEVEL_1) &&
(ent->painDebounceTime < level.time) )
{//gradually increase health back to 25% of max if force sight >= 1
ent->health++;
ent->client->ps.stats[STAT_HEALTH] = ent->health;
}
}
}

Expand Down Expand Up @@ -4908,14 +4915,14 @@ extern cvar_t *g_skippingcin;
ucmd->upmove = 0;
PM_AdjustAnglesToGripper( ent, ucmd );
}
if ( ent->client->ps.leanofs )
/*if ( ent->client->ps.leanofs )
{//no shooting while leaning
ucmd->buttons &= ~BUTTON_ATTACK;
if ( ent->client->ps.weapon != WP_DISRUPTOR )
{//can still zoom around corners
ucmd->buttons &= ~BUTTON_ALT_ATTACK;
}
}
}*/
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions code/game/g_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ void SP_info_player_deathmatch(gentity_t *ent) {
else
{
RegisterItem( FindItemForWeapon( WP_SABER ) ); //these are given in ClientSpawn(), but we register them now before cgame starts
G_SkinIndex( "models/players/kyle/model_fpls.skin" ); //precache the skin used in cg_players.cpp
G_SkinIndex( "models/players/player/model_fpls.skin" ); //precache the skin used in cg_players.cpp
saberInfo_t saber;
WP_SaberParseParms( g_saber->string, &saber );//get saber sounds and models cached before client begins
if (saber.model) G_ModelIndex( saber.model );
Expand Down
2 changes: 1 addition & 1 deletion code/game/g_emplaced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ extern void CG_ChangeWeapon( int num );

if ( ent->s.number < MAX_CLIENTS )
{
if ( ent->client->ps.weapon == WP_SABER )
if ( ent->client->ps.weapon == WP_SABER && cg_saberAutoThird.integer )
{
gi.cvar_set( "cg_thirdperson", "1" );
}
Expand Down
2 changes: 1 addition & 1 deletion code/game/g_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ void G_InitCvars( void ) {
com_buildScript = gi.cvar ("com_buildscript", "0", 0);

g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "1", CVAR_CHEAT );//must press +block button to do any blocking
g_saberRealisticCombat = gi.cvar( "g_saberMoreRealistic", "0", CVAR_ARCHIVE );//makes collision more precise, increases damage
g_saberRealisticCombat = gi.cvar( "g_saberMoreRealistic", "2", CVAR_ARCHIVE );//makes collision more precise, increases damage
debug_subdivision = gi.cvar( "debug_subdivision", "0", CVAR_ARCHIVE );//debug for dismemberment
g_dismemberProbabilities = gi.cvar ( "g_dismemberProbabilities", "1", CVAR_ARCHIVE );//0 = ignore probabilities, 1 = use probabilities
g_saberDamageCapping = gi.cvar( "g_saberDamageCapping", "1", CVAR_CHEAT );//caps damage of sabers vs players and NPC who use sabers
Expand Down
8 changes: 6 additions & 2 deletions code/game/g_missile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,14 @@ extern bool WP_DoingMoronicForcedAnimationForForcePowers(gentity_t *ent);
{
other->owner->client->sess.missionStats.saberBlocksCnt++;
}
if ( ( g_spskill->integer <= 0//on easy, it reflects all shots
if ( /*( g_spskill->integer <= 0//on easy, it reflects all shots
|| (g_spskill->integer == 1 && ent->s.weapon != WP_FLECHETTE && ent->s.weapon != WP_DEMP2 )//on medium it won't reflect flechette or demp shots
|| (g_spskill->integer >= 2 && ent->s.weapon != WP_FLECHETTE && ent->s.weapon != WP_DEMP2 && ent->s.weapon != WP_BOWCASTER && ent->s.weapon != WP_REPEATER )//on hard it won't reflect flechette, demp, repeater or bowcaster shots
)
)*/
ent->s.weapon != WP_FLECHETTE//won't reflect flechette
&& ent->s.weapon != WP_DEMP2//demp
&& ent->s.weapon != WP_BOWCASTER//bowcaster
&& ent->s.weapon != WP_REPEATER//or repeater shots
&& (!ent->splashDamage || !ent->splashRadius) //this would be cool, though, to "bat" the thermal det away...
&& ent->s.weapon != WP_NOGHRI_STICK )//gas bomb, don't reflect
{
Expand Down
40 changes: 31 additions & 9 deletions code/game/wp_saber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ extern saberMoveName_t PM_BrokenParryForAttack( int move );
extern saberMoveName_t PM_KnockawayForParry( int move );
extern qboolean PM_FlippingAnim( int anim );
extern qboolean PM_RollingAnim( int anim );
extern qboolean PM_RestAnim( int anim );
extern qboolean PM_CrouchAnim( int anim );
extern qboolean PM_SaberInIdle( int move );
extern qboolean PM_SaberInReflect( int move );
Expand Down Expand Up @@ -281,15 +282,15 @@ float forceSpeedRangeMod[NUM_FORCE_POWER_LEVELS] =
float forceSpeedFOVMod[NUM_FORCE_POWER_LEVELS] =
{
0.0f,//none
20.0f,
30.0f,
40.0f
0.0f,//20.0f,
0.0f,//30.0f,
0.0f//40.0f
};

int forceGripDamage[NUM_FORCE_POWER_LEVELS] =
{
0,//none
0,
3,//0,
6,
9
};
Expand Down Expand Up @@ -11004,19 +11005,19 @@ void ForceLightningDamage( gentity_t *self, gentity_t *traceEnt, vec3_t dir, flo
{
if ( dist < 100 )
{
dmg += 2;
dmg += 4;//2;
}
else if ( dist < 200 )
{
dmg += 1;
dmg += 2;//1;
}
if ( dot > 0.9f )
{
dmg += 2;
dmg += 4;//2;
}
else if ( dot > 0.7f )
{
dmg += 1;
dmg += 2;//1;
}
}
if ( self->client->ps.torsoAnim == BOTH_FORCE_2HANDEDLIGHTNING
Expand All @@ -11029,7 +11030,7 @@ void ForceLightningDamage( gentity_t *self, gentity_t *traceEnt, vec3_t dir, flo
}
else
{
dmg = Q_irand( 1, 3 );//*self->client->ps.forcePowerLevel[FP_LIGHTNING];
dmg = Q_irand( 2, 6 );//*self->client->ps.forcePowerLevel[FP_LIGHTNING]; //Q_irand( 1, 3 );
}

if ( traceEnt->client
Expand Down Expand Up @@ -14375,6 +14376,27 @@ void WP_ForcePowersUpdate( gentity_t *self, usercmd_t *ucmd )
{
WP_ForcePowerRegenerate( self, self->client->ps.forcePowerRegenAmount );
self->client->ps.forcePowerRegenDebounceTime = level.time + self->client->ps.forcePowerRegenRate;
if ( PM_CrouchAnim( self->client->ps.legsAnim ) )
{//regen force much faster when crouched
WP_ForcePowerRegenerate( self, 2 );
}
else if ( PM_RestAnim( self->client->ps.legsAnim ) )
{//regen force extremly fast when meditating
WP_ForcePowerRegenerate( self, 4 );

if ( (self->health > 0 && self->health < self->client->ps.stats[STAT_MAX_HEALTH]) &&
(self->client->ps.forcePower >= self->client->ps.forcePowerMax) &&
(self->client->ps.forcePowerLevel[FP_SEE] >= FORCE_LEVEL_2) &&
(self->painDebounceTime < level.time) )
{//regen health to max when force is max (force sight must be >= 2)
self->health++;

if ( self->health >= self->client->ps.stats[STAT_MAX_HEALTH]/3 )
{
gi.G2API_ClearSkinGore(self->ghoul2);
}
}
}
if ( self->client->ps.forceRageRecoveryTime >= level.time )
{//regen half as fast
self->client->ps.forcePowerRegenDebounceTime += self->client->ps.forcePowerRegenRate;
Expand Down
1 change: 1 addition & 0 deletions code/ui/ui_atoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ void UI_Init( int apiVersion, uiimport_t *uiimport, qboolean inGameLoad )
ui.Cvar_Create( "ui_prisonerobj_mintotal", "0", CVAR_ROM|CVAR_SAVEGAME|CVAR_NORESTART);

ui.Cvar_Create( "g_dismemberment", "3", CVAR_ARCHIVE );//0 = none, 1 = arms and hands, 2 = legs, 3 = waist and head
ui.Cvar_Create( "cg_saberAutoThird", "1", CVAR_ARCHIVE );
ui.Cvar_Create( "cg_gunAutoFirst", "1", CVAR_ARCHIVE );
ui.Cvar_Create( "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE );
ui.Cvar_Create( "g_subtitles", "0", CVAR_ARCHIVE );
Expand Down
4 changes: 4 additions & 0 deletions code/ui/ui_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5504,10 +5504,12 @@ static const char *g_bindCommands[] = {
"+strafe",
"+use",
"+useforce",
"bow", //add bow
"centerview",
"cg_thirdperson !",
"datapad",
"exitview",
"flourish", //add flourish
#ifndef JK2_MODE
"force_absorb",
#endif
Expand All @@ -5525,6 +5527,7 @@ static const char *g_bindCommands[] = {
"force_throw",
"forcenext",
"forceprev",
"gloat", //add gloat
"invnext",
"invprev",
"invuse",
Expand All @@ -5534,6 +5537,7 @@ static const char *g_bindCommands[] = {
#else
"load quick",
#endif
"meditate", //add meditate
"saberAttackCycle",
#ifdef JK2_MODE
"save quik*",
Expand Down
2 changes: 1 addition & 1 deletion codemp/cgame/cg_xcvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ XCVAR_DEF( cg_debugSaber, "0", NULL, CVAR_CHEAT )
XCVAR_DEF( cg_debugPosition, "0", NULL, CVAR_CHEAT )
XCVAR_DEF( cg_debugEvents, "0", NULL, CVAR_CHEAT )
XCVAR_DEF( cg_duelHeadAngles, "0", NULL, CVAR_NONE )
XCVAR_DEF( cg_dismember, "0", NULL, CVAR_ARCHIVE )
XCVAR_DEF( cg_dismember, "2", NULL, CVAR_ARCHIVE )
XCVAR_DEF( cg_deferPlayers, "1", NULL, CVAR_ARCHIVE )
XCVAR_DEF( cg_errorDecay, "100", NULL, CVAR_NONE )
XCVAR_DEF( cg_fallingBob, "1", NULL, CVAR_ARCHIVE )
Expand Down
Loading

0 comments on commit 18273f3

Please sign in to comment.