Skip to content

Commit

Permalink
custom changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TwelveEyes committed Jun 18, 2024
1 parent 7b9dfe7 commit 980d7a7
Show file tree
Hide file tree
Showing 59 changed files with 1,985 additions and 273 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ 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/
cp ./pk3/jk2binds.pk3 ./build/bin/JediAcademy/base/
- name: Install
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/build
Expand Down Expand Up @@ -137,6 +146,14 @@ 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/
cp ./pk3/jk2binds.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 +227,15 @@ 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/
cp ./pk3/jk2binds.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
22 changes: 21 additions & 1 deletion code/cgame/cg_consolecmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void CG_ToggleBinoculars( void )
cg.zoomMode = 1;
cg.zoomLocked = qfalse;

if ( cg.weaponSelect == WP_SABER )
if ( cg.weaponSelect == WP_SABER || cg.weaponSelect == WP_MELEE )
{
cg.weaponSelect = WP_NONE;
}
Expand Down Expand Up @@ -151,6 +151,10 @@ void CG_ToggleBinoculars( void )
// FIXME: this is pretty damn ugly but whatever
cg.weaponSelect = WP_SABER;
}
else if( cg.weaponSelect == WP_NONE && cg.snap->ps.stats[STAT_WEAPONS] & ( 1 << WP_MELEE ) )
{
cg.weaponSelect = WP_MELEE;
}
}
}

Expand All @@ -177,6 +181,12 @@ void CG_ToggleLAGoggles( void )

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

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

if ( cg.overrides.active & CG_OVERRIDE_FOV )
{
cg_zoomFov = cg.overrides.fov;
Expand All @@ -193,6 +203,16 @@ 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;
}
else if( cg.weaponSelect == WP_NONE && cg.snap->ps.stats[STAT_WEAPONS] & ( 1 << WP_MELEE ) )
{
cg.weaponSelect = WP_MELEE;
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions code/cgame/cg_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static void CG_DrawAmmo(const centity_t *cent,const int xPos,const int yPos)
return;
}

if ( cent->currentState.weapon == WP_STUN_BATON )
if ( cent->currentState.weapon == WP_STUN_BATON || cent->currentState.weapon == WP_MELEE )
{
return;
}
Expand Down Expand Up @@ -3991,7 +3991,7 @@ static void CG_Draw2D( void )
{
if ( !(cent->gent && cent->gent->s.eFlags & (EF_LOCKED_TO_WEAPON )))//|EF_IN_ATST
{
//CG_DrawIconBackground();
CG_DrawIconBackground();
}

CG_DrawWeaponSelect();
Expand Down Expand Up @@ -4145,8 +4145,8 @@ void CG_DrawIconBackground(void)
// Use weapon background?
else if (((cg.weaponSelectTime+WEAPON_SELECT_TIME)>cg.time) || (cgs.media.currentBackground == ICON_WEAPONS))
{
background = 0;
//background = cgs.media.weaponIconBackground;
//background = 0;
background = cgs.media.weaponIconBackground;
}
// Use force background?
else
Expand Down
36 changes: 36 additions & 0 deletions code/cgame/cg_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,34 @@ static void CG_UseItem( centity_t *cent )

}

/*
==============
CG_UnsafeEventType
Returns qtrue for event types that access cent->gent directly (and don't require it
to be the player / entity 0).
==============
*/
qboolean CG_UnsafeEventType(int eventType)
{//from JKEnhanced
switch (eventType)
{
case EV_CHANGE_WEAPON:
case EV_DISRUPTOR_SNIPER_SHOT:
case EV_DISRUPTOR_SNIPER_MISS:
case EV_CONC_ALT_MISS:
case EV_DISINTEGRATION:
case EV_GRENADE_BOUNCE:
case EV_MISSILE_HIT:
case EV_MISSILE_MISS:
case EV_PAIN:
case EV_PLAY_EFFECT:
case EV_TARGET_BEAM_DRAW:
return qtrue;
break;
default:
return qfalse;
}
}

