Make Hardqore2 build

mostly by fixing missing includes and some other compiler errors,
also fixed some compiler warnings (mostly uninitialized variables)
This commit is contained in:
Daniel Gibson 2018-08-26 23:55:54 +02:00
parent ab119636d3
commit 30391e13f0
23 changed files with 84 additions and 40 deletions

View file

@ -36,6 +36,8 @@ If you have questions concerning this license or the applicable additional terms
#include "Actor.h"
#include "Fx.h" // DG: for hq2
/***********************************************************************

View file

@ -36,6 +36,8 @@ If you have questions concerning this license or the applicable additional terms
#include "Fx.h"
#include "framework/DeclEntityDef.h"
/*
===============================================================================
@ -1159,7 +1161,7 @@ void idTeleporter::Event_DoAction( idEntity *activator ) {
bool forceChangeXpos; //ivan
angle = spawnArgs.GetFloat( "angle" );
idAngles a( 0, spawnArgs.GetFloat( "angle" ), 0 );
idAngles a( 0, angle, 0 );
//ivan start
//was: activator->Teleport( GetPhysics()->GetOrigin(), a, NULL );
@ -1372,7 +1374,8 @@ idDamagingFx *idDamagingFx::StartDamagingFx( int type, idEntity *victimEnt ) {
nfx = static_cast<idDamagingFx*>(ent);
nfx->dmgfxType = type;
//gameLocal.Printf("Spawned %s\n", defName );
StartFxUtility( nfx, &(victimEnt->GetPhysics()->GetAbsBounds().GetCenter()), &mat3_identity, victimEnt, true, false );
idVec3 origin = victimEnt->GetPhysics()->GetAbsBounds().GetCenter();
StartFxUtility( nfx, &origin, &mat3_identity, victimEnt, true, false );
return nfx;
}else{
gameLocal.Error( "Could not spawn idDamagingFx" );

View file

@ -688,6 +688,7 @@ extern const float DEFAULT_GRAVITY;
extern const idVec3 DEFAULT_GRAVITY_VEC3;
extern const int CINEMATIC_SKIP_DELAY;
/* DG: having includes here seems to confuse the compiler
#ifdef _WATER_PHYSICS //un noted change from original sdk
#include "physics/Physics_Liquid.h"
#include "Liquid.h"
@ -698,5 +699,6 @@ extern const int CINEMATIC_SKIP_DELAY;
#endif
#include "ai/AI_bot.h" //ivan
*/
#endif /* !__GAME_LOCAL_H__ */

View file

@ -1,10 +1,13 @@
#include "../idlib/precompiled.h"
#pragma hdrstop
#ifdef _WATER_PHYSICS
#include "Game_local.h"
#include "physics/Physics_Actor.h"
#include "physics/Physics_AF.h"
#include "SmokeParticles.h"
#include "Liquid.h"
// We do these splashes if the mass of the colliding object is less than these values.
// Anything large than MEDIUM_SPLASH does a large splash. (get it?)
const int SMALL_SPLASH = 25;

View file

