Ares
Public Member Functions | Public Attributes

WeaponTypeExt::ExtData Class Reference

#include <src/Ext/WeaponType/Body.h>

Inheritance diagram for WeaponTypeExt::ExtData:
Extension< TT >

List of all members.

Public Member Functions

 ExtData (const DWORD Canary, TT *const OwnerObject)
virtual size_t Size () const
virtual void LoadFromINIFile (TT *pThis, CCINIClass *pINI)
virtual void Initialize (TT *pThis)
virtual void InvalidatePointer (void *ptr)
bool IsWave (WeaponTypeClass *pThis)
bool conductAbduction (BulletClass *)

Public Attributes

bool Weapon_Loaded
Customizable< ColorStruct > Beam_Color
int Beam_Duration
double Beam_Amplitude
bool Beam_IsHouseColor
Customizable< ColorStruct > Bolt_Color1
Customizable< ColorStruct > Bolt_Color2
Customizable< ColorStruct > Bolt_Color3
bool Wave_IsHouseColor
bool Wave_IsLaser
bool Wave_IsBigLaser
Customizable< ColorStruct > Wave_Color
bool Wave_Reverse [5]
Customizable< signed int > Laser_Thickness
bool Ivan_KillsBridges
bool Ivan_Detachable
Customizable< int > Ivan_Damage
Customizable< int > Ivan_Delay
CustomizableIdx< int, VocClass > Ivan_TickingSound
CustomizableIdx< int, VocClass > Ivan_AttachSound
Customizable< WarheadTypeClass * > Ivan_WH
Customizable< SHPStruct * > Ivan_Image
Customizable< int > Ivan_FlickerRate
RadTypeRad_Type
Valueable< bool > Abductor
 Will this weapon force eligible targets into the passenger hold of the shooter?

Constructor & Destructor Documentation

WeaponTypeExt::ExtData::ExtData ( const DWORD  Canary,
TT *const  OwnerObject 
) [inline]
                                                                   : Extension<TT>(Canary, OwnerObject),
                        Weapon_Loaded (false),
                        Beam_Color (&RulesClass::Instance->RadColor),
                        Beam_Duration (15),
                        Beam_Amplitude (40.0),
                        Beam_IsHouseColor (false),
                        Bolt_Color1 (NULL),
                        Bolt_Color2 (NULL),
                        Bolt_Color3 (NULL),
                        Wave_IsHouseColor (false),
                        Wave_IsLaser (false),
                        Wave_IsBigLaser (false),
                        Wave_Color (NULL),
                        Laser_Thickness (NULL),
                        Ivan_KillsBridges (true),
                        Ivan_Detachable (true),
                        Ivan_Damage (&RulesClass::Instance->IvanDamage),
                        Ivan_Delay (&RulesClass::Instance->IvanTimedDelay),
                        Ivan_TickingSound (&RulesClass::Instance->BombTickingSound),
                        Ivan_AttachSound (&RulesClass::Instance->BombAttachSound),
                        Ivan_WH (&RulesClass::Instance->IvanWarhead),
                        Ivan_Image (&RulesClass::Instance->BOMBCURS_SHP),
                        Ivan_FlickerRate (&RulesClass::Instance->IvanIconFlickerRate),
                        Rad_Type (NULL),
                        Abductor(false)
                        {
                                this->Laser_Thickness.Set(-1);
//                              this->Beam_Color = ColorStruct(255, 255, 255);
//                              this->Wave_Color = ColorStruct(255, 255, 255);
                                for(int i = 0; i < 5; ++i) {
                                        this->Wave_Reverse[i] = false;
                                }
                        };

Member Function Documentation

bool WeaponTypeExt::ExtData::conductAbduction ( BulletClass *  Bullet)

This function checks if an abduction should be performed, and, if so, performs it, provided that is possible.

Author:
Renegade
Date:
24.08.2010
Parameters:
[in]BulletThe projectile that hits the victim.
Return values:
trueAn abduction was performed. It should be assumed that the target is gone from the map at this point.
falseNo abduction was performed. This can be because the weapon is not an abductor, or because an error occurred. The target should still be on the map.
Todo:
see if TechnoClass::Transporter needs to be set in here
                                                                {
        // ensuring a few base parameters
        if(!this->Abductor || !Bullet->Target || !Bullet->Owner) {
                return false;
        }

        if(FootClass *Target = generic_cast<FootClass *>(Bullet->Target)) {
                TechnoClass* Attacker = Bullet->Owner;
                TechnoTypeClass* TargetType = Target->GetTechnoType();
                TechnoTypeClass* AttackerType = Attacker->GetTechnoType();

                //issue 1362
                if(!WarheadTypeExt::canWarheadAffectTarget(Target, Attacker->Owner, Bullet->WH)) {
                        return false;
                }
                if(Target->IsIronCurtained()) {
                        return false;
                }

                // Don't abduct the target if it's too fat in general, or if there's not enough room left in the hold // alternatively, NumPassengers
                if((TargetType->Size > AttackerType->SizeLimit)
                  || (TargetType->Size > (AttackerType->Passengers - Attacker->Passengers.GetTotalSize()))) {
                        return false;
                } else {
                        // if we ended up here, the target is of the right type, and the attacker can take it
                        // so we abduct the target...
                        Target->StopMoving();
                        Target->SetDestination(NULL, true); // Target->UpdatePosition(int) ?
                        Target->SetTarget(NULL);
                        Target->CurrentTargets.Clear(); // Target->ShouldLoseTargetNow ?
                        Target->SetFocus(NULL);
                        Target->QueueMission(mission_Sleep, true);
                        Target->OnBridge = false;
                        Target->unknown_C4 = 0; // don't ask
                        Target->unknown_5A0 = 0;
                        Target->CurrentGattlingStage = 0;
                        Target->SetCurrentWeaponStage(0);
                        // if this unit is being mind controlled, break the link
                        if(TechnoClass * MindController = Target->MindControlledBy) {
                                if(CaptureManagerClass * MC = MindController->CaptureManager) {
                                        MC->FreeUnit(Target);
                                }
                        }
                        // if this unit is a mind controller, break the link
                        if(Target->CaptureManager) {
                                Target->CaptureManager->FreeAll();
                        }

                        // if this unit is currently in a state of temporal flux, get it back to our time-frame
                        if(Target->TemporalTargetingMe) {
                                Target->TemporalTargetingMe->Detach();
                        }

                        CoordStruct coordsUnitSource;
                        Target->GetCoords(&coordsUnitSource);
                        Target->Locomotor->Mark_All_Occupation_Bits(0);
                        Target->Locomotor->Force_Track(-1, coordsUnitSource);
                        Target->MarkAllOccupationBits(&coordsUnitSource);

                        Target->Remove();
                        Target->Transporter = Attacker;
                        if(Attacker->WhatAmI() == abs_Building) {
                                Target->Absorbed = true;
                        }
                        Attacker->AddPassenger(Target);
                        Attacker->vt_entry_11C(); // something or other

                        // ..and neuter the bullet, since it's not supposed to hurt the prisoner after the abduction
                        Bullet->Health = 0;
                        Bullet->DamageMultiplier = 0;
                        Bullet->Remove();

                        return true;
                }

        } else {
                // the target was not a valid passenger type
                return false;
        }
}
void WeaponTypeExt::ExtData::Initialize ( TT pThis) [virtual]
{
        this->Wave_Reverse[idxVehicle] = pThis->IsMagBeam;
};
virtual void WeaponTypeExt::ExtData::InvalidatePointer ( void *  ptr) [inline, virtual]

Implements Extension< TT >.

                                                          {
                        AnnounceInvalidPointer(Rad_Type, ptr);
                }
bool WeaponTypeExt::ExtData::IsWave ( WeaponTypeClass *  pThis) [inline]
                                                    {
                        return pThis->IsSonic || pThis->IsMagBeam || this->Wave_IsLaser || this->Wave_IsBigLaser;
                }
void WeaponTypeExt::ExtData::LoadFromINIFile ( WeaponTypeExt::TT pThis,
CCINIClass *  pINI 
) [virtual]
{
        const char * section = pThis->get_ID();
        if(!pINI->GetSection(section)) {
                return;
        }

        if(pThis->IsRadBeam || pThis->IsRadEruption) {
                if(pThis->Warhead && pThis->Warhead->Temporal) { //Marshall added the check for Warhead because PrismForwarding.SupportWeapon does not require a Warhead
                        // Well, a RadEruption Temporal will look pretty funny, but this is what WW uses
                        this->Beam_Color.Bind(&RulesClass::Instance->ChronoBeamColor);
                }
        }

        if(pThis->IsMagBeam) {
                this->Wave_Color.Set(ColorStruct(0xB0, 0, 0xD0)); // rp2 values
        } else if(pThis->IsSonic) {
                this->Wave_Color.Set(ColorStruct(0, 0, 0)); // 0,0,0 is a magic value for "no custom handling"
        } else {
                this->Wave_Color.Set(ColorStruct(255, 255, 255)); // placeholder
        }

        if(pThis->Damage == 0 && this->Weapon_Loaded) {
                // blargh
                // this is the ugly case of a something that apparently isn't loaded from ini yet, wonder why
                this->Weapon_Loaded = 0;
                pThis->LoadFromINI(pINI);
                return;
        }

        ColorStruct tmpColor;

        INI_EX exINI(pINI);

        this->Beam_Duration     = pINI->ReadInteger(section, "Beam.Duration", this->Beam_Duration);
        this->Beam_Amplitude    = pINI->ReadDouble(section, "Beam.Amplitude", this->Beam_Amplitude);
        this->Beam_IsHouseColor = pINI->ReadBool(section, "Beam.IsHouseColor", this->Beam_IsHouseColor);

        if(!this->Beam_IsHouseColor) {
                this->Beam_Color.Read(&exINI, section, "Beam.Color");
        }

        this->Wave_IsLaser      = pINI->ReadBool(section, "Wave.IsLaser", this->Wave_IsLaser);
        this->Wave_IsBigLaser   = pINI->ReadBool(section, "Wave.IsBigLaser", this->Wave_IsBigLaser);
        this->Wave_IsHouseColor = pINI->ReadBool(section, "Wave.IsHouseColor", this->Wave_IsHouseColor);

        if(this->IsWave(pThis) && !this->Wave_IsHouseColor) {
                this->Wave_Color.Read(&exINI, section, "Wave.Color");
        }

        this->Wave_Reverse[idxVehicle]   =
                pINI->ReadBool(section, "Wave.ReverseAgainstVehicles", this->Wave_Reverse[idxVehicle]);
        this->Wave_Reverse[idxAircraft]  =
                pINI->ReadBool(section, "Wave.ReverseAgainstAircraft", this->Wave_Reverse[idxAircraft]);
        this->Wave_Reverse[idxBuilding] =
                pINI->ReadBool(section, "Wave.ReverseAgainstBuildings", this->Wave_Reverse[idxBuilding]);
        this->Wave_Reverse[idxInfantry]  =
                pINI->ReadBool(section, "Wave.ReverseAgainstInfantry", this->Wave_Reverse[idxInfantry]);
        this->Wave_Reverse[idxOther]  =
                pINI->ReadBool(section, "Wave.ReverseAgainstOthers", this->Wave_Reverse[idxOther]);

        if(pThis->IsElectricBolt) {
                this->Bolt_Color1.Read(&exINI, section, "Bolt.Color1");
                this->Bolt_Color2.Read(&exINI, section, "Bolt.Color2");
                this->Bolt_Color3.Read(&exINI, section, "Bolt.Color3");
        }

        this->Laser_Thickness.Read(&exINI, section, "LaserThickness");

//      pData->Wave_InitialIntensity = pINI->ReadInteger(section, "Wave.InitialIntensity", pData->Wave_InitialIntensity);
//      pData->Wave_IntensityStep    = pINI->ReadInteger(section, "Wave.IntensityStep", pData->Wave_IntensityStep);
//      pData->Wave_FinalIntensity   = pINI->ReadInteger(section, "Wave.FinalIntensity", pData->Wave_FinalIntensity);

        if(!pThis->Warhead) {
                DEBUGLOG("Weapon %s doesn't have a Warhead yet, what gives?\n", section);
                return;
        }

        if(pThis->Warhead->IvanBomb) {
                this->Ivan_KillsBridges = pINI->ReadBool(section, "IvanBomb.DestroysBridges", this->Ivan_KillsBridges);
                this->Ivan_Detachable   = pINI->ReadBool(section, "IvanBomb.Detachable", this->Ivan_Detachable);

                this->Ivan_Damage.Read(&exINI, section, "IvanBomb.Damage");
                this->Ivan_Delay.Read(&exINI, section, "IvanBomb.Delay");

                this->Ivan_FlickerRate.Read(&exINI, section, "IvanBomb.FlickerRate");

                this->Ivan_TickingSound.Read(&exINI, section, "IvanBomb.TickingSound");

                this->Ivan_AttachSound.Read(&exINI, section, "IvanBomb.AttachSound");

                this->Ivan_WH.Parse(&exINI, section, "IvanBomb.Warhead");

                this->Ivan_Image.Read(&exINI, section, "IvanBomb.Image");
        }
//
/*
        if(pThis->get_RadLevel()) {
//              pData->Beam_Duration     = pINI->ReadInteger(section, "Beam.Duration", pData->Beam_Duration);
                if(pINI->ReadString(section, "Radiation.Type", "", buffer, 256)) {
                        RadType * rType = RadType::Find(buffer);
                        if(!rType) {
                                Debug::Log("Weapon [%s] references undeclared RadiationType '%s'!\n", section, buffer);
                        }
                        pData->Rad_Type = rType;
                }
        }
*/
        // #680 Chrono Prison
        this->Abductor.Read(&exINI, section, "Abductor");
}
virtual size_t WeaponTypeExt::ExtData::Size ( ) const [inline, virtual]

Implements Extension< TT >.

{ return sizeof(*this); };

Member Data Documentation

Will this weapon force eligible targets into the passenger hold of the shooter?


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines