Fix some stuff

This commit is contained in:
LegendaryGuard 2023-07-27 17:41:39 +02:00
parent e29278f1bc
commit 1e694cddd6
18 changed files with 115 additions and 80 deletions

View file

@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
#include "sys/platform.h"
#include "renderer/RenderSystem.h"
#include "framework/DeclEntityDef.h"
#include "gamesys/SysCvar.h"
#include "Player.h"
#include "Fx.h"

View file

@ -31,7 +31,9 @@ If you have questions concerning this license or the applicable additional terms
#include "Fx.h"
#include "Game_local.h"
#include "Moveable.h"
#include "Projectile.h"
/*
===============================================================================

View file

@ -459,8 +459,9 @@ public:
void ArtifactScrollRight( int startfrom );
void ArtifactScrollLeft( int startfrom );
int Belt2Index(int belt_index); // translate an artitfacts position on the belt to it'sArtifactItem[] index.
// HEXEN : Zeroth
/*virtual*/ bool StuckToSurface( void );
bool StuckToSurface( void );
void SpawnHellions( void );
void UpdateHudAutoMap( void );
void AutoMapChange( idStr mapFloor );

View file

@ -3,6 +3,9 @@
#pragma hdrstop
#include "Game_local.h"
#include "Item.h"
#include "Player.h"
#include "gameSys/SysCvar.h"
int idPlayer::FindArtifact( int art ) {
for (int belt=0; belt<Artifact.Num(); belt++) {

View file

@ -3,6 +3,7 @@
#pragma hdrstop
#include "Game_local.h"
#include "Player.h"
void idPlayer::Event_SetViewAngles( idVec3 &vec ) {
viewAngles[0] = vec.x;
@ -17,50 +18,50 @@ void idPlayer::Event_GetEyePos( void ) {
void idPlayer::Event_SetFreeMove( const float yesorno ) {
//spawnArgs.SetInt("freemovement", yesorno);
if (yesorno) {
FreeMove=true;
}else{
FreeMove=false;
FreeMove = true;
} else {
FreeMove = false;
}
}
void idPlayer::Event_ChaosDevice( void ) {
SetOrigin(SpawnPos);
SetViewAngles(SpawnViewAngles);
SetOrigin( SpawnPos );
SetViewAngles( SpawnViewAngles );
}
void idPlayer::Event_GiveHealth( const float amount ) {
health+=amount;
health += amount;
}
void idPlayer::Event_GiveSpeed( const float amount ) {
speedMod+=amount;
speedMod += amount;
}
void idPlayer::Event_GiveArmor( const float amount ) {
inventory.armor+=amount;
inventory.armor += amount;
}
void idPlayer::Event_SetHealth( const float amount ) {
health=amount;
health = amount;
}
void idPlayer::Event_SetArmor( const float amount ) {
inventory.armor=amount;
inventory.armor = amount;
}
void idPlayer::Event_SetInvincible( const float number ) {
if (number != 0) {
if ( number != 0 ) {
invincible = true;
}else{
} else {
invincible = false;
}
}
void idPlayer::Event_GetInvincible( void ) {
if (godmode || invincible) {
idThread::ReturnFloat(1);
}else{
idThread::ReturnFloat(0);
if ( godmode || invincible ) {
idThread::ReturnFloat( 1 );
} else {
idThread::ReturnFloat( 0 );
}
}
@ -99,13 +100,13 @@ void idPlayer::Event_GetArmor( void ) {
}
void idPlayer::Event_StickToSurface( const idVec3 &surfaceNormal ) {
//idPhysics_Actor *x=GetPhysics();
physicsObj.SetSurfaceNormal(surfaceNormal);
physicsObj.SetStuckToSurface(true);
//idPhysics_Actor *x = GetPhysics();
physicsObj.SetSurfaceNormal( surfaceNormal );
physicsObj.SetStuckToSurface( true );
}
void idPlayer::Event_UnstickToSurface( void ) {
physicsObj.SetStuckToSurface(false);
physicsObj.SetStuckToSurface( false );
}
bool idPlayer::StuckToSurface( void ) {
@ -113,36 +114,36 @@ bool idPlayer::StuckToSurface( void ) {
}
void idPlayer::Event_StuckToSurface( void ) {
idThread::ReturnFloat((float)StuckToSurface());
idThread::ReturnFloat( (float)StuckToSurface() );
}
void idPlayer::Event_SetPowerTome( float val ) {
PowerTome = !(!val);
PowerTome = !( !val );
}
void idPlayer::Event_GetPowerTome( void ) {
idThread::ReturnFloat((float)PowerTome);
idThread::ReturnFloat( (float)PowerTome );
}
void idPlayer::Event_VecFacingP( void ) {
// return proper facing direction (yaw only)
idVec3 dir=viewAxis[ 0 ] * physicsObj.GetGravityAxis();
idVec3 dir = viewAxis[ 0 ] * physicsObj.GetGravityAxis();
dir.Normalize();
idThread::ReturnVector(dir);
idThread::ReturnVector( dir );
}
void idPlayer::Event_HudMessage( const char *message ) {
ShowHudMessage( message );
ShowHudMessage( message );
}
void idPlayer::Event_VecForwardP( void ) {
idThread::ReturnVector(VecForwardP());
idThread::ReturnVector( VecForwardP() );
}
idVec3 idPlayer::VecForwardP( void ) const {
// return proper forward vector for whatever way the player is looking
idVec3 dir=viewAngles.ToForward() * physicsObj.GetGravityAxis();
idVec3 dir = viewAngles.ToForward() * physicsObj.GetGravityAxis();
dir.Normalize();
return dir;
}

View file

@ -26,6 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "gamesys/SysCvar.h"
#include "sys/platform.h"
#include "Entity.h"

View file

@ -959,7 +959,7 @@ idTrigger_Hurt::Save
void idTrigger_Hurt::Save( idSaveGame *savefile ) const {
savefile->WriteBool( on );
savefile->WriteFloat( delay );
savefile->WriteInt( nextTime );
savefile->WriteInt( nextTime.Num() );
}
/*
@ -998,7 +998,7 @@ void idTrigger_Hurt::Event_Touch( idEntity *other, trace_t *trace ) {
if ( on && other && gameLocal.time >= nextTime ) {
damage = spawnArgs.GetString( "def_damage", "damage_painTrigger" );
other->Damage( NULL, NULL, vec3_origin, damage, 1.0f, INVALID_JOINT );
other->Damage( NULL, NULL, vec3_origin, damage, 1.0f, INVALID_JOINT, trace->c.point );
ActivateTargets( other );
CallScript();

View file

@ -2965,7 +2965,7 @@ void idAI::SlideMove( void ) {
gameRenderWorld->DebugLine( colorCyan, oldorigin, physicsObj.GetOrigin(), 5000 );
}
if ( !af_push_moveables && attack.Length() && TestMelee() ) {
if ( !af_push_moveables && attack.Length() && TestMelee( idVec3() ) ) {
DirectDamage( attack, enemy.GetEntity() );
} else {
idEntity *blockEnt = physicsObj.GetSlideMoveEntity();

View file

@ -1,9 +1,13 @@
#pragma hdrstop
#include "../Entity.h"
#include "../Game_local.h"
#include "../Moveable.h"
#include "AI.h"
#include "AI_Golem.h"
const idVec3 GOLEM_ROCKS_NO_GRAVITY = idVec3(0,0,0);
const idVec3 GOLEM_ROCKS_NO_GRAVITY = idVec3( 0, 0, 0 );
const int GOLEM_ROCKS_MAX = 13;
const int GOLEM_ROCKS_MIN = 8;
const int GOLEM_ROCKS_MIN_CHECK_DELAY = 2000;
@ -37,7 +41,7 @@ void idAI_Golem::Save( idSaveGame *savefile ) const {
savefile->WriteString( golemType );
savefile->WriteBool( alive );
savefile->WriteInt( rocks.Num() );
for ( int i=0; i<rocks.Num(); i++ ) {
for ( int i = 0; i < rocks.Num(); i++ ) {
savefile->WriteObject( rocks[i] );
}
}
@ -52,14 +56,14 @@ void idAI_Golem::Restore( idRestoreGame *savefile ) {
int i;
savefile->ReadInt( i );
idClass *obj;
for ( ; i>0; i-- ) {
for ( ; i > 0; i-- ) {
savefile->ReadObject( obj );
rocks.Append( static_cast< idMoveable* >( obj ) );
}
}
void idAI_Golem::findNewRocks() {
idMoveable *rock = FindGolemRock();
idMoveable *rock = FindGolemRock();
if ( rock ) {
addRock( rock );
}
@ -68,15 +72,15 @@ void idAI_Golem::findNewRocks() {
void idAI_Golem::addRock( idMoveable *newRock ) {
newRock->BecomeNonSolid();
newRock->spawnArgs.SetBool("golem_owned", 1);
newRock->spawnArgs.SetFloat("golem_bindTime", gameLocal.time + GOLEM_RICKS_MAX_MOVE_TIME_BEFORE_BIND );
newRock->spawnArgs.SetBool("golem_bound", 0);
newRock->spawnArgs.Set("old_bounce", newRock->spawnArgs.GetString("snd_bounce") );
newRock->spawnArgs.Set("snd_bounce", ""); // no bounce sounds while on the golem, gets REAL annoying.
newRock->spawnArgs.Set("bone", curBone);
newRock->spawnArgs.SetBool( "golem_owned", 1 );
newRock->spawnArgs.SetFloat( "golem_bindTime", gameLocal.time + GOLEM_RICKS_MAX_MOVE_TIME_BEFORE_BIND );
newRock->spawnArgs.SetBool( "golem_bound", 0 );
newRock->spawnArgs.Set( "old_bounce", newRock->spawnArgs.GetString( "snd_bounce" ) );
newRock->spawnArgs.Set( "snd_bounce", "" ); // no bounce sounds while on the golem, gets REAL annoying.
newRock->spawnArgs.Set( "bone", curBone );
newRock->health = 1000;
newRock->GetPhysics()->DisableClip();
rocks.Append(newRock);
rocks.Append( newRock );
totRocks++;
nextBone();
@ -117,7 +121,7 @@ void idAI_Golem::evalRocks() {
rocks[i]->GetPhysics()->SetGravity( GOLEM_ROCKS_NO_GRAVITY );
//rocks[i]->SetOrigin( GetLocalCoordinates( GetJointPos(animator.GetJointHandle(bone)) ) );
rocks[i]->SetOrigin( GetJointPos(animator.GetJointHandle(bone)) );
rocks[i]->spawnArgs.Set("golem_bound", "1");
rocks[i]->spawnArgs.Set( "golem_bound", "1");
rocks[i]->SetAngles( idAngles(gameLocal.random.RandomInt() % 200 - 100, gameLocal.random.RandomInt() % 200 - 100, gameLocal.random.RandomInt() % 200 - 100 ) );
rocks[i]->BindToJoint(this, bone, 1);
rocks[i]->GetPhysics()->EnableClip();
@ -167,7 +171,7 @@ void idAI_Golem::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &
if ( health < -999 ) {
health = -999;
}
gameLocal.Printf("BLOWUP!\n");
gameLocal.Printf( "BLOWUP!\n" );
BlowUp();
Killed( inflictor, attacker, damage, dir, location );
} else {
@ -194,11 +198,11 @@ void idAI_Golem::BlowUp( void ) {
// rocks get removed from head to toe.
for (int i=rocks.Num(); i >= 0; i--) {
if ( !rocks[i] ) {
rocks[i]->GetPhysics()->SetGravity(gameLocal.GetGravity());
rocks[i]->spawnArgs.Set("golem_owned", 0);
rocks[i]->spawnArgs.Set("golem_bound", 0);
rocks[i]->spawnArgs.Set("golem_bindTime", 0);
rocks[i]->spawnArgs.Set("snd_bounce", rocks[i]->spawnArgs.GetString("old_bounce") ); //Z.TODO
rocks[i]->GetPhysics()->SetGravity( gameLocal.GetGravity() );
rocks[i]->spawnArgs.Set( "golem_owned", 0 );
rocks[i]->spawnArgs.Set( "golem_bound", 0 );
rocks[i]->spawnArgs.Set( "golem_bindTime", 0 );
rocks[i]->spawnArgs.Set( "snd_bounce", rocks[i]->spawnArgs.GetString( "old_bounce" ) ); //Z.TODO
rocks[i]->Unbind();
rocks[i]->BecomeSolid();
idVec3 dx;
@ -213,7 +217,7 @@ void idAI_Golem::BlowUp( void ) {
dx.Normalize();
rocks[i]->GetPhysics()->EnableClip();
rocks[i]->GetPhysics()->SetAngularVelocity( dx * 100 );
rocks.RemoveIndex(i);
rocks.RemoveIndex( i );
}
}
}
@ -242,7 +246,7 @@ void idAI_Golem::nextBone() {
}
void idAI_Golem::Event_SawEnemy() {
alive=true;
alive = true;
}
const char * idAI_Golem::GetGolemType( void ) const {
@ -252,7 +256,7 @@ const char * idAI_Golem::GetGolemType( void ) const {
// HEXEN : Zeroth
idMoveable *idAI_Golem::FindGolemRock( void ) {
int hash, i;
idMoveable *target=NULL;
idMoveable *target = NULL;
hash = gameLocal.entypeHash.GenerateKey( idMoveable::Type.classname, true );
@ -264,15 +268,15 @@ idMoveable *idAI_Golem::FindGolemRock( void ) {
continue;
}
if ( target->spawnArgs.GetInt("golem_owned") == 1 ) {
if ( target->spawnArgs.GetInt( "golem_owned" ) == 1 ) {
continue;
}
/* smaller golemd haven't been implemented yet
if ( !target->spawnArgs.GetInt("forLargeGolem") ) {
if ( !target->spawnArgs.GetInt( "forLargeGolem" ) ) {
continue;
}
*/
if ( GetGolemType() != target->spawnArgs.GetString("rockType") ) {
if ( GetGolemType() != target->spawnArgs.GetString( "rockType" ) ) {
continue;
}

View file

@ -1,7 +1,9 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Entity.h"
#include "AI.h"
#include "AI_Veloxite.h"
const float VELOX_MAX_WALL_DIST = 75.0f; // get on walls this far away
const float VELOX_SURFACECHECK_RATE = 0.25f; // four times per second should be enough

View file

@ -1,7 +1,9 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Entity.h"
#include "../Moveable.h"
#include "Leaf.h"
CLASS_DECLARATION( idMoveable, idEntity_Leaf )
@ -38,7 +40,7 @@ void idEntity_Leaf::Spawn() {
else if ( dir < 2 && dir > 1 ) { spreadY = 0; }
else { spreadY = -spread; }
SetAngles( idAngles( gameLocal.random.CRandomFloat()*360, gameLocal.random.CRandomFloat()*360, gameLocal.random.CRandomFloat()*360) );
SetAngles( idAngles( gameLocal.random.CRandomFloat()*360, gameLocal.random.CRandomFloat()*360, gameLocal.random.CRandomFloat()*360 ) );
GetPhysics()->SetLinearVelocity( idVec3( 0, 0, 0 ) );
GetPhysics()->SetGravity( idVec3( 0, 0, 0 ) ); //gravity - if we set zero gravity, the leaves stop when they hit the ground. dont know why, but it's cool!

View file

@ -1,6 +1,7 @@
#pragma hdrstop
#include "../Entity.h"
#include "../Game_local.h"
#include "LeafEmitter.h"
@ -9,18 +10,18 @@ CLASS_DECLARATION( idEntity, idEntity_LeafEmitter )
END_CLASS
void idEntity_LeafEmitter::Spawn() {
nextLeaf=0;
interval=spawnArgs.GetFloat( "emitter_leaf_interval" );
maxLeaf=spawnArgs.GetFloat( "emitter_leaf_max" );
nextLeaf = 0;
interval = spawnArgs.GetFloat( "emitter_leaf_interval" );
maxLeaf = spawnArgs.GetFloat( "emitter_leaf_max" );
leaf.SetFloat("leaf_liveTime", spawnArgs.GetFloat("leaf_liveTime"));
leaf.SetFloat("leaf_spread", spawnArgs.GetFloat("leaf_spread"));
leaf.SetFloat("leaf_windPower", spawnArgs.GetFloat("leaf_windPower"));
leaf.SetVector("leaf_windDir", spawnArgs.GetVector("leaf_windDir"));
leaf.SetFloat("leaf_moveSpeed", spawnArgs.GetFloat("leaf_moveSpeed"));
leaf.SetVector("leaf_gravity", spawnArgs.GetVector("leaf_gravity"));
leaf.SetFloat("leaf_maxSpinSpeed", spawnArgs.GetFloat("leaf_maxSpinSpeed"));
leaf.SetVector("leaf_origin", GetPhysics()->GetOrigin());
leaf.SetFloat( "leaf_liveTime", spawnArgs.GetFloat( "leaf_liveTime" ) );
leaf.SetFloat( "leaf_spread", spawnArgs.GetFloat( "leaf_spread" ) );
leaf.SetFloat( "leaf_windPower", spawnArgs.GetFloat( "leaf_windPower" ) );
leaf.SetVector( "leaf_windDir", spawnArgs.GetVector( "leaf_windDir" ) );
leaf.SetFloat( "leaf_moveSpeed", spawnArgs.GetFloat( "leaf_moveSpeed" ) );
leaf.SetVector( "leaf_gravity", spawnArgs.GetVector( "leaf_gravity" ) );
leaf.SetFloat( "leaf_maxSpinSpeed", spawnArgs.GetFloat( "leaf_maxSpinSpeed" ) );
leaf.SetVector( "leaf_origin", GetPhysics()->GetOrigin() );
}
void idEntity_LeafEmitter::Think() {

View file

@ -1,7 +1,9 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Entity.h"
#include "../Misc.h"
#include "Tree.h"
CLASS_DECLARATION( idAnimated, idAnimated_Tree )

View file

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

View file

@ -2,6 +2,11 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Player.h"
#include "../Projectile.h"
#include "../ai/AI.h"
#include "FireStorm.h"
const int FIREBEAM_METEOR_DELAY = 300; // in msec
const int FIREBEAM_METEOR_NUM = 8;
@ -27,9 +32,7 @@ CLASS_DECLARATION( idProjectile, idProj_FireBeam )
EVENT( EV_LaunchFireBeam, idProj_FireBeam::Event_Launch )
END_CLASS
void idProj_FireBeam::Spawn( void ) {
}
void idProj_FireBeam::Spawn( void ) { }
void idProj_FireBeam::Think( void ) {
if ( state == 2 && meteorNum < FIREBEAM_METEOR_NUM ) {

View file

@ -2,6 +2,9 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Projectile.h"
#include "Soul.h"
const float SOUL_SPEED = 1000.0f;

View file

@ -2,6 +2,13 @@
#pragma hdrstop
#include "../Game_local.h"
#include "../Player.h"
#include "../Projectile.h"
#include "../ai/AI.h"
#include "../ai/AI_Golem.h"
#include "../ai/AI_Veloxite.h"
#include "Wraithverge.h"
const int PROJ_WRAITH_CHASE_RANGE = 768;
const int PROJ_WRAITH_SPAWN_DELAY = 400;

View file

@ -26,13 +26,14 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "sys/platform.h"
#include "../../sys/platform.h"
#include "gamesys/SysCvar.h"
#include "Player.h"
#include "Camera.h"
#include "../Game_local.h"
#include "../gamesys/SysCvar.h"
#include "../Player.h"
#include "../Camera.h"
#include "script/Script_Thread.h"
#include "Script_Thread.h"
const idEventDef EV_Thread_Execute( "<execute>", NULL );
const idEventDef EV_Thread_SetCallback( "<script_setcallback>", NULL );
@ -1180,7 +1181,7 @@ void idThread::Event_SpawnParticle( const char *particleName, const idVec3 &orig
return;
}
//gameLocal.smokeParticles->EmitSmoke( static_cast<const idDeclParticle *>( dec ), gameLocal.time+1, gameLocal.random.CRandomFloat(), origin, idMat3() );
//gameLocal.smokeParticles->EmitSmoke( static_cast<const idDeclParticle *>( dec ), gameLocal.time + 1, gameLocal.random.CRandomFloat(), origin, idMat3() );
gameLocal.smokeParticles->EmitSmoke( static_cast<const idDeclParticle *>( dec ), gameLocal.time, gameLocal.random.RandomFloat(), origin, idMat3( 1, 0, 0, 0, 0, 0, 0, 0, 0 ) );
}