Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream update #187

Merged
merged 5 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion codemp/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ extern int dueltypes[MAX_CLIENTS];//JAPRO - Serverside - Fullforce Duels y is th
#define WT_FIX_MINEAMMO (1<<24)
#define WT_JK2_STYLE_ALT_TRIPMINE (1<<25)
#define WT_PROJ_SNIPER (1<<26)
#define WT_TRIBES (1<<27)
#define WT_TRIBES (1<<27) //Move this into g_tribesmode surely..?
#define WT_SLOW_SNIPER (1<<28)
#define WT_SOLID_ROCKET (1<<29)
#define WT_NERFED_PISTOL (1<<30)
Expand Down Expand Up @@ -1219,6 +1219,7 @@ struct gclient_s {

int midRunTeleMarkCount;
int midRunTeleCount;
int oobTime;

vec3_t lastVelocity;

Expand Down
2 changes: 1 addition & 1 deletion codemp/game/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3999,7 +3999,7 @@ void G_RunFrame( int levelTime ) {
float recharge = VectorLength(ent->client->ps.velocity) / (ent->client->ps.speed);
if (recharge < 1)
recharge = 1;
ent->client->ps.jetpackFuel += 2 * recharge;
ent->client->ps.jetpackFuel += 6 * recharge;
}
if (ent->client->ps.jetpackFuel > 100)
ent->client->ps.jetpackFuel = 100;
Expand Down
22 changes: 19 additions & 3 deletions codemp/game/g_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1960,18 +1960,31 @@ void Use_target_restrict_on(gentity_t *trigger, gentity_t *other, gentity_t *pla
player->client->pers.haste = qtrue;
}
if (trigger->spawnflags & RESTRICT_FLAG_FLAGS) { //Reset flags

//If there is a count, use that as timer
if (!player->client->oobTime) {
player->client->oobTime = level.time;
}
if (level.time - player->client->oobTime > trigger->count * 1000) {
//trap->SendServerCommand(player - g_entities, "cp \"^1Flag Returned!\n\n\n\n\n\n\n\n\n\n\""); //Send message?
trap->SendServerCommand(player - g_entities, "cp \""); //clear previous flag warning print?
if (player->client->ps.powerups[PW_NEUTRALFLAG]) { // only happens in One Flag CTF
Team_ReturnFlag( TEAM_FREE );
Team_ReturnFlag(TEAM_FREE);
player->client->ps.powerups[PW_NEUTRALFLAG] = 0;
}
else if (player->client->ps.powerups[PW_REDFLAG]) { // only happens in standard CTF
Team_ReturnFlag( TEAM_RED );
Team_ReturnFlag(TEAM_RED);
player->client->ps.powerups[PW_REDFLAG] = 0;
}
else if (player->client->ps.powerups[PW_BLUEFLAG]) { // only happens in standard CTF
Team_ReturnFlag( TEAM_BLUE );
Team_ReturnFlag(TEAM_BLUE);
player->client->ps.powerups[PW_BLUEFLAG] = 0;
}
}
else {
trap->SendServerCommand(player - g_entities, va("cp \"^3Flag returning in %.1fs\n\n\n\n\n\n\n\n\n\n\"", 0.001*(trigger->count * 1000 - (level.time - player->client->oobTime)))); //Send message?`
}

}
if (trigger->spawnflags & RESTRICT_FLAG_JUMP) { //Change Jump Level with "count" val
if (trigger->count) { //Set client jump without resetting timer because someone suggested a course that uses different movementstyles for each room.
Expand Down Expand Up @@ -2084,6 +2097,9 @@ void Use_target_restrict_off( gentity_t *trigger, gentity_t *other, gentity_t *p
player->client->savedJumpLevel = 0;
}
}
if (player->client->oobTime)
trap->SendServerCommand(player - g_entities, "cp \""); //clear previous flag warning print?
player->client->oobTime = 0;
}

void FreePersonalSpeaker(gentity_t *speaker) {
Expand Down
8 changes: 6 additions & 2 deletions codemp/game/g_weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,10 @@ static void WP_FireBryarPistol( gentity_t *ent, qboolean altFire, int seed )
charge = 400;
vel = 10440 * g_projectileVelocityScale.value;
if (ent->client->ps.jetpackFuel > 0)
ent->client->ps.jetpackFuel -= 7;
ent->client->ps.jetpackFuel -= 8;
if (ent->client->ps.jetpackFuel < 0)
ent->client->ps.jetpackFuel = 0;
ent->client->overheatDebReduce = level.time + 200;
}
else {
vel = BRYAR_PISTOL_VEL * g_projectileVelocityScale.value;
Expand Down Expand Up @@ -327,6 +328,8 @@ static void WP_FireBryarPistol( gentity_t *ent, qboolean altFire, int seed )
count = 5;
}

ent->client->ps.jetpackFuel -= count * 6;

if (count > 1)
{
if (count > 4 && (g_tweakWeapons.integer & WT_NERFED_PISTOL)) {
Expand Down Expand Up @@ -606,9 +609,10 @@ static void WP_FireBlaster( gentity_t *ent, qboolean altFire, int seed )

if (ent && ent->client && g_tweakWeapons.integer & WT_TRIBES) { //Chaingun Overheat mechanic
if (ent->client->ps.jetpackFuel > 0)
ent->client->ps.jetpackFuel -= 5;
ent->client->ps.jetpackFuel -= 8;
if (ent->client->ps.jetpackFuel < 0)
ent->client->ps.jetpackFuel = 0;
ent->client->overheatDebReduce = level.time + 200;
}

if ( altFire || (g_tweakWeapons.integer & WT_TRIBES))
Expand Down
1 change: 1 addition & 0 deletions codemp/rd-common/tr_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ CFontInfo::CFontInfo(const char *_fontName)
m_iOriginalFontWhenSBCSOverriden = -1;
m_fAltSBCSFontScaleFactor = -1;
m_bIsFakeAlienLanguage = !strcmp(_fontName,"aurabesh"); // dont try and make SBCS or asian overrides for this
m_isVariant = qfalse;

len = ri.FS_ReadFile(fontName, NULL);
if (len == sizeof(dfontdat_t))
Expand Down
3 changes: 2 additions & 1 deletion codemp/rd-rend2/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static void R_Splash()
const GLfloat black[] = { 0.0f, 0.0f, 0.0f, 1.0f };
float ratio = (float)(SCREEN_WIDTH * glConfig.vidHeight) / (float)(SCREEN_HEIGHT * glConfig.vidWidth);

qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
GL_SetViewportAndScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
qglClearBufferfv(GL_COLOR, 0, black);
qglClear(GL_DEPTH_BUFFER_BIT);

Expand Down Expand Up @@ -1210,6 +1210,7 @@ void GL_SetDefaultState( void )
qglEnable(GL_PROGRAM_POINT_SIZE);
qglDisable( GL_CULL_FACE );
qglDisable( GL_BLEND );
glState.blend = false;

qglEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);

Expand Down
60 changes: 33 additions & 27 deletions shared/rd-rend2/tr_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,20 @@ void GL_State( uint32_t stateBits )
break;
}

qglEnable( GL_BLEND );
if (!glState.blend)
{
qglEnable(GL_BLEND);
glState.blend = true;
}
qglBlendFunc( srcFactor, dstFactor );
}
else
{
qglDisable( GL_BLEND );
if (glState.blend)
{
qglDisable(GL_BLEND);
glState.blend = false;
}
}
}

