Jump to content

Ask me anything about the Jedi source code


Recommended Posts

Guest Redemption

@@MGummelt - Hi, I prefer the saber locking in Outcast than Academy, I would like to change academy's saber locking to that of outcasts. How to go about changing this? Copy paste outcast code into academy's and set a cvar for the change. Can this be done?

Link to comment

you might not have the correct same way the saber lock system is done in jko from how it is in jka @

i have not looked at it my self, but i know the code change in jka and might not be they same calls for it in the saber lock code

plus a lot of other stuff. i know the mp code from jko over to jka is very diff from each others so could be same thing here for the sp code.

you haft to remember stuff can have been rewrite and networked in new and maybe better ways from how it was done in jko. just saying

 

a change i notes when i had a look at the jko code was the way saber stance used to be call from anims and not from stance names like SS_DESANN and so on, and if i remember correct which i might not do, but then they are call in the jka code for each stance name to know what anim can be play in the saber lock

MGummelt likes this
Link to comment

There is a saboteur commando NPC into t1_fatal mission, when jaden look into the camera when imperial place the bombs in the core of volcanic factory.  but is just for cinematic. and on level not appear, if you edit the cinematic script for avoid his removing, it fight like a normal saboteur... i suppose is a cutted boss maybe , that should have the dual blaster pistols. D:

Ah, then you should just be able to spawn him any time you want from the console like so:

 

\NPC spawn <npc name>

 

You'd just need to know what NPC it was.  cultistcommando? saboteurcommando?

Link to comment

Hey MGummelt just a short question, I'm no coder but I was wondering if it's possible to deactivate dismemberment on an specific model (I'm talking about MP only) I know that cg_dismember activates/deactivates it but that's for every single model. Can that be fixed with an specific command or will it need an individual script or something?

Absolutely, this is done in the .npc file.  For example, look at the dismemberProbabilities in a Stormtrooper (no decapitations, can't cut them in half, no leg dismemberment - last one because they didn't have caps for leg dismemberment):

StormTrooper
{
	playerModel stormtrooper
	weapon		WP_BLASTER
	health		30
	headPitchRangeDown 30
	reactions	3
	aim			1
	move		3
	aggression	3
	evasion		1
	intelligence	5
	rank		crewman
	playerTeam	TEAM_ENEMY
	enemyTeam	TEAM_PLAYER
//	race		klingon
	class		CLASS_STORMTROOPER
	height		64
	crouchheight 38
	walkSpeed	51
	runSpeed	200
	snd			st1
	sndcombat	st1
	sndextra	st1
	yawspeed	70
	walkSpeed	55
	runSpeed	200
	dismemberProbHead	0
	dismemberProbArms	10
	dismemberProbLegs	0
	dismemberProbHands	20
	dismemberProbWaist	0
}

vs those in the saber training droid (fully dismemberable):

saber_droid_training
{
	playerModel	saber_droid
	saber		droid
	weapon	WP_SABER
	saberStyle	1
	FP_SABER_DEFENSE 1
	FP_SABER_OFFENSE 1
	reactions	1
	aim			1
	move		1
	aggression	1
	evasion		1
	intelligence	1
	hfov		120
	vfov		120
	playerTeam	TEAM_ENEMY
	enemyTeam	TEAM_PLAYER
	class		CLASS_SABER_DROID
	snd			saber_droid
	sndcombat	saber_droid
	sndjedi		saber_droid
	yawSpeed	100
	walkSpeed	60
	runSpeed	200
	health		50
	dismemberProbHead	100
	dismemberProbArms	100
	dismemberProbLegs	100
	dismemberProbHands	100
	dismemberProbWaist	100
}

Just set them all to 0 and they should not be dismemberable.

Penekowski and Cerez like this
Link to comment

@@MGummelt - Its very good to know that, I was in the right place after all. Most of that was familiar and where I made some edits, like say at the bounding box part I had shortened it to -4-4-4 4 4 4. To hear you explain it really helps though. I put on Jedi Academy last night and to say it like I see it, the combat is perfect as it is without code edits. I play outcast mainly due to some of the movement animation changes in Academy, I don't like the movement, dunno why they had to change the style. Went from Matrix like realism to more Anime like style.

One last thing. In Academy and Outcast for the matter, when I lowered saberdefense I got better looking lightsaber battles due to not shunting away the enemy saber. Could you tell me where about in the code this bit of code is? I'd like to have a look.

 

Thank you for you're comment, its very much appreciated.

All the best to you

 

Just look for anywhere forcePowerLevel[FP_SABER_DEFENSE] is used, especially in the WP_SaberDamageTrace() function in WP_Saber.cpp.  For example:

if ( entPowerLevel < FORCE_LEVEL_3 
	&& activeDefense
	&& (hitOwnerPowerLevel > FORCE_LEVEL_2||(hitOwner->client->ps.forcePowerLevel[FP_SABER_DEFENSE]>FORCE_LEVEL_2&&Q_irand(0,hitOwner->client->ps.forcePowerLevel[FP_SABER_OFFENSE]))) )
{//knockaways can make fast-attacker go into a broken parry anim if the ent is using fast or med (but not Tavion)
	//make me parry
	WP_SaberParry( hitOwner, ent );

This means that if the attacker's power level is less than 3 (like, maybe doing a fast attack) and the defender's power level is at least 3 (like, say, doing a strong attack) OR the defender has a Saber Defense of 3, then it has a chance of parrying away the attacker's hit (knocking it away).  The chance of the parry is higher if the defender's saber offense level is higher.

 

I'm guessing what you mean by "shunting away" the enemy saber is parrying.  I would look at anything that calls WP_SaberParry() and see what conditions allow it, then tweak to your tastes.

Link to comment

@@MGummelt - Hi, I prefer the saber locking in Outcast than Academy, I would like to change academy's saber locking to that of outcasts. How to go about changing this? Copy paste outcast code into academy's and set a cvar for the change. Can this be done?

So, if you take just the saber locking code from both WP_Saber.cpp files (the Outcast one and Academy one) and diff them in whatever diff program you like (Notepad++ is free and can diff fairly well), you'll see there were a *ton* of changes to saber locking between Outcast and Academy, especially in relation to animations since it had to support dual sabers and saber staffs.

 

Now, this means you obviously could not port the Academy saberlocking code to Outcast, as the code would be referring to enums and anims and structs that don't exist in Outcast.  But you might have better luck replacing the saberlocking chunk of code in Academy with that of Outcast.  Best case scenario, it might work but dual sabers and saber staffs wouldn't work right.  But I'm guessing the animation system changes might make this impossible.

 

If you want to diff them yourself, here are the line ranges in WP_Saber.cpp to compare:

Outcast: 1813-2404

Academy: 2454-3522

 

Good luck!

Stoiss and Cerez like this
Link to comment
Guest Redemption

@@MGummelt - Geez cheers for all the help. I've been having a look at the code and while doing so I thought about trying again to have an idea of mine implemented into the game. It always bugged me how cortosis is meant to be saber resistant, but ingame I can still use the saber to kill shadowtroopers and galak mech. In g_combat, I've made it so you cannot kill galak mech and shadowtroopers with sabers and it works but... how would I go about making the saber bounce off, of them when I land a hit? There is a code in academy called bounce on walls, say if i could port that over to outcast, is there anyway to make this idea happen?  

Link to comment

Ah, then you should just be able to spawn him any time you want from the console like so:

 

\NPC spawn <npc name>

 

You'd just need to know what NPC it was.  cultistcommando? saboteurcommando?

 

lol, my best manage with code is that for my mode i change a lot of thing working around custom NPC and classes because my mod set gameplay for fantasy ambientation (i am doing a mod about legacy of kain series, but is also a good start point for study how to make a game about a my personal science fiction fantasy saga) so on my mod basically i removed all weapons model of shooting weapons leaving just a noweap.glm as model. npc shoot projectiles directly by hands (also changing shooting animation, so shooters become some kind of wizards) next step was to change fx and sound. basically i increased the fxscheduler buffer and added effect by classes: example: if CLASS_SABOTEUR shoot with blaster pistol, shoot darkness projectiles magic. if shoot them a skeleton, shoot a necromantic effect, like a little black hole... and so away.

basically associaction is:

BLASTER_PISTOL: darkness - enem,y is blinded

BLASTER: fire \ lava  - enemy is burned

BOWCASTER: light \ lightning  - enemy is shocked \ disintegrated

FLECHETTE: earth - enemy is freezed or knockbacked

REPEATER: ice \ crystal - enemy is frosted

DEMP2: holy magic - deadly for undeads and vampires

CONCUSSION: necromantic magic -  deadly for humans and sarafan warriors.

ROCKET: air \ wind magic

also i have separated efx and sound fo bryar pistol and jawa. in my mod bryar is a magic bow and jawa weapon shoot sonic projectile that stun hitted enemy like the howler scream.

it's a looong work. a work doing on FX_ files of weapons of SP code, and G_combat interaction, i doing weakness and resistance of the CLASS of ai to elements MOD like demp2 in default game is deadly for droids... so for example, a class of creatures of ice \ frost \ snow is weak to WEAP_BLASTER but not get damage by WP_REPEATER. this add a very strategic shooting combat because player need to use the proper magic spell against an NPC for defeat him.

i do the same thinks also on sabers, creating specific saber into SAB files that inflict various MOD_ damage instead of MOD_SABER to enemy. for example: the reaver of darkness inflict MOD_BRYAR damage to enemies.

in that way, the JKA engine can be used for create a RPG fantasy action game. serious, the potential of the JKA engine is really understimated for what i think. with a good coding skill is possible to make wonder gameplaies.

 

i have also an idea for the next future: because fighter vehicle are not the best on JKA (they move too fast for map so smalls, explode when they hit a surface like nothing, yaw movement is too slow) i want to solve this problem making a NPC AI class code for specific FIGHTER npc so in future should be possible to use playermodel command for play as a flying fighter. shoot weapons become blaster and missile of fighter and yaw and speed are customizable with a simple NPC file. on my conclusion a fighter need:

- a fighter model glm  rigged just to pelvis bone of humanoid skeleton should be sufficient i guess. o.o

- the fighter AI should be an half way between seeker ai and sentry droid AI class.

- dieng remove model and play explosion efx and sound 

- movement are little different: the fighter flay EVER forward. ever. like on rogue squadron 3d old arcade game.

the W and S keywoard comand should control pitch movement of fighter i suppose, or maybe trhust and brake and control pitch movement with mouse? i am not against sure about that.

 

however, i hope i can do that some day. if have success i will share the code and JKA can get also some nice space \ fly battles against players. : 3

MGummelt likes this
Link to comment

Absolutely, this is done in the .npc file.  For example, look at the dismemberProbabilities in a Stormtrooper (no decapitations, can't cut them in half, no leg dismemberment - last one because they didn't have caps for leg dismemberment):

StormTrooper
{
	playerModel stormtrooper
	weapon		WP_BLASTER
	health		30
	headPitchRangeDown 30
	reactions	3
	aim			1
	move		3
	aggression	3
	evasion		1
	intelligence	5
	rank		crewman
	playerTeam	TEAM_ENEMY
	enemyTeam	TEAM_PLAYER
//	race		klingon
	class		CLASS_STORMTROOPER
	height		64
	crouchheight 38
	walkSpeed	51
	runSpeed	200
	snd			st1
	sndcombat	st1
	sndextra	st1
	yawspeed	70
	walkSpeed	55
	runSpeed	200
	dismemberProbHead	0
	dismemberProbArms	10
	dismemberProbLegs	0
	dismemberProbHands	20
	dismemberProbWaist	0
}

vs those in the saber training droid (fully dismemberable):

saber_droid_training
{
	playerModel	saber_droid
	saber		droid
	weapon	WP_SABER
	saberStyle	1
	FP_SABER_DEFENSE 1
	FP_SABER_OFFENSE 1
	reactions	1
	aim			1
	move		1
	aggression	1
	evasion		1
	intelligence	1
	hfov		120
	vfov		120
	playerTeam	TEAM_ENEMY
	enemyTeam	TEAM_PLAYER
	class		CLASS_SABER_DROID
	snd			saber_droid
	sndcombat	saber_droid
	sndjedi		saber_droid
	yawSpeed	100
	walkSpeed	60
	runSpeed	200
	health		50
	dismemberProbHead	100
	dismemberProbArms	100
	dismemberProbLegs	100
	dismemberProbHands	100
	dismemberProbWaist	100
}

Just set them all to 0 and they should not be dismemberable.

 

 

 

 

Thank you! But I'm talking about MP models specifically, like actual real time players that use X model, where should i put those lines? As far as i know that only works with npcs.

Link to comment

@@MGummelt, another question/observation would be with regards to the saber system in general.

 

I'm sure many others can chime in but, simply recompiling the originally released SDK (also linux vs windows) even will cause differences in blocks and damages, more ghosting (visual hits that aren't hits) supposedly according to many people in the game and mod communities.  I guess the problems might stem from different floating point precisions etc and the original codebase being super picky about values in the collision code and w_saber.c.  But nobody has ever really nailed down what the causes are.  And obviously, most people aren't going to want to use ancient compiler versions anymore, its not realistic.  Someone had asked earlier on Discord what computer specs were used to compile JKA for Windows anyway?  And this problem isn't exactly new.  It's been highly debated and contested for many years as far as pure basers won't even use mods because the feels are different even if the code remains the same.

 

I would like to chime in!

 

There is a similar consensus among JK2 players and one I've shared for many years. However JK2 mods work under much more controlled environment as they are all QVM mods. There are no floating point precision issues or compiler differences, all this is handled consistently by the engine. Possibly PRNG can be used a bit differently in different mods, but I can't imagine it's so bad that there are patterns recognizable by players EDIT: I back out of this – it's truly awful, bad implementation of already weak PRNG (comes from id tech 3). Need to have another look. I thought it could be caused by some tiny timing differences but everything works on a millisecond precision and I'm sure in these mods there is nothing that would add a delay as large.

 

On one hand I've heard opinions from other developers that this is placebo, double blind tests with altered mod name confirming it. Belief that something is different may come simply different server conditions.

 

On the other hand I've never doubted the effect myself, nor has any other seasoned player I know, and I remember situations like when we changed mod on a popular server once – same machine, same location, same port, same dedicated server binary. The change was obvious and it took few days for all regulars (including me) to adjust.

 

I understand that JKA has more possible causes for such behavior (dll mods), but I played it a bit and I didn't feel any larger difference between mods there than I do in JK2.

It would be amazing to figure it out once and for all. This has bugged me since I started playing in 2004 and sadly prevented many good mod projects from gaining traction.

 

PS I remember hearing from someone well informed few years ago that JKA modding community finally learned the original compiler name (some version of ICC). Didn't you? :-)

Smoo likes this
Link to comment

@@MGummelt - Geez cheers for all the help. I've been having a look at the code and while doing so I thought about trying again to have an idea of mine implemented into the game. It always bugged me how cortosis is meant to be saber resistant, but ingame I can still use the saber to kill shadowtroopers and galak mech. In g_combat, I've made it so you cannot kill galak mech and shadowtroopers with sabers and it works but... how would I go about making the saber bounce off, of them when I land a hit? There is a code in academy called bounce on walls, say if i could port that over to outcast, is there anyway to make this idea happen?  

 

Sure, and no porting needed.

 

When when you hit an enemy in WP_SaberDamageTrace(), check their NPC type and if it's a galak mech or shadowtrooper, call this:

 

WP_SaberParry( hitOwner, ent );
 
Maybe something like this... down in the WP_SaberApplyDamage() function, when it's checking the victims hit by the lightsaber around line 719):
	for ( int i = 0; i < numVictims; i++ )
	{
		dFlags = baseDFlags|DAMAGE_DEATH_KNOCKBACK|DAMAGE_NO_HIT_LOC;
		if ( victimEntityNum[i] != ENTITYNUM_NONE && &g_entities[victimEntityNum[i]] != NULL )
		{	// Don't bother with this damage if the fraction is higher than the saber's fraction
			if ( dmgFraction[i] < saberHitFraction || brokenParry )
			{
				victim = &g_entities[victimEntityNum[i]];
				if ( !victim )
				{
					continue;
				}

First check the victim's NPC_class, and if it's the type of NPC you want to make reflect the player's saber, parry and return.  Something like this:

				victim = &g_entities[victimEntityNum[i]];
				if ( !victim )
				{
					continue;
				}

				if (victim->client && (victim->client->NPC_class == CLASS_GALAKMECH || victim->client->NPC_class == CLASS_SHADOWTROOPER))
				{
					WP_SaberParry(victim, attacker);
					return didDamage;
				}

I think that should make the saber bounce off those enemies and do no damage.

Cerez likes this
Link to comment

Thank you! But I'm talking about MP models specifically, like actual real time players that use X model, where should i put those lines? As far as i know that only works with npcs.

 

Hmm.  You'd have to put something in the dismemberment code that checks for specific models.  Kind of a hardcoded hack, but you don't really have much of a choice as there's no real external data set for player models in MP.

 

Probably best to put it in G_CheckForDismemberment() in g_combat.c...

 

Check the player's model there, maybe like so?  (second section is the new bit, just included the stuff above it so you know where it goes)

	if (gGAvoidDismember != 2)
	{ //this means do the dismemberment regardless of randomness and damage
		if (Q_irand(0, 100) > dismember)
		{
			return;
		}

		if (damage < 5)
		{
			return;
		}
	}
 
if (ent->client && ent->s.clientNum > 0 && ent->s.clientNum < MAX_CLIENTS)

{ trap_GetUserinfo(clientNum, userinfo, sizeof(userinfo)); modelname = Info_ValueForKey(userinfo, "model"); if (modelname == "chewbacca") return; }

Obviously, for that to work, you need to add this declaration to the top of the function:

char userinfo[MAX_INFO_VALUE], *modelname;

Link to comment

We've known about the icc compiler for linux for a long time.  But they used MSVC 2003 for Windows ofc.  ICC is also not free.

 Heh... maybe install Windows 98, NT, 2000 or XP on an old machine, install Visual Studio .NET or VS.NET 2003 (or was it VS 6.0?) and try compiling it on that?  :D

Smoo likes this
Link to comment

 Heh... maybe install Windows 98, NT, 2000 or XP on an old machine, install Visual Studio .NET or VS.NET 2003 (or was it VS 6.0?) and try compiling it on that?   :D

VS .NET 2003 Pro installs and works perfectly on Windows 7.  I have it installed on my Win7 64-bit workstation. :winkthumb:  ...but installing VS2015 Community afterwards will break the 2003 project wizard (which can be rectified by uninstalling VS2015-- maybe there's a smarter solution which would leave VS2015 installed).

Link to comment

Wow, sounds ambitious!  Sounds like a total conversion!  Good luck with it, man!

Yes, total conversion. Thanks :D

@@Penekowski

is also possible to add a different kind of damage to a specific saber you create on SAB files:

 

 
if ( saberType == SABER_SITH_SWORD )
                        {//do knockback
                            dFlags &= ~(DAMAGE_NO_KNOCKBACK|DAMAGE_DEATH_KNOCKBACK);
                        }
                        if ( !WP_SaberBladeUseSecondBladeStyle( &ent->client->ps.saber[saberNum], bladeNum )
                            && ent->client->ps.saber[saberNum].knockbackScale > 0.0f )
                        {
                            dFlags &= ~(DAMAGE_NO_KNOCKBACK|DAMAGE_DEATH_KNOCKBACK);
                            if ( saberNum < 1 )
                            {
                                dFlags |= DAMAGE_SABER_KNOCKBACK1;
                            }
                            else
                            {
                                dFlags |= DAMAGE_SABER_KNOCKBACK2;
                            }
                        }
                        else if ( WP_SaberBladeUseSecondBladeStyle( &ent->client->ps.saber[saberNum], bladeNum )
                            && ent->client->ps.saber[saberNum].knockbackScale2 > 0.0f )
                        {
                            dFlags &= ~(DAMAGE_NO_KNOCKBACK|DAMAGE_DEATH_KNOCKBACK);
                            if ( saberNum < 1 )
                            {
                                dFlags |= DAMAGE_SABER_KNOCKBACK1_B2;
                            }
                            else
                            {
                                dFlags |= DAMAGE_SABER_KNOCKBACK2_B2;
                            }
                        }
                        if ( thrownSaber )
                        {
                            inflictor = &g_entities[ent->client->ps.saberEntityNum];
                        }
                        int damage = 0;
                        if ( !WP_SaberBladeUseSecondBladeStyle( &ent->client->ps.saber[saberNum], bladeNum )
                            && ent->client->ps.saber[saberNum].damageScale != 1.0f )
                        {
                            damage = ceil(totalDmg[i]*ent->client->ps.saber[saberNum].damageScale);
                        }
                        else if ( WP_SaberBladeUseSecondBladeStyle( &ent->client->ps.saber[saberNum], bladeNum )
                            && ent->client->ps.saber[saberNum].damageScale2 != 1.0f )
                        {
                            damage = ceil(totalDmg[i]*ent->client->ps.saber[saberNum].damageScale2);
                        }
                        else
                        {
                            damage = ceil(totalDmg[i]);
                        }
                        
                        // DANNO SPADA
                        // SPADE DI TENEBRE
                        if(!Q_stricmp( ent->client->ps.saber[saberNum].fullName, "Dark Reaver"))
                        {
                            G_Damage( victim, inflictor, ent, dmgDir[i], dmgSpot[i], damage, dFlags, MOD_BRYAR, hitDismemberLoc[i] );
                        }
                        else if(!Q_stricmp( ent->client->ps.saber[saberNum].fullName, "Smog Reaver"))
                        {
                            G_Damage( victim, inflictor, ent, dmgDir[i], dmgSpot[i], damage, dFlags, MOD_BRYAR_ALT, hitDismemberLoc[i] );
                            G_Damage( victim, inflictor, ent, dmgDir[i], dmgSpot[i], damage, dFlags, MOD_BLASTER, hitDismemberLoc[i] );
                        }
                        else if(!Q_stricmp( ent->client->ps.saber[saberNum].fullName, "Void Reaver"))
                        {
                            G_Damage( victim, inflictor, ent, dmgDir[i], dmgSpot[i], damage, dFlags, MOD_BRYAR_ALT, hitDismemberLoc[i] );
                            G_Damage( victim, inflictor, ent, dmgDir[i], dmgSpot[i], damage, dFlags, MOD_ROCKET, hitDismemberLoc[i] );
                        }
                        else if(!Q_stricmp( ent->client->ps.saber[saberNum].fullName, "Lightning Reaver"))
                        {
                            G_Damage( victim, inflictor, ent, dmgDir[i], dmgSpot[i], damage, dFlags, MOD_ELECTROCUTE, hitDismemberLoc[i] );
                            if (  victim &&  victim->client && victim->health >= 0 )
                                    {
                                                 victim->s.powerups |= ( 1 << PW_SHOCKED );
                                                 victim->client->ps.powerups[PW_SHOCKED] = cg.time + 1000;
                                    }
                        }
                        else if(!Q_stricmp( ent->client->ps.saber[saberNum].fullName, "Sunlight Reaver"))
                        {
                            G_Damage( victim, inflictor, ent, dmgDir[i], dmgSpot[i], damage, dFlags, MOD_SNIPER, hitDismemberLoc[i] );
                            if (  victim &&  victim->client && victim->health >= 1 )
                                    {
                                                 victim->s.powerups |= ( 1 << PW_SHOCKED );
                                                 victim->client->ps.powerups[PW_SHOCKED] = cg.time + 1000;
                                    }
                        }
 

doing something like that on wp_saber.cpp, you can create a specific saber (later you add this on ext_data/sabers folder. that inflict special damage and damage effect to enemies with custom MOD. so you can do same saber that is deadly against droid because inflicting damage with MOD_DEMP2 . otherwise you can add new Mods and set on g_combat for be deadly against jedi, sith or force users, and so you can get sabers inbued with Light side of force and other with dark side.

you can see into the example tree a black hole \ dark sabers, an electric saber that electrocuted enemy hitted, and a disgregator saber. enemy killed by MOD_SNIPER die with body disintegration, like disruptor rifle. :)

Penekowski and Cerez like this
Link to comment

We've known about the icc compiler for linux for a long time.  But they used MSVC 2003 for Windows ofc.  ICC is also not free.

 

Didn't know that ICC was used for linux. Kinda strange not seeing any preprocessor quirks for it, must have been a solid compiler :-) I don't understand how ICC not being free is relevant to anything though (the question being about original compiler).

If you know exact MSVC version then what's the problem again? Did anyone try producing matching binaries with it?

Link to comment

 Heh... maybe install Windows 98, NT, 2000 or XP on an old machine, install Visual Studio .NET or VS.NET 2003 (or was it VS 6.0?) and try compiling it on that?   :D

 

Thing is, code won't compile for it anymore because we fixed some of the bad C++ code and now (though somewhat unnecessary as a whole) use some semi-modern C++ in SP at least.  @@mrwonko replaced the genericparser2 in SP with some C++11/14 code which is used for EFX/dms.dat and some other stuff maybe.

Link to comment

Talking about modern C++ - have you been keeping up with the changes? What excites you, what are you looking forward to? Personally I'm in love with move semantics and eagerly awaiting concepts, modules and opaque typedefs. (Not really related to JK I guess, but I'm curious.)

Link to comment

Didn't know that ICC was used for linux. Kinda strange not seeing any preprocessor quirks for it, must have been a solid compiler :-) I don't understand how ICC not being free is relevant to anything though (the question being about original compiler).

If you know exact MSVC version then what's the problem again? Did anyone try producing matching binaries with it?

 

The original codebase obviously would still compile with those (if you wanted to have that crappy of a vs version, nobody wants to, its too old) OpenJK will not compile with < 2013 as of last year.

Link to comment

Another source code (and scripting) related question comes to mind:

 

Is it possible to set and retrieve values from CVARs in ICARUS?

 

The following code snippet crashes the game when retrieving the value from cvar_sex (the player is female to start with):

 

declare( STRING, "playergen" );

if ( get(STRING, "cvar_sex") = "m" )
{
	set( "cvar_sex", get(STRING, "playergen") );
	free( "playergen" );
}
else
{
	set( "playergen", get(STRING, "cvar_sex") );
	set( "cvar_sex", "m" );
}
Link to comment

The original codebase obviously would still compile with those (if you wanted to have that crappy of a vs version, nobody wants to, its too old) OpenJK will not compile with < 2013 as of last year.

 

Hmm fine. I didn't have using some ancient msvc for modern mods in mind, rather using it as a tool to find out where lies the difference. Eh, I feel like it's gonna stay a mystery forever (at least for those who don't believe it to be placebo). I have some new-found hopes regarding this PRNG but if it's not it then I ran out of ideas. Gonna spend the rest of my days trying to prove it's a placebo =)

Link to comment
Guest Redemption

 

 

Sure, and no porting needed.

 

When when you hit an enemy in WP_SaberDamageTrace(), check their NPC type and if it's a galak mech or shadowtrooper, call this:

 

WP_SaberParry( hitOwner, ent );

 

Maybe something like this... down in the WP_SaberApplyDamage() function, when it's checking the victims hit by the lightsaber around line 719):

for ( int i = 0; i < numVictims; i++ )

{

  dFlags = baseDFlags|DAMAGE_DEATH_KNOCKBACK|DAMAGE_NO_HIT_LOC;

  if ( victimEntityNum != ENTITYNUM_NONE && &g_entities[victimEntityNum] != NULL )

  { // Don't bother with this damage if the fraction is higher than the saber's fraction

   if ( dmgFraction < saberHitFraction || brokenParry )

   {

    victim = &g_entities[victimEntityNum];

    if ( !victim )

    {

     continue;

    }

First check the victim's NPC_class, and if it's the type of NPC you want to make reflect the player's saber, parry and return.  Something like this:

    victim = &g_entities[victimEntityNum];

    if ( !victim )

    {

     continue;

    }

    if (victim->client && (victim->client->NPC_class == CLASS_GALAKMECH || victim->client->NPC_class == CLASS_SHADOWTROOPER))

    {

     WP_SaberParry(victim, attacker);

     return didDamage;

    }

I think that should make the saber bounce off those enemies and do no damage.

 

@@MGummelt - Hello again. I've tried my hand at coding it in but get this error:

Error 4 error C3861: 'WP_SaberParry': identifier not found

Penekowski likes this
Link to comment

@@MGummelt - Hello again. I've tried my hand at coding it in but get this error:

Error 4 error C3861: 'WP_SaberParry': identifier not found

Because you need to declair or define the function at the start of file you're editing, and it need to be pointed to the function inside the other file. right click of mouse on WP_saberparry and go to definition option. you need to add into the file the line:

 

"extern qboolean WP_SaberParry( gentity_t *victim, gentity_t *attacker, int saberNum, int bladeNum )"

 

if instead the function is in the file itself, maybe the function is in a lower section of code respect of the code part you are editing. 

(so compiler cannot find the function?) try to cut and paste the function upon.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...