1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
// SetGlobalShipFlags.cpp : implementation file
//
#include "stdafx.h"
#include "fred.h"
#include "SetGlobalShipFlags.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// SetGlobalShipFlags dialog
SetGlobalShipFlags::SetGlobalShipFlags(CWnd* pParent /*=NULL*/)
: CDialog(SetGlobalShipFlags::IDD, pParent)
{
//{{AFX_DATA_INIT(SetGlobalShipFlags)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void SetGlobalShipFlags::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SetGlobalShipFlags)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(SetGlobalShipFlags, CDialog)
//{{AFX_MSG_MAP(SetGlobalShipFlags)
ON_BN_CLICKED(IDC_NO_SHIELDS, OnNoShields)
ON_BN_CLICKED(IDC_NO_SUBSPACE_DRIVE, OnNoSubspaceDrive)
ON_BN_CLICKED(IDC_PRIMITIVE_SENSORS, OnPrimitiveSensors)
ON_BN_CLICKED(IDC_AFFECTED_BY_GRAVITY, OnAffectedByGravity)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// SetGlobalShipFlags message handlers
void SetGlobalShipFlags::OnNoShields()
{
int i;
for (i=0; i<MAX_SHIPS; i++)
{
if (Ships[i].objnum >= 0)
{
Objects[Ships[i].objnum].flags |= OF_NO_SHIELDS;
}
}
}
void SetGlobalShipFlags::OnNoSubspaceDrive()
{
int i;
for (i=0; i<MAX_SHIPS; i++)
{
if (Ships[i].objnum >= 0)
{
// only for fighters and bombers
if (Ship_info[Ships[i].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER))
Ships[i].flags2 |= SF2_NO_SUBSPACE_DRIVE;
else
Ships[i].flags2 &= ~SF2_NO_SUBSPACE_DRIVE;
}
}
}
void SetGlobalShipFlags::OnPrimitiveSensors()
{
int i;
for (i=0; i<MAX_SHIPS; i++)
{
if (Ships[i].objnum >= 0)
{
// only for fighters and bombers
if (Ship_info[Ships[i].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER))
Ships[i].flags2 |= SF2_PRIMITIVE_SENSORS;
else
Ships[i].flags2 &= ~SF2_PRIMITIVE_SENSORS;
}
}
}
void SetGlobalShipFlags::OnAffectedByGravity()
{
int i;
for (i=0; i<MAX_SHIPS; i++)
{
if (Ships[i].objnum >= 0)
{
// only for fighters and bombers
if (Ship_info[Ships[i].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER))
Ships[i].flags2 |= SF2_AFFECTED_BY_GRAVITY;
else
Ships[i].flags2 &= ~SF2_AFFECTED_BY_GRAVITY;
}
}
}
|