Move over various changes from R2

This commit is contained in:
Marco Cawthorne 2023-06-27 09:16:34 -07:00
parent f4d3a47448
commit 5e19510035
Signed by: eukara
GPG key ID: CE2032F0A2882A22
15 changed files with 198 additions and 9 deletions

View file

@ -0,0 +1,12 @@
class idFuncCroucharea:idEntity {
void idFuncCroucharea( void );
};
void idFuncCroucharea::idFuncCroucharea( void ) {
SetAngles( [0, 0, 0] );
SetMovetype(MOVETYPE_PUSH);
SetSolid(SOLID_BSP);
SetModel(GetModel()); /* relink with the above properties */
}
LINK_ENTITY_TO_CLASS(func_croucharea, idFuncCroucharea)

View file

@ -0,0 +1,12 @@
class idFuncIllusionary:idEntity {
void idFuncIllusionary( void );
};
void idFuncIllusionary::idFuncIllusionary( void ) {
SetAngles( [0, 0, 0] );
SetMovetype(MOVETYPE_PUSH);
SetSolid(SOLID_NOT);
SetModel(GetModel()); /* relink with the above properties */
}
LINK_ENTITY_TO_CLASS(func_illusionary, idFuncIllusionary)

View file

@ -2,7 +2,7 @@ class idFuncWall:idEntity {
void idFuncWall( void );
};
void idFuncWall:: idFuncWall( void ) {
void idFuncWall::idFuncWall( void ) {
SetAngles( [0, 0, 0] );
SetMovetype(MOVETYPE_PUSH);
SetSolid(SOLID_BSP);

View file

@ -11,7 +11,7 @@ void idPlayerStart::idPlayerStart( void ) {
}
idEntity idPlayerStart::MovePlayerToStart( idPlayer player ) {
idEntity point = g_idEngine.Find( world, ::classname, "idPlayerStart" );
idEntity point = g_idEngine.Find( ( idEntity ) world, ::classname, "idPlayerStart" );
if ( point ) {
player.Transport( point.GetOrigin(), point.GetAngles() );

View file

@ -0,0 +1,9 @@
class idLight:idEntity {
void idLight( void );
};
void idLight::idLight( void ) {
}
LINK_ENTITY_TO_CLASS(light, idLight)

View file

@ -1,5 +1,6 @@
#includelist
func_wall.qc
func_illusionary.qc
info_null.qc
info_player_start.qc
light.qc

View file

@ -1,6 +1,75 @@
/* all standard game entry functions live here */
void main( void ) {
/* all the files that DOSQuake needs to boot. */
g_idEngine.Precache_File( "progs.dat");
g_idEngine.Precache_File( "gfx.wad" );
g_idEngine.Precache_File( "quake.rc" );
g_idEngine.Precache_File( "default.cfg" );
g_idEngine.Precache_File( "gfx/palette.lmp" );
g_idEngine.Precache_File( "gfx/colormap.lmp" );
g_idEngine.Precache_File( "gfx/complete.lmp" );
g_idEngine.Precache_File( "gfx/inter.lmp" );
g_idEngine.Precache_File( "gfx/ranking.lmp" );
g_idEngine.Precache_File( "gfx/vidmodes.lmp" );
g_idEngine.Precache_File( "gfx/finale.lmp" );
g_idEngine.Precache_File( "gfx/conback.lmp" );
g_idEngine.Precache_File( "gfx/qplaque.lmp" );
g_idEngine.Precache_File( "gfx/menudot1.lmp" );
g_idEngine.Precache_File( "gfx/menudot2.lmp" );
g_idEngine.Precache_File( "gfx/menudot3.lmp" );
g_idEngine.Precache_File( "gfx/menudot4.lmp" );
g_idEngine.Precache_File( "gfx/menudot5.lmp" );
g_idEngine.Precache_File( "gfx/menudot6.lmp" );
g_idEngine.Precache_File( "gfx/menuplyr.lmp" );
g_idEngine.Precache_File( "gfx/bigbox.lmp" );
g_idEngine.Precache_File( "gfx/dim_modm.lmp" );
g_idEngine.Precache_File( "gfx/dim_drct.lmp" );
g_idEngine.Precache_File( "gfx/dim_ipx.lmp" );
g_idEngine.Precache_File( "gfx/dim_tcp.lmp" );
g_idEngine.Precache_File( "gfx/dim_mult.lmp" );
g_idEngine.Precache_File( "gfx/mainmenu.lmp" );
g_idEngine.Precache_File( "gfx/box_tl.lmp" );
g_idEngine.Precache_File( "gfx/box_tm.lmp" );
g_idEngine.Precache_File( "gfx/box_tr.lmp" );
g_idEngine.Precache_File( "gfx/box_ml.lmp" );
g_idEngine.Precache_File( "gfx/box_mm.lmp" );
g_idEngine.Precache_File( "gfx/box_mm2.lmp" );
g_idEngine.Precache_File( "gfx/box_mr.lmp" );
g_idEngine.Precache_File( "gfx/box_bl.lmp" );
g_idEngine.Precache_File( "gfx/box_bm.lmp" );
g_idEngine.Precache_File( "gfx/box_br.lmp" );
g_idEngine.Precache_File( "gfx/sp_menu.lmp" );
g_idEngine.Precache_File( "gfx/ttl_sgl.lmp" );
g_idEngine.Precache_File( "gfx/ttl_main.lmp" );
g_idEngine.Precache_File( "gfx/ttl_cstm.lmp" );
g_idEngine.Precache_File( "gfx/mp_menu.lmp" );
g_idEngine.Precache_File( "gfx/netmen1.lmp" );
g_idEngine.Precache_File( "gfx/netmen2.lmp" );
g_idEngine.Precache_File( "gfx/netmen3.lmp" );
g_idEngine.Precache_File( "gfx/netmen4.lmp" );
g_idEngine.Precache_File( "gfx/netmen5.lmp" );
g_idEngine.Precache_File( "gfx/sell.lmp" );
g_idEngine.Precache_File( "gfx/help0.lmp" );
g_idEngine.Precache_File( "gfx/help1.lmp" );
g_idEngine.Precache_File( "gfx/help2.lmp" );
g_idEngine.Precache_File( "gfx/help3.lmp" );
g_idEngine.Precache_File( "gfx/help4.lmp" );
g_idEngine.Precache_File( "gfx/help5.lmp" );
g_idEngine.Precache_File( "gfx/pause.lmp" );
g_idEngine.Precache_File( "gfx/loading.lmp" );
g_idEngine.Precache_File( "gfx/p_option.lmp" );
g_idEngine.Precache_File( "gfx/p_load.lmp" );
g_idEngine.Precache_File( "gfx/p_save.lmp" );
g_idEngine.Precache_File( "gfx/p_multi.lmp" );
g_idEngine.Precache_Sound( "misc/menu1.wav" );
g_idEngine.Precache_Sound( "misc/menu2.wav" );
g_idEngine.Precache_Sound( "misc/menu3.wav" );
g_idEngine.Precache_Sound( "ambience/water1.wav" );
g_idEngine.Precache_Sound( "ambience/wind2.wav" );
g_idEngine.Precache_File( "maps/start.bsp" );
g_idEngine.Precache_File( "maps/scale_test.bsp" );
g_idEngine.Precache_File2( "gfx/pop.lmp" );
}
void StartFrame( void ) {
@ -16,16 +85,44 @@ void StartFrame( void ) {
void PlayerPreThink( void ) {
idPlayer pl = ( idPlayer ) self;
pl.PreThink();
if (pl.GetDeadFlag() >= DEAD_DYING) {
pl.DeadThink();
return;
} else {
pl.PreThink();
}
#if 0
if (pl.button2) {
if (pl.HasFlag(FL_JUMPRELEASED) && pl.HasFlag(FL_ONGROUND)) {
pl.RemoveFlags(FL_JUMPRELEASED | FL_ONGROUND);
pl.SetVelocity(pl.GetVelocity() + [0, 0, 200]);
}
} else {
pl.AddFlags(FL_JUMPRELEASED);
}
#else
if (pl.button2) {
if (pl.HasFlag(FL_JUMPRELEASED) && pl.HasFlag(FL_ONGROUND)) {
pl.RemoveFlags(FL_JUMPRELEASED | FL_ONGROUND);
pl.SetVelocity(pl.GetVelocity() + [0, 0, 200]);
}
} else {
pl.AddFlags(FL_JUMPRELEASED);
}
#endif
}
void PlayerPostThink( void ) {
idPlayer pl = ( idPlayer ) self;
pl.PostThink();
if (pl.GetDeadFlag() < DEAD_DEAD) {
pl.PostThink();
}
}
void ClientKill( void ) {
g_gameRules.ApplyDamage( ( idEntity) self, ( idEntity ) self, 200, 0, 0);
}
void ClientConnect( void ) {

View file

@ -302,6 +302,10 @@ string idEngine::Precache_File( string s ) {
return precache_file( s );
}
string idEngine::Precache_File2( string s ) {
return precache_file2( s );
}
void idEngine::MakeStatic( idEntity e ) {
makestatic( e );
}

View file

@ -55,6 +55,7 @@ class idEngine {
nonvirtual void WriteEntity( float to, idEntity s );
nonvirtual void MoveToGoal( float step );
nonvirtual string Precache_File( string s );
nonvirtual string Precache_File2( string s );
nonvirtual void MakeStatic( idEntity e );
nonvirtual void ChangeLevel( string s );
nonvirtual void CVarSet( string var, string val );

View file

@ -123,6 +123,10 @@ void idEntity::SetTakedamage( damage_t value ) {
takedamage = value;
}
void idEntity::SetDeadFlag( dead_t value ) {
deadflag = value;
}
void idEntity::SetViewOffset( vector value ) {
view_ofs = value;
}
@ -219,7 +223,7 @@ void idEntity::SetTouchCallback( void( idEntity ) callback ) {
}
void idEntity::_TouchWrapper( void ) {
TouchCallback(other);
TouchCallback( ( idEntity) other );
}
@ -316,10 +320,14 @@ float idEntity::GetAmmoType4( void ) {
return ammo_cells;
}
float idEntity::CanTakeDamage( void ) {
bool idEntity::CanTakeDamage( void ) {
return ( takedamage != DAMAGE_NO ) ? TRUE : FALSE;
}
dead_t idEntity::GetDeadFlag( void ) {
return (dead_t)deadflag;
}
vector idEntity::GetViewOffset( void ) {
return view_ofs;
}
@ -431,5 +439,13 @@ void idEntity::Transport( vector new_pos, vector new_ang ) {
}
idEntity idEntity::FindFirstTarget( void ) {
return g_idEngine.Find(world, ::targetname, target);
return g_idEngine.Find( (idEntity) world, ::targetname, target);
}
void idEntity::Death( void ) {
}
void idEntity::Pain( void ) {
}

View file

@ -61,6 +61,8 @@ class idEntity {
nonvirtual void SetAmmoType4( float );
/** TODO: This needs to be changed. */
nonvirtual void SetTakedamage( damage_t );
/** Sets the dead_t state */
nonvirtual void SetDeadFlag( dead_t );
/** Sets the eye position of the entity. As an offset relative to its origin. */
nonvirtual void SetViewOffset( vector );
/** When called, will force the client to update its camera angles on the client-side. */
@ -152,7 +154,9 @@ class idEntity {
/** Returns the amount of ammo type 4. */
nonvirtual float GetAmmoType4( void );
/** Returns whether or not this entity can take damage. */
nonvirtual float CanTakeDamage( void );
nonvirtual bool CanTakeDamage( void );
/** Returns which state of dying we're in. */
nonvirtual dead_t GetDeadFlag( void );
/** Returns the eye position of the entity relative to its origin. */
nonvirtual vector GetViewOffset( void );
/** Returns either TRUE or FALSE if the entity has a given flag. */
@ -195,4 +199,7 @@ class idEntity {
nonvirtual void InitTrigger( void );
nonvirtual void Transport( vector, vector );
nonvirtual idEntity FindFirstTarget( void );
virtual void Death( void );
virtual void Pain( void );
};

View file

@ -7,6 +7,9 @@ void idPlayer::PreThink( void ) {
void idPlayer::PostThink( void ) {
}
void idPlayer::DeadThink( void ) {
}
void idPlayer::ResetPlayer( void ) {
ClearFlags();
ClearEffects();
@ -21,3 +24,7 @@ void idPlayer::ResetPlayer( void ) {
SetArmorType( 0 );
SetArmor( 0 );
}
void idPlayer::Death( void ) {
SetViewOffset( [0, 0, -8] );
}

View file

@ -3,6 +3,7 @@ class idPlayer:idEntity {
nonvirtual void PreThink( void );
nonvirtual void PostThink( void );
nonvirtual void DeadThink( void );
nonvirtual void ResetPlayer( void );
virtual void Death( void );
};

View file

@ -23,3 +23,22 @@ void idRules::PlayerFinishesJoining( idPlayer player ) {
}
}
void idRules::ApplyDamage( idEntity target,
idEntity attacker,
float damage,
float weapon,
float flags)
{
/* deduct whatever damage we can */
target.health -= damage;
/* death or pain */
if (target.health <= 0) {
target.SetMovetype(MOVETYPE_TOSS);
target.SetDeadFlag(DEAD_DYING);
target.Death();
} else {
target.Pain();
}
}

View file

@ -4,6 +4,9 @@ class idRules {
nonvirtual void PlayerConnects( idPlayer );
nonvirtual void PlayerDisconnects( idPlayer );
nonvirtual void PlayerFinishesJoining( idPlayer );
/* damage specific */
nonvirtual void ApplyDamage( idEntity, idEntity, float, float, float );
};
idRules g_gameRules;