/*
==============
Expand Down Expand Up @@ -287,6 +315,14 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
return;
}

//When skipping a cutscene the timescale is drastically increased, causing entities to be freed
//and possibly reused between the snapshot currentState and the actual state of the gent when accessed.
//We try to avoid this issue by ignoring events on entities that have been freed since the snapshot.
if (cent->gent->freetime > cg.snap->serverTime && CG_UnsafeEventType(event))
{//from JKEnhanced
return;
}

//ci = &cent->gent->client->clientInfo;
clientNum = cent->gent->s.number;

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
6 changes: 4 additions & 2 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 @@ -352,7 +353,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE },
{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
{ &cg_fov, "cg_fov", "80", CVAR_ARCHIVE },
{ &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE },
{ &cg_fovAspectAdjust, "cg_fovAspectAdjust", "1", CVAR_ARCHIVE },
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.4", CVAR_ARCHIVE },
{ &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
{ &cg_renderToTextureFX, "cg_renderToTextureFX", "1", CVAR_ARCHIVE },
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 Expand Up @@ -1368,7 +1370,7 @@ static void CG_RegisterGraphics( void ) {
// FIXME: do these conditionally
cgi_R_RegisterShader( "gfx/2d/workingCamera" );
cgi_R_RegisterShader( "gfx/2d/brokenCamera" );
//cgi_R_RegisterShader( "gfx/effects/irid_shield" ); // for galak, but he doesn't have his own weapon so I can't register the shader there.
cgi_R_RegisterShader( "gfx/effects/irid_shield" ); // for galak, but he doesn't have his own weapon so I can't register the shader there.

//interface
for ( i = 0 ; i < NUM_CROSSHAIRS ; i++ ) {
Expand Down
86 changes: 61 additions & 25 deletions code/cgame/cg_players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4599,6 +4599,8 @@ CG_AddRefEntityWithPowerups
Adds a piece with modifications or duplications for powerups
===============
*/
extern vmCvar_t cg_thirdPersonAlpha;
extern qboolean G_ControlledByPlayer(gentity_t* self);
void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent )
{
if ( !cent )
Expand Down Expand Up @@ -4634,6 +4636,26 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
ent->shaderRGBA[2] = gent->client->renderInfo.customRGBA[2];
ent->shaderRGBA[3] = gent->client->renderInfo.customRGBA[3];

//cg_thirdpersonAlpha fix from JKEnhanced
if ((cent->gent->s.number == 0 || G_ControlledByPlayer(cent->gent)))
{
float alpha = 1.0f;
if ((cg.overrides.active & CG_OVERRIDE_3RD_PERSON_APH))
{
alpha = cg.overrides.thirdPersonAlpha;
}
else
{
alpha = cg_thirdPersonAlpha.value;
}

if (alpha < 1.0f)
{
ent->renderfx |= RF_ALPHA_FADE;
ent->shaderRGBA[3] *= alpha;
}
}

// If certain states are active, we don't want to add in the regular body
if ( !gent->client->ps.powerups[PW_CLOAKED] &&
!gent->client->ps.powerups[PW_UNCLOAKING] &&
Expand Down Expand Up @@ -4789,11 +4811,13 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen

// FORCE speed does blur trails
//------------------------------------------------------
static int speedTrailDebounce;
if ( cg_speedTrail.integer
&& (gent->client->ps.forcePowersActive & (1 << FP_SPEED) //in force speed
|| cent->gent->client->ps.legsAnim == BOTH_FORCELONGLEAP_START//or force long jump - FIXME: only 1st half of that anim?
|| cent->gent->client->ps.legsAnim == BOTH_FORCELONGLEAP_ATTACK )//or force long jump attack
&& (gent->s.number || cg.renderingThirdPerson) ) // looks dumb doing this with first peron mode on
&& (gent->s.number || cg.renderingThirdPerson) // looks dumb doing this with first peron mode on
&& --speedTrailDebounce <= 0 ) //debounce to avoid model render overload
{
//FIXME: debounce this
localEntity_t *ex;
Expand Down Expand Up @@ -4822,6 +4846,7 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
ex->color[0] = ex->color[1] = ex->color[2] = 255.0f;
}
ex->color[3] = 50.0f;
speedTrailDebounce = 3;
}

