You know in Counter-Strike beta 7.0 back in 2000
they added vehicles that could be driven? It was a really hacked up drivable train but with player turning and acceleration withrudimentary physics added..
Surely there's a way to do the same in this rotatable-brush engine too in a simpler form (no physics and fixed height). Not that it'll be important to OA or anything, i'm just curious on how to do the same in id Tech 3. as i've not seen it ever and I can only ponder on the possibility.
So far i've cloned func_rotating, took out the actual rotating and made it say a message when the player touches it. Ideally i'd want the player to lock to some 'driver seat' entity position or something and turn the player input into manipulating the rotation and velocity of the brush entity, and the player getting out of the vehicle by pressing the Use Item button again.
I'm only modifing the game module at this point, because I think it could be done in just game alone.
and right now this is all the code is, these useless bare things at the end of g_movers.c, more theories and comments than there are actual code
/*
===============================================================================
VEHICLES
===============================================================================
*/
/*QUAKED func_vehicle (0 .5 .8)
You need to have an origin brush as part of this entity. The center of that brush will be
the point around which it is driven.
"model2" .md3 model to also draw
"speed" maximum speed
"dmg" damage to inflict when blocked (250 default)
"color" constantLight color
"light" constantLight radius
"driverOrg" Origin of driver to place in vehicle
"pass1Org" Origin of first passenger of vehicle
"pass2Org" Origin of second passenger of vehicle
"pass3Org" Origin of third passenger of vehicle
"pass4Org" Origin of fourth passenger of vehicle
*/
void Touch_VehicleHasPerson(gentity_t *ent, gentity_t *other, trace_t *trace ) {
if ( !other->client ) {
return;
}
// do nothing.
}
void Touch_Vehicle(gentity_t *ent, gentity_t *other, trace_t *trace ) {
if ( !other->client ) {
return;
}
// take control of the vehicle immediately
trap_SendServerCommand( -1, va("cp \"Your In An Vehicle !\"" ));
//other->ps->pm_type = PM_FREEZE; // we want the player to be still in the vehicle
ent->touch = Touch_VehicleHasPerson; // change touch to prevent hijacks.
}
void SP_func_vehicle (gentity_t *ent) {
if ( !ent->speed ) {
ent->speed = 100;
}
// set the axis of rotation
ent->s.apos.trType = TR_LINEAR;
if (!ent->damage) {
ent->damage = 250; // vehicles should smack and kill
}
trap_SetBrushModel( ent, ent->model );
ent->touch = Touch_Vehicle;
InitMover( ent );
VectorCopy( ent->s.origin, ent->s.pos.trBase );
VectorCopy( ent->s.pos.trBase, ent->r.currentOrigin );
VectorCopy( ent->s.apos.trBase, ent->r.currentAngles );
trap_LinkEntity( ent );
}