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

Rend2 & jaPRO updates #191

Merged
merged 7 commits into from
Apr 28, 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: 3 additions & 0 deletions codemp/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ extern int dueltypes[MAX_CLIENTS];//JAPRO - Serverside - Fullforce Duels y is th
#define ST_EASIERBACKSLASH (1<<15) //no prediction yet
#define ST_SABERGUN (1<<16)
#define ST_FASTCYCLE (1<<17)
#define ST_NEWSPSABERDMG (1<<18)
#define ST_DUNESABER (1<<19)
#define ST_NEWSPSABERDMGCAP (1<<20)

//Saberstyles
#define SABERSTYLE_BLUE (1<<0)//no blue
Expand Down
30 changes: 17 additions & 13 deletions codemp/game/g_missile.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,28 +468,32 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
qboolean isKnockedSaber = qfalse;

other = &g_entities[trace->entityNum];

// check for bounce
if ( other->takedamage &&
if ( !other->takedamage &&
(ent->bounceCount > 0 || ent->bounceCount == -5) &&
( ent->flags & ( FL_BOUNCE | FL_BOUNCE_HALF ) ) &&
((g_tweakWeapons.integer & WT_TRIBES) && ent->s.weapon == WP_REPEATER && ent->setTime && ent->setTime > level.time - 300))
(
((g_tweakWeapons.integer & WT_TRIBES) && ent->s.weapon == WP_REPEATER && ent->setTime && level.time - ent->setTime < 1000) ||
((g_tweakWeapons.integer & WT_TRIBES) && ent->s.weapon == WP_FLECHETTE && ent->setTime && level.time - ent->setTime < 1000)
)
)
{ //if its a direct hit and first 500ms of mortar, bounce off player.
G_BounceMissile( ent, trace );
G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 );
ent->nextthink = level.time + 1500;
if (ent->nextthink && ent->nextthink - level.time > 1500) //don't increase its timer on a bounce
ent->nextthink = level.time + 1500;
return;
}
else if ( !other->takedamage &&
else if (!other->takedamage &&
(ent->bounceCount > 0 || ent->bounceCount == -5) &&
( ent->flags & ( FL_BOUNCE | FL_BOUNCE_HALF ) ) ) { //only on the first bounce vv
if ((!(g_tweakWeapons.integer & WT_TRIBES && ent->s.weapon == WP_REPEATER && ent->bounceCount == 50 && ent->setTime && ent->setTime < level.time - 1000)) &&
!(g_tweakWeapons.integer & WT_TRIBES && ent->s.weapon == WP_FLECHETTE && ent->bounceCount == 50 && ent->setTime && ent->setTime < level.time - 500))
//give this mortar a 1 second 'fuse' until its armed
{
G_BounceMissile( ent, trace );
G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 );
ent->nextthink = level.time + 1500;
(ent->flags & (FL_BOUNCE | FL_BOUNCE_HALF))) {

if ((g_tweakWeapons.integer & WT_TRIBES) && ent->s.weapon == WP_REPEATER || ent->s.weapon == WP_FLECHETTE) {
}
else {

G_BounceMissile(ent, trace);
G_AddEvent(ent, EV_GRENADE_BOUNCE, 0);
return;
}
}
Expand Down
5 changes: 4 additions & 1 deletion codemp/game/g_svcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,10 @@ static bitInfo_T saberTweaks[] = {
{"Make red DFA cost 0 forcepoints"},//15
{"Remove all backslash restrictions"},//16
{"Allow sabergun"},//17
{"Allow fast style change for single saber"}//17
{"Allow fast style change for single saber"},//18
{"New dmg calculation for SP damage (no vel dmg)"},//19
{"The slow blade penetrates the sheild"},//20
{ "New dmg calculation for SP damage (capped vel dmg)" },//19
};
static const int MAX_SABER_TWEAKS = ARRAY_LEN( saberTweaks );

Expand Down
2 changes: 1 addition & 1 deletion codemp/game/g_weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3209,7 +3209,7 @@ static void WP_CreateMortar( vec3_t start, vec3_t fwd, gentity_t *self)
missile->takedamage = qtrue;
missile->r.contents = MASK_SHOT; //solid?
missile->die = RocketDie;
//===testing being able to shoot rockets out of the air==================================
//===testing being able to shoot rockets out of the air==================================
*/

missile->clipmask = MASK_SHOT;
Expand Down
34 changes: 33 additions & 1 deletion codemp/game/w_saber.c
Original file line number Diff line number Diff line change
Expand Up @@ -4188,7 +4188,39 @@ static QINLINE qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBl
{//in faster-paced games, sabers do more damage
fDmg *= 2.0f;
}
if ( fDmg )
if (fDmg && g_tweakSaber.integer & ST_DUNESABER) {
//make fast moving sabers barely do damage if at all, force ppl to counter aim
//Todo, exclude katas and multi swing moves
float len3, traceLength = Distance(saberEnd, saberStart);

//Com_Printf("Len is %.1f\n", traceLength);

len3 = traceLength*traceLength*traceLength;
if (len3 > 100)
len3 = 100;
else if (len3 < 1)
len3 = 1;

dmg = G_GetAttackDamage(self, fDmg * 10 / (len3), fDmg * 40 / (len3), 0.5f);
//Com_Printf("NewDmg is %i\n", dmg);
}
else if (fDmg && g_tweakSaber.integer & ST_NEWSPSABERDMG) {
//take saber vel out of dmg eq
//We want to get the most powerful part of swing which I guess is the middle? The alternative is to normalize trancelength for the players own mouse movement (so it just is speed of saber tip when not moving mouse)
//Todo, exclude katas and multi swing moves
dmg = G_GetAttackDamage(self, fDmg*0.25, fDmg*1, 0.5f);
//Com_Printf("NewDmg is %i\n", dmg);
}
else if (fDmg && g_tweakSaber.integer & ST_NEWSPSABERDMGCAP) {
float traceLength = Distance(saberEnd, saberStart);

if (traceLength > 30)
traceLength = 30; //cap this to a sane amount
dmg = ceil(fDmg*traceLength*0.1f*0.33f);

//Com_Printf("Sabermove dist is %.0f, oldmg is %i, new dmg is %i\n", traceLength, dmg, dmg2);
}
else if ( fDmg )
{//the longer the trace, the more damage it does
//FIXME: in SP, we only use the part of the trace that's actually *inside* the hit ent...
float traceLength = Distance( saberEnd, saberStart );
Expand Down
4 changes: 3 additions & 1 deletion codemp/rd-rend2/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,11 +1795,13 @@ static void R_InitGoreVao()

tr.goreIBO = R_CreateIBO(
nullptr,
sizeof(glIndex_t) * MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES,
sizeof(glIndex_t) * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES,
VBO_USAGE_DYNAMIC);

tr.goreIBOCurrentIndex = 0;
tr.goreVBOCurrentIndex = 0;

GL_CheckErrors();
}
#endif

Expand Down
5 changes: 5 additions & 0 deletions shared/rd-rend2/tr_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static struct ImagesPool
image_t *pPool;
ImagesPool *pNext;
} *imagesPool;
static bool imagePoolInitialized = false;

static image_t *hashTable[FILE_HASH_SIZE];

Expand Down Expand Up @@ -3603,11 +3604,14 @@ Initialise the images pool allocator
*/
void R_InitImagesPool()
{
if (imagePoolInitialized)
return;
Com_Memset(hashTable, 0, sizeof(hashTable));

imagesPool = NULL;
tr.imagesFreeList = NULL;
R_ExtendImagesPool();
imagePoolInitialized = true;
}

/*
Expand Down Expand Up @@ -3648,6 +3652,7 @@ void R_DeleteTextures( void ) {
imagesPool = pNext;
}

imagePoolInitialized = false;
Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) );
GL_SelectTexture( 1 );
qglBindTexture( GL_TEXTURE_2D, 0 );
Expand Down
3 changes: 0 additions & 3 deletions shared/rd-rend2/tr_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1598,9 +1598,6 @@ void R_SVModelInit()

R_InitImagesPool();
R_InitImages();
R_InitGPUBuffers();
FBO_Init();
GLSL_LoadGPUShaders();
R_InitShaders(qfalse);
#endif

Expand Down
4 changes: 2 additions & 2 deletions shared/rd-rend2/tr_vbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ void RB_UpdateGoreVBO(srfG2GoreSurface_t *goreSurface)
goreSurface->firstVert = tr.goreVBOCurrentIndex;
goreSurface->firstIndex = tr.goreIBOCurrentIndex;

if (tr.goreVBOCurrentIndex + goreSurface->numVerts >= (MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_VERTS * MAX_FRAMES))
if (tr.goreVBOCurrentIndex + goreSurface->numVerts >= (MAX_GORE_RECORDS * MAX_GORE_VERTS * MAX_FRAMES))
tr.goreVBOCurrentIndex = 0;

R_BindVBO(tr.goreVBO);
Expand All @@ -698,7 +698,7 @@ void RB_UpdateGoreVBO(srfG2GoreSurface_t *goreSurface)
);
tr.goreVBOCurrentIndex += goreSurface->numVerts;

if (tr.goreIBOCurrentIndex + goreSurface->numVerts >= (MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES))
if (tr.goreIBOCurrentIndex + goreSurface->numIndexes >= (MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES))
tr.goreIBOCurrentIndex = 0;

R_BindIBO(tr.goreIBO);
Expand Down