// Personal Shields
Expand Down Expand Up @@ -4853,9 +4878,9 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen

// Galak Mech shield bubble
//------------------------------------------------------
if ( powerups & ( 1 << PW_GALAK_SHIELD ))
if ( (powerups & ( 1 << PW_GALAK_SHIELD )) && gent->client->NPC_class == CLASS_GALAKMECH )
{
/* refEntity_t tent;
refEntity_t tent;

memset( &tent, 0, sizeof( refEntity_t ));

Expand All @@ -4882,7 +4907,7 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
tent.endTime = gent->fx_time + 1000; // if you want the shell to build around the guy, pass in a time that is 1000ms after the start of the turn-on-effect
tent.customShader = cgi_R_RegisterShader( "gfx/effects/irid_shield" );

cgi_R_AddRefEntityToScene( &tent );*/
cgi_R_AddRefEntityToScene( &tent );
}

// Invincibility -- effect needs work
Expand Down Expand Up @@ -6812,7 +6837,7 @@ CG_Player
===============
*/
extern qboolean G_GetRootSurfNameWithVariant( gentity_t *ent, const char *rootSurfName, char *returnSurfName, int returnSize );
extern qboolean G_ControlledByPlayer( gentity_t *self );
// extern qboolean G_ControlledByPlayer( gentity_t *self );
extern qboolean G_RagDoll(gentity_t *ent, vec3_t forcedAngles);
int cg_saberOnSoundTime[MAX_GENTITIES] = {0};

Expand All @@ -6838,7 +6863,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.weaponSelect == WP_MELEE || cg.weaponSelect == WP_SABER) && (cg.zoomMode == 1 || cg.zoomMode == 3) )
{
// HACK
return;
Expand Down Expand Up @@ -7212,26 +7237,37 @@ Ghoul2 Insert Start
*/
//HACK - add swoop model

extern vmCvar_t cg_thirdPersonAlpha;

if ( (cent->gent->s.number == 0 || G_ControlledByPlayer( cent->gent )) )
{
float alpha = 1.0f;
if ( (cg.overrides.active&CG_OVERRIDE_3RD_PERSON_APH) )
{
alpha = cg.overrides.thirdPersonAlpha;
}
else
{
alpha = cg_thirdPersonAlpha.value;
}

if ( alpha < 1.0f )
{
ent.renderfx |= RF_ALPHA_FADE;
ent.shaderRGBA[3] = (unsigned char)(alpha * 255.0f);
}
// extern vmCvar_t cg_thirdPersonAlpha;

// if ( (cent->gent->s.number == 0 || G_ControlledByPlayer( cent->gent )) )
// {
// float alpha = 1.0f;
// if ( (cg.overrides.active&CG_OVERRIDE_3RD_PERSON_APH) )
// {
// alpha = cg.overrides.thirdPersonAlpha;
// }
// else
// {
// alpha = cg_thirdPersonAlpha.value;
// }

// if ( alpha < 1.0f )
// {
// ent.renderfx |= RF_ALPHA_FADE;
// ent.shaderRGBA[3] = (unsigned char)(alpha * 255.0f);
// }
// }

/*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( "models/players/kyle/model_fpls.skin" ); //precached in g_client.cpp
}
else
{
ent.customSkin = 0;
}*/

if ( cg_debugHealthBars.integer )
{
Expand Down
4 changes: 2 additions & 2 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
Loading

0 comments on commit 980d7a7

Please sign in to comment.