Expand Down Expand Up @@ -479,13 +487,28 @@ void GL_SetProjectionMatrix(matrix_t matrix)
Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
}


void GL_SetModelviewMatrix(matrix_t matrix)
{
Matrix16Copy(matrix, glState.modelview);
Matrix16Multiply(glState.projection, glState.modelview, glState.modelviewProjection);
}

void GL_SetViewportAndScissor(int viewportX, int viewportY, int viewportWidth, int viewportHeight)
{
if (glState.viewportOrigin[0] == viewportX &&
glState.viewportOrigin[1] == viewportY &&
glState.viewportSize[0] == viewportWidth &&
glState.viewportSize[1] == viewportHeight)
return;

qglViewport(viewportX, viewportY, viewportWidth, viewportHeight);
qglScissor(viewportX, viewportY, viewportWidth, viewportHeight);

glState.viewportOrigin[0] = viewportX;
glState.viewportOrigin[1] = viewportY;
glState.viewportSize[0] = viewportWidth;
glState.viewportSize[1] = viewportHeight;
}

/*
================
Expand All @@ -505,20 +528,8 @@ static void SetViewportAndScissor( void ) {
GL_SetProjectionMatrix( backEnd.viewParms.projectionMatrix );

// set the window clipping
qglViewport( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );

if ( !backEnd.viewParms.scissorX && !backEnd.viewParms.scissorY &&
!backEnd.viewParms.scissorWidth && !backEnd.viewParms.scissorHeight )
{
qglScissor( backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight );
}
else
{
qglScissor( backEnd.viewParms.scissorX, backEnd.viewParms.scissorY,
backEnd.viewParms.scissorWidth, backEnd.viewParms.scissorHeight );
}
GL_SetViewportAndScissor(backEnd.viewParms.viewportX, backEnd.viewParms.viewportY,
backEnd.viewParms.viewportWidth, backEnd.viewParms.viewportHeight);
}

/*
Expand Down Expand Up @@ -1529,8 +1540,7 @@ void RB_SetGL2D (void) {
}

// set 2D virtual screen size
qglViewport( 0, 0, width, height );
qglScissor( 0, 0, width, height );
GL_SetViewportAndScissor(0, 0, width, height);

Matrix16Ortho(0, 640, 480, 0, 0, 1, matrix);
GL_SetProjectionMatrix(matrix);
Expand Down Expand Up @@ -2023,8 +2033,7 @@ static const void *RB_PrefilterEnvMap(const void *data) {
GL_BindToTMU(tr.renderCubeImage, TB_CUBEMAP);
GLSL_BindProgram(&tr.prefilterEnvMapShader);

qglViewport(0, 0, width, height);
qglScissor(0, 0, width, height);
GL_SetViewportAndScissor(0, 0, width, height);

vec4_t viewInfo;
VectorSet4(viewInfo, 0, level, roughnessMips, level / roughnessMips);
Expand All @@ -2046,8 +2055,7 @@ static void RB_RenderSSAO()

FBO_Bind(tr.quarterFbo[0]);

qglViewport(0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);
qglScissor(0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);
GL_SetViewportAndScissor(0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);

GL_State( GLS_DEPTHTEST_DISABLE );

Expand All @@ -2060,8 +2068,7 @@ static void RB_RenderSSAO()

FBO_Bind(tr.quarterFbo[1]);

qglViewport(0, 0, tr.quarterFbo[1]->width, tr.quarterFbo[1]->height);
qglScissor(0, 0, tr.quarterFbo[1]->width, tr.quarterFbo[1]->height);
GL_SetViewportAndScissor(0, 0, tr.quarterFbo[1]->width, tr.quarterFbo[1]->height);

GLSL_BindProgram(&tr.depthBlurShader[0]);

Expand All @@ -2073,8 +2080,7 @@ static void RB_RenderSSAO()

FBO_Bind(tr.screenSsaoFbo);

qglViewport(0, 0, tr.screenSsaoFbo->width, tr.screenSsaoFbo->height);
qglScissor(0, 0, tr.screenSsaoFbo->width, tr.screenSsaoFbo->height);
GL_SetViewportAndScissor(0, 0, tr.screenSsaoFbo->width, tr.screenSsaoFbo->height);

GLSL_BindProgram(&tr.depthBlurShader[1]);

Expand Down
3 changes: 1 addition & 2 deletions shared/rd-rend2/tr_fbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,7 @@ void FBO_BlitFromTexture(struct image_s *src, vec4i_t inSrcBox, vec2_t inSrcTexS
height = glConfig.vidHeight;
}

qglViewport( 0, 0, width, height );
qglScissor( 0, 0, width, height );
GL_SetViewportAndScissor(0, 0, width, height);

Matrix16Ortho(0, width, height, 0, 0, 1, projection);

Expand Down
5 changes: 4 additions & 1 deletion shared/rd-rend2/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,6 @@ typedef struct {
int frameCount; // copied from tr.frameCount
cplane_t portalPlane; // clip anything behind this if mirroring
int viewportX, viewportY, viewportWidth, viewportHeight;
int scissorX, scissorY, scissorWidth, scissorHeight;
FBO_t *targetFbo;
int targetFboLayer;
float fovX, fovY;
Expand Down Expand Up @@ -2259,8 +2258,11 @@ typedef struct glstate_s {
int currenttmu;
int texEnv[2];
int faceCulling;
bool blend;
float minDepth;
float maxDepth;
ivec2_t viewportOrigin;
ivec2_t viewportSize;
uint32_t glStateBits;
uint32_t vertexAttribsState;
vertexAttribute_t currentVaoAttribs[ATTR_INDEX_MAX];
Expand Down Expand Up @@ -2929,6 +2931,7 @@ void GL_CheckErrs( const char *file, int line );
void GL_State( uint32_t stateVector );
void GL_SetProjectionMatrix(matrix_t matrix);
void GL_SetModelviewMatrix(matrix_t matrix);
void GL_SetViewportAndScissor(int viewportX, int viewportY, int viewportWidth, int viewportHeight);
void GL_Cull( int cullType );
void GL_DepthRange( float min, float max );
void GL_VertexAttribPointers(size_t numAttributes,
Expand Down
6 changes: 2 additions & 4 deletions shared/rd-rend2/tr_postprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@ void RB_BloomDownscale(image_t *sourceImage, FBO_t *destFBO)

FBO_Bind(destFBO);
GL_State(GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO);

qglViewport(0, 0, destFBO->width, destFBO->height);
GL_SetViewportAndScissor(0, 0, destFBO->width, destFBO->height);
qglClearBufferfv(GL_COLOR, 0, colorBlack);

GLSL_BindProgram(&tr.dglowDownsample);
Expand All @@ -515,8 +514,7 @@ void RB_BloomUpscale(FBO_t *sourceFBO, FBO_t *destFBO)

FBO_Bind(destFBO);
GL_State(GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO);

glViewport(0, 0, destFBO->width, destFBO->height);
GL_SetViewportAndScissor(0, 0, destFBO->width, destFBO->height);
qglClearBufferfv(GL_COLOR, 0, colorBlack);

GLSL_BindProgram(&tr.dglowUpsample);
Expand Down
5 changes: 1 addition & 4 deletions shared/rd-rend2/tr_shadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ void RB_ShadowFinish(void) {
return;
}

GL_Cull(CT_TWO_SIDED);

GL_BindToTMU(tr.whiteImage, TB_COLORMAP);

GL_State(GLS_STENCILTEST_ENABLE | GLS_DEPTHMASK_TRUE | GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);

qglStencilFunc(GL_NOTEQUAL, 0, 0xff);
qglViewport(0, 0, glConfig.vidWidth, glConfig.vidHeight);
qglScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
GL_SetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
matrix_t projection;
Matrix16Ortho(0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1, projection);

Expand Down
5 changes: 2 additions & 3 deletions shared/rd-rend2/tr_weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ namespace
{
FBO_Bind(tr.weatherDepthFbo);

qglViewport(0, 0, tr.weatherDepthFbo->width, tr.weatherDepthFbo->height);
qglScissor(0, 0, tr.weatherDepthFbo->width, tr.weatherDepthFbo->height);

GL_SetViewportAndScissor(0, 0, tr.weatherDepthFbo->width, tr.weatherDepthFbo->height);

if (tr.weatherSystem->weatherBrushType == WEATHER_BRUSHES_OUTSIDE) // used outside brushes
{
qglClearDepth(0.0f);
Expand Down
Loading