mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-10 04:27:10 +03:00
Added more comments in DoUse
This commit is contained in:
parent
cd2fea5262
commit
844a50dfd8
1 changed files with 34 additions and 48 deletions
|
@ -3291,19 +3291,28 @@ void Player::DoUse(Event *ev)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (g_gametype->integer != GT_SINGLE_PLAYER && IsSpectator()) {
|
if (g_gametype->integer != GT_SINGLE_PLAYER && IsSpectator()) {
|
||||||
|
// Prevent using stuff while spectating
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDead()) {
|
if (IsDead()) {
|
||||||
|
// Dead players mustn't use
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pVehicle || m_pTurret) {
|
if (m_pVehicle || m_pTurret) {
|
||||||
RemoveFromVehiclesAndTurretsInternal();
|
RemoveFromVehiclesAndTurretsInternal();
|
||||||
} else if (!(buttons & BUTTON_ATTACKLEFT) && !(buttons & BUTTON_ATTACKRIGHT)) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((buttons & BUTTON_ATTACKLEFT) || (buttons & BUTTON_ATTACKRIGHT)) {
|
||||||
//
|
//
|
||||||
// Allow use if the player isn't holding attack buttons
|
// Added in 2.0
|
||||||
|
// Only allow use if the player isn't holding attack buttons
|
||||||
//
|
//
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
num = getUseableEntities(touch, MAX_GENTITIES, true);
|
num = getUseableEntities(touch, MAX_GENTITIES, true);
|
||||||
|
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
|
@ -3313,17 +3322,21 @@ void Player::DoUse(Event *ev)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Event *event = new Event(EV_Use);
|
Event* event = new Event(EV_Use);
|
||||||
event->AddListener(this);
|
event->AddListener(this);
|
||||||
|
|
||||||
hit->entity->ProcessEvent(event);
|
hit->entity->ProcessEvent(event);
|
||||||
|
|
||||||
if (m_pVehicle || m_pTurret)
|
if (m_pVehicle || m_pTurret) {
|
||||||
{
|
break;
|
||||||
if (m_pVehicle)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < num && m_pVehicle)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// transmit the godmode to the vehicle
|
// Added in 2.30
|
||||||
|
// Make the vehicle also invincible if the player is invincible
|
||||||
//
|
//
|
||||||
if (flags & FL_GODMODE) {
|
if (flags & FL_GODMODE) {
|
||||||
m_pVehicle->flags |= FL_GODMODE;
|
m_pVehicle->flags |= FL_GODMODE;
|
||||||
|
@ -3331,32 +3344,6 @@ void Player::DoUse(Event *ev)
|
||||||
m_pVehicle->flags &= ~FL_GODMODE;
|
m_pVehicle->flags &= ~FL_GODMODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: special game feature
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
// Now retrieve entities that doesn't require to look at
|
|
||||||
num = getUseableEntities( touch, MAX_GENTITIES, false );
|
|
||||||
|
|
||||||
for( i = 0; i < num; i++ )
|
|
||||||
{
|
|
||||||
hit = &g_entities[ touch[ i ] ];
|
|
||||||
|
|
||||||
if( !hit->inuse || hit->entity == NULL || hit->entity == this ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Event *event = new Event( EV_Use );
|
|
||||||
event->AddListener( this );
|
|
||||||
|
|
||||||
hit->entity->ProcessEvent( event );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::TouchStuff(pmove_t *pm)
|
void Player::TouchStuff(pmove_t *pm)
|
||||||
|
@ -5566,7 +5553,6 @@ void Player::GiveNewWeaponsCheat(Event *ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::GodCheat(Event *ev)
|
void Player::GodCheat(Event *ev)
|
||||||
|
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue