#pragma warning(disable : 4244) //'conversion' conversion from 'type1' to 'type2', possible loss of data
#pragma warning(disable : 4284) // return type not UDT
//#pragma warning(disable : 4305) // truncation from const double to float
#pragma warning(disable : 4310) // cast truncates constant value
#pragma warning(disable : 4514) //unreferenced inline/local function has been removed
#pragma warning(disable : 4710) // not inlined
#pragma warning(disable : 4711) // selected for automatic inline expansion
#pragma warning(disable : 4786) // identifier was truncated
#pragma warning(disable : 5208) // unnamed class used in typedef name cannot declare members other than non-static data members, member enumerations, or member classes
#pragma warning(disable : 4996) // This function or variable may be unsafe.
#endif
//rww - conveniently toggle "gore" code, for model decals and stuff.
#define SFL_NOT_LOCKABLE (1<<0)//can't get into a saberlock
#define SFL_NOT_THROWABLE (1<<1)//can't be thrown - FIXME: maybe make this a max level of force saber throw that can be used with this saber?
#define SFL_NOT_DISARMABLE (1<<2)//can't be dropped
#define SFL_NOT_ACTIVE_BLOCKING (1<<3)//don't to try to block incoming shots with this saber
#define SFL_TWO_HANDED (1<<4)//uses both hands
#define SFL_SINGLE_BLADE_THROWABLE (1<<5)//can throw this saber if only the first blade is on
#define SFL_RETURN_DAMAGE (1<<6)//when returning from a saber throw, it keeps spinning and doing damage
//NEW FLAGS
#define SFL_ON_IN_WATER (1<<7)//if set, weapon stays active even in water
#define SFL_BOUNCE_ON_WALLS (1<<8)//if set, the saber will bounce back when it hits solid architecture (good for real-sword type mods)
#define SFL_BOLT_TO_WRIST (1<<9)//if set, saber model is bolted to wrist, not in hand... useful for things like claws & shields, etc.
//#define SFL_STICK_ON_IMPACT (1<<?)//if set, the saber will stick in the wall when thrown and hits solid architecture (good for sabers that are meant to be thrown).
//#define SFL_NO_ATTACK (1<<?)//if set, you cannot attack with the saber (for sabers/weapons that are meant to be thrown only, not used as melee weapons).
//Move Restrictions
#define SFL_NO_PULL_ATTACK (1<<10)//if set, cannot do pull+attack move (move not available in MP anyway)
#define SFL_NO_BACK_ATTACK (1<<11)//if set, cannot do back-stab moves
#define SFL_NO_STABDOWN (1<<12)//if set, cannot do stabdown move (when enemy is on ground)
#define SFL_NO_WALL_RUNS (1<<13)//if set, cannot side-run or forward-run on walls
#define SFL_NO_WALL_FLIPS (1<<14)//if set, cannot do backflip off wall or side-flips off walls
#define SFL_NO_WALL_GRAB (1<<15)//if set, cannot grab wall & jump off
#define SFL_NO_ROLLS (1<<16)//if set, cannot roll
#define SFL_NO_FLIPS (1<<17)//if set, cannot do flips
#define SFL_NO_CARTWHEELS (1<<18)//if set, cannot do cartwheels
#define SFL_NO_KICKS (1<<19)//if set, cannot do kicks (can't do kicks anyway if using a throwable saber/sword)
#define SFL_NO_MIRROR_ATTACKS (1<<20)//if set, cannot do the simultaneous attack left/right moves (only available in Dual Lightsaber Combat Style)
#define SFL_NO_ROLL_STAB (1<<21)//if set, cannot do roll-stab move at end of roll
//SABER FLAGS2
//Primary Blade Style
#define SFL2_NO_WALL_MARKS (1<<0)//if set, stops the saber from drawing marks on the world (good for real-sword type mods)
#define SFL2_NO_DLIGHT (1<<1)//if set, stops the saber from drawing a dynamic light (good for real-sword type mods)
#define SFL2_NO_BLADE (1<<2)//if set, stops the saber from drawing a blade (good for real-sword type mods)
#define SFL2_NO_CLASH_FLARE (1<<3)//if set, the saber will not do the big, white clash flare with other sabers
#define SFL2_NO_DISMEMBERMENT (1<<4)//if set, the saber never does dismemberment (good for pointed/blunt melee weapons)
#define SFL2_NO_IDLE_EFFECT (1<<5)//if set, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods)
#define SFL2_ALWAYS_BLOCK (1<<6)//if set, the blades will always be blocking (good for things like shields that should always block)
#define SFL2_NO_MANUAL_DEACTIVATE (1<<7)//if set, the blades cannot manually be toggled on and off
#define SFL2_TRANSITION_DAMAGE (1<<8)//if set, the blade does damage in start, transition and return anims (like strong style does)
//Secondary Blade Style
#define SFL2_NO_WALL_MARKS2 (1<<9)//if set, stops the saber from drawing marks on the world (good for real-sword type mods)
#define SFL2_NO_DLIGHT2 (1<<10)//if set, stops the saber from drawing a dynamic light (good for real-sword type mods)
#define SFL2_NO_BLADE2 (1<<11)//if set, stops the saber from drawing a blade (good for real-sword type mods)
#define SFL2_NO_CLASH_FLARE2 (1<<12)//if set, the saber will not do the big, white clash flare with other sabers
#define SFL2_NO_DISMEMBERMENT2 (1<<13)//if set, the saber never does dismemberment (good for pointed/blunt melee weapons)
#define SFL2_NO_IDLE_EFFECT2 (1<<14)//if set, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods)
#define SFL2_ALWAYS_BLOCK2 (1<<15)//if set, the blades will always be blocking (good for things like shields that should always block)
#define SFL2_NO_MANUAL_DEACTIVATE2 (1<<16)//if set, the blades cannot manually be toggled on and off
#define SFL2_TRANSITION_DAMAGE2 (1<<17)//if set, the blade does damage in start, transition and return anims (like strong style does)
char*fullName;//the "Proper Name" of the saber, shown in the UI
saberType_ttype;//none, single or staff
char*model;//hilt model
char*skin;//hilt custom skin
intsoundOn;//game soundindex for turning on sound
intsoundLoop;//game soundindex for hum/loop sound
intsoundOff;//game soundindex for turning off sound
intnumBlades;
bladeInfo_tblade[MAX_BLADES];//blade info - like length, trail, origin, dir, etc.
intstylesLearned;//styles you get when you get this saber, if any
intstylesForbidden;//styles you cannot use with this saber, if any
intmaxChain;//how many moves can be chained in a row with this weapon (-1 is infinite, 0 is use default behavior)
intforceRestrictions;//force powers that cannot be used while this saber is on (bitfield) - FIXME: maybe make this a limit on the max level, per force power, that can be used with this type?
intlockBonus;//in saberlocks, this type of saber pushes harder or weaker
intparryBonus;//added to strength of parry with this saber
intbreakParryBonus;//added to strength when hit a parry
intbreakParryBonus2;//for bladeStyle2 (see bladeStyle2Start below)
intdisarmBonus;//added to disarm chance when win saberlock or have a good parry (knockaway)
intdisarmBonus2;//for bladeStyle2 (see bladeStyle2Start below)
saber_styles_tsingleBladeStyle;//makes it so that you use a different style if you only have the first blade active
char*brokenSaber1;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your right hand
char*brokenSaber2;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your left hand
//these values are global to the saber, like all of the ones above
intsaberFlags;//from SFL_ list above
intsaberFlags2;//from SFL2_ list above
//done in cgame (client-side code)
qhandle_tspinSound;//none - if set, plays this sound as it spins when thrown
qhandle_tswingSound[3];//none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!!
qhandle_tfallSound[3];//none - if set, plays one of these 3 sounds when weapon drops to the ground - NOTE: must provide all 3!!!
//done in game (server-side code)
floatmoveSpeedScale;//1.0 - you move faster/slower when using this saber
floatanimSpeedScale;//1.0 - plays normal attack animations faster/slower
//done in both cgame and game (BG code)
intkataMove;//LS_INVALID - if set, player will execute this move when they press both attack buttons at the same time
intlungeAtkMove;//LS_INVALID - if set, player will execute this move when they crouch+fwd+attack
intjumpAtkUpMove;//LS_INVALID - if set, player will execute this move when they jump+attack
intjumpAtkFwdMove;//LS_INVALID - if set, player will execute this move when they jump+fwd+attack
intjumpAtkBackMove;//LS_INVALID - if set, player will execute this move when they jump+back+attack
intjumpAtkRightMove;//LS_INVALID - if set, player will execute this move when they jump+rightattack
intjumpAtkLeftMove;//LS_INVALID - if set, player will execute this move when they jump+left+attack
intreadyAnim;//-1 - anim to use when standing idle
intdrawAnim;//-1 - anim to use when drawing weapon
intputawayAnim;//-1 - anim to use when putting weapon away
inttauntAnim;//-1 - anim to use when hit "taunt"
intbowAnim;//-1 - anim to use when hit "bow"
intmeditateAnim;//-1 - anim to use when hit "meditate"
intflourishAnim;//-1 - anim to use when hit "flourish"
intgloatAnim;//-1 - anim to use when hit "gloat"
//***NOTE: you can only have a maximum of 2 "styles" of blades, so this next value, "bladeStyle2Start" is the number of the first blade to use these value on... all blades before this use the normal values above, all blades at and after this number use the secondary values below***
intbladeStyle2Start;//0 - if set, blades from this number and higher use the following values (otherwise, they use the normal values already set)
//***The following can be different for the extra blades - not setting them individually defaults them to the value for the whole saber (and first blade)***
//===PRIMARY BLADES=====================
//done in cgame (client-side code)
inttrailStyle;//0 - default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods)
charg2MarksShader[MAX_QPATH];//none - if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark"
charg2WeaponMarkShader[MAX_QPATH];//none - if set, the game will ry to project this shader onto the weapon when it damages a person (good for a blood splatter on the weapon)
//int bladeShader; //none - if set, overrides the shader used for the saber blade?
//int trailShader; //none - if set, overrides the shader used for the saber trail?
qhandle_thitSound[3];//none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
qhandle_tblockSound[3];//none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
qhandle_tbounceSound[3];//none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
intblockEffect;//none - if set, plays this effect when the saber/sword hits another saber/sword (instead of "saber/saber_block.efx")
inthitPersonEffect;//none - if set, plays this effect when the saber/sword hits a person (instead of "saber/blood_sparks_mp.efx")
inthitOtherEffect;//none - if set, plays this effect when the saber/sword hits something else damagable (instead of "saber/saber_cut.efx")
intbladeEffect;//none - if set, plays this effect at the blade tag
//done in game (server-side code)
floatknockbackScale;//0 - if non-zero, uses damage done to calculate an appropriate amount of knockback
floatdamageScale;//1 - scale up or down the damage done by the saber
floatsplashRadius;//0 - radius of splashDamage
intsplashDamage;//0 - amount of splashDamage, 100% at a distance of 0, 0% at a distance = splashRadius
floatsplashKnockback;//0 - amount of splashKnockback, 100% at a distance of 0, 0% at a distance = splashRadius
//===SECONDARY BLADES===================
//done in cgame (client-side code)
inttrailStyle2;//0 - default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods)
charg2MarksShader2[MAX_QPATH];//none - if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark"
charg2WeaponMarkShader2[MAX_QPATH];//none - if set, the game will ry to project this shader onto the weapon when it damages a person (good for a blood splatter on the weapon)
//int bladeShader2; //none - if set, overrides the shader used for the saber blade?
//int trailShader2; //none - if set, overrides the shader used for the saber trail?
qhandle_thit2Sound[3];//none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
qhandle_tblock2Sound[3];//none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
qhandle_tbounce2Sound[3];//none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!!
intblockEffect2;//none - if set, plays this effect when the saber/sword hits another saber/sword (instead of "saber/saber_block.efx")
inthitPersonEffect2;//none - if set, plays this effect when the saber/sword hits a person (instead of "saber/blood_sparks_mp.efx")
inthitOtherEffect2;//none - if set, plays this effect when the saber/sword hits something else damagable (instead of "saber/saber_cut.efx")
intbladeEffect2;//none - if set, plays this effect at the blade tag
//done in game (server-side code)
floatknockbackScale2;//0 - if non-zero, uses damage done to calculate an appropriate amount of knockback
floatdamageScale2;//1 - scale up or down the damage done by the saber
floatsplashRadius2;//0 - radius of splashDamage
intsplashDamage2;//0 - amount of splashDamage, 100% at a distance of 0, 0% at a distance = splashRadius
floatsplashKnockback2;//0 - amount of splashKnockback, 100% at a distance of 0, 0% at a distance = splashRadius
//NOTE: Below is the *retail* version of the saberInfo_t structure - it is ONLY used for loading retail-version savegames (we load the savegame into this smaller structure, then copy each field into the appropriate field in the new structure - see SG_ConvertRetailSaberinfoToNewSaberinfo()
classsaberInfoRetail_t
{
public:
char*name;//entry in sabers.cfg, if any
char*fullName;//the "Proper Name" of the saber, shown in the UI
saberType_ttype;//none, single or staff
char*model;//hilt model
char*skin;//hilt custom skin
intsoundOn;//game soundindex for turning on sound
intsoundLoop;//game soundindex for hum/loop sound
intsoundOff;//game soundindex for turning off sound
intnumBlades;
bladeInfo_tblade[MAX_BLADES];//blade info - like length, trail, origin, dir, etc.
saber_styles_tstyle;//locked style to use, if any
intmaxChain;//how many moves can be chained in a row with this weapon (-1 is infinite, 0 is use default behavior)
qbooleanlockable;//can get into a saberlock
qbooleanthrowable;//whether or not this saber can be thrown - FIXME: maybe make this a max level of force saber throw that can be used with this saber?
qbooleandisarmable;//whether or not this saber can be dropped
qbooleanactiveBlocking;//whether or not to try to block incoming shots with this saber
qbooleantwoHanded;//uses both hands
intforceRestrictions;//force powers that cannot be used while this saber is on (bitfield) - FIXME: maybe make this a limit on the max level, per force power, that can be used with this type?
intlockBonus;//in saberlocks, this type of saber pushes harder or weaker
intparryBonus;//added to strength of parry with this saber
intbreakParryBonus;//added to strength when hit a parry
intdisarmBonus;//added to disarm chance when win saberlock or have a good parry (knockaway)
saber_styles_tsingleBladeStyle;//makes it so that you use a different style if you only have the first blade active
qbooleansingleBladeThrowable;//makes it so that you can throw this saber if only the first blade is on
char*brokenSaber1;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your right hand
char*brokenSaber2;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your left hand
qbooleanreturnDamage;//when returning from a saber throw, it keeps spinning and doing damage
voidActivate(void)
{
for(inti=0;i<numBlades;i++)
{
blade[i].active=qtrue;
}
};
voidDeactivate(void)
{
for(inti=0;i<numBlades;i++)
{
blade[i].active=qfalse;
}
};
// Description: Activate a specific Blade of this Saber.
// Created: 10/03/02 by Aurelio Reis, Modified: 10/03/02 by Aurelio Reis.
// [in] int iBlade Which Blade to activate.
// [in] bool bActive Whether to activate it (default true), or deactivate it (false).
intweapon;// determines weapon and flash model, etc
intlegsAnim;//
intlegsAnimTimer;// don't change low priority animations on legs until this runs out
inttorsoAnim;//
inttorsoAnimTimer;// don't change low priority animations on torso until this runs out
intscale;//Scale players
//FIXME: why did IMMERSION dupe these 2 fields here? There's no reason for this!!!
qbooleansaberInFlight;
qbooleansaberActive;
#ifdef JK2_MODE
intvehicleModel;// For overriding your playermodel with a drivable vehicle
#endif
#ifndef JK2_MODE
//int vehicleIndex; // What kind of vehicle you're driving
vec3_tvehicleAngles;//
intvehicleArmor;// current armor of your vehicle (explodes if drops to 0)
// 0 if not in a vehicle, otherwise the client number.
intm_iVehicleNum;
#endif // !JK2_MODE
/*
Ghoul2InsertStart
*/
vec3_tmodelScale;// used to scale models in any axis
intradius;// used for culling all the ghoul models attached to this ent NOTE - this is automatically scaled by Ghoul2 if/when you scale the model. This is a 100% size value
intboltInfo;// info used for bolting entities to Ghoul2 models - NOT used for bolting ghoul2 models to themselves, more for stuff like bolting effects to ghoul2 models
/*
Ghoul2InsertEnd
*/
#ifndef JK2_MODE
qbooleanisPortalEnt;
#endif // !JK2_MODE
voidsg_export(
ojk::SavedGameHelper&saved_game)const
{
saved_game.write<int32_t>(number);
saved_game.write<int32_t>(eType);
saved_game.write<int32_t>(eFlags);
saved_game.write<>(pos);
saved_game.write<>(apos);
saved_game.write<int32_t>(time);
saved_game.write<int32_t>(time2);
saved_game.write<float>(origin);
saved_game.write<float>(origin2);
saved_game.write<float>(angles);
saved_game.write<float>(angles2);
saved_game.write<int32_t>(otherEntityNum);
saved_game.write<int32_t>(otherEntityNum2);
saved_game.write<int32_t>(groundEntityNum);
saved_game.write<int32_t>(constantLight);
saved_game.write<int32_t>(loopSound);
saved_game.write<int32_t>(modelindex);
saved_game.write<int32_t>(modelindex2);
saved_game.write<int32_t>(modelindex3);
saved_game.write<int32_t>(clientNum);
saved_game.write<int32_t>(frame);
saved_game.write<int32_t>(solid);
saved_game.write<int32_t>(event);
saved_game.write<int32_t>(eventParm);
saved_game.write<int32_t>(powerups);
saved_game.write<int32_t>(weapon);
saved_game.write<int32_t>(legsAnim);
saved_game.write<int32_t>(legsAnimTimer);
saved_game.write<int32_t>(torsoAnim);
saved_game.write<int32_t>(torsoAnimTimer);
saved_game.write<int32_t>(scale);
saved_game.write<int32_t>(saberInFlight);
saved_game.write<int32_t>(saberActive);
#ifdef JK2_MODE
saved_game.write<int32_t>(vehicleModel);
#endif // JK2_MODE
#ifndef JK2_MODE
saved_game.write<float>(vehicleAngles);
saved_game.write<int32_t>(vehicleArmor);
saved_game.write<int32_t>(m_iVehicleNum);
#endif // !JK2_MODE
saved_game.write<float>(modelScale);
saved_game.write<int32_t>(radius);
saved_game.write<int32_t>(boltInfo);
#ifndef JK2_MODE
saved_game.write<int32_t>(isPortalEnt);
#endif // !JK2_MODE
}
voidsg_import(
ojk::SavedGameHelper&saved_game)
{
saved_game.read<int32_t>(number);
saved_game.read<int32_t>(eType);
saved_game.read<int32_t>(eFlags);
saved_game.read<>(pos);
saved_game.read<>(apos);
saved_game.read<int32_t>(time);
saved_game.read<int32_t>(time2);
saved_game.read<float>(origin);
saved_game.read<float>(origin2);
saved_game.read<float>(angles);
saved_game.read<float>(angles2);
saved_game.read<int32_t>(otherEntityNum);
saved_game.read<int32_t>(otherEntityNum2);
saved_game.read<int32_t>(groundEntityNum);
saved_game.read<int32_t>(constantLight);
saved_game.read<int32_t>(loopSound);
saved_game.read<int32_t>(modelindex);
saved_game.read<int32_t>(modelindex2);
saved_game.read<int32_t>(modelindex3);
saved_game.read<int32_t>(clientNum);
saved_game.read<int32_t>(frame);
saved_game.read<int32_t>(solid);
saved_game.read<int32_t>(event);
saved_game.read<int32_t>(eventParm);
saved_game.read<int32_t>(powerups);
saved_game.read<int32_t>(weapon);
saved_game.read<int32_t>(legsAnim);
saved_game.read<int32_t>(legsAnimTimer);
saved_game.read<int32_t>(torsoAnim);
saved_game.read<int32_t>(torsoAnimTimer);
saved_game.read<int32_t>(scale);
saved_game.read<int32_t>(saberInFlight);
saved_game.read<int32_t>(saberActive);
#ifdef JK2_MODE
saved_game.read<int32_t>(vehicleModel);
#endif // JK2_MODE
#ifndef JK2_MODE
saved_game.read<float>(vehicleAngles);
saved_game.read<int32_t>(vehicleArmor);
saved_game.read<int32_t>(m_iVehicleNum);
#endif // !JK2_MODE
saved_game.read<float>(modelScale);
saved_game.read<int32_t>(radius);
saved_game.read<int32_t>(boltInfo);
#ifndef JK2_MODE
saved_game.read<int32_t>(isPortalEnt);
#endif // !JK2_MODE
}
}entityState_t;
typedefenum{
CA_UNINITIALIZED,
CA_DISCONNECTED,// not talking to a server
CA_CONNECTING,// sending request packets to the server
CA_CHALLENGING,// sending challenge packets to the server
CA_LOADING,// only during cgame initialization, never during main loop
CA_PRIMED,// got gamestate, waiting for first frame
CA_ACTIVE,// game views should be displayed
CA_CINEMATIC// playing a cinematic or a static pic, not connected to a server
}connstate_t;
typedefstructSSkinGoreData_s
{
vec3_tangles;
vec3_tposition;
intcurrentTime;
intentNum;
vec3_trayDirection;// in world space
vec3_thitLocation;// in world space
vec3_tscale;
floatSSize;// size of splotch in the S texture direction in world units
floatTSize;// size of splotch in the T texture direction in world units
floattheta;// angle to rotate the splotch
vec3_tuaxis;//mark direction
floatdepthStart;// limit marks begin depth
floatdepthEnd;// depth to stop making marks
booluseTheta;
boolfrontFaces;
boolbackFaces;
boolfadeRGB;//specify fade method to modify RGB (by default, the alpha is set instead)
// growing stuff
intgrowDuration;// time over which we want this to scale up, set to -1 for no scaling
floatgoreScaleStartFraction;// fraction of the final size at which we want the gore to initially appear
//qboolean baseModelOnly;
intlifeTime;// effect expires after this amount of time
intfirstModel;// which model to start the gore on (can skip the first)
intfadeOutTime;//specify the duration of fading, from the lifeTime (e.g. 3000 will start fading 3 seconds before removal and be faded entirely by removal)
//int shrinkOutTime; // unimplemented
//float alphaModulate; // unimplemented
//vec3_t tint; // unimplemented
//float impactStrength; // unimplemented
intshader;// shader handle
intmyIndex;// used internally
}SSkinGoreData;
//rww - used for my ik stuff (ported directly from mp)
typedefstruct
{
vec3_tangles;
vec3_tposition;
vec3_tscale;
vec3_tvelocity;
intme;
}sharedRagDollUpdateParams_t;
//rww - update parms for ik bone stuff
typedefstruct
{
charboneName[512];//name of bone
vec3_tdesiredOrigin;//world coordinate that this bone should be attempting to reach
vec3_torigin;//world coordinate of the entity who owns the g2 instance that owns the bone
floatmovementSpeed;//how fast the bone should move toward the destination