Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
135 lines
2.9 KiB
C++
135 lines
2.9 KiB
C++
// DrawInfo.cpp: implementation of the DrawInfo class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "MW4GameEd2.h"
|
|
#include "DrawInfo.h"
|
|
#include<Stuff\Stuff.hpp>
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
const char *DrawInfo::PenName[]= { "SelectPen",
|
|
"HelperPen",
|
|
"VehiclePen",
|
|
"BuildingPen",
|
|
"CulturalPen",
|
|
"MechPen",
|
|
"ExtraHelperPen",
|
|
"WarningPen",
|
|
"NonComPen"};
|
|
|
|
DrawInfo::DrawInfo()
|
|
{
|
|
pDC=NULL;
|
|
CurrentPen=0;
|
|
UseBrushes=false;
|
|
PenArray=new CPen[PenCount];
|
|
|
|
PenArray[SelectPen].CreatePen(PS_SOLID,1,0x0000ff);
|
|
PenArray[HelperPen].CreatePen(PS_SOLID,1,0xff007f);
|
|
PenArray[VehiclePen].CreatePen(PS_SOLID,1,0x00ffff);
|
|
PenArray[BuildingPen].CreatePen(PS_SOLID,1,0xff0000);
|
|
PenArray[CulturalPen].CreatePen(PS_SOLID,1,0xff00ff);
|
|
PenArray[MechPen].CreatePen(PS_SOLID,1,0xffff00);
|
|
PenArray[WarningPen].CreatePen(PS_SOLID,1,0x00ffff);
|
|
PenArray[NonComPen].CreatePen(PS_SOLID,1,0xffffff);
|
|
|
|
LOGBRUSH lb;
|
|
lb.lbStyle=BS_SOLID;
|
|
|
|
lb.lbColor=0xff007f;
|
|
HelperBrush.CreateHatchBrush(HS_BDIAGONAL,lb.lbColor);
|
|
PenArray[ExtraHelperPen].CreatePen(PS_DOT,1,&lb);
|
|
|
|
}
|
|
|
|
void DrawInfo::SetPen(int pen)
|
|
{
|
|
Verify(pDC!=NULL);
|
|
Verify(pen<PenCount);
|
|
|
|
if(pen!=CurrentPen)
|
|
{
|
|
CurrentPen=pen;
|
|
pDC->SelectObject(PenArray[CurrentPen]);
|
|
if(UseBrushes && CurrentPen==ExtraHelperPen)
|
|
pDC->SelectObject(HelperBrush);
|
|
else
|
|
pDC->SelectObject(GetStockObject(NULL_BRUSH));
|
|
|
|
pDC->SetTextColor(GetPenColor(CurrentPen));
|
|
}
|
|
}
|
|
|
|
void DrawInfo::SetPenColor(int idx,COLORREF ref)
|
|
{
|
|
Verify(idx<PenCount);
|
|
|
|
EXTLOGPEN logpen;
|
|
LOGBRUSH lb;
|
|
lb.lbStyle=BS_SOLID;
|
|
|
|
GetPen(idx)->GetExtLogPen(&logpen);
|
|
lb.lbStyle=logpen.elpBrushStyle;
|
|
lb.lbColor=ref;
|
|
|
|
GetPen(idx)->DeleteObject();
|
|
GetPen(idx)->CreatePen(logpen.elpPenStyle,logpen.elpWidth,&lb);
|
|
if(idx==ExtraHelperPen)
|
|
{
|
|
HelperBrush.DeleteObject();
|
|
HelperBrush.CreateHatchBrush(HS_BDIAGONAL,lb.lbColor);
|
|
}
|
|
}
|
|
|
|
COLORREF DrawInfo::GetPenColor(int idx)
|
|
{
|
|
Verify(idx<PenCount);
|
|
|
|
EXTLOGPEN logpen;
|
|
GetPen(idx)->GetExtLogPen(&logpen);
|
|
return logpen.elpColor;
|
|
}
|
|
|
|
void DrawInfo::SaveToReg()
|
|
{
|
|
int i;
|
|
COLORREF ref;
|
|
CString name;
|
|
|
|
for(i=0;i<DrawInfo::PenCount;i++)
|
|
{
|
|
ref=GetPenColor(i);
|
|
name=GetPenName(i)+"Color";
|
|
gos_SaveDataToRegistry((char *)(LPCSTR)name,&ref,sizeof(ref));
|
|
}
|
|
|
|
}
|
|
|
|
void DrawInfo::LoadFromReg()
|
|
{
|
|
int i;
|
|
unsigned long sze;
|
|
COLORREF ref;
|
|
CString name;
|
|
|
|
for(i=0;i<DrawInfo::PenCount;i++)
|
|
{
|
|
sze=sizeof(ref);
|
|
name=GetPenName(i)+"Color";
|
|
gos_LoadDataFromRegistry((char *)(LPCSTR)name,&ref,&sze);
|
|
if(sze) SetPenColor(i,ref);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DrawInfo::~DrawInfo()
|
|
{
|
|
//if(PenArray) delete PenArray;
|
|
}
|