@ -3,6 +3,9 @@
#ifndef __LIQUID_H__
#define __LIQUID_H__
#include "Entity.h"
#include "physics/Physics_Liquid.h"
/*
===============================================================================

View file

@ -7725,6 +7725,8 @@ void idPlayer::AdjustBodyAngles( void ) {
float forwardBlend;
float downBlend;
upBlend = forwardBlend = downBlend = 0.0f; // DG: just make sure they're initialized
if ( health < 0 ) {
return;
}
@ -10663,7 +10665,7 @@ void idPlayer::WritePlayerStateToSnapshot( idBitMsgDelta &msg ) const {
msg.WriteInt( stepUpTime );
msg.WriteFloat( stepUpDelta );
*/
msg.WriteLong( inventory.weapons );//new
msg.WriteInt( inventory.weapons );//new
// msg.WriteShort( inventory.weapons );
msg.WriteByte( inventory.armor );
@ -10688,7 +10690,7 @@ void idPlayer::ReadPlayerStateFromSnapshot( const idBitMsgDelta &msg ) {
stepUpTime = msg.ReadInt();
stepUpDelta = msg.ReadFloat();
*/
inventory.weapons = msg.ReadLong();//new
inventory.weapons = msg.ReadInt();//new
// inventory.weapons = msg.ReadShort();
inventory.armor = msg.ReadByte();

View file

@ -499,7 +499,7 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view )
hackedView.forceUpdate = true; // FIX: for smoke particles not drawing when portalSky present
}
#endif _PORTALSKY
#endif // _PORTALSKY
gameRenderWorld->RenderScene( &hackedView );
@ -811,7 +811,7 @@ void idPlayerView::RenderPlayerView( idUserInterface *hud ) {
int bloomType = r_bloom.GetInteger();
if (bloomType != 0 && !player->objectiveSystemOpen) {
float blur_str, blur_cut, src_str, src_cut;
float blur_str = 0.0f, blur_cut = 0.0f, src_str = 0.0f, src_cut = 0.0f;
renderSystem->CaptureRenderToImage( "_currentRender" );
//------------------------------------------------

View file

@ -38,6 +38,10 @@ If you have questions concerning this license or the applicable additional terms
#include "Projectile.h"
#include "framework/DeclEntityDef.h"
#include "BrittleFracture.h"
#include "Moveable.h"
/*
===============================================================================
@ -203,7 +207,7 @@ void idProjectile::Restore( idRestoreGame *savefile ) {
//Reinitialize the damage Def--- By Clone JC Denton
damageDef = gameLocal.FindEntityDef( spawnArgs.GetString( "def_damage", false ) );
damageDef = gameLocal.FindEntityDef( spawnArgs.GetString( "def_damage" ) );
}
@ -432,7 +436,7 @@ void idProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVec3
// Find and store the damage def only once- --- New //un noted code change from original sdk
// place this line before checking the fuse- for beam weapons
damageDef = gameLocal.FindEntityDef( spawnArgs.GetString( "def_damage", false ) );
damageDef = gameLocal.FindEntityDef( spawnArgs.GetString( "def_damage" ) );
if ( !gameLocal.isClient ) {
if ( fuse <= 0 ) {
@ -2222,7 +2226,7 @@ idVec3 idBFGProjectile::GetAimDir( idEntity *aimAtEnt ) {
idBFGProjectile::FireSecProjAtTarget
================
*/
idProjectile* idBFGProjectile::FireSecProj( idVec3 &dir ) {
idProjectile* idBFGProjectile::FireSecProj( const idVec3 &dir ) {
idProjectile *proj;
idEntity *ent;
idEntity *ownerEnt;

View file

@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms
#include "Entity.h"
#ifdef _DENTONMOD
//#include "tracer.h"
#include "tracer.h"
#ifndef _DENTONMOD_PROJECTILE_CPP
#define _DENTONMOD_PROJECTILE_CPP
#endif
@ -265,7 +265,7 @@ private:
idStr secProjName;
idVec3 GetAimDir( idEntity *aimAtEnt );
idProjectile* FireSecProj( idVec3 &dir );
idProjectile* FireSecProj( const idVec3 &dir );
//ivan end
void FreeBeams();

View file

@ -38,6 +38,7 @@ If you have questions concerning this license or the applicable additional terms
#include "Misc.h"
#include "WorldSpawn.h"
#include "Sound.h"
#include "Trigger.h"
#include "Target.h"

View file

@ -37,6 +37,8 @@ If you have questions concerning this license or the applicable additional terms
#include "SmokeParticles.h"
#include "WorldSpawn.h"
#include "renderer/ModelManager.h"
#include "Weapon.h"
/***********************************************************************
@ -3533,7 +3535,7 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
idVec3 muzzle_pos;
float muzzleDistFromView;
float traceDist, muzzleToTargetDist;
float traceDist = 0.0f, muzzleToTargetDist = 0.0f;
idVec3 muzzleDir;
beam = projectileDict.GetFloat( "fuse" ) <= 0 || projectileDict.GetBool( "rail_beam");

View file

@ -4516,7 +4516,7 @@ idProjectile *idAI::LaunchProjectile( const char *jointname, idEntity *target, b
float attack_cone;
float projectile_spread;
float diff;
float angle;
float angle = 0.0f;
float spin;
idAngles ang;
int num_projectiles;
@ -4623,6 +4623,8 @@ idProjectile *idAI::LaunchProjectile( const char *jointname, idEntity *target, b
spin = (float)DEG2RAD( 360.0f ) * gameLocal.random.RandomFloat();
dir = axis[ 0 ] + axis[ 2 ] * ( angle * idMath::Sin( spin ) ) - axis[ 1 ] * ( angle * idMath::Cos( spin ) );
}else if( fireMode == AI_FIREMODE_2D_STEP_SPREAD){
// FIXME: DG: if num_projectiles == 1, angle is not properly initialized
// (I initialized it to 0 above, but not sure that's the appropriate value)
dir = (axis[ 0 ] * (1-angle*firemodeCounterPos) ) + ( axis[ 2 ] * angle*firemodeCounter );
//upd counter
if(firemodeCounter >= 0){

View file

@ -1,10 +1,13 @@
// Created by Ivan_the_B
//
#include "../../idlib/precompiled.h"
#pragma hdrstop
#include "../Game_local.h"
#include "AI_bot.h"
#include "Moveable.h"
#include "gamesys/SysCvar.h"
#include "script/Script_Thread.h"
/*
===============================================================================
@ -1061,9 +1064,9 @@ void idAI_Bot::ShowOnlyCurrentWeapon( void ) {
for( i = 0; i < weapons.Num(); i++ ) {
ent = weapons[ i ].ent.GetEntity();
if (i == currentWeapon ) {
weapons[ i ].ent.GetEntity()->Show();
ent->Show();
}else{
weapons[ i ].ent.GetEntity()->Hide();
ent->Hide();
}
}
}
@ -1302,7 +1305,7 @@ idProjectile *idAI_Bot::LaunchProjectile( const char *jointname, idEntity *targe
float attack_cone;
float projectile_spread;
float diff;
float angle;
float angle = 0.0f;
float spin;
idAngles ang;
int num_projectiles;
@ -1416,6 +1419,7 @@ idProjectile *idAI_Bot::LaunchProjectile( const char *jointname, idEntity *targe
spin = (float)DEG2RAD( 360.0f ) * gameLocal.random.RandomFloat();
dir = axis[ 0 ] + axis[ 2 ] * ( angle * idMath::Sin( spin ) ) - axis[ 1 ] * ( angle * idMath::Cos( spin ) );
}else if( fireMode == AI_FIREMODE_2D_STEP_SPREAD){
// FIXME: DG: angle might not be properly initialized (if num_projectiles == 1); I added the angle = 0 to the variable definition
dir = (axis[ 0 ] * (1-angle*firemodeCounterPos) ) + ( axis[ 2 ] * angle*firemodeCounter );
//upd counter
if(firemodeCounter >= 0){

View file

@ -34,6 +34,7 @@ If you have questions concerning this license or the applicable additional terms
#include "gamesys/SysCvar.h"
#include "ai/AI.h"
#include "ai/AI_bot.h"
#include "Entity.h"
#include "Fx.h"
#include "Game_local.h"

View file

@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
#include "sys/platform.h"
#include "physics/Physics.h"
#include "gamesys/SaveGame.h"
#include "physics/Force_Spring.h"

View file

@ -35,6 +35,8 @@ If you have questions concerning this license or the applicable additional terms
#include "Player.h"
#include "WorldSpawn.h"
#include "physics/Physics_Liquid.h"
#include "physics/Physics_AF.h"
CLASS_DECLARATION( idPhysics_Base, idPhysics_AF )
@ -6015,8 +6017,8 @@ void idPhysics_AF::AddGravity( void ) {
#ifdef _WATER_PHYSICS // un credited changes from original sdk
idVec3 grav( this->liquidDensity * this->gravityVector );
float waterLevel,wDensity;
bool inWater,bodyBuoyancy;
float waterLevel, wDensity = 0.0f; // DG: make sure to init this
bool inWater, bodyBuoyancy = false; // DG: make sure to init this
if( this->SetWaterLevelf() == 1.0f ) {
wDensity = this->water->GetDensity();

View file

@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
#include "physics/Force.h"
#include "Entity.h"
#include "physics/Physics_Liquid.h"
#include "physics/Physics_Base.h"
CLASS_DECLARATION( idPhysics, idPhysics_Base )

View file

@ -1,11 +1,11 @@
#include "../../idlib/precompiled.h"
#pragma hdrstop
#ifdef _WATER_PHYSICS
#include "../Game_local.h"
#include "Entity.h"
#include "Physics_Liquid.h"
CLASS_DECLARATION( idPhysics_Static, idPhysics_Liquid )
END_CLASS
@ -114,7 +114,7 @@ idPhysics_Liquid::GetPressure
*/
idVec3 idPhysics_Liquid::GetPressure( const idVec3 &point ) const {
idVec3 pressure;
idVec3 &depth = this->GetDepth(point);
const idVec3 &depth = this->GetDepth(point);
pressure = depth * this->density;

View file

@ -1,5 +1,7 @@
#ifdef _WATER_PHYSICS
#include "physics/Physics_Static.h"
/*
===============================================================================

View file

@ -29,6 +29,10 @@ If you have questions concerning this license or the applicable additional terms
#include "sys/platform.h"
#include "gamesys/SysCvar.h"
#include "Entity.h"
#include "Actor.h"
#include "Item.h"
#include "physics/Physics_Liquid.h"
#include "Moveable.h"
#include "physics/Physics_Player.h"
@ -1320,7 +1324,7 @@ void idPhysics_Player::CheckDuck( void ) {
maxZ = pm_deadheight.GetFloat();
} else {
// stand up when up against a ladder
if ( command.upmove < 0 && !ladder || current.movementType == PM_ANIM_CROUCH ) { // un credited changes from original sdk
if ( (command.upmove < 0 && !ladder) || current.movementType == PM_ANIM_CROUCH ) { // un credited changes from original sdk
// duck
current.movementFlags |= PMF_DUCKED;
} else {

View file

@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
#define __PHYSICS_PLAYER_H__
#include "physics/Physics_Actor.h"
#include "physics/Physics_Monster.h" // DG: for monsterMoveResult_t, used by hq2 code below
/*
===================================================================================

View file

@ -32,6 +32,9 @@ If you have questions concerning this license or the applicable additional terms
#include "gamesys/SysCvar.h"
#include "Entity.h"
#include "Player.h"
#include "Moveable.h"
#include "physics/Physics_Liquid.h"
#include "physics/Physics_RigidBody.h"
@ -165,7 +168,7 @@ bool idPhysics_RigidBody::GetBuoyancy( const idVec3 &pos, const idMat3 &rotation
// return true if the body is in water, false otherwise
idVec3 tbCenter(pos);
idBounds bounds = this->GetBounds();
//idBounds bounds = this->GetBounds();
idTraceModel tm = *this->GetClipModel()->GetTraceModel();
int i,count;

View file

@ -1,10 +1,11 @@
#include "../idlib/precompiled.h"
#pragma hdrstop
#ifdef _DENTONMOD
#include "Game_local.h"
#include "Entity.h"
#include "renderer/ModelManager.h"
#include "SmokeParticles.h"
#include "tracer.h"
/*
===============================================================================