See the readme.
This commit is contained in:
parent
20b7c95551
commit
908737afa7
101
q3radiant/BMP.H
101
q3radiant/BMP.H
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef _BMP_H
|
||||
#define _BMP_H
|
||||
|
||||
#define xBI_NONE 0
|
||||
#define xBI_RGB 0
|
||||
#define xBI_RLE4 2
|
||||
#define xBI_RLE8 1
|
||||
|
||||
#define BMP_SIGNATURE_WORD 0x4d42
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned short bfType; // signature - 'BM'
|
||||
unsigned long bfSize; // file size in bytes
|
||||
unsigned short bfReserved1; // 0
|
||||
unsigned short bfReserved2; // 0
|
||||
unsigned long bfOffBits; // offset to bitmap
|
||||
} bmphd_t;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned long biSize; // size of this struct
|
||||
long biWidth; // bmap width in pixels
|
||||
long biHeight; // bmap height in pixels
|
||||
unsigned short biPlanes; // num planes - always 1
|
||||
unsigned short biBitCount; // bits perpixel
|
||||
unsigned long biCompression; // compression flag
|
||||
unsigned long biSizeImage; // image size in bytes
|
||||
long biXPelsPerMeter; // horz resolution
|
||||
long biYPelsPerMeter; // vert resolution
|
||||
unsigned long biClrUsed; // 0 -> color table size
|
||||
unsigned long biClrImportant; // important color count
|
||||
} binfo_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char blue;
|
||||
unsigned char green;
|
||||
unsigned char red;
|
||||
unsigned char reserved;
|
||||
} drgb_t;
|
||||
|
||||
|
||||
// quake expects its palette to be bgr
|
||||
// this is totally backwards but what can you do
|
||||
typedef struct {
|
||||
unsigned char r;
|
||||
unsigned char g;
|
||||
unsigned char b;
|
||||
} rgb_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char b;
|
||||
unsigned char g;
|
||||
unsigned char r;
|
||||
} bgr_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int bpp; // bits per pixel
|
||||
int width;
|
||||
int height;
|
||||
unsigned char *data;
|
||||
rgb_t *palette;
|
||||
} bitmap_t;
|
||||
|
||||
|
||||
void LoadBMP(char *filename, bitmap_t *bit);
|
||||
void FreeBMP(bitmap_t *bitmap);
|
||||
void WriteBMP(char *filename, bitmap_t *bit);
|
||||
void NewBMP(int width, int height, int bpp, bitmap_t *bit);
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
// brush.h
|
||||
|
||||
// all types moved to qertypes.h
|
||||
//--typedef struct
|
||||
//--{
|
||||
//-- int numpoints;
|
||||
//-- int maxpoints;
|
||||
//-- float points[8][5]; // variable sized
|
||||
//--} winding_t;
|
||||
|
||||
|
||||
// the normals on planes point OUT of the brush
|
||||
//--#define MAXPOINTS 16
|
||||
//--typedef struct face_s
|
||||
//--{
|
||||
//-- struct face_s *next;
|
||||
//-- vec3_t planepts[3];
|
||||
//-- texdef_t texdef;
|
||||
//-- plane_t plane;
|
||||
//--
|
||||
//-- winding_t *face_winding;
|
||||
//--
|
||||
//-- vec3_t d_color;
|
||||
//-- qtexture_t *d_texture;
|
||||
//--
|
||||
//--} face_t;
|
||||
//--
|
||||
//--typedef struct {
|
||||
//-- vec3_t xyz;
|
||||
//-- float sideST[2];
|
||||
//-- float capST[2];
|
||||
//--} curveVertex_t;
|
||||
//--
|
||||
//--typedef struct {
|
||||
//-- curveVertex_t v[2];
|
||||
//--} sideVertex_t;
|
||||
//--
|
||||
//--typedef struct brush_s
|
||||
//--{
|
||||
//-- struct brush_s *prev, *next; // links in active/selected
|
||||
//-- struct brush_s *oprev, *onext; // links in entity
|
||||
//-- struct entity_s *owner;
|
||||
//-- vec3_t mins, maxs;
|
||||
//-- face_t *brush_faces;
|
||||
//--
|
||||
//-- qboolean bModelFailed;
|
||||
//-- //
|
||||
//-- // curve brush extensions
|
||||
//-- // all are derived from brush_faces
|
||||
//-- qboolean curveBrush;
|
||||
//-- qboolean patchBrush;
|
||||
//-- int nPatchID;
|
||||
//--} brush_t;
|
||||
|
||||
void Brush_AddToList (brush_t *b, brush_t *list);
|
||||
void Brush_Build(brush_t *b, bool bSnap = true, bool bMarkMap = true, bool bConvert = false);
|
||||
void Brush_BuildWindings( brush_t *b, bool bSnap = true );
|
||||
brush_t* Brush_Clone (brush_t *b);
|
||||
brush_t* Brush_FullClone(brush_t *b);
|
||||
brush_t* Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef);
|
||||
void Brush_Draw( brush_t *b );
|
||||
void Brush_DrawXY(brush_t *b, int nViewType);
|
||||
// set bRemoveNode to false to avoid trying to delete the item in group view tree control
|
||||
void Brush_Free (brush_t *b, bool bRemoveNode = true);
|
||||
int Brush_MemorySize(brush_t *b);
|
||||
void Brush_MakeSided (int sides);
|
||||
void Brush_MakeSidedCone (int sides);
|
||||
void Brush_Move (brush_t *b, const vec3_t move, bool bSnap = true);
|
||||
int Brush_MoveVertex(brush_t *b, vec3_t vertex, vec3_t delta, vec3_t end, bool bSnap = true);
|
||||
void Brush_ResetFaceOriginals(brush_t *b);
|
||||
brush_t* Brush_Parse (void);
|
||||
face_t* Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist);
|
||||
void Brush_RemoveFromList (brush_t *b);
|
||||
void Brush_SplitBrushByFace (brush_t *in, face_t *f, brush_t **front, brush_t **back);
|
||||
void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear);
|
||||
void Brush_SetTexture (brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale = false, IPluginTexdef* pPlugTexdef=NULL );
|
||||
void Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir, qboolean shear);
|
||||
void Brush_SnapToGrid(brush_t *pb);
|
||||
void Brush_Rotate(brush_t *b, vec3_t vAngle, vec3_t vOrigin, bool bBuild = true);
|
||||
void Brush_MakeSidedSphere(int sides);
|
||||
void Brush_Write (brush_t *b, FILE *f);
|
||||
void Brush_Write (brush_t *b, CMemFile* pMemFile);
|
||||
void Brush_RemoveEmptyFaces ( brush_t *b );
|
||||
winding_t* Brush_MakeFaceWinding (brush_t *b, face_t *face);
|
||||
|
||||
int AddPlanept (float *f);
|
||||
float SetShadeForPlane (plane_t *p);
|
||||
|
||||
face_t* Face_Alloc( void );
|
||||
void Face_Free( face_t *f );
|
||||
face_t* Face_Clone (face_t *f);
|
||||
void Face_MakePlane (face_t *f);
|
||||
void Face_Draw( face_t *face );
|
||||
void Face_TextureVectors (face_t *f, float STfromXYZ[2][4]);
|
||||
void SetFaceTexdef (brush_t *b, face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale = false, IPluginTexdef* pPlugTexdef = NULL );
|
||||
|
||||
void Face_FitTexture( face_t * face, int nHeight, int nWidth );
|
||||
void Brush_FitTexture( brush_t *b, int nHeight, int nWidth );
|
||||
void Brush_SetEpair(brush_t *b, const char *pKey, const char *pValue);
|
||||
const char* Brush_GetKeyValue(brush_t *b, const char *pKey);
|
||||
brush_t *Brush_Alloc();
|
||||
const char* Brush_Name(brush_t *b);
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// BSInput.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "BSInput.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBSInput dialog
|
||||
|
||||
|
||||
CBSInput::CBSInput(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CBSInput::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CBSInput)
|
||||
m_fField1 = 0.0f;
|
||||
m_fField2 = 0.0f;
|
||||
m_fField3 = 0.0f;
|
||||
m_fField4 = 0.0f;
|
||||
m_fField5 = 0.0f;
|
||||
m_strField1 = _T("");
|
||||
m_strField2 = _T("");
|
||||
m_strField3 = _T("");
|
||||
m_strField4 = _T("");
|
||||
m_strField5 = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CBSInput::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CBSInput)
|
||||
DDX_Text(pDX, IDC_EDIT_FIELD1, m_fField1);
|
||||
DDX_Text(pDX, IDC_EDIT_FIELD2, m_fField2);
|
||||
DDX_Text(pDX, IDC_EDIT_FIELD3, m_fField3);
|
||||
DDX_Text(pDX, IDC_EDIT_FIELD4, m_fField4);
|
||||
DDX_Text(pDX, IDC_EDIT_FIELD5, m_fField5);
|
||||
DDX_Text(pDX, IDC_STATIC_FIELD1, m_strField1);
|
||||
DDX_Text(pDX, IDC_STATIC_FIELD2, m_strField2);
|
||||
DDX_Text(pDX, IDC_STATIC_FIELD3, m_strField3);
|
||||
DDX_Text(pDX, IDC_STATIC_FIELD4, m_strField4);
|
||||
DDX_Text(pDX, IDC_STATIC_FIELD5, m_strField5);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CBSInput, CDialog)
|
||||
//{{AFX_MSG_MAP(CBSInput)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBSInput message handlers
|
||||
|
||||
BOOL CBSInput::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
if (m_strField1.GetLength() == 0)
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_FIELD1)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_STATIC_FIELD1)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
if (m_strField2.GetLength() == 0)
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_FIELD2)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_STATIC_FIELD2)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
if (m_strField3.GetLength() == 0)
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_FIELD3)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_STATIC_FIELD3)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
if (m_strField4.GetLength() == 0)
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_FIELD4)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_STATIC_FIELD4)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
if (m_strField5.GetLength() == 0)
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_FIELD5)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_STATIC_FIELD5)->ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_BSINPUT_H__81DF2A32_A552_11D1_B58E_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_BSINPUT_H__81DF2A32_A552_11D1_B58E_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// BSInput.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBSInput dialog
|
||||
|
||||
class CBSInput : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CBSInput(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CBSInput)
|
||||
enum { IDD = IDD_DIALOG_INPUT };
|
||||
float m_fField1;
|
||||
float m_fField2;
|
||||
float m_fField3;
|
||||
float m_fField4;
|
||||
float m_fField5;
|
||||
CString m_strField1;
|
||||
CString m_strField2;
|
||||
CString m_strField3;
|
||||
CString m_strField4;
|
||||
CString m_strField5;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBSInput)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CBSInput)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_BSINPUT_H__81DF2A32_A552_11D1_B58E_00AA00A410FC__INCLUDED_)
|
|
@ -1,379 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
// upper design bounds
|
||||
// leaffaces, leafbrushes, planes, and verts are still bounded by
|
||||
// 16 bit short limits
|
||||
#define MAX_MAP_MODELS 1024
|
||||
#define MAX_MAP_BRUSHES 8192
|
||||
#define MAX_MAP_ENTITIES 2048
|
||||
#define MAX_MAP_PATHS 2048
|
||||
#define MAX_MAP_ENTSTRING 0x20000
|
||||
#define MAX_MAP_TEXTURES 1024
|
||||
#define MAX_MAP_TEXINFO 8192
|
||||
|
||||
#define MAX_MAP_PLANES 65536
|
||||
#define MAX_MAP_NODES 65536
|
||||
#define MAX_MAP_BRUSHSIDES 65536
|
||||
#define MAX_MAP_LEAFS 65536
|
||||
#define MAX_MAP_VERTS 65536
|
||||
#define MAX_MAP_FACES 65536
|
||||
#define MAX_MAP_LEAFFACES 65536
|
||||
#define MAX_MAP_LEAFBRUSHES 65536
|
||||
#define MAX_MAP_PORTALS 65536
|
||||
#define MAX_MAP_EDGES 128000
|
||||
#define MAX_MAP_SURFEDGES 256000
|
||||
#define MAX_MAP_MIPTEX 0x200000
|
||||
#define MAX_MAP_LIGHTING 0x200000
|
||||
#define MAX_MAP_VISIBILITY 0x100000
|
||||
|
||||
// key / value pair sizes
|
||||
|
||||
#define MAX_KEY 32
|
||||
#define MAX_VALUE 1024
|
||||
|
||||
//=============================================================================
|
||||
|
||||
#define BSPVERSION 34
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fileofs, filelen;
|
||||
} lump_t;
|
||||
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_PLANES 1
|
||||
#define LUMP_TEXTURES 2
|
||||
#define LUMP_VERTEXES 3
|
||||
#define LUMP_VISIBILITY 4
|
||||
#define LUMP_NODES 5
|
||||
#define LUMP_TEXINFO 6
|
||||
#define LUMP_FACES 7
|
||||
#define LUMP_LIGHTING 8
|
||||
#define LUMP_LEAFS 9
|
||||
#define LUMP_LEAFFACES 10
|
||||
#define LUMP_LEAFBRUSHES 11
|
||||
#define LUMP_EDGES 12
|
||||
#define LUMP_SURFEDGES 13
|
||||
#define LUMP_MODELS 14
|
||||
#define LUMP_PATHS 15
|
||||
#define LUMP_BRUSHES 16
|
||||
#define LUMP_BRUSHSIDES 17
|
||||
#define LUMP_POP 18
|
||||
|
||||
#define HEADER_LUMPS 18
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
lump_t lumps[HEADER_LUMPS];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3], maxs[3];
|
||||
float origin[3]; // for sounds or lights
|
||||
int headnode;
|
||||
int visleafs; // not including the solid leaf 0
|
||||
int firstface, numfaces;
|
||||
} dmodel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nummiptex;
|
||||
int dataofs[4]; // [nummiptex]
|
||||
} dmiptexlump_t;
|
||||
|
||||
#define MIPLEVELS 4
|
||||
typedef struct miptex_s
|
||||
{
|
||||
char name[16];
|
||||
unsigned width, height;
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
int flags;
|
||||
int value;
|
||||
} miptex_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float point[3];
|
||||
} dvertex_t;
|
||||
|
||||
|
||||
// 0-2 are axial planes
|
||||
#define PLANE_X 0
|
||||
#define PLANE_Y 1
|
||||
#define PLANE_Z 2
|
||||
|
||||
// 3-5 are non-axial planes snapped to the nearest
|
||||
#define PLANE_ANYX 3
|
||||
#define PLANE_ANYY 4
|
||||
#define PLANE_ANYZ 5
|
||||
|
||||
// planes (x&~1) and (x&~1)+1 are allways opposites
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float normal[3];
|
||||
float dist;
|
||||
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
|
||||
} dplane_t;
|
||||
|
||||
|
||||
// contents flags are seperate bits
|
||||
// a given brush can contribute multiple content bits
|
||||
// multiple brushes can be in a single leaf
|
||||
|
||||
// lower bits are stronger, and will eat weaker brushes completely
|
||||
#define CONTENTS_SOLID 1 // an eye is never valid in a solid
|
||||
#define CONTENTS_WINDOW 2 // translucent, but not watery
|
||||
#define CONTENTS_LAVA 8
|
||||
#define CONTENTS_SLIME 16
|
||||
#define CONTENTS_WATER 32
|
||||
#define CONTENTS_THINWATER 64 // translucent faces
|
||||
|
||||
#define LAST_VISIBLE_CONTENTS 64
|
||||
|
||||
// remaining contents are non-visible, and don't eat brushes
|
||||
#define CONTENTS_MONSTER 128
|
||||
#define CONTENTS_PLAYERCLIP 256
|
||||
#define CONTENTS_MONSTERCLIP 512
|
||||
|
||||
|
||||
// currents can be added to any other contents, and may be mixed
|
||||
#define CONTENTS_CURRENT_0 1024
|
||||
#define CONTENTS_CURRENT_90 2048
|
||||
#define CONTENTS_CURRENT_180 4096
|
||||
#define CONTENTS_CURRENT_270 8192
|
||||
#define CONTENTS_CURRENT_UP 16384
|
||||
#define CONTENTS_CURRENT_DOWN 32768
|
||||
|
||||
#define CONTENTS_ORIGIN 65536 // removed before processing
|
||||
|
||||
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_i386.h too !!!
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
short mins[3]; // for frustom culling
|
||||
short maxs[3];
|
||||
unsigned short firstface;
|
||||
unsigned short numfaces; // counting both sides
|
||||
} dnode_t;
|
||||
|
||||
typedef struct texinfo_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t][xyz offset]
|
||||
int miptex;
|
||||
int flags; // miptex flags + overrides
|
||||
int value; // light emition, etc
|
||||
} texinfo_t;
|
||||
|
||||
#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
|
||||
#define SURF_LIGHT 2
|
||||
|
||||
#define SURF_WATER 4
|
||||
#define SURF_SLIME 8
|
||||
#define SURF_LAVA 16
|
||||
#define SURF_WINDOW 32
|
||||
|
||||
#define SURF_SKY 64
|
||||
#define SURF_MIRROR 128
|
||||
|
||||
#define SURF_SLIPPERY 256
|
||||
|
||||
// note that edge 0 is never used, because negative edge nums are used for
|
||||
// counterclockwise use of the edge in a face
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v[2]; // vertex numbers
|
||||
} dedge_t;
|
||||
|
||||
#define MAXLIGHTMAPS 4
|
||||
typedef struct
|
||||
{
|
||||
unsigned short planenum;
|
||||
short side;
|
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
short numedges;
|
||||
short texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
} dface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int contents; // OR of all brushes
|
||||
int visofs; // -1 = no visibility info
|
||||
|
||||
short mins[3]; // for frustum culling
|
||||
short maxs[3];
|
||||
|
||||
unsigned short firstleafface;
|
||||
unsigned short numleaffaces;
|
||||
|
||||
unsigned short firstleafbrush;
|
||||
unsigned short numleafbrushes;
|
||||
} dleaf_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short planenum; // facing out of the leaf
|
||||
short texinfo;
|
||||
} dbrushside_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int firstside;
|
||||
int numsides;
|
||||
int contents;
|
||||
} dbrush_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float origin[3];
|
||||
float angles[3];
|
||||
int next, prev;
|
||||
int flags;
|
||||
float speed;
|
||||
} dpath_t;
|
||||
|
||||
//============================================================================
|
||||
|
||||
#ifndef QUAKE_GAME
|
||||
|
||||
#define ANGLE_UP -1
|
||||
#define ANGLE_DOWN -2
|
||||
|
||||
|
||||
// the utilities get to be lazy and just use large static arrays
|
||||
|
||||
extern int nummodels;
|
||||
extern dmodel_t dmodels[MAX_MAP_MODELS];
|
||||
|
||||
extern int visdatasize;
|
||||
extern byte dvisdata[MAX_MAP_VISIBILITY];
|
||||
|
||||
extern int lightdatasize;
|
||||
extern byte dlightdata[MAX_MAP_LIGHTING];
|
||||
|
||||
extern int texdatasize;
|
||||
extern byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
|
||||
|
||||
extern int entdatasize;
|
||||
extern char dentdata[MAX_MAP_ENTSTRING];
|
||||
|
||||
extern int numleafs;
|
||||
extern dleaf_t dleafs[MAX_MAP_LEAFS];
|
||||
|
||||
extern int numplanes;
|
||||
extern dplane_t dplanes[MAX_MAP_PLANES];
|
||||
|
||||
extern int numvertexes;
|
||||
extern dvertex_t dvertexes[MAX_MAP_VERTS];
|
||||
|
||||
extern int numnodes;
|
||||
extern dnode_t dnodes[MAX_MAP_NODES];
|
||||
|
||||
extern int numtexinfo;
|
||||
extern texinfo_t texinfo[MAX_MAP_TEXINFO];
|
||||
|
||||
extern int numfaces;
|
||||
extern dface_t dfaces[MAX_MAP_FACES];
|
||||
|
||||
extern int numedges;
|
||||
extern dedge_t dedges[MAX_MAP_EDGES];
|
||||
|
||||
extern int numleaffaces;
|
||||
extern unsigned short dleaffaces[MAX_MAP_LEAFFACES];
|
||||
|
||||
extern int numleafbrushes;
|
||||
extern unsigned short dleafbrushes[MAX_MAP_LEAFBRUSHES];
|
||||
|
||||
extern int numsurfedges;
|
||||
extern int dsurfedges[MAX_MAP_SURFEDGES];
|
||||
|
||||
extern int numpaths;
|
||||
extern dpath_t dpaths[MAX_MAP_PATHS];
|
||||
|
||||
extern int numbrushes;
|
||||
extern dbrush_t dbrushes[MAX_MAP_BRUSHES];
|
||||
|
||||
extern int numbrushsides;
|
||||
extern dbrushside_t dbrushsides[MAX_MAP_BRUSHSIDES];
|
||||
|
||||
|
||||
void DecompressVis (byte *in, byte *decompressed);
|
||||
int CompressVis (byte *vis, byte *dest);
|
||||
|
||||
void LoadBSPFile (char *filename);
|
||||
void WriteBSPFile (char *filename);
|
||||
void PrintBSPFileSizes (void);
|
||||
|
||||
//===============
|
||||
|
||||
|
||||
typedef struct epair_s
|
||||
{
|
||||
struct epair_s *next;
|
||||
char *key;
|
||||
char *value;
|
||||
} epair_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t origin;
|
||||
int firstbrush;
|
||||
int numbrushes;
|
||||
epair_t *epairs;
|
||||
} entity_t;
|
||||
|
||||
extern int num_entities;
|
||||
extern entity_t entities[MAX_MAP_ENTITIES];
|
||||
|
||||
void ParseEntities (void);
|
||||
void UnparseEntities (void);
|
||||
|
||||
void SetKeyValue (entity_t *ent, char *key, char *value);
|
||||
char *ValueForKey (entity_t *ent, char *key);
|
||||
// will return "" if not present
|
||||
|
||||
vec_t FloatForKey (entity_t *ent, char *key);
|
||||
void GetVectorForKey (entity_t *ent, char *key, vec3_t vec);
|
||||
|
||||
epair_t *ParseEpair (void);
|
||||
|
||||
void PrintEntity (entity_t *ent);
|
||||
|
||||
extern int r_leaftovis[MAX_MAP_LEAFS];
|
||||
extern int r_vistoleaf[MAX_MAP_LEAFS];
|
||||
extern int r_numvisleafs;
|
||||
|
||||
#endif
|
|
@ -1,417 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bmp.h"
|
||||
|
||||
|
||||
void Error(char *fmt, ...);
|
||||
|
||||
|
||||
static int GetColorCount(int nbits)
|
||||
{
|
||||
int ncolors = 0;
|
||||
|
||||
if (nbits < 24)
|
||||
{
|
||||
ncolors = 1 << nbits;
|
||||
}
|
||||
|
||||
return(ncolors);
|
||||
}
|
||||
|
||||
|
||||
static void BMPLineNone(FILE *f, char *sline, int pixbytes, int width)
|
||||
{
|
||||
int nbytes, i, k, j;
|
||||
|
||||
switch (pixbytes)
|
||||
{
|
||||
case 1 :
|
||||
nbytes = (width + 3) / 4;
|
||||
nbytes *= 4;
|
||||
|
||||
fread(sline, width, 1, f);
|
||||
nbytes -= width;
|
||||
|
||||
while (nbytes-- > 0) fgetc(f);
|
||||
return;
|
||||
|
||||
case 3 :
|
||||
nbytes = ((width * 3) + 3) / 4;
|
||||
nbytes *= 4;
|
||||
|
||||
fread(sline, width, 3, f);
|
||||
nbytes -= width * 3;
|
||||
|
||||
while (nbytes-- > 0) fgetc(f);
|
||||
|
||||
// reorder bgr to rgb
|
||||
for (i = 0, j = 0; i < width; i++, j += 3)
|
||||
{
|
||||
k = sline[j];
|
||||
sline[j] = sline[j+2];
|
||||
sline[j+2] = k;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Error("BMPLineNone failed.");
|
||||
}
|
||||
|
||||
|
||||
static void BMPLineRLE8(FILE *f, char *sline, int pixbytes, int width)
|
||||
{
|
||||
Error("RLE8 not yet supported.");
|
||||
}
|
||||
|
||||
|
||||
static void BMPLineRLE4(FILE *f, char *sline, int pixbytes, int width)
|
||||
{
|
||||
Error("RLE4 not yet supported.");
|
||||
}
|
||||
|
||||
|
||||
static void BMPLine(FILE *f, char *scanline, int pixbytes, int width, int rle)
|
||||
{
|
||||
switch (rle)
|
||||
{
|
||||
case xBI_NONE : BMPLineNone(f, scanline, pixbytes, width); return;
|
||||
case xBI_RLE8 : BMPLineRLE8(f, scanline, pixbytes, width); return;
|
||||
case xBI_RLE4 : BMPLineRLE4(f, scanline, pixbytes, width); return;
|
||||
}
|
||||
|
||||
Error("Unknown compression type.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void PrintHeader(binfo_t *b)
|
||||
{
|
||||
printf("biSize : %ld\n", b->biSize);
|
||||
printf("biWidth : %ld\n", b->biWidth);
|
||||
printf("biHeight : %ld\n", b->biHeight);
|
||||
printf("biPlanes : %d\n", b->biPlanes);
|
||||
printf("biBitCount : %d\n", b->biBitCount);
|
||||
printf("biCompression : %ld\n", b->biCompression);
|
||||
printf("biSizeImage : %ld\n", b->biSizeImage);
|
||||
printf("biXPelsPerMeter: %ld\n", b->biXPelsPerMeter);
|
||||
printf("biYPelsPerMeter: %ld\n", b->biYPelsPerMeter);
|
||||
printf("biClrUsed : %ld\n", b->biClrUsed);
|
||||
printf("biClrImportant : %ld\n", b->biClrImportant);
|
||||
}
|
||||
|
||||
|
||||
void LoadBMP(char *filename, bitmap_t *bit)
|
||||
{
|
||||
FILE *f;
|
||||
bmphd_t bhd;
|
||||
binfo_t info;
|
||||
int pxlsize = 1;
|
||||
int rowbytes, i, pixbytes;
|
||||
char *scanline;
|
||||
|
||||
// open file
|
||||
if ((f = fopen(filename, "rb")) == NULL)
|
||||
{
|
||||
Error("Unable to open %s.", filename);
|
||||
}
|
||||
|
||||
// read in bitmap header
|
||||
if (fread(&bhd, sizeof(bhd), 1, f) != 1)
|
||||
{
|
||||
fclose(f);
|
||||
Error("Unable to read in bitmap header.");
|
||||
}
|
||||
|
||||
// make sure we have a valid bitmap file
|
||||
if (bhd.bfType != BMP_SIGNATURE_WORD)
|
||||
{
|
||||
fclose(f);
|
||||
Error("Invalid BMP file: %s", filename);
|
||||
}
|
||||
|
||||
// load in info header
|
||||
if (fread(&info, sizeof(info), 1, f) != 1)
|
||||
{
|
||||
fclose(f);
|
||||
Error("Unable to read bitmap info header.");
|
||||
}
|
||||
|
||||
// make sure this is an info type of bitmap
|
||||
if (info.biSize != sizeof(binfo_t))
|
||||
{
|
||||
fclose(f);
|
||||
Error("We only support the info bitmap type.");
|
||||
}
|
||||
|
||||
// PrintHeader(&info);
|
||||
|
||||
bit->bpp = info.biBitCount;
|
||||
bit->width = info.biWidth;
|
||||
bit->height = info.biHeight;
|
||||
bit->data = NULL;
|
||||
bit->palette = NULL;
|
||||
|
||||
//currently we only read in 8 and 24 bit bmp files
|
||||
if (info.biBitCount == 8) pixbytes = 1;
|
||||
else if (info.biBitCount == 24) pixbytes = 3;
|
||||
else
|
||||
{
|
||||
Error("BPP %d not supported.", info.biBitCount);
|
||||
}
|
||||
|
||||
// if this is an eight bit image load palette
|
||||
if (pixbytes == 1)
|
||||
{
|
||||
drgb_t q;
|
||||
|
||||
bit->palette = reinterpret_cast<rgb_t*>(malloc(sizeof(rgb_t) * 256));
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
if (fread(&q, sizeof(drgb_t), 1, f) != 1)
|
||||
{
|
||||
fclose(f); free(bit->palette);
|
||||
Error("Unable to read palette.");
|
||||
}
|
||||
|
||||
bit->palette[i].r = q.red;
|
||||
bit->palette[i].g = q.green;
|
||||
bit->palette[i].b = q.blue;
|
||||
}
|
||||
}
|
||||
|
||||
// position to start of bitmap
|
||||
fseek(f, bhd.bfOffBits, SEEK_SET);
|
||||
|
||||
// create scanline to read data into
|
||||
rowbytes = ((info.biWidth * pixbytes) + 3) / 4;
|
||||
rowbytes *= 4;
|
||||
|
||||
scanline = reinterpret_cast<char*>(malloc(rowbytes));
|
||||
|
||||
// alloc space for new bitmap
|
||||
bit->data = reinterpret_cast<unsigned char*>(malloc(info.biWidth * pixbytes * info.biHeight));
|
||||
|
||||
// read in image
|
||||
for (i = 0; i < info.biHeight; i++)
|
||||
{
|
||||
BMPLine(f, scanline, pixbytes, info.biWidth, info.biCompression);
|
||||
|
||||
// store line
|
||||
memcpy(&bit->data[info.biWidth * pixbytes * (info.biHeight - i - 1)], scanline, info.biWidth * pixbytes);
|
||||
}
|
||||
|
||||
free(scanline);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void BMPEncodeLine(FILE *f, unsigned char *data, int npxls, int pixbytes)
|
||||
{
|
||||
int nbytes, i, j, k;
|
||||
|
||||
switch (pixbytes)
|
||||
{
|
||||
case 1 :
|
||||
nbytes = (npxls + 3) / 4;
|
||||
nbytes *= 4;
|
||||
|
||||
fwrite(data, npxls, 1, f);
|
||||
nbytes -= npxls;
|
||||
|
||||
while (nbytes-- > 0) fputc(0, f);
|
||||
return;
|
||||
|
||||
case 3 :
|
||||
// reorder rgb to bgr
|
||||
for (i = 0, j = 0; i < npxls; i++, j+= 3)
|
||||
{
|
||||
k = data[j];
|
||||
data[j] = data[j + 2];
|
||||
data[j + 2] = k;
|
||||
}
|
||||
|
||||
nbytes = ((npxls * 3) + 3) / 4;
|
||||
nbytes *= 4;
|
||||
|
||||
fwrite(data, npxls, 3, f);
|
||||
nbytes -= npxls * 3;
|
||||
|
||||
while (nbytes-- > 0) fputc(0, f);
|
||||
return;
|
||||
}
|
||||
|
||||
Error("BMPEncodeLine Failed.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WriteBMP(char *filename, bitmap_t *bit)
|
||||
{
|
||||
FILE *f;
|
||||
bmphd_t header;
|
||||
binfo_t info;
|
||||
drgb_t q; // palette that gets written
|
||||
long bmofs;
|
||||
int w, h, i;
|
||||
int pixbytes;
|
||||
|
||||
if (bit->bpp == 8) pixbytes = 1;
|
||||
else if (bit->bpp == 24) pixbytes = 3;
|
||||
|
||||
else
|
||||
{
|
||||
Error("BPP %d not supported.", bit->bpp);
|
||||
}
|
||||
|
||||
|
||||
if ((f = fopen(filename, "wb")) == NULL)
|
||||
{
|
||||
Error("Unable to open %s.", filename);
|
||||
}
|
||||
|
||||
// write out an empty header as a place holder
|
||||
if (fwrite(&header, sizeof(header), 1, f) != 1)
|
||||
{
|
||||
Error("Unable to fwrite.");
|
||||
}
|
||||
|
||||
// init and write info header
|
||||
info.biSize = sizeof(binfo_t);
|
||||
info.biWidth = bit->width;
|
||||
info.biHeight = bit->height;
|
||||
info.biPlanes = 1;
|
||||
info.biBitCount = bit->bpp;
|
||||
info.biCompression = xBI_NONE;
|
||||
info.biSizeImage = bit->width * bit->height;
|
||||
info.biXPelsPerMeter = 0;
|
||||
info.biYPelsPerMeter = 0;
|
||||
info.biClrUsed = 256;
|
||||
info.biClrImportant = 256;
|
||||
|
||||
if (fwrite(&info, sizeof(binfo_t), 1, f) != 1)
|
||||
{
|
||||
Error("fwrite failed.");
|
||||
}
|
||||
|
||||
// write out palette if we need to
|
||||
if (bit->bpp == 8)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
q.red = bit->palette[i].r;
|
||||
q.green = bit->palette[i].g;
|
||||
q.blue = bit->palette[i].b;
|
||||
|
||||
fwrite(&q, sizeof(q), 1, f);
|
||||
}
|
||||
}
|
||||
|
||||
// save offset to start of bitmap
|
||||
bmofs = ftell(f);
|
||||
|
||||
// output bitmap
|
||||
w = bit->width;
|
||||
h = bit->height;
|
||||
|
||||
for (i = h - 1; i >= 0; i--)
|
||||
{
|
||||
BMPEncodeLine(f, &bit->data[w * pixbytes * i], w, pixbytes);
|
||||
}
|
||||
|
||||
// update and rewrite file header
|
||||
header.bfType = BMP_SIGNATURE_WORD;
|
||||
header.bfSize = ftell(f);
|
||||
header.bfOffBits = bmofs;
|
||||
|
||||
fseek(f, 0L, SEEK_SET);
|
||||
fwrite(&header, sizeof(header), 1, f);
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
||||
void NewBMP(int width, int height, int bpp, bitmap_t *bit)
|
||||
{
|
||||
int pixbytes;
|
||||
|
||||
if (bpp == 8) pixbytes = 1;
|
||||
else if (bpp == 24) pixbytes = 3;
|
||||
|
||||
else
|
||||
{
|
||||
Error("NewBMP: 8 or 24 bit only.");
|
||||
}
|
||||
|
||||
bit->bpp = bpp;
|
||||
bit->width = width;
|
||||
bit->height = height;
|
||||
|
||||
bit->data = reinterpret_cast<unsigned char*>(malloc(width * height * pixbytes));
|
||||
|
||||
if (bit->data == NULL)
|
||||
{
|
||||
Error("NewBMP: malloc failed.");
|
||||
}
|
||||
|
||||
// see if we need to create a palette
|
||||
if (pixbytes == 1)
|
||||
{
|
||||
bit->palette = (rgb_t *) malloc(768);
|
||||
|
||||
if (bit->palette == NULL)
|
||||
{
|
||||
Error("NewBMP: unable to malloc palette.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bit->palette = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FreeBMP(bitmap_t *bitmap)
|
||||
{
|
||||
if (bitmap->palette)
|
||||
{
|
||||
free(bitmap->palette);
|
||||
bitmap->palette = NULL;
|
||||
}
|
||||
|
||||
if (bitmap->data)
|
||||
{
|
||||
free(bitmap->data);
|
||||
bitmap->data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
4595
q3radiant/Brush.cpp
4595
q3radiant/Brush.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,672 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// BrushScript stuff
|
||||
//
|
||||
#include "stdafx.h"
|
||||
#include "qe3.h"
|
||||
#include "BSInput.h"
|
||||
#include "DialogInfo.h"
|
||||
|
||||
|
||||
//
|
||||
struct SVariableDef
|
||||
{
|
||||
CString m_strName;
|
||||
CString m_strInput;
|
||||
float m_fValue;
|
||||
};
|
||||
|
||||
struct SVecVariableDef
|
||||
{
|
||||
CString m_strName;
|
||||
CString m_strInput;
|
||||
vec3_t m_vValue;
|
||||
};
|
||||
|
||||
|
||||
|
||||
const int MAX_VARIABLES = 64;
|
||||
|
||||
brush_t* g_pHold1 = NULL;
|
||||
brush_t* g_pHold2 = NULL;
|
||||
brush_t* g_pHold3 = NULL;
|
||||
bool g_bRotateAroundSelection;
|
||||
int g_nVariableCount;
|
||||
int g_nVecVariableCount;
|
||||
int g_nLoopCounter;
|
||||
float g_fDefault = 9999.9;
|
||||
vec3_t g_vDefault;
|
||||
bool g_bStartLoop;
|
||||
char* g_pLooper;
|
||||
bool g_bKeepGoing;
|
||||
|
||||
SVariableDef g_Variables[MAX_VARIABLES];
|
||||
SVecVariableDef g_VecVariables[MAX_VARIABLES];
|
||||
|
||||
void InitForScriptRun()
|
||||
{
|
||||
g_pHold1 = NULL;
|
||||
g_pHold2 = NULL;
|
||||
g_pHold3 = NULL;
|
||||
g_bRotateAroundSelection = true;
|
||||
g_nVariableCount = 0;
|
||||
g_nVecVariableCount = 0;
|
||||
g_nLoopCounter = 0;
|
||||
g_bStartLoop = false;
|
||||
g_pLooper = NULL;
|
||||
g_bKeepGoing = true;
|
||||
}
|
||||
|
||||
void AddVariable(const char* pName, float fValue, const char* pInput = NULL)
|
||||
{
|
||||
if (g_nVariableCount < MAX_VARIABLES)
|
||||
{
|
||||
g_Variables[g_nVariableCount].m_strName = pName;
|
||||
g_Variables[g_nVariableCount].m_strName.MakeLower();
|
||||
g_Variables[g_nVariableCount].m_fValue = fValue;
|
||||
if (pInput)
|
||||
g_Variables[g_nVariableCount].m_strInput = pInput;
|
||||
g_nVariableCount++;
|
||||
}
|
||||
else
|
||||
g_pParentWnd->MessageBox("Maximum script variable limit reached!");
|
||||
}
|
||||
|
||||
float VariableValue(const char* pName)
|
||||
{
|
||||
CString strName = pName;
|
||||
strName.MakeLower();
|
||||
for (int n = 0; n < g_nVariableCount; n++)
|
||||
{
|
||||
if (strName == g_Variables[n].m_strName)
|
||||
return g_Variables[n].m_fValue;
|
||||
}
|
||||
//strName.Format("Reference to non-existant varirable %s", pName);
|
||||
//g_pParentWnd->MessageBox(strName);
|
||||
return g_fDefault;
|
||||
}
|
||||
|
||||
void SetVariableValue(const char* pName, float fValue)
|
||||
{
|
||||
CString strName = pName;
|
||||
strName.MakeLower();
|
||||
for (int n = 0; n < g_nVariableCount; n++)
|
||||
{
|
||||
if (strName == g_Variables[n].m_strName)
|
||||
g_Variables[n].m_fValue = fValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AddVectorVariable(const char* pName, const char* pInput = NULL)
|
||||
{
|
||||
if (g_nVecVariableCount < MAX_VARIABLES)
|
||||
{
|
||||
g_VecVariables[g_nVecVariableCount].m_strName = pName;
|
||||
g_VecVariables[g_nVecVariableCount].m_strName.MakeLower();
|
||||
if (pInput)
|
||||
g_VecVariables[g_nVariableCount].m_strInput = pInput;
|
||||
g_nVecVariableCount++;
|
||||
}
|
||||
else
|
||||
g_pParentWnd->MessageBox("Maximum script variable limit reached!");
|
||||
}
|
||||
|
||||
void VectorVariableValue(const char* pName, vec3_t& v)
|
||||
{
|
||||
CString strName = pName;
|
||||
strName.MakeLower();
|
||||
for (int n = 0; n < g_nVecVariableCount; n++)
|
||||
{
|
||||
if (strName == g_VecVariables[n].m_strName)
|
||||
{
|
||||
VectorCopy(g_VecVariables[n].m_vValue, v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
strName.Format("Reference to non-existant variable %s", pName);
|
||||
g_pParentWnd->MessageBox(strName);
|
||||
}
|
||||
|
||||
void SetVectorVariableValue(const char* pName, vec3_t v)
|
||||
{
|
||||
CString strName = pName;
|
||||
strName.MakeLower();
|
||||
for (int n = 0; n < g_nVecVariableCount; n++)
|
||||
{
|
||||
if (strName == g_VecVariables[n].m_strName)
|
||||
VectorCopy(v, g_VecVariables[n].m_vValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// commands
|
||||
//
|
||||
// _CopySelected(nHoldPos)
|
||||
// copies selected brush to hold spot 1, 2 or 3
|
||||
//
|
||||
// _MoveSelected(x, y, z)
|
||||
// moves selected brush by coords provided
|
||||
//
|
||||
// _RotateSelected(x, y, z)
|
||||
// rotates selected brush by coords provided
|
||||
//
|
||||
// _MoveHold(nHoldPos, x, y, z)
|
||||
// moves brush in hold pos by coords provided
|
||||
//
|
||||
// _RotateHold(nHoldPos, x, y, z)
|
||||
// rotates brush in hold pos by coords provided
|
||||
//
|
||||
// _CopyToMap(nHoldPos)
|
||||
// copies hold brush to map
|
||||
//
|
||||
// _CopyAndSelect(nHoldPos)
|
||||
// copies hold brush to map and selects it
|
||||
//
|
||||
// _Input(VarName1, ... VarNamennn)
|
||||
// inputs a list of values from the user
|
||||
//
|
||||
|
||||
typedef void (PFNScript)(char*&);
|
||||
|
||||
|
||||
struct SBrushScript
|
||||
{
|
||||
const char* m_pName;
|
||||
PFNScript* m_pProc;
|
||||
};
|
||||
|
||||
|
||||
const char* GetParam(char*& pBuffer)
|
||||
{
|
||||
static CString strParam;
|
||||
bool bStringMode = false;
|
||||
|
||||
while (*pBuffer != NULL && isspace(*pBuffer)) // skip and whitespace
|
||||
pBuffer++;
|
||||
|
||||
if (*pBuffer == '(') // if it's an opening paren, skip it
|
||||
pBuffer++;
|
||||
|
||||
if (*pBuffer == '\"') // string ?
|
||||
{
|
||||
pBuffer++;
|
||||
bStringMode = true;
|
||||
}
|
||||
|
||||
strParam = "";
|
||||
|
||||
if (bStringMode)
|
||||
{
|
||||
while (*pBuffer != NULL && *pBuffer != '\"')
|
||||
strParam += *pBuffer++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*pBuffer != NULL && *pBuffer != ' ' && *pBuffer != ')' && *pBuffer != ',')
|
||||
strParam += *pBuffer++;
|
||||
}
|
||||
|
||||
if (*pBuffer != NULL) // skip last char
|
||||
pBuffer++;
|
||||
|
||||
if (strParam.GetLength() > 0)
|
||||
{
|
||||
if (strParam.GetAt(0) == '$') // ? variable name
|
||||
{
|
||||
float f = VariableValue(strParam);
|
||||
if (f != g_fDefault)
|
||||
strParam.Format("%f", f);
|
||||
}
|
||||
}
|
||||
|
||||
return strParam;
|
||||
}
|
||||
|
||||
brush_t* CopyBrush(brush_t* p)
|
||||
{
|
||||
brush_t* pCopy = Brush_Clone(p);
|
||||
//Brush_AddToList (pCopy, &active_brushes);
|
||||
//Entity_LinkBrush (world_entity, pCopy);
|
||||
Brush_Build(pCopy, false);
|
||||
return pCopy;
|
||||
}
|
||||
|
||||
|
||||
void CopySelected(char*& pBuffer)
|
||||
{
|
||||
// expects one param
|
||||
CString strParam = GetParam(pBuffer);
|
||||
int n = atoi(strParam);
|
||||
|
||||
brush_t* pCopy = NULL;
|
||||
if (selected_brushes.next != &selected_brushes &&
|
||||
selected_brushes.next->next == &selected_brushes)
|
||||
pCopy = selected_brushes.next;
|
||||
|
||||
if (pCopy)
|
||||
{
|
||||
if (n == 1)
|
||||
{
|
||||
//if (g_pHold1)
|
||||
//Brush_Free(g_pHold1);
|
||||
g_pHold1 = CopyBrush(pCopy);
|
||||
}
|
||||
else if (n == 2)
|
||||
{
|
||||
//if (g_pHold2)
|
||||
//Brush_Free(g_pHold2);
|
||||
g_pHold2 = CopyBrush(pCopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (g_pHold3)
|
||||
//Brush_Free(g_pHold3);
|
||||
g_pHold3 = CopyBrush(pCopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MoveSelected(char*& pBuffer)
|
||||
{
|
||||
vec3_t v;
|
||||
CString strParam = GetParam(pBuffer);
|
||||
v[0] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[1] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[2] = atof(strParam);
|
||||
Select_Move(v, false);
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
void RotateSelected(char*& pBuffer)
|
||||
{
|
||||
vec3_t v;
|
||||
|
||||
if (g_bRotateAroundSelection)
|
||||
{
|
||||
Select_GetTrueMid(v);
|
||||
VectorCopy(v, g_pParentWnd->ActiveXY()->RotateOrigin());
|
||||
}
|
||||
|
||||
CString strParam = GetParam(pBuffer);
|
||||
v[0] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[1] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[2] = atof(strParam);
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (v[i] != 0.0)
|
||||
Select_RotateAxis(i, v[i], false , true);
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
void MoveHold(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
brush_t* pBrush = NULL;
|
||||
int nHold = atoi(strParam);
|
||||
if (nHold == 1)
|
||||
pBrush = g_pHold1;
|
||||
else if (nHold == 2)
|
||||
pBrush = g_pHold2;
|
||||
else
|
||||
pBrush = g_pHold3;
|
||||
|
||||
if (pBrush)
|
||||
{
|
||||
vec3_t v;
|
||||
strParam = GetParam(pBuffer);
|
||||
v[0] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[1] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[2] = atof(strParam);
|
||||
Brush_Move (pBrush, v, false);
|
||||
}
|
||||
}
|
||||
|
||||
void RotateHold(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
brush_t* pBrush = NULL;
|
||||
int nHold = atoi(strParam);
|
||||
if (nHold == 1)
|
||||
pBrush = g_pHold1;
|
||||
else if (nHold == 2)
|
||||
pBrush = g_pHold2;
|
||||
else
|
||||
pBrush = g_pHold3;
|
||||
|
||||
if (pBrush)
|
||||
{
|
||||
vec3_t v;
|
||||
strParam = GetParam(pBuffer);
|
||||
v[0] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[1] = atof(strParam);
|
||||
strParam = GetParam(pBuffer);
|
||||
v[2] = atof(strParam);
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (v[i] != 0.0)
|
||||
Select_RotateAxis(i, v[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CopyToMap(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
brush_t* pBrush = NULL;
|
||||
int nHold = atoi(strParam);
|
||||
if (nHold == 1)
|
||||
pBrush = g_pHold1;
|
||||
else if (nHold == 2)
|
||||
pBrush = g_pHold2;
|
||||
else
|
||||
pBrush = g_pHold3;
|
||||
|
||||
if (pBrush)
|
||||
{
|
||||
Brush_AddToList(pBrush, &active_brushes);
|
||||
Entity_LinkBrush (world_entity, pBrush);
|
||||
Brush_Build(pBrush, false);
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
void CopyAndSelect(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
brush_t* pBrush = NULL;
|
||||
int nHold = atoi(strParam);
|
||||
if (nHold == 1)
|
||||
pBrush = g_pHold1;
|
||||
else if (nHold == 2)
|
||||
pBrush = g_pHold2;
|
||||
else
|
||||
pBrush = g_pHold3;
|
||||
|
||||
if (pBrush)
|
||||
{
|
||||
Select_Deselect();
|
||||
Brush_AddToList(pBrush, &active_brushes);
|
||||
Entity_LinkBrush (world_entity, pBrush);
|
||||
Brush_Build(pBrush, false);
|
||||
Select_Brush(pBrush);
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
void Input(char*& pBuffer)
|
||||
{
|
||||
CBSInput dlg;
|
||||
bool bGo = false;
|
||||
for (int n = 0; n < g_nVariableCount; n++)
|
||||
{
|
||||
if (g_Variables[n].m_strInput.GetLength() > 0)
|
||||
{
|
||||
bGo = true;
|
||||
if (n < 5)
|
||||
{
|
||||
switch (n)
|
||||
{
|
||||
case 0 : dlg.m_strField1 = g_Variables[n].m_strInput; break;
|
||||
case 1 : dlg.m_strField2 = g_Variables[n].m_strInput; break;
|
||||
case 2 : dlg.m_strField3 = g_Variables[n].m_strInput; break;
|
||||
case 3 : dlg.m_strField4 = g_Variables[n].m_strInput; break;
|
||||
case 4 : dlg.m_strField5 = g_Variables[n].m_strInput; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bGo)
|
||||
{
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
for (int n = 0; n < g_nVariableCount; n++)
|
||||
{
|
||||
if (g_Variables[n].m_strInput.GetLength() > 0)
|
||||
{
|
||||
if (n < 5)
|
||||
{
|
||||
switch (n)
|
||||
{
|
||||
case 0 : g_Variables[n].m_fValue = dlg.m_fField1; break;
|
||||
case 1 : g_Variables[n].m_fValue = dlg.m_fField2; break;
|
||||
case 2 : g_Variables[n].m_fValue = dlg.m_fField3; break;
|
||||
case 3 : g_Variables[n].m_fValue = dlg.m_fField4; break;
|
||||
case 4 : g_Variables[n].m_fValue = dlg.m_fField5; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else g_bKeepGoing = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool g_bWaiting;
|
||||
void _3DPointDone(bool b, int n)
|
||||
{
|
||||
g_bWaiting = false;
|
||||
}
|
||||
|
||||
void _3DPointInput(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
CString strParam2 = GetParam(pBuffer);
|
||||
ShowInfoDialog(strParam2);
|
||||
AddVectorVariable(strParam, strParam2);
|
||||
g_bWaiting = true;
|
||||
AcquirePath(2, &_3DPointDone);
|
||||
while (g_bWaiting)
|
||||
{
|
||||
MSG msg;
|
||||
if (::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
HideInfoDialog();
|
||||
SetVectorVariableValue(strParam, g_PathPoints[0]);
|
||||
}
|
||||
|
||||
void SetRotateOrigin(char*& pBuffer)
|
||||
{
|
||||
vec3_t v;
|
||||
CString strParam = GetParam(pBuffer);
|
||||
VectorVariableValue(strParam, v);
|
||||
VectorCopy(v, g_pParentWnd->ActiveXY()->RotateOrigin());
|
||||
g_bRotateAroundSelection = false;
|
||||
}
|
||||
|
||||
void InputVar(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
CString strParam2 = GetParam(pBuffer);
|
||||
AddVariable(strParam, 0.0, strParam2);
|
||||
}
|
||||
|
||||
void LoopCount(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
g_nLoopCounter = atoi(strParam);
|
||||
if (g_nLoopCounter == 0)
|
||||
g_nLoopCounter = VariableValue(strParam);
|
||||
if (g_nLoopCounter > 0)
|
||||
g_pLooper = pBuffer;
|
||||
}
|
||||
|
||||
void LoopRun(char*& pBuffer)
|
||||
{
|
||||
if (g_bStartLoop == true)
|
||||
{
|
||||
g_nLoopCounter--;
|
||||
if (g_nLoopCounter == 0)
|
||||
{
|
||||
g_bStartLoop = false;
|
||||
GetParam(pBuffer);
|
||||
}
|
||||
else
|
||||
pBuffer = g_pLooper;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_pLooper && g_nLoopCounter > 0)
|
||||
{
|
||||
g_bStartLoop = true;
|
||||
pBuffer = g_pLooper;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetParam(pBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConfirmMessage(char*& pBuffer)
|
||||
{
|
||||
CString strParam = GetParam(pBuffer);
|
||||
if (g_pParentWnd->MessageBox(strParam, "Script Info", MB_OKCANCEL) == IDCANCEL)
|
||||
g_bKeepGoing = false;
|
||||
}
|
||||
|
||||
void Spherize(char*& pBuffer)
|
||||
{
|
||||
g_bScreenUpdates = false;
|
||||
for (int n = 0; n < 120; n += 36)
|
||||
{
|
||||
for (int i = 0; i < 360; i += 36)
|
||||
{
|
||||
Select_RotateAxis(0, i, false , true);
|
||||
CSG_Subtract();
|
||||
}
|
||||
Select_RotateAxis(2, n, false , true);
|
||||
}
|
||||
g_bScreenUpdates = true;
|
||||
}
|
||||
|
||||
void RunIt(char*& pBuffer);
|
||||
SBrushScript g_ScriptCmds[] =
|
||||
{
|
||||
{"_CopySelected", &CopySelected},
|
||||
{"_MoveSelected", &MoveSelected},
|
||||
{"_RotateSelected", &RotateSelected},
|
||||
{"_MoveHold", &MoveHold},
|
||||
{"_RotateHold", &RotateHold},
|
||||
{"_CopyToMap", &CopyToMap},
|
||||
{"_CopyAndSelect", &CopyAndSelect},
|
||||
{"_Input", &Input},
|
||||
{"_3DPointInput", &_3DPointInput},
|
||||
{"_SetRotateOrigin", &SetRotateOrigin},
|
||||
{"_InputVar", &InputVar},
|
||||
{"_LoopCount", &LoopCount},
|
||||
{"_LoopRun", &LoopRun},
|
||||
{"_ConfirmMessage", &ConfirmMessage},
|
||||
{"_Spherize", &Spherize},
|
||||
{"_RunScript", RunIt}
|
||||
};
|
||||
|
||||
const int g_nScriptCmdCount = sizeof(g_ScriptCmds) / sizeof(SBrushScript);
|
||||
|
||||
void RunScript(char* pBuffer)
|
||||
{
|
||||
g_pHold1 = NULL;
|
||||
g_pHold2 = NULL;
|
||||
g_pHold3 = NULL;
|
||||
|
||||
while (g_bKeepGoing && pBuffer && *pBuffer)
|
||||
{
|
||||
while (*pBuffer != NULL && *pBuffer != '_')
|
||||
pBuffer++;
|
||||
|
||||
char* pTemp = pBuffer;
|
||||
int nLen = 0;
|
||||
while (*pTemp != NULL && *pTemp != '(')
|
||||
{
|
||||
pTemp++;
|
||||
nLen++;
|
||||
}
|
||||
if (*pBuffer != NULL)
|
||||
{
|
||||
bool bFound = false;
|
||||
for (int i = 0; i < g_nScriptCmdCount; i++)
|
||||
{
|
||||
//if (strnicmp(g_ScriptCmds[i].m_pName, pBuffer, strlen(g_ScriptCmds[i].m_pName)) == 0)
|
||||
if (strnicmp(g_ScriptCmds[i].m_pName, pBuffer, nLen) == 0)
|
||||
{
|
||||
pBuffer += strlen(g_ScriptCmds[i].m_pName);
|
||||
g_ScriptCmds[i].m_pProc(pBuffer);
|
||||
if (g_bStartLoop)
|
||||
{
|
||||
}
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFound)
|
||||
pBuffer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RunScriptByName(char* pBuffer, bool bInit)
|
||||
{
|
||||
if (bInit)
|
||||
InitForScriptRun();
|
||||
char* pScript = new char[4096];
|
||||
CString strINI = g_strAppPath;
|
||||
strINI += "\\scripts.ini";
|
||||
GetPrivateProfileSection(pBuffer, pScript, 16384, strINI);
|
||||
CString strScript;
|
||||
char* pWorkScript = pScript;
|
||||
while (*pWorkScript != NULL)
|
||||
{
|
||||
strScript += pWorkScript;
|
||||
pWorkScript += strlen(pWorkScript) + 1;
|
||||
}
|
||||
RunScript(strScript.GetBuffer(0));
|
||||
}
|
||||
|
||||
|
||||
void RunIt(char*& pBuffer)
|
||||
{
|
||||
brush_t* p1 = g_pHold1;
|
||||
brush_t* p2 = g_pHold2;
|
||||
brush_t* p3 = g_pHold3;
|
||||
|
||||
CString strParam = GetParam(pBuffer);
|
||||
RunScriptByName(strParam.GetBuffer(0), false);
|
||||
|
||||
g_pHold3 = p3;
|
||||
g_pHold2 = p2;
|
||||
g_pHold1 = p1;
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
// window system independent camera view code
|
||||
|
||||
typedef enum
|
||||
{
|
||||
cd_wire,
|
||||
cd_solid,
|
||||
cd_texture,
|
||||
cd_light,
|
||||
cd_blend
|
||||
} camera_draw_mode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int width, height;
|
||||
|
||||
qboolean timing;
|
||||
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
|
||||
camera_draw_mode draw_mode;
|
||||
|
||||
vec3_t color; // background
|
||||
|
||||
vec3_t forward, right, up; // move matrix
|
||||
|
||||
vec3_t vup, vpn, vright; // view matrix
|
||||
} camera_t;
|
||||
|
|
@ -1,686 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "qe3.h"
|
||||
#include "winding.h"
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
CSG_MakeHollow
|
||||
=============
|
||||
*/
|
||||
|
||||
void Brush_Scale(brush_t* b)
|
||||
{
|
||||
for (face_t* f = b->brush_faces ; f ; f=f->next)
|
||||
{
|
||||
for (int i=0 ; i<3 ; i++)
|
||||
{
|
||||
VectorScale (f->planepts[i], g_qeglobals.d_gridsize, f->planepts[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSG_MakeHollow (void)
|
||||
{
|
||||
brush_t *b, *front, *back, *next;
|
||||
face_t *f;
|
||||
face_t split;
|
||||
vec3_t move;
|
||||
int i;
|
||||
|
||||
for (b = selected_brushes.next ; b != &selected_brushes ; b=next)
|
||||
{
|
||||
next = b->next;
|
||||
|
||||
if (b->owner->eclass->fixedsize || b->patchBrush || b->terrainBrush || b->hiddenBrush)
|
||||
continue;
|
||||
|
||||
for (f = b->brush_faces ; f ; f=f->next)
|
||||
{
|
||||
split = *f;
|
||||
VectorScale (f->plane.normal, g_qeglobals.d_gridsize, move);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
VectorSubtract (split.planepts[i], move, split.planepts[i]);
|
||||
|
||||
Brush_SplitBrushByFace (b, &split, &front, &back);
|
||||
if (back)
|
||||
Brush_Free (back);
|
||||
if (front)
|
||||
Brush_AddToList (front, &selected_brushes);
|
||||
}
|
||||
Brush_Free (b);
|
||||
}
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Brush_Merge
|
||||
|
||||
Returns a new brush that is created by merging brush1 and brush2.
|
||||
May return NULL if brush1 and brush2 do not create a convex brush when merged.
|
||||
The input brushes brush1 and brush2 stay intact.
|
||||
|
||||
if onlyshape is true then the merge is allowed based on the shape only
|
||||
otherwise the texture/shader references of faces in the same plane have to
|
||||
be the same as well.
|
||||
=============
|
||||
*/
|
||||
brush_t *Brush_Merge(brush_t *brush1, brush_t *brush2, int onlyshape)
|
||||
{
|
||||
int i, shared;
|
||||
brush_t *newbrush;
|
||||
face_t *face1, *face2, *newface, *f;
|
||||
|
||||
// check for bounding box overlapp
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (brush1->mins[i] > brush2->maxs[i] + ON_EPSILON
|
||||
|| brush1->maxs[i] < brush2->mins[i] - ON_EPSILON)
|
||||
{
|
||||
// never merge if the brushes overlap
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
//
|
||||
shared = 0;
|
||||
// check if the new brush would be convex... flipped planes make a brush non-convex
|
||||
for (face1 = brush1->brush_faces; face1; face1 = face1->next)
|
||||
{
|
||||
// don't check the faces of brush 1 and 2 touching each other
|
||||
for (face2 = brush2->brush_faces; face2; face2 = face2->next)
|
||||
{
|
||||
if (Plane_Equal(&face1->plane, &face2->plane, true))
|
||||
{
|
||||
shared++;
|
||||
// there may only be ONE shared side
|
||||
if (shared > 1)
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if this face plane is shared
|
||||
if (face2) continue;
|
||||
//
|
||||
for (face2 = brush2->brush_faces; face2; face2 = face2->next)
|
||||
{
|
||||
// don't check the faces of brush 1 and 2 touching each other
|
||||
for (f = brush1->brush_faces; f; f = f->next)
|
||||
{
|
||||
if (Plane_Equal(&face2->plane, &f->plane, true)) break;
|
||||
}
|
||||
if (f)
|
||||
continue;
|
||||
//
|
||||
if (Plane_Equal(&face1->plane, &face2->plane, false))
|
||||
{
|
||||
//if the texture/shader references should be the same but are not
|
||||
if (!onlyshape && stricmp(face1->texdef.name, face2->texdef.name) != 0) return NULL;
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (Winding_PlanesConcave(face1->face_winding, face2->face_winding,
|
||||
face1->plane.normal, face2->plane.normal,
|
||||
face1->plane.dist, face2->plane.dist))
|
||||
{
|
||||
return NULL;
|
||||
} //end if
|
||||
} //end for
|
||||
} //end for
|
||||
//
|
||||
newbrush = Brush_Alloc();
|
||||
//
|
||||
for (face1 = brush1->brush_faces; face1; face1 = face1->next)
|
||||
{
|
||||
// don't add the faces of brush 1 and 2 touching each other
|
||||
for (face2 = brush2->brush_faces; face2; face2 = face2->next)
|
||||
{
|
||||
if (Plane_Equal(&face1->plane, &face2->plane, true))
|
||||
break;
|
||||
}
|
||||
if (face2)
|
||||
continue;
|
||||
// don't add faces with the same plane twice
|
||||
for (f = newbrush->brush_faces; f; f = f->next)
|
||||
{
|
||||
if (Plane_Equal(&face1->plane, &f->plane, false))
|
||||
break;
|
||||
if (Plane_Equal(&face1->plane, &f->plane, true))
|
||||
break;
|
||||
}
|
||||
if (f)
|
||||
continue;
|
||||
//
|
||||
newface = Face_Alloc();
|
||||
newface->texdef = face1->texdef;
|
||||
VectorCopy(face1->planepts[0], newface->planepts[0]);
|
||||
VectorCopy(face1->planepts[1], newface->planepts[1]);
|
||||
VectorCopy(face1->planepts[2], newface->planepts[2]);
|
||||
newface->plane = face1->plane;
|
||||
newface->next = newbrush->brush_faces;
|
||||
newbrush->brush_faces = newface;
|
||||
}
|
||||
//
|
||||
for (face2 = brush2->brush_faces; face2; face2 = face2->next)
|
||||
{
|
||||
// don't add the faces of brush 1 and 2 touching each other
|
||||
for (face1 = brush1->brush_faces; face1; face1 = face1->next)
|
||||
{
|
||||
if (Plane_Equal(&face2->plane, &face1->plane, true))
|
||||
break;
|
||||
}
|
||||
if (face1)
|
||||
continue;
|
||||
// don't add faces with the same plane twice
|
||||
for (f = newbrush->brush_faces; f; f = f->next)
|
||||
{
|
||||
if (Plane_Equal(&face2->plane, &f->plane, false))
|
||||
break;
|
||||
if (Plane_Equal(&face2->plane, &f->plane, true))
|
||||
break;
|
||||
}
|
||||
if (f)
|
||||
continue;
|
||||
//
|
||||
newface = Face_Alloc();
|
||||
newface->texdef = face2->texdef;
|
||||
VectorCopy(face2->planepts[0], newface->planepts[0]);
|
||||
VectorCopy(face2->planepts[1], newface->planepts[1]);
|
||||
VectorCopy(face2->planepts[2], newface->planepts[2]);
|
||||
newface->plane = face2->plane;
|
||||
newface->next = newbrush->brush_faces;
|
||||
newbrush->brush_faces = newface;
|
||||
}
|
||||
// link the new brush to an entity
|
||||
Entity_LinkBrush (brush1->owner, newbrush);
|
||||
// build windings for the faces
|
||||
Brush_BuildWindings( newbrush, false);
|
||||
return newbrush;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Brush_MergeListPairs
|
||||
|
||||
Returns a list with merged brushes.
|
||||
Tries to merge brushes pair wise.
|
||||
The input list is destroyed.
|
||||
Input and output should be a single linked list using .next
|
||||
=============
|
||||
*/
|
||||
brush_t *Brush_MergeListPairs(brush_t *brushlist, int onlyshape)
|
||||
{
|
||||
int nummerges, merged;
|
||||
brush_t *b1, *b2, *tail, *newbrush, *newbrushlist;
|
||||
brush_t *lastb2;
|
||||
|
||||
if (!brushlist) return NULL;
|
||||
|
||||
nummerges = 0;
|
||||
do
|
||||
{
|
||||
for (tail = brushlist; tail; tail = tail->next)
|
||||
{
|
||||
if (!tail->next) break;
|
||||
}
|
||||
merged = 0;
|
||||
newbrushlist = NULL;
|
||||
for (b1 = brushlist; b1; b1 = brushlist)
|
||||
{
|
||||
lastb2 = b1;
|
||||
for (b2 = b1->next; b2; b2 = b2->next)
|
||||
{
|
||||
newbrush = Brush_Merge(b1, b2, onlyshape);
|
||||
if (newbrush)
|
||||
{
|
||||
tail->next = newbrush;
|
||||
lastb2->next = b2->next;
|
||||
brushlist = brushlist->next;
|
||||
b1->next = b1->prev = NULL;
|
||||
b2->next = b2->prev = NULL;
|
||||
Brush_Free(b1);
|
||||
Brush_Free(b2);
|
||||
for (tail = brushlist; tail; tail = tail->next)
|
||||
{
|
||||
if (!tail->next) break;
|
||||
} //end for
|
||||
merged++;
|
||||
nummerges++;
|
||||
break;
|
||||
}
|
||||
lastb2 = b2;
|
||||
}
|
||||
//if b1 can't be merged with any of the other brushes
|
||||
if (!b2)
|
||||
{
|
||||
brushlist = brushlist->next;
|
||||
//keep b1
|
||||
b1->next = newbrushlist;
|
||||
newbrushlist = b1;
|
||||
}
|
||||
}
|
||||
brushlist = newbrushlist;
|
||||
} while(merged);
|
||||
return newbrushlist;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Brush_MergeList
|
||||
|
||||
Tries to merge all brushes in the list into one new brush.
|
||||
The input brush list stays intact.
|
||||
Returns NULL if no merged brush can be created.
|
||||
To create a new brush the brushes in the list may not overlap and
|
||||
the outer faces of the brushes together should make a new convex brush.
|
||||
|
||||
if onlyshape is true then the merge is allowed based on the shape only
|
||||
otherwise the texture/shader references of faces in the same plane have to
|
||||
be the same as well.
|
||||
=============
|
||||
*/
|
||||
brush_t *Brush_MergeList(brush_t *brushlist, int onlyshape)
|
||||
{
|
||||
brush_t *brush1, *brush2, *brush3, *newbrush;
|
||||
face_t *face1, *face2, *face3, *newface, *f;
|
||||
|
||||
if (!brushlist) return NULL;
|
||||
for (brush1 = brushlist; brush1; brush1 = brush1->next)
|
||||
{
|
||||
// check if the new brush would be convex... flipped planes make a brush concave
|
||||
for (face1 = brush1->brush_faces; face1; face1 = face1->next)
|
||||
{
|
||||
// don't check face1 if it touches another brush
|
||||
for (brush2 = brushlist; brush2; brush2 = brush2->next)
|
||||
{
|
||||
if (brush2 == brush1) continue;
|
||||
for (face2 = brush2->brush_faces; face2; face2 = face2->next)
|
||||
{
|
||||
if (Plane_Equal(&face1->plane, &face2->plane, true))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (face2) break;
|
||||
}
|
||||
// if face1 touches another brush
|
||||
if (brush2) continue;
|
||||
//
|
||||
for (brush2 = brush1->next; brush2; brush2 = brush2->next)
|
||||
{
|
||||
// don't check the faces of brush 2 touching another brush
|
||||
for (face2 = brush2->brush_faces; face2; face2 = face2->next)
|
||||
{
|
||||
for (brush3 = brushlist; brush3; brush3 = brush3->next)
|
||||
{
|
||||
if (brush3 == brush2) continue;
|
||||
for (face3 = brush3->brush_faces; face3; face3 = face3->next)
|
||||
{
|
||||
if (Plane_Equal(&face2->plane, &face3->plane, true)) break;
|
||||
}
|
||||
if (face3) break;
|
||||
}
|
||||
// if face2 touches another brush
|
||||
if (brush3) continue;
|
||||
//
|
||||
if (Plane_Equal(&face1->plane, &face2->plane, false))
|
||||
{
|
||||
//if the texture/shader references should be the same but are not
|
||||
if (!onlyshape && stricmp(face1->texdef.name, face2->texdef.name) != 0) return NULL;
|
||||
continue;
|
||||
}
|
||||
//
|
||||
if (Winding_PlanesConcave(face1->face_winding, face2->face_winding,
|
||||
face1->plane.normal, face2->plane.normal,
|
||||
face1->plane.dist, face2->plane.dist))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
newbrush = Brush_Alloc();
|
||||
//
|
||||
for (brush1 = brushlist; brush1; brush1 = brush1->next)
|
||||
{
|
||||
for (face1 = brush1->brush_faces; face1; face1 = face1->next)
|
||||
{
|
||||
// don't add face1 to the new brush if it touches another brush
|
||||
for (brush2 = brushlist; brush2; brush2 = brush2->next)
|
||||
{
|
||||
if (brush2 == brush1) continue;
|
||||
for (face2 = brush2->brush_faces; face2; face2 = face2->next)
|
||||
{
|
||||
if (Plane_Equal(&face1->plane, &face2->plane, true))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (face2) break;
|
||||
}
|
||||
if (brush2) continue;
|
||||
// don't add faces with the same plane twice
|
||||
for (f = newbrush->brush_faces; f; f = f->next)
|
||||
{
|
||||
if (Plane_Equal(&face1->plane, &f->plane, false))
|
||||
break;
|
||||
if (Plane_Equal(&face1->plane, &f->plane, true))
|
||||
break;
|
||||
}
|
||||
if (f)
|
||||
continue;
|
||||
//
|
||||
newface = Face_Alloc();
|
||||
newface->texdef = face1->texdef;
|
||||
VectorCopy(face1->planepts[0], newface->planepts[0]);
|
||||
VectorCopy(face1->planepts[1], newface->planepts[1]);
|
||||
VectorCopy(face1->planepts[2], newface->planepts[2]);
|
||||
newface->plane = face1->plane;
|
||||
newface->next = newbrush->brush_faces;
|
||||
newbrush->brush_faces = newface;
|
||||
}
|
||||
}
|
||||
// link the new brush to an entity
|
||||
Entity_LinkBrush (brushlist->owner, newbrush);
|
||||
// build windings for the faces
|
||||
Brush_BuildWindings( newbrush, false);
|
||||
return newbrush;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Brush_Subtract
|
||||
|
||||
Returns a list of brushes that remain after B is subtracted from A.
|
||||
May by empty if A is contained inside B.
|
||||
The originals are undisturbed.
|
||||
=============
|
||||
*/
|
||||
brush_t *Brush_Subtract(brush_t *a, brush_t *b)
|
||||
{
|
||||
// a - b = out (list)
|
||||
brush_t *front, *back;
|
||||
brush_t *in, *out, *next;
|
||||
face_t *f;
|
||||
|
||||
in = a;
|
||||
out = NULL;
|
||||
for (f = b->brush_faces; f && in; f = f->next)
|
||||
{
|
||||
Brush_SplitBrushByFace(in, f, &front, &back);
|
||||
if (in != a) Brush_Free(in);
|
||||
if (front)
|
||||
{ // add to list
|
||||
front->next = out;
|
||||
out = front;
|
||||
}
|
||||
in = back;
|
||||
}
|
||||
//NOTE: in != a just in case brush b has no faces
|
||||
if (in && in != a)
|
||||
{
|
||||
Brush_Free(in);
|
||||
}
|
||||
else
|
||||
{ //didn't really intersect
|
||||
for (b = out; b; b = next)
|
||||
{
|
||||
next = b->next;
|
||||
b->next = b->prev = NULL;
|
||||
Brush_Free(b);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CSG_Subtract
|
||||
=============
|
||||
*/
|
||||
void CSG_Subtract (void)
|
||||
{
|
||||
brush_t *b, *s, *fragments, *nextfragment, *frag, *next, *snext;
|
||||
brush_t fragmentlist;
|
||||
int i, numfragments, numbrushes;
|
||||
|
||||
Sys_Printf ("Subtracting...\n");
|
||||
|
||||
if (selected_brushes.next == &selected_brushes)
|
||||
{
|
||||
Sys_Printf("No brushes selected.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fragmentlist.next = &fragmentlist;
|
||||
fragmentlist.prev = &fragmentlist;
|
||||
|
||||
numfragments = 0;
|
||||
numbrushes = 0;
|
||||
for (b = selected_brushes.next ; b != &selected_brushes ; b=next)
|
||||
{
|
||||
next = b->next;
|
||||
|
||||
if (b->owner->eclass->fixedsize)
|
||||
continue; // can't use texture from a fixed entity, so don't subtract
|
||||
|
||||
// chop all fragments further up
|
||||
for (s = fragmentlist.next; s != &fragmentlist; s = snext)
|
||||
{
|
||||
snext = s->next;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
if (b->mins[i] >= s->maxs[i] - ON_EPSILON
|
||||
|| b->maxs[i] <= s->mins[i] + ON_EPSILON)
|
||||
break;
|
||||
if (i != 3)
|
||||
continue; // definately don't touch
|
||||
fragments = Brush_Subtract(s, b);
|
||||
// if the brushes did not really intersect
|
||||
if (fragments == s)
|
||||
continue;
|
||||
// try to merge fragments
|
||||
fragments = Brush_MergeListPairs(fragments, true);
|
||||
// add the fragments to the list
|
||||
for (frag = fragments; frag; frag = nextfragment)
|
||||
{
|
||||
nextfragment = frag->next;
|
||||
frag->next = NULL;
|
||||
frag->owner = s->owner;
|
||||
Brush_AddToList(frag, &fragmentlist);
|
||||
}
|
||||
// free the original brush
|
||||
Brush_Free(s);
|
||||
}
|
||||
|
||||
// chop any active brushes up
|
||||
for (s = active_brushes.next; s != &active_brushes; s = snext)
|
||||
{
|
||||
snext = s->next;
|
||||
|
||||
if (s->owner->eclass->fixedsize || s->patchBrush || s->terrainBrush || s->hiddenBrush)
|
||||
continue;
|
||||
|
||||
//face_t *pFace = s->brush_faces;
|
||||
if (s->brush_faces->d_texture->bFromShader && (s->brush_faces->d_texture->nShaderFlags & QER_NOCARVE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
if (b->mins[i] >= s->maxs[i] - ON_EPSILON
|
||||
|| b->maxs[i] <= s->mins[i] + ON_EPSILON)
|
||||
break;
|
||||
if (i != 3)
|
||||
continue; // definately don't touch
|
||||
|
||||
fragments = Brush_Subtract(s, b);
|
||||
// if the brushes did not really intersect
|
||||
if (fragments == s)
|
||||
continue;
|
||||
//
|
||||
Undo_AddBrush(s);
|
||||
// one extra brush chopped up
|
||||
numbrushes++;
|
||||
// try to merge fragments
|
||||
fragments = Brush_MergeListPairs(fragments, true);
|
||||
// add the fragments to the list
|
||||
for (frag = fragments; frag; frag = nextfragment)
|
||||
{
|
||||
nextfragment = frag->next;
|
||||
frag->next = NULL;
|
||||
frag->owner = s->owner;
|
||||
Brush_AddToList(frag, &fragmentlist);
|
||||
}
|
||||
// free the original brush
|
||||
Brush_Free(s);
|
||||
}
|
||||
}
|
||||
|
||||
// move all fragments to the active brush list
|
||||
for (frag = fragmentlist.next; frag != &fragmentlist; frag = nextfragment)
|
||||
{
|
||||
nextfragment = frag->next;
|
||||
numfragments++;
|
||||
Brush_RemoveFromList(frag);
|
||||
Brush_AddToList(frag, &active_brushes);
|
||||
Undo_EndBrush(frag);
|
||||
}
|
||||
|
||||
if (numfragments == 0)
|
||||
{
|
||||
Sys_Printf("Selected brush%s did not intersect with any other brushes.\n",
|
||||
(selected_brushes.next->next == &selected_brushes) ? "":"es");
|
||||
return;
|
||||
}
|
||||
Sys_Printf("done. (created %d fragment%s out of %d brush%s)\n", numfragments, (numfragments == 1)?"":"s",
|
||||
numbrushes, (numbrushes == 1)?"":"es");
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CSG_Merge
|
||||
=============
|
||||
*/
|
||||
void CSG_Merge(void)
|
||||
{
|
||||
brush_t *b, *next, *newlist, *newbrush;
|
||||
struct entity_s *owner;
|
||||
|
||||
Sys_Printf ("Merging...\n");
|
||||
|
||||
if (selected_brushes.next == &selected_brushes)
|
||||
{
|
||||
Sys_Printf("No brushes selected.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (selected_brushes.next->next == &selected_brushes)
|
||||
{
|
||||
Sys_Printf("At least two brushes have to be selected.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
owner = selected_brushes.next->owner;
|
||||
|
||||
for (b = selected_brushes.next; b != &selected_brushes; b = next)
|
||||
{
|
||||
next = b->next;
|
||||
|
||||
if (b->owner->eclass->fixedsize)
|
||||
{
|
||||
// can't use texture from a fixed entity, so don't subtract
|
||||
Sys_Printf("Cannot add fixed size entities.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (b->patchBrush)
|
||||
{
|
||||
Sys_Printf("Cannot add patches.\n");
|
||||
return;
|
||||
}
|
||||
if (b->terrainBrush)
|
||||
{
|
||||
Sys_Printf("Cannot add terrains.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (b->brush_faces->d_texture->bFromShader && (b->brush_faces->d_texture->nShaderFlags & QER_NOCARVE))
|
||||
{
|
||||
Sys_Printf("Cannot add brushes using shaders that don't allows CSG operations.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (b->owner != owner)
|
||||
{
|
||||
Sys_Printf("Cannot add brushes from different entities.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
newlist = NULL;
|
||||
for (b = selected_brushes.next; b != &selected_brushes; b = next)
|
||||
{
|
||||
next = b->next;
|
||||
|
||||
Brush_RemoveFromList(b);
|
||||
b->next = newlist;
|
||||
b->prev = NULL;
|
||||
newlist = b;
|
||||
}
|
||||
|
||||
newbrush = Brush_MergeList(newlist, true);
|
||||
// if the new brush would not be convex
|
||||
if (!newbrush)
|
||||
{
|
||||
// add the brushes back into the selection
|
||||
for (b = newlist; b; b = next)
|
||||
{
|
||||
next = b->next;
|
||||
b->next = NULL;
|
||||
b->prev = NULL;
|
||||
Brush_AddToList(b, &selected_brushes);
|
||||
}
|
||||
Sys_Printf("Cannot add a set of brushes with a concave hull.\n");
|
||||
return;
|
||||
}
|
||||
// free the original brushes
|
||||
for (b = newlist; b; b = next)
|
||||
{
|
||||
next = b->next;
|
||||
b->next = NULL;
|
||||
b->prev = NULL;
|
||||
Brush_Free(b);
|
||||
}
|
||||
Brush_AddToList(newbrush, &selected_brushes);
|
||||
|
||||
Sys_Printf ("done.\n");
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
1165
q3radiant/CamWnd.cpp
1165
q3radiant/CamWnd.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_CAMWND_H__44B4BA03_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_CAMWND_H__44B4BA03_781B_11D1_B53C_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// CamWnd.h : header file
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCamWnd window
|
||||
class CXYWnd;
|
||||
|
||||
class CCamWnd : public CWnd
|
||||
{
|
||||
DECLARE_DYNCREATE(CCamWnd);
|
||||
// Construction
|
||||
public:
|
||||
CCamWnd();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CCamWnd)
|
||||
protected:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
void ShiftTexture_BrushPrimit(face_t *f, int x, int y);
|
||||
void ReInitGL();
|
||||
void BenchMark();
|
||||
CXYWnd* m_pXYFriend;
|
||||
void SetXYFriend(CXYWnd* pWnd);
|
||||
virtual ~CCamWnd();
|
||||
camera_t& Camera(){return m_Camera;};
|
||||
void Cam_MouseControl(float dtime);
|
||||
void Cam_ChangeFloor(qboolean up);
|
||||
|
||||
protected:
|
||||
void Cam_Init();
|
||||
void Cam_BuildMatrix();
|
||||
void Cam_PositionDrag();
|
||||
void Cam_MouseDown(int x, int y, int buttons);
|
||||
void Cam_MouseUp (int x, int y, int buttons);
|
||||
void Cam_MouseMoved (int x, int y, int buttons);
|
||||
void InitCull();
|
||||
qboolean CullBrush (brush_t *b);
|
||||
void Cam_Draw();
|
||||
|
||||
|
||||
brush_t* m_TransBrushes[MAX_MAP_BRUSHES];
|
||||
int m_nNumTransBrushes;
|
||||
camera_t m_Camera;
|
||||
int m_nCambuttonstate;
|
||||
CPoint m_ptButton;
|
||||
CPoint m_ptCursor;
|
||||
CPoint m_ptLastCursor;
|
||||
face_t* m_pSide_select;
|
||||
vec3_t m_vCull1;
|
||||
vec3_t m_vCull2;
|
||||
int m_nCullv1[3];
|
||||
int m_nCullv2[3];
|
||||
bool m_bClipMode;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
void OriginalMouseDown(UINT nFlags, CPoint point);
|
||||
void OriginalMouseUp(UINT nFlags, CPoint point);
|
||||
//{{AFX_MSG(CCamWnd)
|
||||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CAMWND_H__44B4BA03_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// CapDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "CapDialog.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCapDialog dialog
|
||||
|
||||
|
||||
CCapDialog::CCapDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CCapDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CCapDialog)
|
||||
m_nCap = 0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CCapDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CCapDialog)
|
||||
DDX_Radio(pDX, IDC_RADIO_CAP, m_nCap);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CCapDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CCapDialog)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCapDialog message handlers
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_CAPDIALOG_H__10637162_2BD2_11D2_B030_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_CAPDIALOG_H__10637162_2BD2_11D2_B030_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// CapDialog.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCapDialog dialog
|
||||
|
||||
class CCapDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
static enum {BEVEL = 0, ENDCAP, IBEVEL, IENDCAP};
|
||||
CCapDialog(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
int getCapType() {return m_nCap;};
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CCapDialog)
|
||||
enum { IDD = IDD_DIALOG_CAP };
|
||||
int m_nCap;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CCapDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CCapDialog)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CAPDIALOG_H__10637162_2BD2_11D2_B030_00AA00A410FC__INCLUDED_)
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __CHARBUFFER_HPP
|
||||
#define __CHARBUFFER_HPP
|
||||
|
||||
class CCharBuffer
|
||||
{
|
||||
char* m_pCharBuffer;
|
||||
unsigned m_uSize;
|
||||
|
||||
public:
|
||||
CCharBuffer();
|
||||
|
||||
CCharBuffer(unsigned uSize);
|
||||
|
||||
CCharBuffer(const char* pString);
|
||||
|
||||
CCharBuffer(const CCharBuffer& rhs);
|
||||
|
||||
~CCharBuffer();
|
||||
|
||||
char* Allocate(uint uSize);
|
||||
|
||||
void DeAllocate();
|
||||
|
||||
size_t StringLength()
|
||||
{ return strlen(m_pCharBuffer); }
|
||||
|
||||
void StripTrailing(char c, int nLen);
|
||||
|
||||
char& operator *()
|
||||
{ return *m_pCharBuffer; }
|
||||
|
||||
char& operator *() const
|
||||
{ return *const_cast<CCharBuffer*>(this)->m_pCharBuffer; }
|
||||
|
||||
operator void*()
|
||||
{ return m_pCharBuffer; }
|
||||
|
||||
operator char*()
|
||||
{ return m_pCharBuffer; }
|
||||
|
||||
operator const char*()
|
||||
{ return reinterpret_cast<const char*>(m_pCharBuffer); }
|
||||
|
||||
operator unsigned char*()
|
||||
{ return reinterpret_cast<unsigned char*>(m_pCharBuffer); }
|
||||
|
||||
operator const unsigned char*()
|
||||
{ return reinterpret_cast<const unsigned char*>(m_pCharBuffer); }
|
||||
|
||||
unsigned SizeOf()
|
||||
{ return m_uSize; }
|
||||
|
||||
CCharBuffer& operator =(const CCharBuffer& rhs);
|
||||
|
||||
CCharBuffer& operator =(const char* pString);
|
||||
|
||||
bool operator ==(const CCharBuffer& rhs) const
|
||||
{ return strcmp(m_pCharBuffer, rhs.m_pCharBuffer) == 0; }
|
||||
|
||||
bool operator ==(char* pString) const
|
||||
{ return strcmp(m_pCharBuffer, pString) == 0; }
|
||||
|
||||
bool operator ==(const char* pString) const
|
||||
{ return strcmp(m_pCharBuffer, pString) == 0; }
|
||||
|
||||
bool operator !=(CCharBuffer& rhs) const
|
||||
{ return strcmp(m_pCharBuffer, rhs.m_pCharBuffer) != 0; }
|
||||
|
||||
bool operator !=(char* pString) const
|
||||
{ return strcmp(m_pCharBuffer, pString) != 0; }
|
||||
|
||||
bool operator !=(const char* pString) const
|
||||
{ return strcmp(m_pCharBuffer, pString) != 0; }
|
||||
|
||||
char& operator [](int nIndex)
|
||||
{ return m_pCharBuffer[nIndex]; }
|
||||
|
||||
char& operator [](int nIndex) const
|
||||
{ return m_pCharBuffer[nIndex]; }
|
||||
|
||||
char* Fill(char FillChar)
|
||||
{ memset(m_pCharBuffer, FillChar, m_uSize-1); return m_pCharBuffer; }
|
||||
};
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#endif // __CCHARBUFFER_HPP
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// ChildFrm.cpp : implementation of the CChildFrame class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
|
||||
#include "ChildFrm.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame
|
||||
|
||||
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
|
||||
//{{AFX_MSG_MAP(CChildFrame)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame construction/destruction
|
||||
|
||||
CChildFrame::CChildFrame()
|
||||
{
|
||||
// TODO: add member initialization code here
|
||||
|
||||
}
|
||||
|
||||
CChildFrame::~CChildFrame()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
|
||||
return CMDIChildWnd::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CChildFrame::AssertValid() const
|
||||
{
|
||||
CMDIChildWnd::AssertValid();
|
||||
}
|
||||
|
||||
void CChildFrame::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CMDIChildWnd::Dump(dc);
|
||||
}
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CChildFrame message handlers
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// ChildFrm.h : interface of the CChildFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_CHILDFRM_H__330BBF0C_731C_11D1_B539_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_CHILDFRM_H__330BBF0C_731C_11D1_B539_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
class CChildFrame : public CMDIChildWnd
|
||||
{
|
||||
DECLARE_DYNCREATE(CChildFrame)
|
||||
public:
|
||||
CChildFrame();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CChildFrame)
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CChildFrame();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CChildFrame)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CHILDFRM_H__330BBF0C_731C_11D1_B539_00AA00A410FC__INCLUDED_)
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// CommandsDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "CommandsDlg.h"
|
||||
#include "MainFrm.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCommandsDlg dialog
|
||||
|
||||
|
||||
CCommandsDlg::CCommandsDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CCommandsDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CCommandsDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CCommandsDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CCommandsDlg)
|
||||
DDX_Control(pDX, IDC_LIST_COMMANDS, m_lstCommands);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CCommandsDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CCommandsDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCommandsDlg message handlers
|
||||
|
||||
BOOL CCommandsDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
m_lstCommands.SetTabStops(96);
|
||||
int nCount = g_nCommandCount;
|
||||
|
||||
CFile fileout;
|
||||
fileout.Open("c:/commandlist.txt", CFile::modeCreate | CFile::modeWrite);
|
||||
for (int n = 0; n < nCount; n++)
|
||||
{
|
||||
CString strLine;
|
||||
char c = g_Commands[n].m_nKey;
|
||||
CString strKeys = c;
|
||||
for (int k = 0; k < g_nKeyCount; k++)
|
||||
{
|
||||
if (g_Keys[k].m_nVKKey == g_Commands[n].m_nKey)
|
||||
{
|
||||
strKeys = g_Keys[k].m_strName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CString strMod("");
|
||||
if (g_Commands[n].m_nModifiers & RAD_SHIFT)
|
||||
strMod = "Shift";
|
||||
if (g_Commands[n].m_nModifiers & RAD_ALT)
|
||||
strMod += (strMod.GetLength() > 0) ? " + Alt" : "Alt";
|
||||
if (g_Commands[n].m_nModifiers & RAD_CONTROL)
|
||||
strMod += (strMod.GetLength() > 0) ? " + Control" : "Control";
|
||||
if (strMod.GetLength() > 0)
|
||||
{
|
||||
strMod += " + ";
|
||||
}
|
||||
strLine.Format("%s \t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
|
||||
m_lstCommands.AddString(strLine);
|
||||
|
||||
strLine.Format("%s \t\t\t%s%s", g_Commands[n].m_strCommand, strMod, strKeys);
|
||||
|
||||
fileout.Write(strLine, strLine.GetLength());
|
||||
fileout.Write("\r\n", 2);
|
||||
}
|
||||
fileout.Close();
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_COMMANDSDLG_H__C80F6E42_8531_11D1_B548_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_COMMANDSDLG_H__C80F6E42_8531_11D1_B548_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// CommandsDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCommandsDlg dialog
|
||||
|
||||
class CCommandsDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CCommandsDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CCommandsDlg)
|
||||
enum { IDD = IDD_DLG_COMMANDLIST };
|
||||
CListBox m_lstCommands;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CCommandsDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CCommandsDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_COMMANDSDLG_H__C80F6E42_8531_11D1_B548_00AA00A410FC__INCLUDED_)
|
|
@ -1,828 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "qe3.h"
|
||||
|
||||
/*
|
||||
|
||||
drag either multiple brushes, or select plane points from
|
||||
a single brush.
|
||||
|
||||
*/
|
||||
|
||||
qboolean drag_ok;
|
||||
vec3_t drag_xvec;
|
||||
vec3_t drag_yvec;
|
||||
|
||||
static int buttonstate;
|
||||
int pressx, pressy;
|
||||
static vec3_t pressdelta;
|
||||
static vec3_t vPressStart;
|
||||
static int buttonx, buttony;
|
||||
|
||||
|
||||
//int num_move_points;
|
||||
//float *move_points[1024];
|
||||
|
||||
int lastx, lasty;
|
||||
|
||||
qboolean drag_first;
|
||||
|
||||
|
||||
void AxializeVector (vec3_t v)
|
||||
{
|
||||
vec3_t a;
|
||||
float o;
|
||||
int i;
|
||||
|
||||
if (!v[0] && !v[1])
|
||||
return;
|
||||
if (!v[1] && !v[2])
|
||||
return;
|
||||
if (!v[0] && !v[2])
|
||||
return;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
a[i] = fabs(v[i]);
|
||||
if (a[0] > a[1] && a[0] > a[2])
|
||||
i = 0;
|
||||
else if (a[1] > a[0] && a[1] > a[2])
|
||||
i = 1;
|
||||
else
|
||||
i = 2;
|
||||
|
||||
o = v[i];
|
||||
VectorCopy (vec3_origin, v);
|
||||
if (o<0)
|
||||
v[i] = -1;
|
||||
else
|
||||
v[i] = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
Drag_Setup
|
||||
===========
|
||||
*/
|
||||
void Drag_Setup (int x, int y, int buttons,
|
||||
vec3_t xaxis, vec3_t yaxis,
|
||||
vec3_t origin, vec3_t dir)
|
||||
{
|
||||
trace_t t;
|
||||
face_t *f;
|
||||
|
||||
drag_first = true;
|
||||
|
||||
VectorCopy (vec3_origin, pressdelta);
|
||||
pressx = x;
|
||||
pressy = y;
|
||||
|
||||
VectorCopy (xaxis, drag_xvec);
|
||||
AxializeVector (drag_xvec);
|
||||
VectorCopy (yaxis, drag_yvec);
|
||||
AxializeVector (drag_yvec);
|
||||
|
||||
if (g_qeglobals.d_select_mode == sel_addpoint) {
|
||||
if (g_qeglobals.selectObject) {
|
||||
g_qeglobals.selectObject->addPoint(origin[0], origin[1], origin[2]);
|
||||
} else {
|
||||
clearSelection();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_qeglobals.d_select_mode == sel_editpoint) {
|
||||
|
||||
if (g_qeglobals.selectObject) {
|
||||
if (g_qeglobals.selectObject->selectPointByRay(origin[0], origin[1], origin[2], dir[0], dir[1], dir[2], !(buttons == MK_SHIFT)) >= 0) {
|
||||
drag_ok = true;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
clearSelection();
|
||||
}
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
Undo_Start("drag object point");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extern void SelectCurvePointByRay (vec3_t org, vec3_t dir, int buttons);
|
||||
if (g_qeglobals.d_select_mode == sel_curvepoint)
|
||||
{
|
||||
//if ((buttons == MK_LBUTTON))
|
||||
// g_qeglobals.d_num_move_points = 0;
|
||||
|
||||
SelectCurvePointByRay (origin, dir, buttons);
|
||||
|
||||
if (g_qeglobals.d_num_move_points || g_qeglobals.d_select_mode == sel_area)
|
||||
{
|
||||
drag_ok = true;
|
||||
}
|
||||
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
|
||||
Undo_Start("drag curve point");
|
||||
Undo_AddBrushList(&selected_brushes);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (g_qeglobals.d_select_mode == sel_terrainpoint)
|
||||
{
|
||||
Terrain_SelectPointByRay( origin, dir, buttons );
|
||||
|
||||
if (g_qeglobals.d_numterrapoints || g_qeglobals.d_select_mode == sel_area)
|
||||
{
|
||||
drag_ok = true;
|
||||
}
|
||||
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
|
||||
Undo_Start("drag terrain point");
|
||||
Undo_AddBrushList(&selected_brushes);
|
||||
return;
|
||||
}
|
||||
else if (g_qeglobals.d_select_mode == sel_terraintexture)
|
||||
{
|
||||
Terrain_SelectPointByRay( origin, dir, buttons );
|
||||
|
||||
if (g_qeglobals.d_numterrapoints || g_qeglobals.d_select_mode == sel_area)
|
||||
{
|
||||
drag_ok = true;
|
||||
}
|
||||
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
|
||||
Undo_Start("drag terrain point");
|
||||
Undo_AddBrushList(&selected_brushes);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_qeglobals.d_num_move_points = 0;
|
||||
}
|
||||
|
||||
if (selected_brushes.next == &selected_brushes)
|
||||
{
|
||||
//in this case a new brush is created when the dragging
|
||||
//takes place in the XYWnd, An useless undo is created
|
||||
//when the dragging takes place in the CamWnd
|
||||
Undo_Start("create brush");
|
||||
|
||||
Sys_Status("No selection to drag\n", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (g_qeglobals.d_select_mode == sel_vertex)
|
||||
{
|
||||
SelectVertexByRay (origin, dir);
|
||||
if (g_qeglobals.d_num_move_points)
|
||||
{
|
||||
drag_ok = true;
|
||||
Undo_Start("drag vertex");
|
||||
Undo_AddBrushList(&selected_brushes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_qeglobals.d_select_mode == sel_edge)
|
||||
{
|
||||
SelectEdgeByRay (origin, dir);
|
||||
if (g_qeglobals.d_num_move_points)
|
||||
{
|
||||
drag_ok = true;
|
||||
Undo_Start("drag edge");
|
||||
Undo_AddBrushList(&selected_brushes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// check for direct hit first
|
||||
//
|
||||
t = Test_Ray (origin, dir, true);
|
||||
if (t.selected)
|
||||
{
|
||||
drag_ok = true;
|
||||
|
||||
Undo_Start("drag selection");
|
||||
Undo_AddBrushList(&selected_brushes);
|
||||
|
||||
if (buttons == (MK_LBUTTON|MK_CONTROL) )
|
||||
{
|
||||
Sys_Printf ("Shear dragging face\n");
|
||||
Brush_SelectFaceForDragging (t.brush, t.face, true);
|
||||
}
|
||||
else if (buttons == (MK_LBUTTON|MK_CONTROL|MK_SHIFT) )
|
||||
{
|
||||
Sys_Printf ("Sticky dragging brush\n");
|
||||
for (f=t.brush->brush_faces ; f ; f=f->next)
|
||||
Brush_SelectFaceForDragging (t.brush, f, false);
|
||||
}
|
||||
else
|
||||
Sys_Printf ("Dragging entire selection\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_qeglobals.d_select_mode == sel_vertex || g_qeglobals.d_select_mode == sel_edge)
|
||||
return;
|
||||
|
||||
//
|
||||
// check for side hit
|
||||
//
|
||||
// multiple brushes selected?
|
||||
if (selected_brushes.next->next != &selected_brushes)
|
||||
{
|
||||
// yes, special handling
|
||||
bool bOK = (g_PrefsDlg.m_bALTEdge) ? (static_cast<bool>(::GetAsyncKeyState(VK_MENU))) : true;
|
||||
if (bOK)
|
||||
{
|
||||
for (brush_t* pBrush = selected_brushes.next ; pBrush != &selected_brushes ; pBrush = pBrush->next)
|
||||
{
|
||||
if (buttons & MK_CONTROL)
|
||||
Brush_SideSelect (pBrush, origin, dir, true);
|
||||
else
|
||||
Brush_SideSelect (pBrush, origin, dir, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Printf ("press ALT to drag multiple edges\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// single select.. trying to drag fixed entities handle themselves and just move
|
||||
if (buttons & MK_CONTROL)
|
||||
Brush_SideSelect (selected_brushes.next, origin, dir, true);
|
||||
else
|
||||
Brush_SideSelect (selected_brushes.next, origin, dir, false);
|
||||
}
|
||||
|
||||
Sys_Printf ("Side stretch\n");
|
||||
drag_ok = true;
|
||||
|
||||
Undo_Start("side stretch");
|
||||
Undo_AddBrushList(&selected_brushes);
|
||||
}
|
||||
|
||||
entity_t *peLink;
|
||||
|
||||
void UpdateTarget(vec3_t origin, vec3_t dir)
|
||||
{
|
||||
trace_t t;
|
||||
entity_t *pe;
|
||||
int i;
|
||||
char sz[128];
|
||||
|
||||
t = Test_Ray (origin, dir, 0);
|
||||
|
||||
if (!t.brush)
|
||||
return;
|
||||
|
||||
pe = t.brush->owner;
|
||||
|
||||
if (pe == NULL)
|
||||
return;
|
||||
|
||||
// is this the first?
|
||||
if (peLink != NULL)
|
||||
{
|
||||
|
||||
// Get the target id from out current target
|
||||
// if there is no id, make one
|
||||
|
||||
i = IntForKey(pe, "target");
|
||||
if (i <= 0)
|
||||
{
|
||||
i = GetUniqueTargetId(1);
|
||||
sprintf(sz, "%d", i);
|
||||
|
||||
SetKeyValue(pe, "target", sz);
|
||||
}
|
||||
|
||||
// set the target # into our src
|
||||
|
||||
sprintf(sz, "%d", i);
|
||||
SetKeyValue(peLink, "targetname", sz);
|
||||
|
||||
Sys_UpdateWindows(W_ENTITY);
|
||||
|
||||
}
|
||||
|
||||
// promote the target to the src
|
||||
|
||||
peLink = pe;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Drag_Begin
|
||||
//++timo test three button mouse and three button emulation here ?
|
||||
===========
|
||||
*/
|
||||
void Drag_Begin (int x, int y, int buttons,
|
||||
vec3_t xaxis, vec3_t yaxis,
|
||||
vec3_t origin, vec3_t dir)
|
||||
{
|
||||
trace_t t;
|
||||
bool altdown;
|
||||
|
||||
drag_ok = false;
|
||||
VectorCopy (vec3_origin, pressdelta);
|
||||
VectorCopy (vec3_origin, vPressStart);
|
||||
drag_first = true;
|
||||
peLink = NULL;
|
||||
|
||||
altdown = static_cast<bool>(::GetAsyncKeyState(VK_MENU));
|
||||
|
||||
// shift-LBUTTON = select entire brush
|
||||
if (buttons == (MK_LBUTTON | MK_SHIFT) && g_qeglobals.d_select_mode != sel_curvepoint &&
|
||||
g_qeglobals.d_select_mode != sel_terrainpoint && g_qeglobals.d_select_mode != sel_terraintexture)
|
||||
{
|
||||
int nFlag = altdown ? SF_CYCLE : 0;
|
||||
if (dir[0] == 0 || dir[1] == 0 || dir[2] == 0) // extremely low chance of this happening from camera
|
||||
Select_Ray (origin, dir, nFlag | SF_ENTITIES_FIRST); // hack for XY
|
||||
else
|
||||
Select_Ray (origin, dir, nFlag);
|
||||
return;
|
||||
}
|
||||
|
||||
// ctrl-alt-LBUTTON = multiple brush select without selecting whole entities
|
||||
if (buttons == (MK_LBUTTON | MK_CONTROL) && altdown && g_qeglobals.d_select_mode != sel_curvepoint &&
|
||||
g_qeglobals.d_select_mode != sel_terrainpoint && g_qeglobals.d_select_mode != sel_terraintexture)
|
||||
{
|
||||
if (dir[0] == 0 || dir[1] == 0 || dir[2] == 0) // extremely low chance of this happening from camera
|
||||
Select_Ray (origin, dir, SF_ENTITIES_FIRST); // hack for XY
|
||||
else
|
||||
Select_Ray (origin, dir, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// ctrl-shift-LBUTTON = select single face
|
||||
if (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT) && g_qeglobals.d_select_mode != sel_curvepoint &&
|
||||
g_qeglobals.d_select_mode != sel_terrainpoint && g_qeglobals.d_select_mode != sel_terraintexture)
|
||||
{
|
||||
Select_Deselect (!static_cast<bool>(::GetAsyncKeyState(VK_MENU)));
|
||||
Select_Ray (origin, dir, SF_SINGLEFACE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// LBUTTON + all other modifiers = manipulate selection
|
||||
if (buttons & MK_LBUTTON)
|
||||
{
|
||||
//
|
||||
Drag_Setup (x, y, buttons, xaxis, yaxis, origin, dir);
|
||||
return;
|
||||
}
|
||||
|
||||
int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
|
||||
// middle button = grab texture
|
||||
if (buttons == nMouseButton)
|
||||
{
|
||||
t = Test_Ray (origin, dir, false);
|
||||
if (t.face)
|
||||
{
|
||||
g_qeglobals.d_new_brush_bottom_z = t.brush->mins[2];
|
||||
g_qeglobals.d_new_brush_top_z = t.brush->maxs[2];
|
||||
// use a local brushprimit_texdef fitted to a default 2x2 texture
|
||||
brushprimit_texdef_t bp_local;
|
||||
ConvertTexMatWithQTexture( &t.face->brushprimit_texdef, t.face->d_texture, &bp_local, NULL );
|
||||
Texture_SetTexture ( &t.face->texdef, &bp_local, false, GETPLUGINTEXDEF(t.face));
|
||||
UpdateSurfaceDialog();
|
||||
UpdatePatchInspector();
|
||||
}
|
||||
else
|
||||
Sys_Printf ("Did not select a texture\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// ctrl-middle button = set entire brush to texture
|
||||
if (buttons == (nMouseButton|MK_CONTROL) )
|
||||
{
|
||||
t = Test_Ray (origin, dir, false);
|
||||
if (t.brush)
|
||||
{
|
||||
if (t.brush->brush_faces->texdef.name[0] == '(')
|
||||
Sys_Printf ("Can't change an entity texture\n");
|
||||
else
|
||||
{
|
||||
Brush_SetTexture (t.brush, &g_qeglobals.d_texturewin.texdef, &g_qeglobals.d_texturewin.brushprimit_texdef, false, static_cast<IPluginTexdef *>( g_qeglobals.d_texturewin.pTexdef ) );
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
}
|
||||
else
|
||||
Sys_Printf ("Didn't hit a btrush\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// ctrl-shift-middle button = set single face to texture
|
||||
if (buttons == (nMouseButton|MK_SHIFT|MK_CONTROL) )
|
||||
{
|
||||
t = Test_Ray (origin, dir, false);
|
||||
if (t.brush)
|
||||
{
|
||||
if (t.brush->brush_faces->texdef.name[0] == '(')
|
||||
Sys_Printf ("Can't change an entity texture\n");
|
||||
else
|
||||
{
|
||||
SetFaceTexdef (t.brush, t.face, &g_qeglobals.d_texturewin.texdef, &g_qeglobals.d_texturewin.brushprimit_texdef);
|
||||
Brush_Build( t.brush );
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
}
|
||||
else
|
||||
Sys_Printf ("Didn't hit a btrush\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (buttons == (nMouseButton | MK_SHIFT))
|
||||
{
|
||||
Sys_Printf("Set brush face texture info\n");
|
||||
t = Test_Ray (origin, dir, false);
|
||||
if (t.brush)
|
||||
{
|
||||
if (t.brush->brush_faces->texdef.name[0] == '(')
|
||||
{
|
||||
if (t.brush->owner->eclass->nShowFlags & ECLASS_LIGHT)
|
||||
{
|
||||
CString strBuff;
|
||||
qtexture_t* pTex = Texture_ForName(g_qeglobals.d_texturewin.texdef.name);
|
||||
if (pTex)
|
||||
{
|
||||
vec3_t vColor;
|
||||
VectorCopy(pTex->color, vColor);
|
||||
|
||||
float fLargest = 0.0f;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (vColor[i] > fLargest)
|
||||
fLargest = vColor[i];
|
||||
}
|
||||
|
||||
if (fLargest == 0.0f)
|
||||
{
|
||||
vColor[0] = vColor[1] = vColor[2] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
float fScale = 1.0f / fLargest;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
vColor[i] *= fScale;
|
||||
}
|
||||
}
|
||||
strBuff.Format("%f %f %f",pTex->color[0], pTex->color[1], pTex->color[2]);
|
||||
SetKeyValue(t.brush->owner, "_color", strBuff.GetBuffer(0));
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Printf ("Can't select an entity brush face\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//strcpy(t.face->texdef.name,g_qeglobals.d_texturewin.texdef.name);
|
||||
t.face->texdef.SetName(g_qeglobals.d_texturewin.texdef.name);
|
||||
Brush_Build(t.brush);
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
}
|
||||
else
|
||||
Sys_Printf ("Didn't hit a brush\n");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//===========
|
||||
//MoveSelection
|
||||
//===========
|
||||
//
|
||||
void MoveSelection (vec3_t move)
|
||||
{
|
||||
int i, success;
|
||||
brush_t *b;
|
||||
CString strStatus;
|
||||
vec3_t vTemp, vTemp2, end;
|
||||
|
||||
if (!move[0] && !move[1] && !move[2])
|
||||
return;
|
||||
|
||||
move[0] = (g_nScaleHow & SCALE_X) ? 0 : move[0];
|
||||
move[1] = (g_nScaleHow & SCALE_Y) ? 0 : move[1];
|
||||
move[2] = (g_nScaleHow & SCALE_Z) ? 0 : move[2];
|
||||
|
||||
if (g_pParentWnd->ActiveXY()->RotateMode() || g_bPatchBendMode)
|
||||
{
|
||||
float fDeg = -move[2];
|
||||
float fAdj = move[2];
|
||||
int nAxis = 0;
|
||||
if (g_pParentWnd->ActiveXY()->GetViewType() == XY)
|
||||
{
|
||||
fDeg = -move[1];
|
||||
fAdj = move[1];
|
||||
nAxis = 2;
|
||||
}
|
||||
else
|
||||
if (g_pParentWnd->ActiveXY()->GetViewType() == XZ)
|
||||
{
|
||||
fDeg = move[2];
|
||||
fAdj = move[2];
|
||||
nAxis = 1;
|
||||
}
|
||||
else
|
||||
nAxis = 0;
|
||||
|
||||
g_pParentWnd->ActiveXY()->Rotation()[nAxis] += fAdj;
|
||||
strStatus.Format("%s x:: %.1f y:: %.1f z:: %.1f", (g_bPatchBendMode) ? "Bend angle" : "Rotation", g_pParentWnd->ActiveXY()->Rotation()[0], g_pParentWnd->ActiveXY()->Rotation()[1], g_pParentWnd->ActiveXY()->Rotation()[2]);
|
||||
g_pParentWnd->SetStatusText(2, strStatus);
|
||||
|
||||
if (g_bPatchBendMode)
|
||||
{
|
||||
Patch_SelectBendNormal();
|
||||
Select_RotateAxis(nAxis, fDeg*2, false, true);
|
||||
Patch_SelectBendAxis();
|
||||
Select_RotateAxis(nAxis, fDeg, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Select_RotateAxis(nAxis, fDeg, false, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_pParentWnd->ActiveXY()->ScaleMode())
|
||||
{
|
||||
vec3_t v;
|
||||
v[0] = v[1] = v[2] = 1.0;
|
||||
if (move[1] > 0)
|
||||
{
|
||||
v[0] = 1.1;
|
||||
v[1] = 1.1;
|
||||
v[2] = 1.1;
|
||||
}
|
||||
else
|
||||
if (move[1] < 0)
|
||||
{
|
||||
v[0] = 0.9;
|
||||
v[1] = 0.9;
|
||||
v[2] = 0.9;
|
||||
}
|
||||
|
||||
Select_Scale((g_nScaleHow & SCALE_X) ? 1.0 : v[0],
|
||||
(g_nScaleHow & SCALE_Y) ? 1.0 : v[1],
|
||||
(g_nScaleHow & SCALE_Z) ? 1.0 : v[2]);
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
vec3_t vDistance;
|
||||
VectorSubtract(pressdelta, vPressStart, vDistance);
|
||||
strStatus.Format("Distance x: %.1f y: %.1f z: %.1f", vDistance[0], vDistance[1], vDistance[2]);
|
||||
g_pParentWnd->SetStatusText(3, strStatus);
|
||||
|
||||
//
|
||||
// dragging only a part of the selection
|
||||
//
|
||||
//point object selection
|
||||
if (g_qeglobals.d_select_mode == sel_editpoint) {
|
||||
if (g_qeglobals.selectObject) {
|
||||
g_qeglobals.selectObject->updateSelection(move[0], move[1], move[2]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// this is fairly crappy way to deal with curvepoint and area selection
|
||||
// but it touches the smallest amount of code this way
|
||||
//
|
||||
if (g_qeglobals.d_num_move_points || g_qeglobals.d_numterrapoints || g_qeglobals.d_select_mode == sel_area)
|
||||
{
|
||||
//area selection
|
||||
if (g_qeglobals.d_select_mode == sel_area)
|
||||
{
|
||||
VectorAdd(g_qeglobals.d_vAreaBR, move, g_qeglobals.d_vAreaBR);
|
||||
return;
|
||||
}
|
||||
//curve point selection
|
||||
if (g_qeglobals.d_select_mode == sel_curvepoint)
|
||||
{
|
||||
Patch_UpdateSelected(move);
|
||||
return;
|
||||
}
|
||||
//terrain point selection
|
||||
if ( ( g_qeglobals.d_select_mode == sel_terrainpoint ) || ( g_qeglobals.d_select_mode == sel_terraintexture ) )
|
||||
{
|
||||
Terrain_UpdateSelected(move);
|
||||
return;
|
||||
}
|
||||
|
||||
//vertex selection
|
||||
if (g_qeglobals.d_select_mode == sel_vertex)
|
||||
{
|
||||
success = true;
|
||||
for (b = selected_brushes.next; b != &selected_brushes; b = b->next)
|
||||
{
|
||||
success &= Brush_MoveVertex(b, g_qeglobals.d_move_points[0], move, end, true);
|
||||
}
|
||||
if (success)
|
||||
VectorCopy(end, g_qeglobals.d_move_points[0]);
|
||||
return;
|
||||
}
|
||||
//all other selection types
|
||||
for (i=0 ; i<g_qeglobals.d_num_move_points ; i++)
|
||||
VectorAdd (g_qeglobals.d_move_points[i], move, g_qeglobals.d_move_points[i]);
|
||||
//VectorScale(move, .5, move);
|
||||
//for (i=0 ; i<g_qeglobals.d_num_move_points2 ; i++)
|
||||
// VectorAdd (g_qeglobals.d_move_points2[i], move, g_qeglobals.d_move_points2[i]);
|
||||
for (b = selected_brushes.next; b != &selected_brushes; b = b->next)
|
||||
{
|
||||
VectorCopy(b->maxs, vTemp);
|
||||
VectorSubtract(vTemp, b->mins, vTemp);
|
||||
Brush_Build( b );
|
||||
for (i=0 ; i<3 ; i++)
|
||||
if (b->mins[i] > b->maxs[i]
|
||||
|| b->maxs[i] - b->mins[i] > MAX_BRUSH_SIZE)
|
||||
break; // dragged backwards or fucked up
|
||||
if (i != 3)
|
||||
break;
|
||||
if (b->patchBrush)
|
||||
{
|
||||
VectorCopy(b->maxs, vTemp2);
|
||||
VectorSubtract(vTemp2, b->mins, vTemp2);
|
||||
VectorSubtract(vTemp2, vTemp, vTemp2);
|
||||
//if (!Patch_DragScale(b->nPatchID, vTemp2, move))
|
||||
if (!Patch_DragScale(b->pPatch, vTemp2, move))
|
||||
{
|
||||
b = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (b->terrainBrush)
|
||||
{
|
||||
VectorCopy(b->maxs, vTemp2);
|
||||
VectorSubtract(vTemp2, b->mins, vTemp2);
|
||||
VectorSubtract(vTemp2, vTemp, vTemp2);
|
||||
if (!Terrain_DragScale(b->pTerrain, vTemp2, move))
|
||||
{
|
||||
b = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if any of the brushes were crushed out of existance
|
||||
// calcel the entire move
|
||||
if (b != &selected_brushes)
|
||||
{
|
||||
Sys_Printf ("Brush dragged backwards, move canceled\n");
|
||||
for (i=0 ; i<g_qeglobals.d_num_move_points ; i++)
|
||||
VectorSubtract (g_qeglobals.d_move_points[i], move, g_qeglobals.d_move_points[i]);
|
||||
|
||||
for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
|
||||
Brush_Build( b );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset face originals from vertex edit mode
|
||||
// this is dirty, but unfortunately necessary because Brush_Build
|
||||
// can remove windings
|
||||
for (b = selected_brushes.next; b != &selected_brushes; b = b->next)
|
||||
{
|
||||
Brush_ResetFaceOriginals(b);
|
||||
}
|
||||
//
|
||||
// if there are lots of brushes selected, just translate instead
|
||||
// of rebuilding the brushes
|
||||
//
|
||||
if (drag_yvec[2] == 0 && selected_brushes.next->next != &selected_brushes)
|
||||
{
|
||||
Select_Move (move);
|
||||
//VectorAdd (g_qeglobals.d_select_translate, move, g_qeglobals.d_select_translate);
|
||||
}
|
||||
else
|
||||
{
|
||||
Select_Move (move);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Drag_MouseMoved
|
||||
===========
|
||||
*/
|
||||
void Drag_MouseMoved (int x, int y, int buttons)
|
||||
{
|
||||
vec3_t move, delta;
|
||||
int i;
|
||||
|
||||
if (!buttons)
|
||||
{
|
||||
drag_ok = false;
|
||||
return;
|
||||
}
|
||||
if (!drag_ok)
|
||||
return;
|
||||
|
||||
// clear along one axis
|
||||
if (buttons & MK_SHIFT)
|
||||
{
|
||||
drag_first = false;
|
||||
if (abs(x-pressx) > abs(y-pressy))
|
||||
y = pressy;
|
||||
else
|
||||
x = pressx;
|
||||
}
|
||||
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
move[i] = drag_xvec[i]*(x - pressx) + drag_yvec[i]*(y - pressy);
|
||||
if (!g_PrefsDlg.m_bNoClamp)
|
||||
{
|
||||
move[i] = floor(move[i]/g_qeglobals.d_gridsize+0.5)*g_qeglobals.d_gridsize;
|
||||
}
|
||||
}
|
||||
|
||||
VectorSubtract (move, pressdelta, delta);
|
||||
VectorCopy (move, pressdelta);
|
||||
|
||||
MoveSelection (delta);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Drag_MouseUp
|
||||
===========
|
||||
*/
|
||||
void Drag_MouseUp (int nButtons)
|
||||
{
|
||||
Sys_Status ("drag completed.", 0);
|
||||
|
||||
if (g_qeglobals.d_select_mode == sel_area)
|
||||
{
|
||||
if ( OnlyTerrainSelected() )
|
||||
{
|
||||
Terrain_SelectAreaPoints();
|
||||
g_qeglobals.d_select_mode = sel_terrainpoint;
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Patch_SelectAreaPoints();
|
||||
g_qeglobals.d_select_mode = sel_curvepoint;
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_qeglobals.d_select_translate[0] || g_qeglobals.d_select_translate[1] || g_qeglobals.d_select_translate[2])
|
||||
{
|
||||
Select_Move (g_qeglobals.d_select_translate);
|
||||
VectorCopy (vec3_origin, g_qeglobals.d_select_translate);
|
||||
Sys_UpdateWindows (W_CAMERA);
|
||||
}
|
||||
|
||||
g_pParentWnd->SetStatusText(3, "");
|
||||
|
||||
//
|
||||
Undo_EndBrushList(&selected_brushes);
|
||||
Undo_End();
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// DialogInfo.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "DialogInfo.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogInfo dialog
|
||||
CDialogInfo g_dlgInfo;
|
||||
|
||||
void ShowInfoDialog(const char* pText)
|
||||
{
|
||||
if (g_dlgInfo.GetSafeHwnd())
|
||||
{
|
||||
g_dlgInfo.m_wndInfo.SetWindowText(pText);
|
||||
g_dlgInfo.ShowWindow(SW_SHOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dlgInfo.Create(IDD_DLG_INFORMATION);
|
||||
g_dlgInfo.m_wndInfo.SetWindowText(pText);
|
||||
g_dlgInfo.ShowWindow(SW_SHOW);
|
||||
}
|
||||
g_pParentWnd->SetFocus();
|
||||
}
|
||||
|
||||
void HideInfoDialog()
|
||||
{
|
||||
if (g_dlgInfo.GetSafeHwnd())
|
||||
g_dlgInfo.ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
|
||||
CDialogInfo::CDialogInfo(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDialogInfo::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDialogInfo)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CDialogInfo::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDialogInfo)
|
||||
DDX_Control(pDX, IDC_EDIT1, m_wndInfo);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDialogInfo, CDialog)
|
||||
//{{AFX_MSG_MAP(CDialogInfo)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogInfo message handlers
|
||||
|
||||
BOOL CDialogInfo::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_DIALOGINFO_H__81DF2A33_A552_11D1_B58E_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_DIALOGINFO_H__81DF2A33_A552_11D1_B58E_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// DialogInfo.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogInfo dialog
|
||||
void HideInfoDialog();
|
||||
void ShowInfoDialog(const char* pText);
|
||||
|
||||
class CDialogInfo : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CDialogInfo(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDialogInfo)
|
||||
enum { IDD = IDD_DLG_INFORMATION };
|
||||
CEdit m_wndInfo;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDialogInfo)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDialogInfo)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DIALOGINFO_H__81DF2A33_A552_11D1_B58E_00AA00A410FC__INCLUDED_)
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// DialogTextures.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "DialogTextures.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogTextures dialog
|
||||
|
||||
|
||||
CDialogTextures::CDialogTextures(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDialogTextures::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDialogTextures)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CDialogTextures::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDialogTextures)
|
||||
DDX_Control(pDX, IDC_LIST_TEXTURES, m_wndList);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDialogTextures, CDialog)
|
||||
//{{AFX_MSG_MAP(CDialogTextures)
|
||||
ON_LBN_DBLCLK(IDC_LIST_TEXTURES, OnDblclkListTextures)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogTextures message handlers
|
||||
|
||||
void CDialogTextures::OnOK()
|
||||
{
|
||||
m_nSelection = m_wndList.GetCurSel();
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CDialogTextures::OnDblclkListTextures()
|
||||
{
|
||||
OnOK();
|
||||
}
|
||||
|
||||
BOOL CDialogTextures::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
CStringArray sa;
|
||||
FillTextureMenu(&sa);
|
||||
m_nSelection = -1;
|
||||
for (int i = 0; i < sa.GetSize(); i ++)
|
||||
{
|
||||
m_wndList.AddString(sa.GetAt(i));
|
||||
}
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_DIALOGTEXTURES_H__F3F3F984_E47E_11D1_B61B_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_DIALOGTEXTURES_H__F3F3F984_E47E_11D1_B61B_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// DialogTextures.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogTextures dialog
|
||||
|
||||
class CDialogTextures : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CDialogTextures(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDialogTextures)
|
||||
enum { IDD = IDD_DIALOG_TEXTURELIST };
|
||||
CListBox m_wndList;
|
||||
//}}AFX_DATA
|
||||
int m_nSelection;
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDialogTextures)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDialogTextures)
|
||||
virtual void OnOK();
|
||||
afx_msg void OnDblclkListTextures();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DIALOGTEXTURES_H__F3F3F984_E47E_11D1_B61B_00AA00A410FC__INCLUDED_)
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// DialogThick.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "DialogThick.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogThick dialog
|
||||
|
||||
|
||||
CDialogThick::CDialogThick(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDialogThick::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDialogThick)
|
||||
m_bSeams = TRUE;
|
||||
m_nAmount = 8;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CDialogThick::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDialogThick)
|
||||
DDX_Check(pDX, IDC_CHECK_SEAMS, m_bSeams);
|
||||
DDX_Text(pDX, IDC_EDIT_AMOUNT, m_nAmount);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDialogThick, CDialog)
|
||||
//{{AFX_MSG_MAP(CDialogThick)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogThick message handlers
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_DIALOGTHICK_H__59F46602_553D_11D2_B082_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_DIALOGTHICK_H__59F46602_553D_11D2_B082_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// DialogThick.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDialogThick dialog
|
||||
|
||||
class CDialogThick : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CDialogThick(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDialogThick)
|
||||
enum { IDD = IDD_DIALOG_THICKEN };
|
||||
BOOL m_bSeams;
|
||||
int m_nAmount;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDialogThick)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDialogThick)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DIALOGTHICK_H__59F46602_553D_11D2_B082_00AA00A410FC__INCLUDED_)
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// DlgEvent.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "DlgEvent.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDlgEvent dialog
|
||||
|
||||
|
||||
CDlgEvent::CDlgEvent(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDlgEvent::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDlgEvent)
|
||||
m_strParm = _T("");
|
||||
m_event = 0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CDlgEvent::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDlgEvent)
|
||||
DDX_Text(pDX, IDC_EDIT_PARAM, m_strParm);
|
||||
DDX_Radio(pDX, IDC_RADIO_EVENT, m_event);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDlgEvent, CDialog)
|
||||
//{{AFX_MSG_MAP(CDlgEvent)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDlgEvent message handlers
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_DLGEVENT_H__B12EEBE1_FB71_407B_9075_50F63B168567__INCLUDED_)
|
||||
#define AFX_DLGEVENT_H__B12EEBE1_FB71_407B_9075_50F63B168567__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// DlgEvent.h : header file
|
||||
//
|
||||
|
||||
#include "splines/splines.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDlgEvent dialog
|
||||
|
||||
class CDlgEvent : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CDlgEvent(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDlgEvent)
|
||||
enum { IDD = IDD_DLG_CAMERAEVENT };
|
||||
CString m_strParm;
|
||||
int m_event;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDlgEvent)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDlgEvent)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DLGEVENT_H__B12EEBE1_FB71_407B_9075_50F63B168567__INCLUDED_)
|
|
@ -1,932 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "qe3.h"
|
||||
#include "io.h"
|
||||
#include "pakstuff.h"
|
||||
//#include "qertypes.h"
|
||||
|
||||
eclass_t *eclass = NULL;
|
||||
eclass_t *eclass_bad = NULL;
|
||||
char eclass_directory[1024];
|
||||
|
||||
// md3 cache for misc_models
|
||||
eclass_t *g_md3Cache = NULL;
|
||||
|
||||
/*
|
||||
|
||||
the classname, color triple, and bounding box are parsed out of comments
|
||||
A ? size means take the exact brush size.
|
||||
|
||||
/*QUAKED <classname> (0 0 0) ?
|
||||
/*QUAKED <classname> (0 0 0) (-8 -8 -8) (8 8 8)
|
||||
|
||||
Flag names can follow the size description:
|
||||
|
||||
/*QUAKED func_door (0 .5 .8) ? START_OPEN STONE_SOUND DOOR_DONT_LINK GOLD_KEY SILVER_KEY
|
||||
|
||||
*/
|
||||
|
||||
void CleanEntityList(eclass_t *&pList)
|
||||
{
|
||||
while (pList)
|
||||
{
|
||||
eclass_t* pTemp = pList->next;
|
||||
|
||||
entitymodel *model = pList->model;
|
||||
while (model != NULL)
|
||||
{
|
||||
delete []model->pTriList;
|
||||
model = model->pNext;
|
||||
}
|
||||
|
||||
if (pList->modelpath)
|
||||
free(pList->modelpath);
|
||||
if (pList->skinpath) // PGM
|
||||
free(pList->skinpath); // PGM
|
||||
|
||||
free(pList->name);
|
||||
free(pList->comments);
|
||||
free(pList);
|
||||
pList = pTemp;
|
||||
}
|
||||
|
||||
pList = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CleanUpEntities()
|
||||
{
|
||||
CleanEntityList(eclass);
|
||||
CleanEntityList(g_md3Cache);
|
||||
/*
|
||||
while (eclass)
|
||||
{
|
||||
eclass_t* pTemp = eclass->next;
|
||||
delete []eclass->pTriList;
|
||||
|
||||
if (eclass->modelpath)
|
||||
free(eclass->modelpath);
|
||||
if (eclass->skinpath) // PGM
|
||||
free(eclass->skinpath); // PGM
|
||||
|
||||
free(eclass->name);
|
||||
free(eclass->comments);
|
||||
free(eclass);
|
||||
eclass = pTemp;
|
||||
}
|
||||
|
||||
eclass = NULL;
|
||||
*/
|
||||
if (eclass_bad)
|
||||
{
|
||||
free(eclass_bad->name);
|
||||
free(eclass_bad->comments);
|
||||
free(eclass_bad);
|
||||
eclass_bad = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ExtendBounds(vec3_t v, vec3_t &vMin, vec3_t &vMax)
|
||||
{
|
||||
for (int i = 0 ;i < 3 ;i++)
|
||||
{
|
||||
vec_t f = v[i];
|
||||
|
||||
if (f < vMin[i])
|
||||
{
|
||||
vMin[i] = f;
|
||||
}
|
||||
|
||||
if (f > vMax[i])
|
||||
{
|
||||
vMax[i] = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// FIXME: this code is a TOTAL clusterfuck
|
||||
//
|
||||
void LoadModel(const char *pLocation, eclass_t *e, vec3_t &vMin, vec3_t &vMax, entitymodel *&pModel, const char *pSkin)
|
||||
{
|
||||
// this assumes a path only and uses tris.md2
|
||||
// for the model and skin.pcx for the skin
|
||||
char cPath[1024];
|
||||
char cSkin[1024];
|
||||
char cFullLocation[1024];
|
||||
//struct _finddata_t fileinfo;
|
||||
|
||||
vMin[0] = vMin[1] = vMin[2] = 99999;
|
||||
vMax[0] = vMax[1] = vMax[2] = -99999;
|
||||
|
||||
bool bMD3 = false;
|
||||
bool bASE = false;
|
||||
|
||||
strcpy( cFullLocation, pLocation );
|
||||
|
||||
if (strstr(pLocation, ".md3"))
|
||||
{
|
||||
bMD3 = true;
|
||||
}
|
||||
else if (strstr(pLocation, ".md2") != NULL)
|
||||
{
|
||||
sprintf( cFullLocation, "%stris.md2", pLocation);
|
||||
}
|
||||
else if (strstr(pLocation, ".ase") != NULL)
|
||||
{
|
||||
bASE = true;
|
||||
}
|
||||
|
||||
sprintf( cPath, "%s/%s", ValueForKey(g_qeglobals.d_project_entity, "basepath"), cFullLocation);
|
||||
|
||||
Sys_Printf("Loading model %s...", cPath);
|
||||
unsigned char* p = NULL;
|
||||
bool bOpen = (LoadFile(cPath, reinterpret_cast<void**>(&p)) > 0);
|
||||
if (!bOpen)
|
||||
{
|
||||
Sys_Printf(" failed. Trying PAK file...");
|
||||
// sprintf (cPath, "%stris.md2", pLocation);
|
||||
strcpy (cPath, cFullLocation);
|
||||
bOpen = (PakLoadAnyFile(cPath, reinterpret_cast<void**>(&p)) > 0);
|
||||
}
|
||||
|
||||
if (bOpen)
|
||||
{
|
||||
Sys_Printf(" successful.\n");
|
||||
|
||||
if (bASE)
|
||||
{
|
||||
/*
|
||||
free(p);
|
||||
CString strOut;
|
||||
::GetTempPath(1024, strOut.GetBuffer(1024));
|
||||
strOut.ReleaseBuffer();
|
||||
AddSlash(strOut);
|
||||
strOut += "Temp.ase";
|
||||
CopyFile(cPath, strOut, false);
|
||||
CString strIn = strOut;
|
||||
FindReplace(strOut, ".ase", ".md3");
|
||||
strcpy(cPath, strIn);
|
||||
strcpy(cSkin, strOut);
|
||||
Q3Data_ProduceTempMD3(ValueForKey(g_qeglobals.d_project_entity, "basepath"), cPath, cSkin);
|
||||
CString strModel = cPath;
|
||||
if (LoadFile(strOut.GetBuffer(0), reinterpret_cast<void**>(&p)) == 0)
|
||||
{
|
||||
Sys_Printf(" Conversion from ASE failed.\n");
|
||||
return;
|
||||
}
|
||||
bMD3 = true;
|
||||
*/
|
||||
}
|
||||
|
||||
if (bMD3)
|
||||
{
|
||||
md3Header_t header;
|
||||
md3Surface_t *pSurface;
|
||||
header = *(md3Header_t *)p;
|
||||
if (pSkin != NULL)
|
||||
{
|
||||
strcpy(cSkin, pSkin);
|
||||
}
|
||||
else
|
||||
{
|
||||
cSkin[0] = '\0';
|
||||
}
|
||||
int n = header.numFrames;
|
||||
pSurface = (md3Surface_t *) (p + header.ofsSurfaces);
|
||||
for (int z = 0; z < header.numSurfaces; z++ )
|
||||
{
|
||||
int nTris = pSurface->numTriangles;
|
||||
|
||||
//unsigned char* pTris = reinterpret_cast<unsigned char*>(pSurface);
|
||||
//pTris += pSurface->ofsTriangles;
|
||||
|
||||
if (nTris > 0)
|
||||
{
|
||||
int nStart = 0;
|
||||
if (pModel->pTriList == NULL)
|
||||
{
|
||||
pModel->nModelPosition = 0;
|
||||
pModel->pTriList = new trimodel[nTris];
|
||||
pModel->nTriCount = nTris;
|
||||
}
|
||||
else
|
||||
{
|
||||
// already have one so we need to reallocate
|
||||
int nNewCount = pModel->nTriCount + nTris;
|
||||
trimodel* pNewModels = new trimodel[nNewCount];
|
||||
for (int i = 0; i < pModel->nTriCount; i++)
|
||||
{
|
||||
memcpy(&pNewModels[i], &pModel->pTriList[i], sizeof(trimodel));
|
||||
}
|
||||
nStart = pModel->nTriCount;
|
||||
pModel->nTriCount = nNewCount;
|
||||
//nTris = nNewCount;
|
||||
delete [] pModel->pTriList;
|
||||
pModel->pTriList = pNewModels;
|
||||
}
|
||||
|
||||
md3Triangle_t *pTris = reinterpret_cast<md3Triangle_t*>((reinterpret_cast<unsigned char*>(pSurface) + pSurface->ofsTriangles));
|
||||
md3XyzNormal_t *pXyz = reinterpret_cast<md3XyzNormal_t*>((reinterpret_cast<unsigned char*>(pSurface) + pSurface->ofsXyzNormals));
|
||||
if (e->nFrame < pSurface->numFrames)
|
||||
{
|
||||
pXyz += (e->nFrame * pSurface->numVerts);
|
||||
}
|
||||
|
||||
md3St_t *pST = reinterpret_cast<md3St_t*>((reinterpret_cast<unsigned char*>(pSurface) + pSurface->ofsSt));
|
||||
|
||||
for (int i = 0; i < nTris; i++)
|
||||
{
|
||||
for (int k = 0; k < 3; k ++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
//e->pTriList[i].v[k][j] = (f->verts[tri.index_xyz[k]].v[j] * f->scale[j] + f->translate[j]);
|
||||
pModel->pTriList[nStart].v[k][j] = pXyz[pTris[i].indexes[k]].xyz[j] * MD3_XYZ_SCALE;
|
||||
}
|
||||
pModel->pTriList[nStart].st[k][0] = pST[pTris[i].indexes[k]].st[0];
|
||||
pModel->pTriList[nStart].st[k][1] = pST[pTris[i].indexes[k]].st[1];
|
||||
ExtendBounds (pModel->pTriList[nStart].v[k], vMin, vMax);
|
||||
}
|
||||
nStart++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
md3Shader_t *pShader = reinterpret_cast<md3Shader_t*>((reinterpret_cast<unsigned char*>(pSurface) + pSurface->ofsShaders));
|
||||
sprintf (cPath, "%s/%s", ValueForKey(g_qeglobals.d_project_entity, "basepath"), pShader->name);
|
||||
strlwr(cPath);
|
||||
pModel->nTextureBind = Texture_LoadSkin(cPath, &pModel->nSkinWidth, &pModel->nSkinHeight);
|
||||
if (pModel->nTextureBind == -1)
|
||||
{
|
||||
Sys_Printf("Model skin load failed on texture %s\n", cPath);
|
||||
}
|
||||
pSurface = (md3Surface_t *) ((( char * ) pSurface) + pSurface->ofsEnd);
|
||||
pModel->pNext = reinterpret_cast<entitymodel_t*>(qmalloc(sizeof(entitymodel_t)));
|
||||
pModel = pModel->pNext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
dmdl_t model;
|
||||
daliasframe_t *f;
|
||||
unsigned char* pTris = p;
|
||||
dstvert_t *pST = NULL;
|
||||
int nTris = 0;
|
||||
|
||||
// grab model params
|
||||
memcpy(&model, p, sizeof(dmdl_t));
|
||||
f = (daliasframe_t*)(p + model.ofs_frames);
|
||||
pTris += model.ofs_tris;
|
||||
pST = reinterpret_cast<dstvert_t*>(p + model.ofs_st);
|
||||
nTris = model.num_tris;
|
||||
|
||||
if(pSkin)
|
||||
{
|
||||
strcpy (cSkin, pSkin);
|
||||
if ((cSkin[strlen(cSkin)-1] == '\\') || (cSkin[strlen(cSkin)-1] == '/'))
|
||||
strcat(cSkin, "skin.pcx\0");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(cSkin, (char *)(p + model.ofs_skins));
|
||||
}
|
||||
|
||||
sprintf (cPath, "%s/%s", ValueForKey(g_qeglobals.d_project_entity, "basepath"), cSkin);
|
||||
strlwr(cPath);
|
||||
pModel->nTextureBind = Texture_LoadSkin(cPath, &pModel->nSkinWidth, &pModel->nSkinHeight);
|
||||
if (pModel->nTextureBind == -1)
|
||||
{
|
||||
Sys_Printf("Model skin load failed on texture %s\n", cPath);
|
||||
}
|
||||
int nStart = 0;
|
||||
if (pModel->pTriList == NULL)
|
||||
{
|
||||
pModel->nModelPosition = 0;
|
||||
pModel->pTriList = new trimodel[nTris];
|
||||
pModel->nTriCount = nTris;
|
||||
}
|
||||
else
|
||||
{
|
||||
// already have one so we need to reallocate
|
||||
int nNewCount = pModel->nTriCount + nTris;
|
||||
trimodel* pNewModels = new trimodel[nNewCount];
|
||||
for (int i = 0; i < pModel->nTriCount; i++)
|
||||
{
|
||||
memcpy(&pNewModels[i], &pModel->pTriList[i], sizeof(trimodel));
|
||||
}
|
||||
nStart = pModel->nTriCount;
|
||||
pModel->nTriCount = nNewCount;
|
||||
nTris = nNewCount;
|
||||
delete [] pModel->pTriList;
|
||||
pModel->pTriList = pNewModels;
|
||||
}
|
||||
|
||||
for (int i = nStart; i < nTris; i++)
|
||||
{
|
||||
dtriangle_t tri;
|
||||
memcpy(&tri, pTris, sizeof(dtriangle_t));
|
||||
for (int k = 0; k < 3; k ++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
pModel->pTriList[i].v[k][j] = (f->verts[tri.index_xyz[k]].v[j] * f->scale[j] + f->translate[j]);
|
||||
}
|
||||
|
||||
pModel->pTriList[i].st[k][0] = pST[tri.index_st[k]].s / pModel->nSkinWidth;
|
||||
pModel->pTriList[i].st[k][1] = pST[tri.index_st[k]].t / pModel->nSkinHeight;;
|
||||
ExtendBounds (pModel->pTriList[i].v[k], vMin, vMax);
|
||||
}
|
||||
pTris += sizeof(dtriangle_t);
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Printf(" failed.\n");
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (pModel->pTriList != NULL && pModel->nTriCount > 0 && !bMD3)
|
||||
{
|
||||
if(fabs(vMin[2]) < ((vMax[2]-vMin[2]) / 10.0)) // > 90% above 0 point.
|
||||
pModel->nModelPosition = 1;
|
||||
// sprintf (cPath, "%s/%sskin.pcx", ValueForKey(g_qeglobals.d_project_entity, "basepath"), pLocation);
|
||||
sprintf (cPath, "%s/%s", ValueForKey(g_qeglobals.d_project_entity, "basepath"), cSkin);
|
||||
pModel->nTextureBind = Texture_LoadSkin(cPath, &pModel->nSkinWidth, &pModel->nSkinHeight);
|
||||
if (pModel->nTextureBind == -1)
|
||||
{
|
||||
// sprintf (cPath, "%sskin.pcx", pLocation);
|
||||
strcpy (cPath, cSkin);
|
||||
pModel->nTextureBind = Texture_LoadSkin(cPath, &pModel->nSkinWidth, &pModel->nSkinHeight);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void setSpecialLoad(eclass_t *e, const char* pWhat, char*& p)
|
||||
{
|
||||
CString str = e->comments;
|
||||
int n = str.Find(pWhat);
|
||||
if (n >= 0)
|
||||
{
|
||||
char* pText = e->comments + n + strlen(pWhat);
|
||||
if (*pText == '\"')
|
||||
pText++;
|
||||
|
||||
str = "";
|
||||
while (*pText != '\"' && *pText != '\0')
|
||||
{
|
||||
str += *pText;
|
||||
pText++;
|
||||
}
|
||||
if (str.GetLength() > 0)
|
||||
{
|
||||
p = strdup(str);
|
||||
//--LoadModel(str, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char *debugname;
|
||||
|
||||
eclass_t *Eclass_InitFromText (char *text)
|
||||
{
|
||||
char *t;
|
||||
int len;
|
||||
int r, i;
|
||||
char parms[256], *p;
|
||||
eclass_t *e;
|
||||
char color[128];
|
||||
|
||||
e = (eclass_t*)qmalloc(sizeof(*e));
|
||||
memset (e, 0, sizeof(*e));
|
||||
|
||||
text += strlen("/*QUAKED ");
|
||||
|
||||
// grab the name
|
||||
text = COM_Parse (text);
|
||||
e->name = (char*)qmalloc (strlen(com_token)+1);
|
||||
strcpy (e->name, com_token);
|
||||
debugname = e->name;
|
||||
|
||||
// grab the color, reformat as texture name
|
||||
r = sscanf (text," (%f %f %f)", &e->color[0], &e->color[1], &e->color[2]);
|
||||
if (r != 3)
|
||||
return e;
|
||||
sprintf (color, "(%f %f %f)", e->color[0], e->color[1], e->color[2]);
|
||||
//strcpy (e->texdef.name, color);
|
||||
e->texdef.SetName(color);
|
||||
|
||||
while (*text != ')')
|
||||
{
|
||||
if (!*text)
|
||||
return e;
|
||||
text++;
|
||||
}
|
||||
text++;
|
||||
|
||||
// get the size
|
||||
text = COM_Parse (text);
|
||||
if (com_token[0] == '(')
|
||||
{ // parse the size as two vectors
|
||||
e->fixedsize = true;
|
||||
r = sscanf (text,"%f %f %f) (%f %f %f)", &e->mins[0], &e->mins[1], &e->mins[2],
|
||||
&e->maxs[0], &e->maxs[1], &e->maxs[2]);
|
||||
if (r != 6)
|
||||
return e;
|
||||
|
||||
for (i=0 ; i<2 ; i++)
|
||||
{
|
||||
while (*text != ')')
|
||||
{
|
||||
if (!*text)
|
||||
return e;
|
||||
text++;
|
||||
}
|
||||
text++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // use the brushes
|
||||
}
|
||||
|
||||
// get the flags
|
||||
|
||||
|
||||
// copy to the first /n
|
||||
p = parms;
|
||||
while (*text && *text != '\n')
|
||||
*p++ = *text++;
|
||||
*p = 0;
|
||||
text++;
|
||||
|
||||
// any remaining words are parm flags
|
||||
p = parms;
|
||||
for (i=0 ; i<8 ; i++)
|
||||
{
|
||||
p = COM_Parse (p);
|
||||
if (!p)
|
||||
break;
|
||||
strcpy (e->flagnames[i], com_token);
|
||||
}
|
||||
|
||||
// find the length until close comment
|
||||
for (t=text ; t[0] && !(t[0]=='*' && t[1]=='/') ; t++)
|
||||
;
|
||||
|
||||
// copy the comment block out
|
||||
len = t-text;
|
||||
e->comments = (char*)qmalloc (len+1);
|
||||
memcpy (e->comments, text, len);
|
||||
#if 0
|
||||
for (i=0 ; i<len ; i++)
|
||||
if (text[i] == '\n')
|
||||
e->comments[i] = '\r';
|
||||
else
|
||||
e->comments[i] = text[i];
|
||||
#endif
|
||||
e->comments[len] = 0;
|
||||
|
||||
setSpecialLoad(e, "model=", e->modelpath);
|
||||
setSpecialLoad(e, "skin=", e->skinpath);
|
||||
char *pFrame = NULL;
|
||||
setSpecialLoad(e, "frame=", pFrame);
|
||||
if (pFrame != NULL)
|
||||
{
|
||||
e->nFrame = atoi(pFrame);
|
||||
}
|
||||
|
||||
if(!e->skinpath)
|
||||
setSpecialLoad(e, "texture=", e->skinpath);
|
||||
|
||||
// setup show flags
|
||||
e->nShowFlags = 0;
|
||||
if (strcmpi(e->name, "light") == 0)
|
||||
{
|
||||
e->nShowFlags |= ECLASS_LIGHT;
|
||||
}
|
||||
|
||||
if ( (strnicmp(e->name, "info_player", strlen("info_player")) == 0)
|
||||
||(strnicmp(e->name, "path_corner", strlen("path_corner")) == 0)
|
||||
||(strnicmp(e->name, "team_ctf", strlen("team_ctf")) == 0) )
|
||||
{
|
||||
e->nShowFlags |= ECLASS_ANGLE;
|
||||
}
|
||||
if (strcmpi(e->name, "path") == 0)
|
||||
{
|
||||
e->nShowFlags |= ECLASS_PATH;
|
||||
}
|
||||
if (strcmpi(e->name, "misc_model") == 0)
|
||||
{
|
||||
e->nShowFlags |= ECLASS_MISCMODEL;
|
||||
}
|
||||
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
qboolean Eclass_hasModel(eclass_t *e, vec3_t &vMin, vec3_t &vMax)
|
||||
{
|
||||
if (e->modelpath != NULL)
|
||||
{
|
||||
if (e->model == NULL)
|
||||
{
|
||||
e->model = reinterpret_cast<entitymodel_t*>(qmalloc(sizeof(entitymodel_t)));
|
||||
}
|
||||
char *pModelBuff = strdup(e->modelpath);
|
||||
char *pSkinBuff = NULL;
|
||||
if (e->skinpath)
|
||||
{
|
||||
pSkinBuff = strdup(e->skinpath);
|
||||
}
|
||||
|
||||
CStringList Models;
|
||||
CStringList Skins;
|
||||
char* pToken = strtok(pModelBuff, ";\0");
|
||||
while (pToken != NULL)
|
||||
{
|
||||
Models.AddTail(pToken);
|
||||
pToken = strtok(NULL, ";\0");
|
||||
}
|
||||
|
||||
if (pSkinBuff != NULL)
|
||||
{
|
||||
pToken = strtok(pSkinBuff, ";\0");
|
||||
while (pToken != NULL)
|
||||
{
|
||||
Skins.AddTail(pToken);
|
||||
pToken = strtok(NULL, ";\0");
|
||||
}
|
||||
}
|
||||
|
||||
entitymodel *model = e->model;
|
||||
for (int i = 0; i < Models.GetCount(); i++)
|
||||
{
|
||||
char *pSkin = NULL;
|
||||
if (i < Skins.GetCount())
|
||||
{
|
||||
pSkin = Skins.GetAt(Skins.FindIndex(i)).GetBuffer(0);
|
||||
}
|
||||
LoadModel(Models.GetAt(Models.FindIndex(i)), e, vMin, vMax, model, pSkin);
|
||||
model->pNext = reinterpret_cast<entitymodel_t*>(qmalloc(sizeof(entitymodel_t)));
|
||||
model = model->pNext;
|
||||
}
|
||||
|
||||
// at this poitn vMin and vMax contain the min max of the model
|
||||
// which needs to be centered at origin 0, 0, 0
|
||||
|
||||
VectorSnap(vMin);
|
||||
VectorSnap(vMax);
|
||||
|
||||
if (vMax[0] - vMin[0] < 2)
|
||||
{
|
||||
vMin[0] -= 1;
|
||||
vMax[0] += 1;
|
||||
}
|
||||
|
||||
if (vMin[1] - vMax[1] < 2)
|
||||
{
|
||||
vMin[1] -= 1;
|
||||
vMax[1] += 1;
|
||||
}
|
||||
|
||||
if (vMax[2] - vMin[2] < 2)
|
||||
{
|
||||
vMax[2] -= 1;
|
||||
vMax[2] += 1;
|
||||
}
|
||||
|
||||
vec3_t vTemp;
|
||||
VectorAdd(vMin, vMax, vTemp);
|
||||
VectorScale(vTemp, 0.5, vTemp);
|
||||
model = e->model;
|
||||
while (model != NULL)
|
||||
{
|
||||
for (i = 0; i < model->nTriCount; i++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
;//VectorSubtract(model->pTriList[i].v[j], vTemp, model->pTriList[i].v[j]);
|
||||
}
|
||||
}
|
||||
model = model->pNext;
|
||||
}
|
||||
|
||||
free(pModelBuff);
|
||||
free(e->modelpath);
|
||||
e->modelpath = NULL;
|
||||
|
||||
if(e->skinpath)
|
||||
{
|
||||
free(e->skinpath);
|
||||
e->skinpath = NULL;
|
||||
free(pSkinBuff);
|
||||
}
|
||||
|
||||
}
|
||||
return (e->model != NULL && e->model->nTriCount > 0);
|
||||
}
|
||||
|
||||
|
||||
void EClass_InsertSortedList(eclass_t *&pList, eclass_t *e)
|
||||
{
|
||||
eclass_t *s;
|
||||
|
||||
if (!pList)
|
||||
{
|
||||
pList = e;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
s = pList;
|
||||
if (stricmp (e->name, s->name) < 0)
|
||||
{
|
||||
e->next = s;
|
||||
pList = e;
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!s->next || stricmp (e->name, s->next->name) < 0)
|
||||
{
|
||||
e->next = s->next;
|
||||
s->next = e;
|
||||
return;
|
||||
}
|
||||
s=s->next;
|
||||
} while (1);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Eclass_InsertAlphabetized
|
||||
=================
|
||||
*/
|
||||
void Eclass_InsertAlphabetized (eclass_t *e)
|
||||
{
|
||||
#if 1
|
||||
EClass_InsertSortedList(eclass, e);
|
||||
#else
|
||||
eclass_t *s;
|
||||
|
||||
if (!eclass)
|
||||
{
|
||||
eclass = e;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
s = eclass;
|
||||
if (stricmp (e->name, s->name) < 0)
|
||||
{
|
||||
e->next = s;
|
||||
eclass = e;
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (!s->next || stricmp (e->name, s->next->name) < 0)
|
||||
{
|
||||
e->next = s->next;
|
||||
s->next = e;
|
||||
return;
|
||||
}
|
||||
s=s->next;
|
||||
} while (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
Eclass_ScanFile
|
||||
=================
|
||||
*/
|
||||
|
||||
qboolean parsing_single = false;
|
||||
qboolean eclass_found;
|
||||
eclass_t *eclass_e;
|
||||
//#ifdef BUILD_LIST
|
||||
extern bool g_bBuildList;
|
||||
CString strDefFile;
|
||||
//#endif
|
||||
void Eclass_ScanFile (char *filename)
|
||||
{
|
||||
int size;
|
||||
char *data;
|
||||
eclass_t *e;
|
||||
int i;
|
||||
char temp[1024];
|
||||
|
||||
QE_ConvertDOSToUnixName( temp, filename );
|
||||
|
||||
Sys_Printf ("ScanFile: %s\n", temp);
|
||||
|
||||
// BUG
|
||||
size = LoadFile (filename, (void**)&data);
|
||||
eclass_found = false;
|
||||
for (i=0 ; i<size ; i++)
|
||||
if (!strncmp(data+i, "/*QUAKED",8))
|
||||
{
|
||||
|
||||
//#ifdef BUILD_LIST
|
||||
if (g_bBuildList)
|
||||
{
|
||||
CString strDef = "";
|
||||
int j = i;
|
||||
while (1)
|
||||
{
|
||||
strDef += *(data+j);
|
||||
if (*(data+j) == '/' && *(data+j-1) == '*')
|
||||
break;
|
||||
j++;
|
||||
}
|
||||
strDef += "\r\n\r\n\r\n";
|
||||
strDefFile += strDef;
|
||||
}
|
||||
//#endif
|
||||
e = Eclass_InitFromText (data+i);
|
||||
if (e)
|
||||
Eclass_InsertAlphabetized (e);
|
||||
else
|
||||
printf ("Error parsing: %s in %s\n",debugname, filename);
|
||||
|
||||
// single ?
|
||||
eclass_e = e;
|
||||
eclass_found = true;
|
||||
if ( parsing_single )
|
||||
break;
|
||||
}
|
||||
|
||||
free (data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Eclass_InitForSourceDirectory (char *path)
|
||||
{
|
||||
struct _finddata_t fileinfo;
|
||||
int handle;
|
||||
char filename[1024];
|
||||
char filebase[1024];
|
||||
char temp[1024];
|
||||
char *s;
|
||||
|
||||
QE_ConvertDOSToUnixName( temp, path );
|
||||
|
||||
Sys_Printf ("Eclass_InitForSourceDirectory: %s\n", temp );
|
||||
|
||||
strcpy (filebase, path);
|
||||
s = filebase + strlen(filebase)-1;
|
||||
while (*s != '\\' && *s != '/' && s!=filebase)
|
||||
s--;
|
||||
*s = 0;
|
||||
|
||||
CleanUpEntities();
|
||||
eclass = NULL;
|
||||
//#ifdef BUILD_LIST
|
||||
if (g_bBuildList)
|
||||
strDefFile = "";
|
||||
//#endif
|
||||
handle = _findfirst (path, &fileinfo);
|
||||
if (handle != -1)
|
||||
{
|
||||
do
|
||||
{
|
||||
sprintf (filename, "%s\\%s", filebase, fileinfo.name);
|
||||
Eclass_ScanFile (filename);
|
||||
} while (_findnext( handle, &fileinfo ) != -1);
|
||||
|
||||
_findclose (handle);
|
||||
}
|
||||
|
||||
//#ifdef BUILD_LIST
|
||||
if (g_bBuildList)
|
||||
{
|
||||
CFile file;
|
||||
if (file.Open("c:\\entities.def", CFile::modeCreate | CFile::modeWrite))
|
||||
{
|
||||
file.Write(strDefFile.GetBuffer(0), strDefFile.GetLength());
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
|
||||
eclass_bad = Eclass_InitFromText ("/*QUAKED UNKNOWN_CLASS (0 0.5 0) ?");
|
||||
}
|
||||
|
||||
eclass_t *Eclass_ForName (char *name, qboolean has_brushes)
|
||||
{
|
||||
eclass_t *e;
|
||||
char init[1024];
|
||||
|
||||
#ifdef _DEBUG
|
||||
// grouping stuff, not an eclass
|
||||
if (strcmp(name, "group_info")==0)
|
||||
Sys_Printf("WARNING: unexpected group_info entity in Eclass_ForName\n");
|
||||
#endif
|
||||
|
||||
if (!name)
|
||||
return eclass_bad;
|
||||
|
||||
for (e=eclass ; e ; e=e->next)
|
||||
if (!strcmp (name, e->name))
|
||||
return e;
|
||||
|
||||
// create a new class for it
|
||||
if (has_brushes)
|
||||
{
|
||||
sprintf (init, "/*QUAKED %s (0 0.5 0) ?\nNot found in source.\n", name);
|
||||
e = Eclass_InitFromText (init);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (init, "/*QUAKED %s (0 0.5 0) (-8 -8 -8) (8 8 8)\nNot found in source.\n", name);
|
||||
e = Eclass_InitFromText (init);
|
||||
}
|
||||
|
||||
Eclass_InsertAlphabetized (e);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
eclass_t* GetCachedModel(entity_t *pEntity, const char *pName, vec3_t &vMin, vec3_t &vMax)
|
||||
{
|
||||
|
||||
eclass_t *e = NULL;
|
||||
if (pName == NULL || strlen(pName) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (e = g_md3Cache; e ; e = e->next)
|
||||
{
|
||||
if (!strcmp (pName, e->name))
|
||||
{
|
||||
pEntity->md3Class = e;
|
||||
VectorCopy(e->mins, vMin);
|
||||
VectorCopy(e->maxs, vMax);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
e = (eclass_t*)qmalloc(sizeof(*e));
|
||||
memset (e, 0, sizeof(*e));
|
||||
e->name = strdup(pName);
|
||||
e->modelpath = strdup(pName);
|
||||
e->skinpath = strdup(pName);
|
||||
char *p = strstr(e->skinpath, ".md3");
|
||||
if (p != NULL)
|
||||
{
|
||||
p++;
|
||||
strncpy(p, "tga", 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(e->skinpath);
|
||||
e->skinpath = NULL;
|
||||
}
|
||||
|
||||
e->color[0] = e->color[2] = 0.85;
|
||||
|
||||
if (Eclass_hasModel(e, vMin, vMax))
|
||||
{
|
||||
EClass_InsertSortedList(g_md3Cache, e);
|
||||
VectorCopy(vMin, e->mins);
|
||||
VectorCopy(vMax, e->maxs);
|
||||
pEntity->md3Class = e;
|
||||
return e;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -1,933 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "qe3.h"
|
||||
|
||||
//
|
||||
int g_entityId = 1;
|
||||
|
||||
char *ValueForKey ( epair_t *&e, const char *key)
|
||||
{
|
||||
epair_t *ep;
|
||||
for (ep=e ; ep ; ep=ep->next)
|
||||
{
|
||||
if (!strcmp (ep->key, key) )
|
||||
{
|
||||
return ep->value;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
char *ValueForKey (entity_t *ent, const char *key)
|
||||
{
|
||||
return ValueForKey(ent->epairs, key);
|
||||
}
|
||||
|
||||
void TrackMD3Angles(entity_t *e, const char *key, const char *value)
|
||||
{
|
||||
if (strcmpi(key, "angle") != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e->eclass->fixedsize && e->eclass->nShowFlags & ECLASS_MISCMODEL)
|
||||
{
|
||||
float a = FloatForKey (e, "angle");
|
||||
float b = atof(value);
|
||||
if (a != b)
|
||||
{
|
||||
vec3_t vAngle;
|
||||
vAngle[0] = vAngle[1] = 0;
|
||||
vAngle[2] = -a;
|
||||
Brush_Rotate(e->brushes.onext, vAngle, e->origin, true);
|
||||
vAngle[2] = b;
|
||||
Brush_Rotate(e->brushes.onext, vAngle, e->origin, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetKeyValue (epair_t *&e, const char *key, const char *value)
|
||||
{
|
||||
epair_t *ep;
|
||||
for (ep=e ; ep ; ep=ep->next)
|
||||
{
|
||||
if (!strcmp (ep->key, key) )
|
||||
{
|
||||
free (ep->value);
|
||||
ep->value = (char*)qmalloc(strlen(value)+1);
|
||||
strcpy (ep->value, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ep = (epair_t*)qmalloc (sizeof(*ep));
|
||||
ep->next = e;
|
||||
e = ep;
|
||||
ep->key = (char*)qmalloc(strlen(key)+1);
|
||||
strcpy (ep->key, key);
|
||||
ep->value = (char*)qmalloc(strlen(value)+1);
|
||||
strcpy (ep->value, value);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SetKeyValue (entity_t *ent, const char *key, const char *value)
|
||||
{
|
||||
|
||||
if (ent == NULL)
|
||||
return;
|
||||
|
||||
if (!key || !key[0])
|
||||
return;
|
||||
|
||||
TrackMD3Angles(ent, key, value);
|
||||
|
||||
SetKeyValue(ent->epairs, key, value);
|
||||
|
||||
}
|
||||
|
||||
void DeleteKey (epair_t *&e, const char *key)
|
||||
{
|
||||
epair_t **ep, *next;
|
||||
|
||||
ep = &e;
|
||||
while (*ep)
|
||||
{
|
||||
next = *ep;
|
||||
if ( !strcmp (next->key, key) )
|
||||
{
|
||||
*ep = next->next;
|
||||
free(next->key);
|
||||
free(next->value);
|
||||
free(next);
|
||||
return;
|
||||
}
|
||||
ep = &next->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DeleteKey (entity_t *ent, const char *key)
|
||||
{
|
||||
DeleteKey(ent->epairs, key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float FloatForKey (entity_t *ent, const char *key)
|
||||
{
|
||||
char *k;
|
||||
|
||||
k = ValueForKey (ent, key);
|
||||
return atof(k);
|
||||
}
|
||||
|
||||
int IntForKey (entity_t *ent, const char *key)
|
||||
{
|
||||
char *k;
|
||||
|
||||
k = ValueForKey (ent, key);
|
||||
return atoi(k);
|
||||
}
|
||||
|
||||
void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec)
|
||||
{
|
||||
char *k;
|
||||
|
||||
k = ValueForKey (ent, key);
|
||||
sscanf (k, "%f %f %f", &vec[0], &vec[1], &vec[2]);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Entity_FreeEpairs
|
||||
|
||||
Frees the entity epairs.
|
||||
===============
|
||||
*/
|
||||
void Entity_FreeEpairs(entity_t *e)
|
||||
{
|
||||
epair_t *ep, *next;
|
||||
|
||||
for (ep = e->epairs; ep; ep = next)
|
||||
{
|
||||
next = ep->next;
|
||||
free (ep->key);
|
||||
free (ep->value);
|
||||
free (ep);
|
||||
}
|
||||
e->epairs = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Entity_AddToList
|
||||
===========
|
||||
*/
|
||||
void Entity_AddToList(entity_t *e, entity_t *list)
|
||||
{
|
||||
if (e->next || e->prev)
|
||||
Error ("Entity_AddToList: allready linked");
|
||||
e->next = list->next;
|
||||
list->next->prev = e;
|
||||
list->next = e;
|
||||
e->prev = list;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Entity_RemoveFromList
|
||||
===========
|
||||
*/
|
||||
void Entity_RemoveFromList (entity_t *e)
|
||||
{
|
||||
if (!e->next || !e->prev)
|
||||
Error ("Entity_RemoveFromList: not linked");
|
||||
e->next->prev = e->prev;
|
||||
e->prev->next = e->next;
|
||||
e->next = e->prev = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
Entity_Free
|
||||
|
||||
Frees the entity and any brushes is has.
|
||||
The entity is removed from the global entities list.
|
||||
===============
|
||||
*/
|
||||
void Entity_Free (entity_t *e)
|
||||
{
|
||||
// do we have a plugin entity ?
|
||||
if ( e->pPlugEnt )
|
||||
{
|
||||
e->pPlugEnt->DecRef();
|
||||
e->pPlugEnt = NULL;
|
||||
}
|
||||
|
||||
while (e->brushes.onext != &e->brushes)
|
||||
Brush_Free (e->brushes.onext);
|
||||
|
||||
if (e->next)
|
||||
{
|
||||
e->next->prev = e->prev;
|
||||
e->prev->next = e->next;
|
||||
}
|
||||
|
||||
Entity_FreeEpairs(e);
|
||||
|
||||
free (e);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Entity_MemorySize
|
||||
=================
|
||||
*/
|
||||
int Entity_MemorySize(entity_t *e)
|
||||
{
|
||||
epair_t *ep;
|
||||
int size = 0;
|
||||
|
||||
for (ep = e->epairs; ep; ep = ep->next)
|
||||
{
|
||||
size += _msize(ep->key);
|
||||
size += _msize(ep->value);
|
||||
size += _msize(ep);
|
||||
}
|
||||
size += _msize(e);
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ParseEpair
|
||||
=================
|
||||
*/
|
||||
epair_t *ParseEpair (void)
|
||||
{
|
||||
epair_t *e;
|
||||
|
||||
e = (epair_t*)qmalloc (sizeof(*e));
|
||||
|
||||
e->key = (char*)qmalloc(strlen(token)+1);
|
||||
strcpy (e->key, token);
|
||||
|
||||
GetToken (false);
|
||||
e->value = (char*)qmalloc(strlen(token)+1);
|
||||
strcpy (e->value, token);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Entity_Parse
|
||||
|
||||
If onlypairs is set, the classname info will not
|
||||
be looked up, and the entity will not be added
|
||||
to the global list. Used for parsing the project.
|
||||
================
|
||||
*/
|
||||
entity_t *Entity_Parse (qboolean onlypairs, brush_t* pList)
|
||||
{
|
||||
entity_t *ent;
|
||||
eclass_t *e;
|
||||
brush_t *b;
|
||||
vec3_t mins, maxs;
|
||||
epair_t *ep;
|
||||
qboolean has_brushes;
|
||||
|
||||
if (!GetToken (true))
|
||||
return NULL;
|
||||
|
||||
if (strcmp (token, "{") )
|
||||
Error ("ParseEntity: { not found");
|
||||
|
||||
ent = (entity_t*)qmalloc (sizeof(*ent));
|
||||
ent->entityId = g_entityId++;
|
||||
ent->brushes.onext = ent->brushes.oprev = &ent->brushes;
|
||||
|
||||
int n = 0;
|
||||
do
|
||||
{
|
||||
if (!GetToken (true))
|
||||
{
|
||||
Warning ("ParseEntity: EOF without closing brace");
|
||||
return NULL;
|
||||
}
|
||||
if (!strcmp (token, "}") )
|
||||
break;
|
||||
if (!strcmp (token, "{") )
|
||||
{
|
||||
b = Brush_Parse ();
|
||||
if (b != NULL)
|
||||
{
|
||||
b->owner = ent;
|
||||
// add to the end of the entity chain
|
||||
b->onext = &ent->brushes;
|
||||
b->oprev = ent->brushes.oprev;
|
||||
ent->brushes.oprev->onext = b;
|
||||
ent->brushes.oprev = b;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ep = ParseEpair ();
|
||||
ep->next = ent->epairs;
|
||||
ent->epairs = ep;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
// group info entity?
|
||||
if (strcmp(ValueForKey (ent, "classname"), "group_info") == 0)
|
||||
return ent;
|
||||
|
||||
if (onlypairs)
|
||||
return ent;
|
||||
|
||||
if (ent->brushes.onext == &ent->brushes)
|
||||
has_brushes = false;
|
||||
else
|
||||
has_brushes = true;
|
||||
|
||||
GetVectorForKey (ent, "origin", ent->origin);
|
||||
|
||||
e = Eclass_ForName (ValueForKey (ent, "classname"), has_brushes);
|
||||
ent->eclass = e;
|
||||
if ( e->nShowFlags & ECLASS_PLUGINENTITY )
|
||||
{
|
||||
// locate the plugin
|
||||
CPlugIn * pPlug = g_pParentWnd->GetPlugInMgr().PluginForModule( e->hPlug );
|
||||
if (pPlug)
|
||||
{
|
||||
// create the plugin entity
|
||||
IPluginEntity* pPlugEnt = pPlug->CreatePluginEntity( ent );
|
||||
if (pPlugEnt)
|
||||
{
|
||||
ent->pPlugEnt = pPlugEnt;
|
||||
// the brush is used to select and move
|
||||
pPlugEnt->GetBounds( mins, maxs );
|
||||
}
|
||||
else
|
||||
{
|
||||
// give it a default bounding box
|
||||
SetKeyValue (ent, "model", "");
|
||||
mins[0] = -4; mins[1] = -4; mins[2] = -4;
|
||||
maxs[0] = 4; maxs[1] = 4; maxs[2] = 4;
|
||||
VectorAdd( mins, ent->origin, mins );
|
||||
VectorAdd( maxs, ent->origin, maxs );
|
||||
}
|
||||
b = Brush_Create (mins, maxs, &ent->eclass->texdef);
|
||||
Entity_LinkBrush (ent, b);
|
||||
Brush_Build( b, true );
|
||||
}
|
||||
else
|
||||
Sys_Printf("WARNING: plugin lookup failed for plugin entities\n");
|
||||
}
|
||||
else if (e->fixedsize)
|
||||
{ // fixed size entity
|
||||
if (ent->brushes.onext != &ent->brushes)
|
||||
{
|
||||
printf ("Warning: Fixed size entity with brushes\n");
|
||||
#if 0
|
||||
while (ent->brushes.onext != &ent->brushes)
|
||||
{ // FIXME: this will free the entity and crash!
|
||||
Brush_Free (b);
|
||||
}
|
||||
#endif
|
||||
ent->brushes.next = ent->brushes.prev = &ent->brushes;
|
||||
}
|
||||
|
||||
// create a custom brush
|
||||
VectorAdd (e->mins, ent->origin, mins);
|
||||
VectorAdd (e->maxs, ent->origin, maxs);
|
||||
|
||||
float a = 0;
|
||||
if (e->nShowFlags & ECLASS_MISCMODEL)
|
||||
{
|
||||
char* p = ValueForKey(ent, "model");
|
||||
if (p != NULL && strlen(p) > 0)
|
||||
{
|
||||
vec3_t vMin, vMax;
|
||||
a = FloatForKey (ent, "angle");
|
||||
if (GetCachedModel(ent, p, vMin, vMax))
|
||||
{
|
||||
// create a custom brush
|
||||
VectorAdd (ent->md3Class->mins, ent->origin, mins);
|
||||
VectorAdd (ent->md3Class->maxs, ent->origin, maxs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b = Brush_Create (mins, maxs, &e->texdef);
|
||||
|
||||
if (a)
|
||||
{
|
||||
vec3_t vAngle;
|
||||
vAngle[0] = vAngle[1] = 0;
|
||||
vAngle[2] = a;
|
||||
Brush_Rotate(b, vAngle, ent->origin, false);
|
||||
}
|
||||
|
||||
|
||||
b->owner = ent;
|
||||
|
||||
b->onext = ent->brushes.onext;
|
||||
b->oprev = &ent->brushes;
|
||||
ent->brushes.onext->oprev = b;
|
||||
ent->brushes.onext = b;
|
||||
}
|
||||
else
|
||||
{ // brush entity
|
||||
if (ent->brushes.next == &ent->brushes)
|
||||
printf ("Warning: Brush entity with no brushes\n");
|
||||
}
|
||||
|
||||
// add all the brushes to the main list
|
||||
if (pList)
|
||||
{
|
||||
for (b=ent->brushes.onext ; b != &ent->brushes ; b=b->onext)
|
||||
{
|
||||
b->next = pList->next;
|
||||
pList->next->prev = b;
|
||||
b->prev = pList;
|
||||
pList->next = b;
|
||||
}
|
||||
}
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
void VectorMidpoint(vec3_t va, vec3_t vb, vec3_t& out)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
out[i] = va[i] + ((vb[i] - va[i]) / 2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Entity_Write
|
||||
============
|
||||
*/
|
||||
void Entity_Write (entity_t *e, FILE *f, qboolean use_region)
|
||||
{
|
||||
epair_t *ep;
|
||||
brush_t *b;
|
||||
vec3_t origin;
|
||||
char text[128];
|
||||
int count;
|
||||
|
||||
// if none of the entities brushes are in the region,
|
||||
// don't write the entity at all
|
||||
if (use_region)
|
||||
{
|
||||
// in region mode, save the camera position as playerstart
|
||||
if ( !strcmp(ValueForKey (e, "classname"), "info_player_start") )
|
||||
{
|
||||
fprintf (f, "{\n");
|
||||
fprintf (f, "\"classname\" \"info_player_start\"\n");
|
||||
fprintf (f, "\"origin\" \"%i %i %i\"\n", (int)g_pParentWnd->GetCamera()->Camera().origin[0],
|
||||
(int)g_pParentWnd->GetCamera()->Camera().origin[1], (int)g_pParentWnd->GetCamera()->Camera().origin[2]);
|
||||
fprintf (f, "\"angle\" \"%i\"\n", (int)g_pParentWnd->GetCamera()->Camera().angles[YAW]);
|
||||
fprintf (f, "}\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (b=e->brushes.onext ; b != &e->brushes ; b=b->onext)
|
||||
if (!Map_IsBrushFiltered(b))
|
||||
break; // got one
|
||||
|
||||
if (b == &e->brushes)
|
||||
return; // nothing visible
|
||||
}
|
||||
|
||||
if ( e->eclass->nShowFlags & ECLASS_PLUGINENTITY )
|
||||
{
|
||||
// NOTE: the whole brush placement / origin stuff is a mess
|
||||
VectorCopy( e->origin, origin );
|
||||
sprintf (text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue (e, "origin", text);
|
||||
}
|
||||
// if fixedsize, calculate a new origin based on the current
|
||||
// brush position
|
||||
else if (e->eclass->fixedsize)
|
||||
{
|
||||
if (e->eclass->nShowFlags & ECLASS_MISCMODEL && e->md3Class != NULL)
|
||||
{
|
||||
VectorCopy(e->origin, origin);
|
||||
//VectorSubtract (e->brushes.onext->mins, e->md3Class->mins, origin);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract (e->brushes.onext->mins, e->eclass->mins, origin);
|
||||
}
|
||||
sprintf (text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue (e, "origin", text);
|
||||
}
|
||||
|
||||
fprintf (f, "{\n");
|
||||
for (ep = e->epairs ; ep ; ep=ep->next)
|
||||
fprintf (f, "\"%s\" \"%s\"\n", ep->key, ep->value);
|
||||
|
||||
if (!e->eclass->fixedsize)
|
||||
{
|
||||
count = 0;
|
||||
for (b=e->brushes.onext ; b != &e->brushes ; b=b->onext)
|
||||
{
|
||||
if (!use_region || !Map_IsBrushFiltered (b))
|
||||
{
|
||||
fprintf (f, "// brush %i\n", count);
|
||||
count++;
|
||||
Brush_Write (b, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf (f, "}\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
qboolean IsBrushSelected(brush_t* bSel)
|
||||
{
|
||||
for (brush_t* b = selected_brushes.next ;b != NULL && b != &selected_brushes; b = b->next)
|
||||
{
|
||||
if (b == bSel)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
//============
|
||||
//Entity_WriteSelected
|
||||
//============
|
||||
//
|
||||
void Entity_WriteSelected(entity_t *e, FILE *f)
|
||||
{
|
||||
epair_t *ep;
|
||||
brush_t *b;
|
||||
vec3_t origin;
|
||||
char text[128];
|
||||
int count;
|
||||
|
||||
for (b=e->brushes.onext ; b != &e->brushes ; b=b->onext)
|
||||
if (IsBrushSelected(b))
|
||||
break; // got one
|
||||
|
||||
if (b == &e->brushes)
|
||||
return; // nothing selected
|
||||
|
||||
// if fixedsize, calculate a new origin based on the current
|
||||
// brush position
|
||||
if (e->eclass->fixedsize)
|
||||
{
|
||||
if (e->eclass->nShowFlags & ECLASS_MISCMODEL && e->md3Class != NULL)
|
||||
{
|
||||
VectorCopy(e->origin, origin);
|
||||
//VectorSubtract (e->brushes.onext->mins, e->md3Class->mins, origin);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract (e->brushes.onext->mins, e->eclass->mins, origin);
|
||||
}
|
||||
sprintf (text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue (e, "origin", text);
|
||||
}
|
||||
|
||||
fprintf (f, "{\n");
|
||||
for (ep = e->epairs ; ep ; ep=ep->next)
|
||||
fprintf (f, "\"%s\" \"%s\"\n", ep->key, ep->value);
|
||||
|
||||
if (!e->eclass->fixedsize)
|
||||
{
|
||||
count = 0;
|
||||
for (b=e->brushes.onext ; b != &e->brushes ; b=b->onext)
|
||||
{
|
||||
if (IsBrushSelected(b))
|
||||
{
|
||||
fprintf (f, "// brush %i\n", count);
|
||||
count++;
|
||||
Brush_Write (b, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf (f, "}\n");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//============
|
||||
//Entity_WriteSelected to a CMemFile
|
||||
//============
|
||||
//
|
||||
void Entity_WriteSelected(entity_t *e, CMemFile* pMemFile)
|
||||
{
|
||||
epair_t *ep;
|
||||
brush_t *b;
|
||||
vec3_t origin;
|
||||
char text[128];
|
||||
int count;
|
||||
|
||||
for (b=e->brushes.onext ; b != &e->brushes ; b=b->onext)
|
||||
if (IsBrushSelected(b))
|
||||
break; // got one
|
||||
|
||||
if (b == &e->brushes)
|
||||
return; // nothing selected
|
||||
|
||||
// if fixedsize, calculate a new origin based on the current
|
||||
// brush position
|
||||
if (e->eclass->fixedsize)
|
||||
{
|
||||
if (e->eclass->nShowFlags & ECLASS_MISCMODEL && e->md3Class != NULL)
|
||||
{
|
||||
//VectorSubtract (e->brushes.onext->mins, e->md3Class->mins, origin);
|
||||
VectorCopy(e->origin, origin);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract (e->brushes.onext->mins, e->eclass->mins, origin);
|
||||
}
|
||||
sprintf (text, "%i %i %i", (int)origin[0], (int)origin[1], (int)origin[2]);
|
||||
SetKeyValue (e, "origin", text);
|
||||
}
|
||||
|
||||
MemFile_fprintf(pMemFile, "{\n");
|
||||
for (ep = e->epairs ; ep ; ep=ep->next)
|
||||
MemFile_fprintf(pMemFile, "\"%s\" \"%s\"\n", ep->key, ep->value);
|
||||
|
||||
if (!e->eclass->fixedsize)
|
||||
{
|
||||
count = 0;
|
||||
for (b=e->brushes.onext ; b != &e->brushes ; b=b->onext)
|
||||
{
|
||||
if (IsBrushSelected(b))
|
||||
{
|
||||
MemFile_fprintf(pMemFile, "// brush %i\n", count);
|
||||
count++;
|
||||
Brush_Write (b, pMemFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
MemFile_fprintf(pMemFile, "}\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
============
|
||||
Entity_Create
|
||||
|
||||
Creates a new entity out of the selected_brushes list.
|
||||
If the entity class is fixed size, the brushes are only
|
||||
used to find a midpoint. Otherwise, the brushes have
|
||||
their ownership transfered to the new entity.
|
||||
============
|
||||
*/
|
||||
entity_t *Entity_Create (eclass_t *c)
|
||||
{
|
||||
entity_t *e;
|
||||
brush_t *b;
|
||||
vec3_t mins, maxs;
|
||||
int i;
|
||||
|
||||
// check to make sure the brushes are ok
|
||||
|
||||
for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
|
||||
{
|
||||
if (b->owner != world_entity)
|
||||
{
|
||||
Sys_Printf ("Entity NOT created, brushes not all from world\n");
|
||||
Sys_Beep ();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// create it
|
||||
|
||||
e = (entity_t*)qmalloc(sizeof(*e));
|
||||
e->entityId = g_entityId++;
|
||||
e->brushes.onext = e->brushes.oprev = &e->brushes;
|
||||
e->eclass = c;
|
||||
SetKeyValue (e, "classname", c->name);
|
||||
|
||||
// add the entity to the entity list
|
||||
Entity_AddToList(e, &entities);
|
||||
|
||||
// plugin entity ?
|
||||
if (c->nShowFlags & ECLASS_PLUGINENTITY)
|
||||
{
|
||||
// locate the plugin
|
||||
CPlugIn * pPlug = g_pParentWnd->GetPlugInMgr().PluginForModule( c->hPlug );
|
||||
if (pPlug)
|
||||
{
|
||||
//
|
||||
// just use the selection for positioning
|
||||
//
|
||||
b = selected_brushes.next;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
e->origin[i] = b->mins[i] - c->mins[i];
|
||||
|
||||
// create the plugin entity
|
||||
IPluginEntity* pPlugEnt = pPlug->CreatePluginEntity( e );
|
||||
|
||||
if (pPlugEnt)
|
||||
{
|
||||
e->pPlugEnt = pPlugEnt;
|
||||
// the brush is used to select and move
|
||||
pPlugEnt->GetBounds( mins, maxs );
|
||||
b = Brush_Create (mins, maxs, &c->texdef);
|
||||
|
||||
Entity_LinkBrush (e, b);
|
||||
|
||||
// delete the current selection
|
||||
Select_Delete ();
|
||||
|
||||
// select the new brush
|
||||
b->next = b->prev = &selected_brushes;
|
||||
selected_brushes.next = selected_brushes.prev = b;
|
||||
|
||||
Brush_Build( b );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Printf( "WARNING: plugin lookup failed while creating a plugin entitiy in Entity_Create\n" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (c->fixedsize)
|
||||
{
|
||||
//
|
||||
// just use the selection for positioning
|
||||
//
|
||||
b = selected_brushes.next;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
e->origin[i] = b->mins[i] - c->mins[i];
|
||||
|
||||
// create a custom brush
|
||||
VectorAdd (c->mins, e->origin, mins);
|
||||
VectorAdd (c->maxs, e->origin, maxs);
|
||||
|
||||
b = Brush_Create (mins, maxs, &c->texdef);
|
||||
|
||||
Entity_LinkBrush (e, b);
|
||||
|
||||
// delete the current selection
|
||||
Select_Delete ();
|
||||
|
||||
// select the new brush
|
||||
b->next = b->prev = &selected_brushes;
|
||||
selected_brushes.next = selected_brushes.prev = b;
|
||||
|
||||
Brush_Build( b );
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// change the selected brushes over to the new entity
|
||||
//
|
||||
for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
|
||||
{
|
||||
Entity_UnlinkBrush (b);
|
||||
Entity_LinkBrush (e, b);
|
||||
Brush_Build( b ); // so the key brush gets a name
|
||||
}
|
||||
}
|
||||
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
Entity_LinkBrush
|
||||
===========
|
||||
*/
|
||||
void Entity_LinkBrush (entity_t *e, brush_t *b)
|
||||
{
|
||||
if (b->oprev || b->onext)
|
||||
Error ("Entity_LinkBrush: Allready linked");
|
||||
b->owner = e;
|
||||
|
||||
b->onext = e->brushes.onext;
|
||||
b->oprev = &e->brushes;
|
||||
e->brushes.onext->oprev = b;
|
||||
e->brushes.onext = b;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Entity_UnlinkBrush
|
||||
===========
|
||||
*/
|
||||
void Entity_UnlinkBrush (brush_t *b)
|
||||
{
|
||||
//if (!b->owner || !b->onext || !b->oprev)
|
||||
if (!b->onext || !b->oprev)
|
||||
Error ("Entity_UnlinkBrush: Not currently linked");
|
||||
b->onext->oprev = b->oprev;
|
||||
b->oprev->onext = b->onext;
|
||||
b->onext = b->oprev = NULL;
|
||||
b->owner = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
Entity_Clone
|
||||
===========
|
||||
*/
|
||||
entity_t *Entity_Clone (entity_t *e)
|
||||
{
|
||||
entity_t *n;
|
||||
epair_t *ep, *np;
|
||||
|
||||
n = (entity_t*)qmalloc(sizeof(*n));
|
||||
n->entityId = g_entityId++;
|
||||
n->brushes.onext = n->brushes.oprev = &n->brushes;
|
||||
n->eclass = e->eclass;
|
||||
|
||||
// add the entity to the entity list
|
||||
Entity_AddToList(n, &entities);
|
||||
|
||||
for (ep = e->epairs ; ep ; ep=ep->next)
|
||||
{
|
||||
np = (epair_t*)qmalloc(sizeof(*np));
|
||||
np->key = copystring(ep->key);
|
||||
np->value = copystring(ep->value);
|
||||
np->next = n->epairs;
|
||||
n->epairs = np;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int GetUniqueTargetId(int iHint)
|
||||
{
|
||||
int iMin, iMax, i;
|
||||
BOOL fFound;
|
||||
entity_t *pe;
|
||||
|
||||
fFound = FALSE;
|
||||
pe = entities.next;
|
||||
iMin = 0;
|
||||
iMax = 0;
|
||||
|
||||
for (; pe != NULL && pe != &entities ; pe = pe->next)
|
||||
{
|
||||
i = IntForKey(pe, "target");
|
||||
if (i)
|
||||
{
|
||||
iMin = min(i, iMin);
|
||||
iMax = max(i, iMax);
|
||||
if (i == iHint)
|
||||
fFound = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (fFound)
|
||||
return iMax + 1;
|
||||
else
|
||||
return iHint;
|
||||
}
|
||||
|
||||
entity_t *FindEntity(char *pszKey, char *pszValue)
|
||||
{
|
||||
entity_t *pe;
|
||||
|
||||
pe = entities.next;
|
||||
|
||||
for (; pe != NULL && pe != &entities ; pe = pe->next)
|
||||
{
|
||||
if (!strcmp(ValueForKey(pe, pszKey), pszValue))
|
||||
return pe;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entity_t *FindEntityInt(char *pszKey, int iValue)
|
||||
{
|
||||
entity_t *pe;
|
||||
|
||||
pe = entities.next;
|
||||
|
||||
for (; pe != NULL && pe != &entities ; pe = pe->next)
|
||||
{
|
||||
if (IntForKey(pe, pszKey) == iValue)
|
||||
return pe;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// entity.h
|
||||
|
||||
void Eclass_InitForSourceDirectory (char *path);
|
||||
eclass_t *Eclass_ForName (char *name, qboolean has_brushes);
|
||||
|
||||
// forward declare this one
|
||||
class IPluginEntity;
|
||||
|
||||
typedef struct entity_s
|
||||
{
|
||||
struct entity_s *prev, *next;
|
||||
brush_t brushes; // head/tail of list
|
||||
int undoId, redoId, entityId; // used for undo/redo
|
||||
vec3_t origin;
|
||||
eclass_t *eclass;
|
||||
epair_t *epairs;
|
||||
eclass_t *md3Class;
|
||||
IPluginEntity *pPlugEnt;
|
||||
vec3_t vRotation; // valid for misc_models only
|
||||
vec3_t vScale; // valid for misc_models only
|
||||
} entity_t;
|
||||
|
||||
char *ValueForKey (entity_t *ent, const char *key);
|
||||
void SetKeyValue (entity_t *ent, const char *key, const char *value);
|
||||
void SetKeyValue (epair_t *&e, const char *key, const char *value);
|
||||
void DeleteKey (entity_t *ent, const char *key);
|
||||
void DeleteKey (epair_t *&e, const char *key);
|
||||
float FloatForKey (entity_t *ent, const char *key);
|
||||
int IntForKey (entity_t *ent, const char *key);
|
||||
void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec);
|
||||
|
||||
void Entity_Free (entity_t *e);
|
||||
void Entity_FreeEpairs(entity_t *e);
|
||||
int Entity_MemorySize(entity_t *e);
|
||||
entity_t *Entity_Parse (qboolean onlypairs, brush_t* pList = NULL);
|
||||
void Entity_Write (entity_t *e, FILE *f, qboolean use_region);
|
||||
void Entity_WriteSelected(entity_t *e, FILE *f);
|
||||
void Entity_WriteSelected(entity_t *e, CMemFile*);
|
||||
entity_t *Entity_Create (eclass_t *c);
|
||||
entity_t *Entity_Clone (entity_t *e);
|
||||
void Entity_AddToList(entity_t *e, entity_t *list);
|
||||
void Entity_RemoveFromList(entity_t *e);
|
||||
|
||||
void Entity_LinkBrush (entity_t *e, brush_t *b);
|
||||
void Entity_UnlinkBrush (brush_t *b);
|
||||
entity_t *FindEntity(char *pszKey, char *pszValue);
|
||||
entity_t *FindEntityInt(char *pszKey, int iValue);
|
||||
|
||||
int GetUniqueTargetId(int iHint);
|
||||
qboolean Eclass_hasModel(eclass_t *e, vec3_t &vMin, vec3_t &vMax);
|
||||
eclass_t* GetCachedModel(entity_t *pEntity, const char *pName, vec3_t &vMin, vec3_t &vMax);
|
||||
|
||||
//Timo : used for parsing epairs in brush primitive
|
||||
epair_t* ParseEpair(void);
|
||||
char *ValueForKey ( epair_t *&e, const char *key);
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// entity.h
|
||||
|
||||
#define DlgXBorder 5
|
||||
#define DlgYBorder 5
|
||||
|
||||
|
||||
#define EntList 0
|
||||
#define EntComment 1
|
||||
#define EntCheck1 2
|
||||
#define EntCheck2 3
|
||||
#define EntCheck3 4
|
||||
#define EntCheck4 5
|
||||
#define EntCheck5 6
|
||||
#define EntCheck6 7
|
||||
#define EntCheck7 8
|
||||
#define EntCheck8 9
|
||||
#define EntCheck9 10
|
||||
#define EntCheck10 11
|
||||
#define EntCheck11 12
|
||||
#define EntCheck12 13
|
||||
#define EntProps 14
|
||||
#define EntDir0 15
|
||||
#define EntDir45 16
|
||||
#define EntDir90 17
|
||||
#define EntDir135 18
|
||||
#define EntDir180 19
|
||||
#define EntDir225 20
|
||||
#define EntDir270 21
|
||||
#define EntDir315 22
|
||||
#define EntDirUp 23
|
||||
#define EntDirDown 24
|
||||
#define EntDelProp 25
|
||||
#define EntKeyLabel 26
|
||||
#define EntKeyField 27
|
||||
#define EntValueLabel 28
|
||||
#define EntValueField 29
|
||||
#define EntColor 30
|
||||
#define EntAssignSounds 31
|
||||
#define EntAssignModels 32
|
||||
#define EntTab 33
|
||||
|
||||
#define EntLast 34
|
||||
|
||||
extern HWND hwndEnt[EntLast];
|
||||
|
||||
extern int rgIds[EntLast];
|
||||
|
1402
q3radiant/EPAIRS.H
1402
q3radiant/EPAIRS.H
File diff suppressed because it is too large
Load Diff
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// EditWnd.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "EditWnd.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditWnd
|
||||
IMPLEMENT_DYNCREATE(CEditWnd, CWnd);
|
||||
|
||||
CEditWnd::CEditWnd()
|
||||
{
|
||||
}
|
||||
|
||||
CEditWnd::~CEditWnd()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CEditWnd, CEdit)
|
||||
//{{AFX_MSG_MAP(CEditWnd)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditWnd message handlers
|
||||
|
||||
BOOL CEditWnd::PreCreateWindow(CREATESTRUCT& cs)
|
||||
{
|
||||
cs.style = WS_CHILD | WS_VSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | WS_VISIBLE;
|
||||
cs.lpszClass = "EDIT";
|
||||
return CEdit::PreCreateWindow(cs);
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_EDITWND_H__279AAE22_78C5_11D1_B53C_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_EDITWND_H__279AAE22_78C5_11D1_B53C_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// EditWnd.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEditWnd window
|
||||
|
||||
class CEditWnd : public CEdit
|
||||
{
|
||||
DECLARE_DYNCREATE(CEditWnd);
|
||||
// Construction
|
||||
public:
|
||||
CEditWnd();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CEditWnd)
|
||||
protected:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CEditWnd();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CEditWnd)
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_EDITWND_H__279AAE22_78C5_11D1_B53C_00AA00A410FC__INCLUDED_)
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// EntityListDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "EntityListDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEntityListDlg dialog
|
||||
|
||||
|
||||
CEntityListDlg::CEntityListDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CEntityListDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CEntityListDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CEntityListDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CEntityListDlg)
|
||||
DDX_Control(pDX, IDC_LIST_ENTITY, m_lstEntity);
|
||||
DDX_Control(pDX, IDC_TREE_ENTITY, m_treeEntity);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CEntityListDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CEntityListDlg)
|
||||
ON_BN_CLICKED(IDSELECT, OnSelect)
|
||||
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_ENTITY, OnSelchangedTreeEntity)
|
||||
ON_NOTIFY(NM_DBLCLK, IDC_TREE_ENTITY, OnDblclkTreeEntity)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEntityListDlg message handlers
|
||||
|
||||
void CEntityListDlg::OnSelect()
|
||||
{
|
||||
HTREEITEM hItem = m_treeEntity.GetSelectedItem();
|
||||
if (hItem)
|
||||
{
|
||||
entity_t* pEntity = reinterpret_cast<entity_t*>(m_treeEntity.GetItemData(hItem));
|
||||
if (pEntity)
|
||||
{
|
||||
Select_Deselect();
|
||||
Select_Brush (pEntity->brushes.onext);
|
||||
}
|
||||
}
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
BOOL CEntityListDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CMapStringToPtr mapEntity;
|
||||
|
||||
HTREEITEM hParent = m_treeEntity.InsertItem(world_entity->eclass->name);
|
||||
HTREEITEM hChild = m_treeEntity.InsertItem(world_entity->eclass->name, hParent);
|
||||
m_treeEntity.SetItemData(hChild, reinterpret_cast<DWORD>(world_entity));
|
||||
|
||||
for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
|
||||
{
|
||||
hParent = NULL;
|
||||
if (mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast<void*&>(hParent)) == FALSE)
|
||||
{
|
||||
hParent = m_treeEntity.InsertItem(pEntity->eclass->name);
|
||||
mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast<void*>(hParent));
|
||||
}
|
||||
hChild = m_treeEntity.InsertItem(pEntity->eclass->name, hParent);
|
||||
m_treeEntity.SetItemData(hChild, reinterpret_cast<DWORD>(pEntity));
|
||||
}
|
||||
|
||||
CRect rct;
|
||||
m_lstEntity.GetClientRect(rct);
|
||||
m_lstEntity.InsertColumn(0, "Key", LVCFMT_LEFT, rct.Width() / 2);
|
||||
m_lstEntity.InsertColumn(1, "Value", LVCFMT_LEFT, rct.Width() / 2);
|
||||
m_lstEntity.DeleteColumn(2);
|
||||
UpdateData(FALSE);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CEntityListDlg::OnSelchangedTreeEntity(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
|
||||
HTREEITEM hItem = m_treeEntity.GetSelectedItem();
|
||||
m_lstEntity.DeleteAllItems();
|
||||
if (hItem)
|
||||
{
|
||||
CString strList;
|
||||
entity_t* pEntity = reinterpret_cast<entity_t*>(m_treeEntity.GetItemData(hItem));
|
||||
if (pEntity)
|
||||
{
|
||||
for (epair_t* pEpair = pEntity->epairs ; pEpair ; pEpair = pEpair->next)
|
||||
{
|
||||
if (strlen(pEpair->key) > 8)
|
||||
strList.Format("%s\t%s", pEpair->key, pEpair->value);
|
||||
else
|
||||
strList.Format("%s\t\t%s", pEpair->key, pEpair->value);
|
||||
int nParent = m_lstEntity.InsertItem(0, pEpair->key);
|
||||
m_lstEntity.SetItem(nParent, 1, LVIF_TEXT, pEpair->value, 0, 0, 0, reinterpret_cast<DWORD>(pEntity));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CEntityListDlg::OnDblclkListInfo()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
}
|
||||
|
||||
void CEntityListDlg::OnDblclkTreeEntity(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
OnSelect();
|
||||
*pResult = 0;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_ENTITYLISTDLG_H__C241B9A3_819F_11D1_B548_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_ENTITYLISTDLG_H__C241B9A3_819F_11D1_B548_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// EntityListDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEntityListDlg dialog
|
||||
|
||||
class CEntityListDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CEntityListDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CEntityListDlg)
|
||||
enum { IDD = IDD_DLG_ENTITYLIST };
|
||||
CListCtrl m_lstEntity;
|
||||
CTreeCtrl m_treeEntity;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CEntityListDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CEntityListDlg)
|
||||
afx_msg void OnSelect();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSelchangedTreeEntity(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDblclkListInfo();
|
||||
afx_msg void OnDblclkTreeEntity(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_ENTITYLISTDLG_H__C241B9A3_819F_11D1_B548_00AA00A410FC__INCLUDED_)
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.1.4 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/01/18 00:17:10 $
|
||||
// $Log: EpairsWrapper.h,v $
|
||||
// Revision 1.1.1.4 2000/01/18 00:17:10 ttimo
|
||||
// merging in for RC
|
||||
//
|
||||
// Revision 1.3 2000/01/17 23:53:41 TBesset
|
||||
// ready for merge in sourceforge (RC candidate)
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:25 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// virtual class to allow plugin operations on entities epairs
|
||||
// this is the internal header for our implementation
|
||||
|
||||
#ifndef _EPAIRSWRAPPER_H_
|
||||
#define _EPAIRSWRAPPER_H_
|
||||
|
||||
class CEpairsWrapper : public IEpair
|
||||
{
|
||||
public:
|
||||
int refCount;
|
||||
entity_t *m_pEnt;
|
||||
virtual void IncRef() { refCount++; }
|
||||
virtual void DecRef() { refCount--; if (refCount <= 0) delete this; }
|
||||
CEpairsWrapper() { refCount = 0; }
|
||||
CEpairsWrapper( entity_t* ep ) { refCount = 0; m_pEnt = ep; }
|
||||
virtual ~CEpairsWrapper() { }
|
||||
virtual void GetVectorForKey( char* key, vec3_t vec );
|
||||
virtual float FloatForKey( char *key );
|
||||
virtual char* ValueForKey( char *key );
|
||||
virtual void SetKeyValue( char *key, char *value );
|
||||
virtual void GetEntityOrigin( vec3_t vec );
|
||||
virtual void CalculateRotatedBounds( vec3_t mins, vec3_t maxs );
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define Reg1 register
|
||||
int match(char *mask, char *name)
|
||||
{
|
||||
Reg1 unsigned char *m = (unsigned char *)mask, *n = (unsigned char *)name;
|
||||
char *ma = mask, *na = name;
|
||||
int wild = 0, q = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (*m == '*')
|
||||
{
|
||||
while (*m == '*')
|
||||
m++;
|
||||
wild = 1;
|
||||
ma = (char *)m;
|
||||
na = (char *)n;
|
||||
}
|
||||
|
||||
if (!*m)
|
||||
{
|
||||
if (!*n)
|
||||
return 0;
|
||||
for (m--; (m > (unsigned char *)mask) && (*m == '?'); m--)
|
||||
;
|
||||
if ((*m == '*') && (m > (unsigned char *)mask) &&
|
||||
(m[-1] != '\\'))
|
||||
return 0;
|
||||
if (!wild)
|
||||
return 1;
|
||||
m = (unsigned char *)ma;
|
||||
n = (unsigned char *)++na;
|
||||
}
|
||||
else if (!*n)
|
||||
{
|
||||
while(*m == '*')
|
||||
m++;
|
||||
return (*m != 0);
|
||||
}
|
||||
if ((*m == '\\') && ((m[1] == '*') || (m[1] == '?')))
|
||||
{
|
||||
m++;
|
||||
q = 1;
|
||||
}
|
||||
else
|
||||
q = 0;
|
||||
|
||||
if ((tolower(*m) != tolower(*n)) && ((*m != '?') || q))
|
||||
{
|
||||
if (!wild)
|
||||
return 1;
|
||||
m = (unsigned char *)ma;
|
||||
n = (unsigned char *)++na;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*m)
|
||||
m++;
|
||||
if (*n)
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef _FNMATCH_H
|
||||
#define _FNMATCH_H
|
||||
|
||||
int match(char *mask, char *name);
|
||||
|
||||
#endif /* fnmatch.h */
|
|
@ -1,175 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// FindTextureDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "FindTextureDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFindTextureDlg dialog
|
||||
|
||||
CFindTextureDlg g_TexFindDlg;
|
||||
CFindTextureDlg& g_dlgFind = g_TexFindDlg;
|
||||
static bool g_bFindActive = true;
|
||||
|
||||
void CFindTextureDlg::updateTextures(const char *p)
|
||||
{
|
||||
if (isOpen())
|
||||
{
|
||||
if (g_bFindActive)
|
||||
{
|
||||
setFindStr(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
setReplaceStr(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFindTextureDlg::CFindTextureDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CFindTextureDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CFindTextureDlg)
|
||||
m_bSelectedOnly = FALSE;
|
||||
m_strFind = _T("");
|
||||
m_strReplace = _T("");
|
||||
m_bForce = FALSE;
|
||||
m_bLive = TRUE;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CFindTextureDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CFindTextureDlg)
|
||||
DDX_Check(pDX, IDC_CHECK_SELECTED, m_bSelectedOnly);
|
||||
DDX_Text(pDX, IDC_EDIT_FIND, m_strFind);
|
||||
DDX_Text(pDX, IDC_EDIT_REPLACE, m_strReplace);
|
||||
DDX_Check(pDX, IDC_CHECK_FORCE, m_bForce);
|
||||
DDX_Check(pDX, IDC_CHECK_LIVE, m_bLive);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFindTextureDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CFindTextureDlg)
|
||||
ON_BN_CLICKED(ID_BTN_APPLY, OnBtnApply)
|
||||
ON_EN_SETFOCUS(IDC_EDIT_FIND, OnSetfocusEditFind)
|
||||
ON_EN_SETFOCUS(IDC_EDIT_REPLACE, OnSetfocusEditReplace)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CFindTextureDlg::OnBtnApply()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
CRect rct;
|
||||
GetWindowRect(rct);
|
||||
SaveRegistryInfo("Radiant::TextureFindWindow", &rct, sizeof(rct));
|
||||
FindReplaceTextures(m_strFind, m_strReplace, m_bSelectedOnly, m_bForce);
|
||||
}
|
||||
|
||||
void CFindTextureDlg::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
CRect rct;
|
||||
GetWindowRect(rct);
|
||||
SaveRegistryInfo("Radiant::TextureFindWindow", &rct, sizeof(rct));
|
||||
FindReplaceTextures(m_strFind, m_strReplace, m_bSelectedOnly, m_bForce);
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CFindTextureDlg::show()
|
||||
{
|
||||
if (g_dlgFind.GetSafeHwnd() == NULL || IsWindow(g_dlgFind.GetSafeHwnd()) == FALSE)
|
||||
{
|
||||
g_dlgFind.Create(IDD_DIALOG_FINDREPLACE);
|
||||
g_dlgFind.ShowWindow(SW_SHOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dlgFind.ShowWindow(SW_SHOW);
|
||||
}
|
||||
CRect rct;
|
||||
LONG lSize = sizeof(rct);
|
||||
if (LoadRegistryInfo("Radiant::TextureFindWindow", &rct, &lSize))
|
||||
g_dlgFind.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
|
||||
bool CFindTextureDlg::isOpen()
|
||||
{
|
||||
return (g_dlgFind.GetSafeHwnd() == NULL || ::IsWindowVisible(g_dlgFind.GetSafeHwnd()) == FALSE) ? false : true;
|
||||
}
|
||||
|
||||
void CFindTextureDlg::setFindStr(const char * p)
|
||||
{
|
||||
g_dlgFind.UpdateData(TRUE);
|
||||
if (g_dlgFind.m_bLive)
|
||||
{
|
||||
g_dlgFind.m_strFind = p;
|
||||
g_dlgFind.UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void CFindTextureDlg::setReplaceStr(const char * p)
|
||||
{
|
||||
g_dlgFind.UpdateData(TRUE);
|
||||
if (g_dlgFind.m_bLive)
|
||||
{
|
||||
g_dlgFind.m_strReplace = p;
|
||||
g_dlgFind.UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFindTextureDlg::OnCancel()
|
||||
{
|
||||
CRect rct;
|
||||
GetWindowRect(rct);
|
||||
SaveRegistryInfo("Radiant::TextureFindWindow", &rct, sizeof(rct));
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
BOOL CFindTextureDlg::DestroyWindow()
|
||||
{
|
||||
return CDialog::DestroyWindow();
|
||||
}
|
||||
|
||||
void CFindTextureDlg::OnSetfocusEditFind()
|
||||
{
|
||||
g_bFindActive = true;
|
||||
}
|
||||
|
||||
void CFindTextureDlg::OnSetfocusEditReplace()
|
||||
{
|
||||
g_bFindActive = false;
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_FINDTEXTUREDLG_H__34B75D32_9F3A_11D1_B570_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_FINDTEXTUREDLG_H__34B75D32_9F3A_11D1_B570_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// FindTextureDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFindTextureDlg dialog
|
||||
|
||||
class CFindTextureDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
static void setReplaceStr(const char* p);
|
||||
static void setFindStr(const char* p);
|
||||
static bool isOpen();
|
||||
static void show();
|
||||
static void updateTextures(const char* p);
|
||||
CFindTextureDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CFindTextureDlg)
|
||||
enum { IDD = IDD_DIALOG_FINDREPLACE };
|
||||
BOOL m_bSelectedOnly;
|
||||
CString m_strFind;
|
||||
CString m_strReplace;
|
||||
BOOL m_bForce;
|
||||
BOOL m_bLive;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CFindTextureDlg)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CFindTextureDlg)
|
||||
afx_msg void OnBtnApply();
|
||||
virtual void OnOK();
|
||||
virtual void OnCancel();
|
||||
afx_msg void OnSetfocusEditFind();
|
||||
afx_msg void OnSetfocusEditReplace();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_FINDTEXTUREDLG_H__34B75D32_9F3A_11D1_B570_00AA00A410FC__INCLUDED_)
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// This .h file contains constants, typedefs, etc. for Intergraph
|
||||
// extensions to OpenGL. These extensions are:
|
||||
//
|
||||
// Multiple Palette Extension
|
||||
// Texture Object Extension
|
||||
|
||||
#define GL_INGR_multiple_palette 1
|
||||
#define GL_EXT_texture_object 1
|
||||
|
||||
|
||||
// New constants and typedefs for the Multiple Palette Extension
|
||||
#define GL_PALETTE_INGR 0x80c0
|
||||
#define GL_MAX_PALETTES_INGR 0x80c1
|
||||
#define GL_MAX_PALETTE_ENTRIES_INGR 0x80c2
|
||||
#define GL_CURRENT_PALETTE_INGR 0x80c3
|
||||
#define GL_PALETTE_WRITEMASK_INGR 0x80c4
|
||||
#define GL_CURRENT_RASTER_PALETTE_INGR 0x80c5
|
||||
#define GL_PALETTE_CLEAR_VALUE_INGR 0x80c6
|
||||
|
||||
// Function prototypes for the Multiple Palette Extension routines
|
||||
typedef void (APIENTRY *PALETTEFUNCPTR)(GLuint);
|
||||
typedef void (APIENTRY *PALETTEMASKFUNCPTR)(GLboolean);
|
||||
typedef void (APIENTRY *WGLLOADPALETTEFUNCPTR)(GLuint, GLsizei, GLuint *);
|
||||
typedef void (APIENTRY *CLEARPALETTEFUNCPTR)(GLuint);
|
||||
|
||||
|
||||
// New Constants and typedefs for the Texture Object Extension
|
||||
#define GL_TEXTURE_PRIORITY_EXT 0x8066
|
||||
#define GL_TEXTURE_RESIDENT_EXT 0x8067
|
||||
#define GL_TEXTURE_1D_BINDING_EXT 0x8068
|
||||
#define GL_TEXTURE_2D_BINDING_EXT 0x8069
|
||||
|
||||
// Function prototypes for the Texture Object Extension routines
|
||||
typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
|
||||
const GLboolean *);
|
||||
typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
|
||||
typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
|
||||
typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
|
||||
typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint);
|
||||
typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
|
||||
const GLclampf *);
|
||||
|
||||
|
||||
/* OpenGL ExtEscape escape function constants */
|
||||
#ifndef OPENGL_GETINFO
|
||||
#define OPENGL_GETINFO 4353 /* for OpenGL ExtEscape */
|
||||
#endif
|
||||
|
||||
// OPENGL_GETINFO ExtEscape sub-escape numbers. They are defined by
|
||||
// Microsoft.
|
||||
|
||||
#ifndef OPENGL_GETINFO_DRVNAME
|
||||
|
||||
#define OPENGL_GETINFO_DRVNAME 0
|
||||
|
||||
|
||||
// Input structure for OPENGL_GETINFO ExtEscape.
|
||||
|
||||
typedef struct _OPENGLGETINFO
|
||||
{
|
||||
ULONG ulSubEsc;
|
||||
} OPENGLGETINFO, *POPENGLGETINFO;
|
||||
|
||||
|
||||
// Output structure for OPENGL_GETINFO_DRVNAME ExtEscape.
|
||||
|
||||
typedef struct _GLDRVNAMERET
|
||||
{
|
||||
ULONG ulVersion; // must be 1 for this version
|
||||
ULONG ulDriverVersion; // driver specific version number
|
||||
WCHAR awch[MAX_PATH+1];
|
||||
} GLDRVNAMERET, *PGLDRVNAMERET;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.1.4.2.1 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/02/04 22:59:34 $
|
||||
// $log$
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:26 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.2 1999/11/22 17:46:45 Timo & Christine
|
||||
// merged EARadiant into the main tree
|
||||
// bug fixes for Q3Plugin / EAPlugin
|
||||
// export for Robert
|
||||
//
|
||||
// Revision 1.1.4.1 1999/11/03 20:37:59 Timo & Christine
|
||||
// MEAN plugin for Q3Radiant, alpha version
|
||||
//
|
||||
// Revision 1.1.2.1 1999/10/27 08:34:26 Timo & Christine
|
||||
// preview version of the texture tools plugin is ready
|
||||
// ( TexTool.dll plugin is in Q3Plugin module )
|
||||
// plugins can draw in their own window using Radiant's qgl bindings
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Quick interface hack for selected face interface
|
||||
// this one really needs more work, but I'm in a hurry with TexTool
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// stores objects that want to be hooked into drawing in the XY window
|
||||
//++timo TODO: add support for camera view, Z view ... (texture view?)
|
||||
CPtrArray l_GLWindows;
|
||||
|
||||
int WINAPI QERApp_ISelectedFace_GetTextureNumber()
|
||||
{
|
||||
if (g_ptrSelectedFaces.GetSize() > 0)
|
||||
{
|
||||
face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(0));
|
||||
return selFace->d_texture->texture_number;
|
||||
}
|
||||
//++timo hu ? find the appropriate gl bind number
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WINAPI QERApp_HookXYGLWindow(IGLWindow* pGLW)
|
||||
{
|
||||
l_GLWindows.Add( pGLW );
|
||||
pGLW->IncRef();
|
||||
}
|
||||
|
||||
void WINAPI QERApp_UnHookGLWindow(IGLWindow* pGLW)
|
||||
{
|
||||
for( int i = 0; i < l_GLWindows.GetSize(); i++ )
|
||||
{
|
||||
if (l_GLWindows.GetAt(i) == pGLW)
|
||||
{
|
||||
l_GLWindows.RemoveAt(i);
|
||||
pGLW->DecRef();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
Sys_Printf("ERROR: IGLWindow* not found in QERApp_UnHookGLWindow\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void DrawPluginEntities( VIEWTYPE vt )
|
||||
{
|
||||
for(int i = 0; i<l_GLWindows.GetSize(); i++ )
|
||||
static_cast<IGLWindow*>(l_GLWindows.GetAt(i))->Draw( vt );
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef _WIN32
|
||||
# error You should not be including this file on this platform
|
||||
#endif
|
||||
|
||||
#ifndef __GLW_WIN_H__
|
||||
#define __GLW_WIN_H__
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HINSTANCE hInstance;
|
||||
void *wndproc;
|
||||
|
||||
HDC hDC; // handle to device context
|
||||
HWND hWnd; // handle to window
|
||||
HGLRC hGLRC; // handle to GL rendering context
|
||||
|
||||
HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library
|
||||
|
||||
qboolean minidriver;
|
||||
qboolean allowdisplaydepthchange;
|
||||
qboolean mcd_accelerated;
|
||||
|
||||
FILE *log_fp;
|
||||
} glwstate_t;
|
||||
|
||||
extern glwstate_t glw_state;
|
||||
|
||||
#endif
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// GroupBar.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "GroupBar.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGroupBar dialog
|
||||
|
||||
|
||||
CGroupBar::CGroupBar(CWnd* pParent /*=NULL*/)
|
||||
: CDialogBar()
|
||||
{
|
||||
//{{AFX_DATA_INIT(CGroupBar)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CGroupBar::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogBar::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CGroupBar)
|
||||
DDX_Control(pDX, IDC_COMBO_GROUPS, m_wndGroupList);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGroupBar, CDialogBar)
|
||||
//{{AFX_MSG_MAP(CGroupBar)
|
||||
ON_BN_CLICKED(IDC_BTN_ADDGROUP, OnBtnAddgroup)
|
||||
ON_BN_CLICKED(IDC_BTN_LISTGROUPS, OnBtnListgroups)
|
||||
ON_BN_CLICKED(IDC_BTN_REMOVEGROUP, OnBtnRemovegroup)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGroupBar message handlers
|
||||
|
||||
void CGroupBar::OnBtnAddgroup()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
}
|
||||
|
||||
void CGroupBar::OnBtnListgroups()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
}
|
||||
|
||||
void CGroupBar::OnBtnRemovegroup()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_GROUPBAR_H__926379A9_F46B_4E81_AD23_71BDDF55BDB3__INCLUDED_)
|
||||
#define AFX_GROUPBAR_H__926379A9_F46B_4E81_AD23_71BDDF55BDB3__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// GroupBar.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGroupBar dialog
|
||||
|
||||
class CGroupBar : public CDialogBar
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CGroupBar(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CGroupBar)
|
||||
enum { IDD = IDD_GROUPBAR };
|
||||
CComboBox m_wndGroupList;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CGroupBar)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CGroupBar)
|
||||
afx_msg void OnBtnAddgroup();
|
||||
afx_msg void OnBtnListgroups();
|
||||
afx_msg void OnBtnRemovegroup();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_GROUPBAR_H__926379A9_F46B_4E81_AD23_71BDDF55BDB3__INCLUDED_)
|
|
@ -1,655 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// GroupDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "GroupDlg.h"
|
||||
#include "NameDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define IMG_PATCH 0
|
||||
#define IMG_BRUSH 1
|
||||
#define IMG_GROUP 2
|
||||
#define IMG_ENTITY 3
|
||||
#define IMG_ENTITYGROUP 4
|
||||
#define IMG_MODEL 5
|
||||
#define IMG_SCRIPT 6
|
||||
|
||||
// misc group support
|
||||
#define MAX_GROUPS 4096
|
||||
#define GROUP_DELIMETER '@'
|
||||
#define GROUPNAME "QER_Group_%i"
|
||||
|
||||
CGroupDlg g_wndGroup;
|
||||
CGroupDlg *g_pGroupDlg = &g_wndGroup;
|
||||
|
||||
// group_t are loaded / saved through "group_info" entities
|
||||
// they hold epairs for group settings and additionnal access info (tree nodes)
|
||||
group_t *g_pGroups = NULL;
|
||||
|
||||
void Group_Add(entity_t *e)
|
||||
{
|
||||
group_t *g = (group_t*)qmalloc(sizeof(group_t));
|
||||
g->epairs = e->epairs;
|
||||
g->next = NULL;
|
||||
e->epairs = NULL;
|
||||
// create a new group node
|
||||
HTREEITEM hItem = g_wndGroup.m_wndTree.GetSelectedItem();
|
||||
TVINSERTSTRUCT tvInsert;
|
||||
memset(&tvInsert, 0, sizeof(TVINSERTSTRUCT));
|
||||
tvInsert.item.iImage = IMG_GROUP;
|
||||
tvInsert.item.iSelectedImage = tvInsert.item.iImage;
|
||||
//++timo wasat?
|
||||
// tvInsert.hParent = (hItem) ? hItem : m_hWorld;
|
||||
tvInsert.hParent = g_wndGroup.m_hWorld;
|
||||
tvInsert.hInsertAfter = NULL;
|
||||
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
char *pipo = ValueForKey(e->epairs, "group");
|
||||
tvInsert.item.pszText = _T(ValueForKey(g->epairs, "group"));
|
||||
g->itemOwner = g_wndGroup.m_wndTree.InsertItem(&tvInsert);
|
||||
g->next = g_pGroups;
|
||||
g_pGroups = g;
|
||||
}
|
||||
|
||||
group_t* Group_Alloc(char *name)
|
||||
{
|
||||
group_t *g = (group_t*)qmalloc(sizeof(group_t));
|
||||
SetKeyValue( g->epairs, "group", name );
|
||||
return g;
|
||||
}
|
||||
|
||||
group_t* Group_ForName(const char * name)
|
||||
{
|
||||
group_t *g = g_pGroups;
|
||||
while (g != NULL)
|
||||
{
|
||||
if (strcmp( ValueForKey(g->epairs,"group"), name ) == 0)
|
||||
break;
|
||||
g = g->next;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
void Group_AddToItem(brush_t *b, HTREEITEM item)
|
||||
{
|
||||
char cBuff[1024];
|
||||
int nImage = IMG_BRUSH;
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const char *pName = NULL;
|
||||
const char *pNamed = Brush_GetKeyValue(b, "name");
|
||||
|
||||
if (!b->owner || (b->owner == world_entity))
|
||||
{
|
||||
if (b->patchBrush)
|
||||
{
|
||||
pName = "Generic Patch";
|
||||
nImage = IMG_PATCH;
|
||||
}
|
||||
else
|
||||
{
|
||||
pName = "Generic Brush";
|
||||
nImage = IMG_BRUSH;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pName = b->owner->eclass->name;
|
||||
if (b->owner->eclass->fixedsize)
|
||||
{
|
||||
nImage = IMG_ENTITY;
|
||||
}
|
||||
else
|
||||
{
|
||||
nImage = IMG_ENTITYGROUP;
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(cBuff, pName);
|
||||
|
||||
TVINSERTSTRUCT tvInsert;
|
||||
memset(&tvInsert, 0, sizeof(TVINSERTSTRUCT));
|
||||
tvInsert.item.iImage = (b->patchBrush) ? IMG_PATCH : IMG_BRUSH;
|
||||
tvInsert.item.iSelectedImage = tvInsert.item.iImage;
|
||||
tvInsert.hParent = item;
|
||||
tvInsert.hInsertAfter = NULL;
|
||||
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
tvInsert.item.pszText = cBuff;
|
||||
HTREEITEM itemNew = g_pGroupDlg->m_wndTree.InsertItem(&tvInsert);
|
||||
g_pGroupDlg->m_wndTree.SetItemData(itemNew, reinterpret_cast<DWORD>(b));
|
||||
b->itemOwner = itemNew;
|
||||
g_pGroupDlg->m_wndTree.RedrawWindow();
|
||||
|
||||
}
|
||||
|
||||
void Group_RemoveBrush(brush_t *b)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (b->itemOwner)
|
||||
{
|
||||
g_pGroupDlg->m_wndTree.DeleteItem(b->itemOwner);
|
||||
b->itemOwner = NULL;
|
||||
g_pGroupDlg->m_wndTree.RedrawWindow();
|
||||
}
|
||||
DeleteKey(b->epairs, "group");
|
||||
}
|
||||
|
||||
void Group_AddToWorld(brush_t *b)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
HTREEITEM itemParent = g_pGroupDlg->m_wndTree.GetRootItem();
|
||||
Group_AddToItem(b, itemParent);
|
||||
}
|
||||
|
||||
void Group_AddToProperGroup(brush_t *b)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// NOTE: we do a local copy of the "group" key because it gets erased by Group_RemoveBrush
|
||||
const char *pGroup = Brush_GetKeyValue(b, "group");
|
||||
// remove the entry in the tree if there's one
|
||||
if (b->itemOwner)
|
||||
{
|
||||
g_pGroupDlg->m_wndTree.DeleteItem(b->itemOwner);
|
||||
b->itemOwner = NULL;
|
||||
g_pGroupDlg->m_wndTree.RedrawWindow();
|
||||
}
|
||||
|
||||
if (*pGroup != 0)
|
||||
{
|
||||
// find the item
|
||||
group_t *g = Group_ForName(pGroup);
|
||||
if (g)
|
||||
Group_AddToItem(b, g->itemOwner);
|
||||
#ifdef _DEBUG
|
||||
else
|
||||
Sys_Printf("WARNING: unexpected Group_ForName not found in Group_AddToProperGroup\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Group_AddToWorld(b);
|
||||
}
|
||||
}
|
||||
|
||||
void Group_AddToSelected(brush_t *b)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
HTREEITEM hItem = g_pGroupDlg->m_wndTree.GetSelectedItem();
|
||||
if (hItem == NULL)
|
||||
{
|
||||
hItem = g_pGroupDlg->m_wndTree.GetRootItem();
|
||||
}
|
||||
Group_AddToItem(b, hItem);
|
||||
}
|
||||
|
||||
void Group_Save(FILE *f)
|
||||
{
|
||||
group_t *g = g_pGroups;
|
||||
while (g)
|
||||
{
|
||||
fprintf(f,"{\n\"classname\" \"group_info\"\n\"group\" \"%s\"\n}\n", ValueForKey( g->epairs, "group" ));
|
||||
g = g->next;
|
||||
}
|
||||
}
|
||||
|
||||
void Group_Init()
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// start by cleaning everything
|
||||
// clean the groups
|
||||
//++timo FIXME: we leak, delete the groups on the way (I don't have time to do it now)
|
||||
#ifdef _DEBUG
|
||||
Sys_Printf("TODO: fix leak in Group_Init\n");
|
||||
#endif
|
||||
group_t *g = g_pGroups;
|
||||
while (g)
|
||||
{
|
||||
epair_t *ep,*enext;
|
||||
for (ep = g->epairs ; ep ; ep=enext )
|
||||
{
|
||||
enext = ep->next;
|
||||
free (ep->key);
|
||||
free (ep->value);
|
||||
free (ep);
|
||||
}
|
||||
g = g->next;
|
||||
}
|
||||
g_pGroups = NULL;
|
||||
g_wndGroup.m_wndTree.DeleteAllItems();
|
||||
TVINSERTSTRUCT tvInsert;
|
||||
memset(&tvInsert, 0, sizeof(TVINSERTSTRUCT));
|
||||
tvInsert.hParent = NULL;
|
||||
tvInsert.hInsertAfter = NULL;
|
||||
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
tvInsert.item.pszText = _T("World");
|
||||
tvInsert.item.iImage = IMG_GROUP;
|
||||
tvInsert.item.iSelectedImage = IMG_GROUP;
|
||||
HTREEITEM hWorld = g_wndGroup.m_wndTree.InsertItem(&tvInsert);
|
||||
// walk through all the brushes, remove the itemOwner key and add them back where they belong
|
||||
brush_t *b;
|
||||
for (b = active_brushes.next; b != &active_brushes; b = b->next)
|
||||
{
|
||||
b->itemOwner = NULL;
|
||||
Group_AddToProperGroup(b);
|
||||
}
|
||||
for (b = selected_brushes.next ; b != &selected_brushes ; b = b->next)
|
||||
{
|
||||
b->itemOwner = NULL;
|
||||
Group_AddToProperGroup(b);
|
||||
}
|
||||
}
|
||||
|
||||
// scan through world_entity for groups in this map?
|
||||
// we use GROUPNAME "QER_group_%i" to look for existing groups and their naming
|
||||
//++timo FIXME: is this actually needed for anything?
|
||||
void Group_GetListFromWorld(CStringArray *pArray)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (world_entity == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pArray->RemoveAll();
|
||||
char cBuff[1024];
|
||||
for (int i =0; i < MAX_GROUPS; i++)
|
||||
{
|
||||
sprintf(cBuff, GROUPNAME, i);
|
||||
char *pGroup = ValueForKey(world_entity, cBuff);
|
||||
if (pGroup && strlen(pGroup) > 0)
|
||||
{
|
||||
pArray->Add(pGroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Group_RemoveListFromWorld()
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CStringArray array;
|
||||
Group_GetListFromWorld(&array);
|
||||
int nCount = array.GetSize();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
DeleteKey(world_entity, array.GetAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void Group_SetListToWorld(CStringArray *pArray)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
char cBuff[1024];
|
||||
Group_RemoveListFromWorld();
|
||||
int nCount = pArray->GetSize();
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
sprintf(cBuff, GROUPNAME, i);
|
||||
SetKeyValue(world_entity, cBuff, pArray->GetAt(i));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
int CountChar(const char *p, char c)
|
||||
{
|
||||
int nCount = 0;
|
||||
int nLen = strlen(p)-1;
|
||||
while (nLen-- >= 0)
|
||||
{
|
||||
if (p[nLen] == c)
|
||||
{
|
||||
nCount++;
|
||||
}
|
||||
}
|
||||
return nCount;
|
||||
}
|
||||
|
||||
/*
|
||||
// this is not very efficient but should get the job done
|
||||
// as our trees should never be too big
|
||||
void Group_BuildTree(CTreeCtrl *pTree)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CStringArray array;
|
||||
int i;
|
||||
CString strTemp;
|
||||
CString strRight;
|
||||
|
||||
//++timo WARNING: this is very dangerous! delete all tree items, without checking the brushes
|
||||
pTree->DeleteAllItems();
|
||||
TVINSERTSTRUCT tvInsert;
|
||||
memset(&tvInsert, 0, sizeof(TVINSERTSTRUCT));
|
||||
tvInsert.hParent = NULL;
|
||||
tvInsert.hInsertAfter = NULL;
|
||||
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
tvInsert.item.pszText = _T("World");
|
||||
tvInsert.item.iImage = IMG_GROUP;
|
||||
tvInsert.item.iSelectedImage = IMG_GROUP;
|
||||
HTREEITEM hWorld = pTree->InsertItem(&tvInsert);
|
||||
|
||||
Group_GetListFromWorld(&array);
|
||||
|
||||
// groups use @ to delimit levels, the number of @ signs
|
||||
// start with ROOT item
|
||||
// nothing is a peer with world, it is ancestor to everything
|
||||
// expects things in order so first entry should be a 2nd level item
|
||||
HTREEITEM itemParent = pTree->GetRootItem();
|
||||
HTREEITEM itemLast = itemParent;
|
||||
int nCount = array.GetSize();
|
||||
int nLastLevel = 1;
|
||||
for (i = 0; i < nCount; i++)
|
||||
{
|
||||
strTemp = array.GetAt(i);
|
||||
int nLevel = CountChar(strTemp, GROUP_DELIMETER);
|
||||
if (nLevel < nLastLevel)
|
||||
{
|
||||
int nLevelsUp = nLastLevel - nLevel;
|
||||
while (nLevelsUp-- > 0)
|
||||
{
|
||||
itemParent = pTree->GetParentItem(itemParent);
|
||||
}
|
||||
}
|
||||
else if (nLevel > nLastLevel)
|
||||
{
|
||||
itemParent = itemLast;
|
||||
}
|
||||
nLastLevel = nLevel;
|
||||
char *pLast = strrchr(strTemp, GROUP_DELIMETER);
|
||||
pLast++;
|
||||
itemLast = pTree->InsertItem(pLast, itemParent);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void DecomposeSiblingList(const char *p, CStringArray *pArray, CTreeCtrl *pTree, HTREEITEM itemChild)
|
||||
{
|
||||
CString str = p;
|
||||
str += GROUP_DELIMETER;
|
||||
while (itemChild)
|
||||
{
|
||||
CString strAdd = str;
|
||||
strAdd += pTree->GetItemText(itemChild);
|
||||
// do not want to add brushes or things, just groups
|
||||
if (pTree->GetItemData(itemChild) == 0)
|
||||
{
|
||||
pArray->Add(strAdd);
|
||||
}
|
||||
if (pTree->ItemHasChildren(itemChild))
|
||||
{
|
||||
HTREEITEM itemOffspring = pTree->GetChildItem(itemChild);
|
||||
DecomposeSiblingList(strAdd, pArray, pTree, itemOffspring);
|
||||
}
|
||||
itemChild = pTree->GetNextSiblingItem(itemChild);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void Group_DecomposeTree(CTreeCtrl *pTree)
|
||||
{
|
||||
if (!g_qeglobals.m_bBrushPrimitMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CStringArray array;
|
||||
HTREEITEM itemParent = pTree->GetRootItem();
|
||||
if (pTree->ItemHasChildren(itemParent))
|
||||
{
|
||||
HTREEITEM itemChild = pTree->GetChildItem(itemParent);
|
||||
DecomposeSiblingList(pTree->GetItemText(itemParent), &array, pTree, itemChild);
|
||||
}
|
||||
Group_SetListToWorld(&array);
|
||||
}
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGroupDlg dialog
|
||||
|
||||
|
||||
CGroupDlg::CGroupDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CGroupDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CGroupDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CGroupDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CGroupDlg)
|
||||
DDX_Control(pDX, IDC_TREE_GROUP, m_wndTree);
|
||||
DDX_Control(pDX, IDC_BTN_EDIT, m_wndEdit);
|
||||
DDX_Control(pDX, IDC_BTN_DEL, m_wndDel);
|
||||
DDX_Control(pDX, IDC_BTN_ADD, m_wndAdd);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGroupDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CGroupDlg)
|
||||
ON_WM_SIZE()
|
||||
ON_BN_CLICKED(IDC_BTN_ADD, OnBtnAdd)
|
||||
ON_BN_CLICKED(IDC_BTN_DEL, OnBtnDel)
|
||||
ON_BN_CLICKED(IDC_BTN_EDIT, OnBtnEdit)
|
||||
ON_NOTIFY(NM_RCLICK, IDC_TREE_GROUP, OnRclickTreeGroup)
|
||||
ON_NOTIFY(TVN_ENDLABELEDIT, IDC_TREE_GROUP, OnEndlabeleditTreeGroup)
|
||||
ON_NOTIFY(NM_CLICK, IDC_TREE_GROUP, OnClickTreeGroup)
|
||||
ON_NOTIFY(TVN_SETDISPINFO, IDC_TREE_GROUP, OnSetdispinfoTreeGroup)
|
||||
ON_NOTIFY(TVN_BEGINDRAG, IDC_TREE_GROUP, OnBegindragTreeGroup)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGroupDlg message handlers
|
||||
|
||||
void CGroupDlg::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
CRect rct;
|
||||
GetClientRect(rct);
|
||||
|
||||
if ( m_wndAdd.GetSafeHwnd())
|
||||
{
|
||||
//all borders at 4, spacing at 6
|
||||
CRect rctButton;
|
||||
m_wndAdd.GetWindowRect(rctButton);
|
||||
int nWidth = rctButton.Width();
|
||||
int nHeight = rctButton.Height();
|
||||
|
||||
int nTop = rct.Height() - nHeight - 4;
|
||||
|
||||
m_wndAdd.SetWindowPos(NULL, 4, nTop, 0, 0, SWP_NOSIZE);
|
||||
m_wndEdit.SetWindowPos(NULL, 8 + nWidth , nTop, 0, 0, SWP_NOSIZE);
|
||||
m_wndDel.SetWindowPos(NULL, 12 + (nWidth * 2), nTop, 0, 0, SWP_NOSIZE);
|
||||
rct.bottom = nTop;
|
||||
m_wndTree.SetWindowPos(NULL, rct.left + 4, rct.top + 4, rct.Width() - 8, rct.Height() - 8, SWP_SHOWWINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CGroupDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
m_imgList.Create(IDB_BITMAP_GROUPS, 16, 0, ILC_COLOR);
|
||||
m_wndTree.SetImageList(&m_imgList, TVSIL_NORMAL);
|
||||
InitGroups();
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CGroupDlg::InitGroups()
|
||||
{
|
||||
Group_Init();
|
||||
}
|
||||
|
||||
// add a new group, put all selected brushes into the group
|
||||
void CGroupDlg::OnBtnAdd()
|
||||
{
|
||||
CNameDlg dlg("New Group", this);
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
// create a new group node
|
||||
HTREEITEM hItem = m_wndTree.GetSelectedItem();
|
||||
TVINSERTSTRUCT tvInsert;
|
||||
memset(&tvInsert, 0, sizeof(TVINSERTSTRUCT));
|
||||
tvInsert.item.iImage = IMG_GROUP;
|
||||
tvInsert.item.iSelectedImage = tvInsert.item.iImage;
|
||||
//++timo wasat?
|
||||
// tvInsert.hParent = (hItem) ? hItem : m_hWorld;
|
||||
tvInsert.hParent = m_hWorld;
|
||||
tvInsert.hInsertAfter = NULL;
|
||||
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||
tvInsert.item.pszText = _T(dlg.m_strName.GetBuffer(0));
|
||||
// create a new group
|
||||
group_t *g = Group_Alloc( dlg.m_strName.GetBuffer(0) );
|
||||
g->itemOwner = m_wndTree.InsertItem(&tvInsert);
|
||||
g->next = g_pGroups;
|
||||
g_pGroups = g;
|
||||
// now add the selected brushes
|
||||
// NOTE: it would be much faster to give the group_t for adding
|
||||
// but Select_AddToGroup is the standard way for all other cases
|
||||
Select_AddToGroup( dlg.m_strName.GetBuffer(0) );
|
||||
}
|
||||
}
|
||||
|
||||
void CGroupDlg::OnBtnDel()
|
||||
{
|
||||
}
|
||||
|
||||
void CGroupDlg::OnBtnEdit()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL CGroupDlg::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
|
||||
{
|
||||
return CDialog::OnChildNotify(message, wParam, lParam, pLResult);
|
||||
}
|
||||
|
||||
BOOL CGroupDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
|
||||
{
|
||||
return CDialog::OnNotify(wParam, lParam, pResult);
|
||||
}
|
||||
|
||||
void CGroupDlg::OnRclickTreeGroup(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CGroupDlg::OnEndlabeleditTreeGroup(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
|
||||
const char *pText = pTVDispInfo->item.pszText;
|
||||
if (pText && strlen(pText) > 0)
|
||||
{
|
||||
HTREEITEM item = pTVDispInfo->item.hItem;
|
||||
if (m_wndTree.GetRootItem() != item)
|
||||
{
|
||||
m_wndTree.SetItemText(item, pText);
|
||||
if (pTVDispInfo->item.iImage != IMG_GROUP)
|
||||
{
|
||||
// if it is an entity
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Printf("Cannot rename the world\n");
|
||||
}
|
||||
}
|
||||
m_wndTree.RedrawWindow();
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CGroupDlg::OnClickTreeGroup(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CGroupDlg::OnSetdispinfoTreeGroup(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CGroupDlg::OnCancel()
|
||||
{
|
||||
TreeView_EndEditLabelNow(m_wndTree.GetSafeHwnd(), TRUE);
|
||||
}
|
||||
|
||||
void CGroupDlg::OnOK()
|
||||
{
|
||||
TreeView_EndEditLabelNow(m_wndTree.GetSafeHwnd(), FALSE);
|
||||
}
|
||||
|
||||
void CGroupDlg::OnBegindragTreeGroup(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
*pResult = 0;
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_GROUPDLG_H__92368487_9E05_454E_A66F_23A9A94A753B__INCLUDED_)
|
||||
#define AFX_GROUPDLG_H__92368487_9E05_454E_A66F_23A9A94A753B__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// GroupDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CGroupDlg dialog
|
||||
|
||||
class CGroupDlg : public CDialog
|
||||
{
|
||||
CImageList m_imgList;
|
||||
// Construction
|
||||
public:
|
||||
virtual void OnOK();
|
||||
virtual void OnCancel();
|
||||
void InitGroups();
|
||||
CGroupDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
HTREEITEM m_hWorld;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CGroupDlg)
|
||||
enum { IDD = IDD_DLG_GROUP };
|
||||
CTreeCtrl m_wndTree;
|
||||
CButton m_wndEdit;
|
||||
CButton m_wndDel;
|
||||
CButton m_wndAdd;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CGroupDlg)
|
||||
public:
|
||||
virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CGroupDlg)
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnBtnAdd();
|
||||
afx_msg void OnBtnDel();
|
||||
afx_msg void OnBtnEdit();
|
||||
afx_msg void OnRclickTreeGroup(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnEndlabeleditTreeGroup(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnClickTreeGroup(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnSetdispinfoTreeGroup(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnBegindragTreeGroup(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
extern CGroupDlg *g_pGroupDlg;
|
||||
|
||||
|
||||
#endif // !defined(AFX_GROUPDLG_H__92368487_9E05_454E_A66F_23A9A94A753B__INCLUDED_)
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.3 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/01/18 00:43:59 $
|
||||
// $Log: IBSPFrontend.h,v $
|
||||
// Revision 1.3 2000/01/18 00:43:59 ttimo
|
||||
// RC
|
||||
//
|
||||
// Revision 1.2 2000/01/13 00:46:41 ttimo
|
||||
// Merged in patches in / out
|
||||
//
|
||||
// Revision 1.1.1.1.2.1 2000/01/13 00:15:41 ttimo
|
||||
// beta of patches in / out - tested with GenSurf
|
||||
//
|
||||
// Revision 1.1.1.1 2000/01/07 17:17:27 ttimo
|
||||
// initial import of Q3Radiant module
|
||||
//
|
||||
// Revision 1.2 2000/01/07 16:40:09 TBesset
|
||||
// merged from BSP frontend
|
||||
//
|
||||
// Revision 1.1.2.4 2000/01/07 00:16:26 TBesset
|
||||
// frontend ready for public version
|
||||
//
|
||||
// Revision 1.1.2.3 2000/01/04 00:26:58 TBesset
|
||||
// added a LoadPointFile in BSP frontend
|
||||
//
|
||||
// Revision 1.1.2.2 1999/12/31 19:43:20 TBesset
|
||||
// no message
|
||||
//
|
||||
// Revision 1.1.2.1 1999/12/29 16:49:39 TBesset
|
||||
// adding IBSPFrontend to the repository
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// interface for BSP frontends plugins
|
||||
//
|
||||
|
||||
// DONE: - change BSP menu to Q3Build menu ?
|
||||
// DONE: - detect when Q3Build dies ?
|
||||
// DELAYED: - hotkeys !
|
||||
// SUCCESS: - try again getting feedback from Q3Build
|
||||
|
||||
#ifndef __IBSPFRONTEND_H_
|
||||
#define __IBSPFRONTEND_H_
|
||||
|
||||
// define a GUID for this interface so plugins can access and reference it
|
||||
// {8ED6A480-BA5E-11d3-A3E3-0004AC96D4C3}
|
||||
static const GUID QERPlugBSPFrontendTable_GUID =
|
||||
{ 0x8ed6a480, 0xba5e, 0x11d3, { 0xa3, 0xe3, 0x0, 0x4, 0xac, 0x96, 0xd4, 0xc3 } };
|
||||
|
||||
// ask the plugin about the items to show up in the BSP menu
|
||||
typedef char * (WINAPI* PFN_GETBSPMENU) ();
|
||||
// dispatch a BSP menu command
|
||||
typedef void (WINAPI* PFN_DISPATCHBSPCOMMAND) (char *);
|
||||
|
||||
struct _QERPlugBSPFrontendTable
|
||||
{
|
||||
int m_nSize;
|
||||
PFN_GETBSPMENU m_pfnGetBSPMenu;
|
||||
PFN_DISPATCHBSPCOMMAND m_pfnDispatchBSPCommand;
|
||||
};
|
||||
|
||||
// interface provided by Radiant to the plugin
|
||||
// {A2CCF366-BA60-11d3-A3E3-0004AC96D4C3}
|
||||
static const GUID QERAppBSPFrontendTable_GUID =
|
||||
{ 0xa2ccf366, 0xba60, 0x11d3, { 0xa3, 0xe3, 0x0, 0x4, 0xac, 0x96, 0xd4, 0xc3 } };
|
||||
|
||||
typedef char * (WINAPI* PFN_GETMAPNAME) ();
|
||||
typedef void (WINAPI* PFN_LOADPOINTFILE) ();
|
||||
|
||||
struct _QERAppBSPFrontendTable
|
||||
{
|
||||
int m_nSize;
|
||||
PFN_GETMAPNAME m_pfnGetMapName;
|
||||
PFN_LOADPOINTFILE m_pfnLoadPointFile;
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 766 B |
|
@ -1,185 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.1.4 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/01/18 00:17:12 $
|
||||
// $Log: IEpairs.cpp,v $
|
||||
// Revision 1.1.1.4 2000/01/18 00:17:12 ttimo
|
||||
// merging in for RC
|
||||
//
|
||||
// Revision 1.3 2000/01/17 23:53:41 TBesset
|
||||
// ready for merge in sourceforge (RC candidate)
|
||||
//
|
||||
// Revision 1.2 2000/01/07 16:40:10 TBesset
|
||||
// merged from BSP frontend
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:26 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
//
|
||||
// Revision 1.2 1999/11/22 17:46:45 Timo & Christine
|
||||
// merged EARadiant into the main tree
|
||||
// bug fixes for Q3Plugin / EAPlugin
|
||||
// export for Robert
|
||||
//
|
||||
// Revision 1.1.2.1 1999/11/03 20:37:59 Timo & Christine
|
||||
// MEAN plugin for Q3Radiant, alpha version
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// virtual class to allow plugin operations on entities epairs
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
void CEpairsWrapper::GetVectorForKey( char* key, vec3_t vec )
|
||||
{
|
||||
::GetVectorForKey( m_pEnt, key, vec );
|
||||
}
|
||||
|
||||
float CEpairsWrapper::FloatForKey( char *key )
|
||||
{
|
||||
return ::FloatForKey( m_pEnt, key );
|
||||
}
|
||||
|
||||
char* CEpairsWrapper::ValueForKey( char *key )
|
||||
{
|
||||
return ::ValueForKey( m_pEnt, key );
|
||||
}
|
||||
|
||||
void CEpairsWrapper::SetKeyValue( char *key, char *value )
|
||||
{
|
||||
::SetKeyValue( m_pEnt, key, value );
|
||||
}
|
||||
|
||||
void CEpairsWrapper::GetEntityOrigin( vec3_t vec )
|
||||
{
|
||||
VectorCopy( m_pEnt->origin, vec );
|
||||
}
|
||||
|
||||
// taken from Ritual's version of Q3Radiant ( Entity_CalculateRotatedBounds )
|
||||
void CEpairsWrapper::CalculateRotatedBounds( vec3_t mins, vec3_t maxs )
|
||||
{
|
||||
entity_t *ent = m_pEnt;
|
||||
int i;
|
||||
float angle;
|
||||
vec3_t angles;
|
||||
vec3_t forward,right,up;
|
||||
vec3_t rotmins, rotmaxs;
|
||||
float trans[3][3];
|
||||
qboolean changed;
|
||||
char tempangles[ 128 ];
|
||||
|
||||
memset( angles, 0, sizeof(vec3_t) );
|
||||
::GetVectorForKey (ent, "angles", angles);
|
||||
|
||||
changed = false;
|
||||
while ( angles[0] < 0 )
|
||||
{
|
||||
changed = true;
|
||||
angles[0] += 360;
|
||||
}
|
||||
while ( angles[0] > 359 )
|
||||
{
|
||||
changed = true;
|
||||
angles[0] -= 360;
|
||||
}
|
||||
while ( angles[1] < 0 )
|
||||
{
|
||||
changed = true;
|
||||
angles[1] += 360;
|
||||
}
|
||||
while ( angles[1] > 359 )
|
||||
{
|
||||
changed = true;
|
||||
angles[1] -= 360;
|
||||
}
|
||||
while ( angles[2] < 0 )
|
||||
{
|
||||
changed = true;
|
||||
angles[2] += 360;
|
||||
}
|
||||
while ( angles[2] > 359 )
|
||||
{
|
||||
changed = true;
|
||||
angles[2] -= 360;
|
||||
}
|
||||
|
||||
if ( changed )
|
||||
{
|
||||
sprintf( tempangles, "%d %d %d", (int)angles[0], (int)angles[1], (int)angles[2] );
|
||||
::SetKeyValue ( ent, "angles", tempangles );
|
||||
}
|
||||
|
||||
|
||||
angle = ::FloatForKey (ent, "angle");
|
||||
if ( fabs(angle) > 2 )
|
||||
{
|
||||
angles[1] = angle;
|
||||
}
|
||||
else if (angle == -1)
|
||||
{
|
||||
angles[0] = -90;
|
||||
}
|
||||
else if (angle == -2)
|
||||
{
|
||||
angles[0] = 90;
|
||||
}
|
||||
::AngleVectors( angles, forward, right, up );
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
trans[i][0] = forward[i];
|
||||
trans[i][1] = -right[i];
|
||||
trans[i][2] = up[i];
|
||||
}
|
||||
ClearBounds( rotmins, rotmaxs );
|
||||
for ( i = 0; i < 8; i++ )
|
||||
{
|
||||
int j;
|
||||
vec3_t tmp, rottemp;
|
||||
|
||||
if ( i & 1 )
|
||||
tmp[0] = mins[0];
|
||||
else
|
||||
tmp[0] = maxs[0];
|
||||
|
||||
if ( i & 2 )
|
||||
tmp[1] = mins[1];
|
||||
else
|
||||
tmp[1] = maxs[1];
|
||||
|
||||
if ( i & 4 )
|
||||
tmp[2] = mins[2];
|
||||
else
|
||||
tmp[2] = maxs[2];
|
||||
|
||||
for (j=0; j<3 ; j++)
|
||||
{
|
||||
rottemp[j] = DotProduct( tmp, trans[j] );
|
||||
}
|
||||
AddPointToBounds( rottemp, rotmins, rotmaxs );
|
||||
}
|
||||
VectorCopy( rotmins, mins );
|
||||
VectorCopy( rotmaxs, maxs );
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.1.4 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/01/18 00:17:12 $
|
||||
// $Log: IEpairs.h,v $
|
||||
// Revision 1.1.1.4 2000/01/18 00:17:12 ttimo
|
||||
// merging in for RC
|
||||
//
|
||||
// Revision 1.3 2000/01/17 23:53:42 TBesset
|
||||
// ready for merge in sourceforge (RC candidate)
|
||||
//
|
||||
// Revision 1.2 2000/01/07 16:40:10 TBesset
|
||||
// merged from BSP frontend
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:26 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.1.1.1.2.1 1999/12/29 21:39:35 TBesset
|
||||
// updated to update3 from Robert
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:26 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:26 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
//
|
||||
// Revision 1.2 1999/11/22 17:46:45 Timo & Christine
|
||||
// merged EARadiant into the main tree
|
||||
// bug fixes for Q3Plugin / EAPlugin
|
||||
// export for Robert
|
||||
//
|
||||
// Revision 1.1.2.1 1999/11/03 20:37:59 Timo & Christine
|
||||
// MEAN plugin for Q3Radiant, alpha version
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// virtual class to allow plugin operations on entities epairs
|
||||
//
|
||||
|
||||
#ifndef _IEPAIRS_H_
|
||||
#define _IEPAIRS_H_
|
||||
|
||||
class IEpair
|
||||
{
|
||||
public:
|
||||
// Increment the number of references to this object
|
||||
virtual void IncRef () = 0;
|
||||
// Decrement the reference count
|
||||
virtual void DecRef () = 0;
|
||||
virtual void GetVectorForKey( char* key, vec3_t vec ) = 0;
|
||||
virtual float FloatForKey( char *key ) = 0;
|
||||
virtual char* ValueForKey( char *key ) = 0;
|
||||
virtual void SetKeyValue( char *key, char *value ) = 0;
|
||||
virtual void GetEntityOrigin( vec3_t vec ) = 0;
|
||||
// compute the rotated bounds of the BBox based on "angle" and "angles" keys
|
||||
virtual void CalculateRotatedBounds( vec3_t mins, vec3_t maxs ) = 0;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.2.1 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/02/04 22:59:34 $
|
||||
// $Log: IMessaging.h,v $
|
||||
// Revision 1.1.2.1 2000/02/04 22:59:34 ttimo
|
||||
// messaging API preview
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// interface for all-purpose messaging in Radiant
|
||||
|
||||
#ifndef __IMESSAGING_H_
|
||||
#define __IMESSAGING_H_
|
||||
|
||||
// this one can be hooked in the GL window procs for customizing GUI through plugins
|
||||
class IWindowListener
|
||||
{
|
||||
public:
|
||||
// Increment the number of references to this object
|
||||
virtual void IncRef () = 0;
|
||||
// Decrement the reference count
|
||||
virtual void DecRef () = 0;
|
||||
// since Radiant is MFC we don't use a WNDPROC, we wrap the MFC handlers
|
||||
// the handler is called first, if returns false Radiant continues processing
|
||||
//++timo maybe add more later ? OnKeyUp and OnKeyDown for instance
|
||||
//++timo TODO: add handlers everywhere
|
||||
virtual bool OnLButtonDown(UINT nFlags, int x, int y) = 0;
|
||||
virtual bool OnMButtonDown(UINT nFlags, int x, int y) = 0;
|
||||
virtual bool OnRButtonDown(UINT nFlags, int x, int y) = 0;
|
||||
virtual bool OnLButtonUp(UINT nFlags, int x, int y) = 0;
|
||||
virtual bool OnMButtonUp(UINT nFlags, int x, int y) = 0;
|
||||
virtual bool OnRButtonUp(UINT nFlags, int x, int y) = 0;
|
||||
virtual bool OnMouseMove(UINT nFlags, int x, int y) = 0;
|
||||
};
|
||||
|
||||
// various Radiant messages --------
|
||||
// this one holds the total number of supported messages (this is used to allocate structs)
|
||||
#define RADIANT_MSGCOUNT 3
|
||||
// they start with a 0, can be indexed in an array
|
||||
// something was selected / deselected
|
||||
#define RADIANT_SELECTION 0
|
||||
// a brush face was selected / deselected
|
||||
#define RADIANT_SFACE 1
|
||||
// current texture / shader changed
|
||||
#define RADIANT_TEXTURE 2
|
||||
|
||||
// this one can be used to listen for Radiant-specific events
|
||||
class IListener
|
||||
{
|
||||
public:
|
||||
// Increment the number of references to this object
|
||||
virtual void IncRef () = 0;
|
||||
// Decrement the reference count
|
||||
virtual void DecRef () = 0;
|
||||
// message is one of the RADIANT_* consts
|
||||
virtual void DispatchRadiantMsg( int Msg ) = 0;
|
||||
};
|
||||
|
||||
// this one is provided by Radiant, it's a wrapper for some usefull functions
|
||||
class IXYWndWrapper
|
||||
{
|
||||
public:
|
||||
virtual void SnapToGrid( int x1, int y1, vec3_t pt ) = 0;
|
||||
};
|
||||
|
||||
// define a GUID for this interface so plugins can access and reference it
|
||||
// {41FD005C-D36B-11d3-A3E9-0004AC96D4C3}
|
||||
static const GUID QERMessaging_GUID =
|
||||
{ 0x41fd005c, 0xd36b, 0x11d3, { 0xa3, 0xe9, 0x0, 0x4, 0xac, 0x96, 0xd4, 0xc3 } };
|
||||
|
||||
// will hook the given IWindowListener to the XY window and increment the ref count
|
||||
//++timo TODO: add hooking in the CAM view and Z view
|
||||
typedef void (WINAPI* PFN_QERAPP_HOOKWINDOW) (IWindowListener *);
|
||||
// will unhook the given IWindowListener
|
||||
typedef void (WINAPI* PFN_QERAPP_UNHOOKWINDOW) (IWindowListener *);
|
||||
// to retrieve the IXYWndWrapper
|
||||
typedef IXYWndWrapper* (WINAPI* PFN_QERAPP_GETXYWNDWRAPPER) ();
|
||||
|
||||
// will hook a given listener into Radiant listening for the given message and increment ref count
|
||||
// call several times to listen for several messages
|
||||
typedef void (WINAPI* PFN_QERAPP_HOOKLISTENER) (IListener *, int Msg);
|
||||
// will unhook the listener and return the number of messages the given listener was removed from
|
||||
typedef int (WINAPI* PFN_QERAPP_UNHOOKLISTENER)(IListener *);
|
||||
|
||||
struct _QERMessagingTable
|
||||
{
|
||||
int m_nSize;
|
||||
PFN_QERAPP_HOOKWINDOW m_pfnHookWindow;
|
||||
PFN_QERAPP_UNHOOKWINDOW m_pfnUnHookWindow;
|
||||
PFN_QERAPP_GETXYWNDWRAPPER m_pfnGetXYWndWrapper;
|
||||
PFN_QERAPP_HOOKLISTENER m_pfnHookListener;
|
||||
PFN_QERAPP_UNHOOKLISTENER m_pfnUnHookListener;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.1.4 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/01/18 00:17:12 $
|
||||
// $Log: IPluginEntities.h,v $
|
||||
// Revision 1.1.1.4 2000/01/18 00:17:12 ttimo
|
||||
// merging in for RC
|
||||
//
|
||||
// Revision 1.3 2000/01/17 23:53:42 TBesset
|
||||
// ready for merge in sourceforge (RC candidate)
|
||||
//
|
||||
// Revision 1.2 2000/01/07 16:40:10 TBesset
|
||||
// merged from BSP frontend
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.1.1.1.2.1 1999/12/29 21:39:35 TBesset
|
||||
// updated to update3 from Robert
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
|
||||
// Q3Radiant public version
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.2 1999/11/22 17:46:45 Timo & Christine
|
||||
// merged EARadiant into the main tree
|
||||
// bug fixes for Q3Plugin / EAPlugin
|
||||
// export for Robert
|
||||
//
|
||||
// Revision 1.1.2.1 1999/11/03 20:37:59 Timo & Christine
|
||||
// MEAN plugin for Q3Radiant, alpha version
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// _QERPluginEntitiesTable is used by plugins for various plugin entities commands
|
||||
// _QERPlugEntitiesFactory is a set of commands Radiant uses to instanciate plugin entities
|
||||
// next are basics for plugin entities ( interfaces )
|
||||
|
||||
#ifndef __IPLUGINENTITIES_H_
|
||||
#define __IPLUGINENTITIES_H_
|
||||
|
||||
// define a GUID for this interface so plugins can access and reference it
|
||||
// {9613F500-8C7C-11d3-8EF3-C9EB56B6B7BE}
|
||||
static const GUID QERPluginEntitiesTable_GUID =
|
||||
{ 0x9613f500, 0x8c7c, 0x11d3, { 0x8e, 0xf3, 0xc9, 0xeb, 0x56, 0xb6, 0xb7, 0xbe } };
|
||||
|
||||
typedef int (WINAPI* PFN_ECLASSSCANDIR) ( char*, HMODULE );
|
||||
|
||||
struct _QERPluginEntitiesTable
|
||||
{
|
||||
int m_nSize;
|
||||
PFN_ECLASSSCANDIR m_pfnEClassScanDir;
|
||||
};
|
||||
|
||||
// plugin entities
|
||||
class IPluginEntity
|
||||
{
|
||||
public:
|
||||
// Increment the number of references to this object
|
||||
virtual void IncRef () = 0;
|
||||
// Decrement the reference count
|
||||
virtual void DecRef () = 0;
|
||||
// getting bounds of the brush used to select/move the object
|
||||
virtual void GetBounds( vec3_t mins, vec3_t maxs ) = 0;
|
||||
// rendering the object in the camera view
|
||||
virtual void CamRender() = 0;
|
||||
};
|
||||
|
||||
// {DBC6B300-8E4B-11d3-8EF3-BA5E57D56399}
|
||||
static const GUID QERPlugEntitiesFactory_GUID =
|
||||
{ 0xdbc6b300, 0x8e4b, 0x11d3, { 0x8e, 0xf3, 0xba, 0x5e, 0x57, 0xd5, 0x63, 0x99 } };
|
||||
|
||||
typedef IPluginEntity * (WINAPI* PFN_CREATEENTITY) ( eclass_t *, IEpair * );
|
||||
|
||||
struct _QERPlugEntitiesFactory
|
||||
{
|
||||
int m_nSize;
|
||||
PFN_CREATEENTITY m_pfnCreateEntity;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.1.4.2.1 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/02/10 03:00:20 $
|
||||
// $Log: ISelectedFace.h,v $
|
||||
// Revision 1.1.1.4.2.1 2000/02/10 03:00:20 ttimo
|
||||
// adding IShaders.h
|
||||
//
|
||||
// Revision 1.1.1.4 2000/01/18 00:17:12 ttimo
|
||||
// merging in for RC
|
||||
//
|
||||
// Revision 1.3 2000/01/17 23:53:42 TBesset
|
||||
// ready for merge in sourceforge (RC candidate)
|
||||
//
|
||||
// Revision 1.2 2000/01/07 16:40:10 TBesset
|
||||
// merged from BSP frontend
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.1.1.1.2.1 1999/12/29 21:39:35 TBesset
|
||||
// updated to update3 from Robert
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
|
||||
// Q3Radiant public version
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:27 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.2 1999/11/22 17:46:45 Timo & Christine
|
||||
// merged EARadiant into the main tree
|
||||
// bug fixes for Q3Plugin / EAPlugin
|
||||
// export for Robert
|
||||
//
|
||||
// Revision 1.1.4.3 1999/11/15 22:39:40 Timo & Christine
|
||||
// bug fixing / additional features after update 173 from Robert
|
||||
//
|
||||
// Revision 1.1.4.2 1999/11/14 16:26:10 Timo & Christine
|
||||
// first beta of the ritualmap surface plugin
|
||||
//
|
||||
// Revision 1.1.4.1 1999/11/03 20:37:59 Timo & Christine
|
||||
// MEAN plugin for Q3Radiant, alpha version
|
||||
//
|
||||
// Revision 1.1.2.1 1999/10/27 08:34:26 Timo & Christine
|
||||
// preview version of the texture tools plugin is ready
|
||||
// ( TexTool.dll plugin is in Q3Plugin module )
|
||||
// plugins can draw in their own window using Radiant's qgl bindings
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// Quick interface hack for selected face interface
|
||||
// this one really needs more work, but I'm in a hurry with TexTool
|
||||
|
||||
#ifndef __ISELECTEDFACE_H_
|
||||
#define __ISELECTEDFACE_H_
|
||||
|
||||
// define a GUID for this interface so plugins can access and reference it
|
||||
// {5416A2A0-8633-11d3-8EF3-88B61F3A3B12}
|
||||
static const GUID QERSelectedFaceTable_GUID =
|
||||
{ 0x5416a2a0, 0x8633, 0x11d3, { 0x8e, 0xf3, 0x88, 0xb6, 0x1f, 0x3a, 0x3b, 0x12 } };
|
||||
|
||||
//++timo TODO: this interface needs some cleanup with the new texture / shaders interface
|
||||
|
||||
// retrieve the texture number to bind to
|
||||
typedef int (WINAPI* PFN_GETTEXTURENUMBER) ();
|
||||
// winding_t is assumed to have MAX_POINTS_ON_WINDING allocated
|
||||
typedef int (WINAPI* PFN_GETFACEINFO) (_QERFaceData*, winding_t* );
|
||||
// tell editor to update the selected face data
|
||||
typedef int (WINAPI* PFN_SETFACEINFO) (_QERFaceData*);
|
||||
// retrieving some texture information
|
||||
typedef void (WINAPI* PFN_GETTEXTURESIZE) ( int Size[2] );
|
||||
// loading the qtexture_t from the texture name
|
||||
typedef qtexture_t* (WINAPI* PFN_TEXTUREFORNAME) ( const char *name );
|
||||
// straight func pointer to Select_SetTexture
|
||||
// last parameter must be casted to an IPluginTexdef
|
||||
typedef void (WINAPI* PFN_SELECT_SETTEXTURE) (texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef );
|
||||
|
||||
// NOTE: some things in there are not really related to the selected face
|
||||
// having some stuff moved into a textures-dedicated part ?
|
||||
struct _QERSelectedFaceTable
|
||||
{
|
||||
int m_nSize;
|
||||
PFN_GETTEXTURENUMBER m_pfnGetTextureNumber;
|
||||
PFN_GETFACEINFO m_pfnGetFaceInfo;
|
||||
PFN_SETFACEINFO m_pfnSetFaceInfo;
|
||||
PFN_GETTEXTURESIZE m_pfnGetTextureSize;
|
||||
PFN_TEXTUREFORNAME m_pfnTextureForName;
|
||||
PFN_SELECT_SETTEXTURE m_pfnSelect_SetTexture;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.2.2 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/02/24 22:24:45 $
|
||||
// $Log: IShaders.cpp,v $
|
||||
// Revision 1.1.2.2 2000/02/24 22:24:45 ttimo
|
||||
// RC2
|
||||
//
|
||||
// Revision 1.1.2.1 2000/02/11 03:52:30 ttimo
|
||||
// working on the IShader interface
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// implementation of the shaders / textures interface
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
//++timo NOTE: this whole part is evolving on a seperate branch on SourceForge
|
||||
// will eventually turn into a major rewrite of the shader / texture code
|
||||
|
||||
// this is a modified version of Texture_ForName
|
||||
qtexture_t* WINAPI QERApp_TryTextureForName(const char* name)
|
||||
{
|
||||
qtexture_t *q;
|
||||
char filename[1024];
|
||||
for (q=g_qeglobals.d_qtextures ; q ; q=q->next)
|
||||
{
|
||||
if (!strcmp(name, q->filename))
|
||||
return q;
|
||||
}
|
||||
// try loading from file .. this is a copy of the worst part of Texture_ForName
|
||||
char cWork[1024];
|
||||
sprintf (filename, "%s/%s.tga", ValueForKey (g_qeglobals.d_project_entity, "texturepath"), name);
|
||||
QE_ConvertDOSToUnixName( cWork, filename );
|
||||
strcpy(filename, cWork);
|
||||
unsigned char* pPixels = NULL;
|
||||
int nWidth;
|
||||
int nHeight;
|
||||
LoadImage(filename, &pPixels, &nWidth, &nHeight);
|
||||
if (pPixels == NULL)
|
||||
{
|
||||
// try jpg
|
||||
// blatant assumption of .tga should be fine since we sprintf'd it above
|
||||
int nLen = strlen(filename);
|
||||
filename[nLen-3] = 'j';
|
||||
filename[nLen-2] = 'p';
|
||||
filename[nLen-1] = 'g';
|
||||
LoadImage(filename, &pPixels, &nWidth, &nHeight);
|
||||
}
|
||||
if (pPixels)
|
||||
{
|
||||
q = Texture_LoadTGATexture(pPixels, nWidth, nHeight, NULL, 0, 0, 0);
|
||||
//++timo storing the filename .. will be removed by shader code cleanup
|
||||
// this is dirty, and we sure miss some places were we should fill the filename info
|
||||
strcpy( q->filename, name );
|
||||
SetNameShaderInfo(q, filename, name);
|
||||
Sys_Printf ("done.\n", name);
|
||||
free(pPixels);
|
||||
return q;
|
||||
}
|
||||
return NULL;
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.2.3 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/02/24 22:24:45 $
|
||||
// $Log: IShaders.h,v $
|
||||
// Revision 1.1.2.3 2000/02/24 22:24:45 ttimo
|
||||
// RC2
|
||||
//
|
||||
// Revision 1.1.2.2 2000/02/11 03:52:30 ttimo
|
||||
// working on the IShader interface
|
||||
//
|
||||
// Revision 1.1.2.1 2000/02/10 03:00:20 ttimo
|
||||
// adding IShaders.h
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// a set of functions to manipulate textures in Radiant
|
||||
//
|
||||
|
||||
#ifndef __ISHADERS_H_
|
||||
#define __ISHADERS_H_
|
||||
|
||||
// define a GUID for this interface so plugins can access and reference it
|
||||
// {D42F798A-DF57-11d3-A3EE-0004AC96D4C3}
|
||||
static const GUID QERShadersTable_GUID =
|
||||
{ 0xd42f798a, 0xdf57, 0x11d3, { 0xa3, 0xee, 0x0, 0x4, 0xac, 0x96, 0xd4, 0xc3 } };
|
||||
|
||||
//++timo NOTE: global strategy, when there's try before it means .. if the thing can't be found / loaded it will not
|
||||
// create a default one
|
||||
|
||||
//++timo TODO: duplicate _QERFuncTable_1::m_pfnHasShader here?
|
||||
//++timo FIXME: change the names to fit the changes we wanna do in the Radiant shader / textures code
|
||||
//++timo NOTE: for Curry, this shader loading thingy is only provided so that we can update the Radiant texture window?
|
||||
// don't use yet .. will not implement yet
|
||||
// get a shader, load it if needed
|
||||
// returns NULL if shader doesn't exist
|
||||
//++timo will reload the shader if already loaded? .. no, don't do that yet ..
|
||||
//++timo I'm not happy with the name?
|
||||
typedef qtexture_t* (WINAPI* PFN_TRYSHADERFORNAME) (const char* name);
|
||||
// load a texture
|
||||
// will not try loading a shader, will look for the actual image file ..
|
||||
// returns NULL on file not found
|
||||
// NOTE: don't put the .tga or .jpg filetype extension
|
||||
// if returns NULL, it means the texture needs loading, use _QERSelectedFaceTable::m_pfnTextureForName
|
||||
//++timo NOTE: all of this is hacks and workarounds, the shader code rewrite is supposed to solve all issues
|
||||
typedef qtexture_t* (WINAPI* PFN_TRYTEXTUREFORNAME) (const char* filename);
|
||||
|
||||
struct _QERShadersTable
|
||||
{
|
||||
int m_nSize;
|
||||
// currently disabled
|
||||
// PFN_TRYLOADSHADER m_pfnTryLoadShader;
|
||||
PFN_TRYTEXTUREFORNAME m_pfnTryTextureForName;
|
||||
};
|
||||
|
||||
#endif
|
1329
q3radiant/LBMLIB.CPP
1329
q3radiant/LBMLIB.CPP
File diff suppressed because it is too large
Load Diff
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// piclib.h
|
||||
|
||||
|
||||
void LoadLBM (char *filename, byte **picture, byte **palette);
|
||||
void WriteLBMfile (char *filename, byte *data, int width, int height
|
||||
, byte *palette);
|
||||
void LoadPCX (char *filename, byte **picture, byte **palette, int *width, int *height);
|
||||
void WritePCXfile (char *filename, byte *data, int width, int height
|
||||
, byte *palette);
|
||||
|
||||
// loads / saves either lbm or pcx, depending on extension
|
||||
void Load256Image (char *name, byte **pixels, byte **palette,
|
||||
int *width, int *height);
|
||||
void Save256Image (char *name, byte *pixels, byte *palette,
|
||||
int width, int height);
|
||||
|
||||
|
||||
void LoadTGA (char *filename, byte **pixels, int *width, int *height);
|
||||
void LoadImage( const char *name, byte **pic, int *width, int *height );
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// LstToolBar.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "LstToolBar.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLstToolBar
|
||||
|
||||
CLstToolBar::CLstToolBar()
|
||||
{
|
||||
}
|
||||
|
||||
CLstToolBar::~CLstToolBar()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CLstToolBar, CToolBar)
|
||||
//{{AFX_MSG_MAP(CLstToolBar)
|
||||
ON_WM_PARENTNOTIFY()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLstToolBar message handlers
|
||||
|
||||
void CLstToolBar::OnParentNotify(UINT message, LPARAM lParam)
|
||||
{
|
||||
CToolBar::OnParentNotify(message, lParam);
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_LSTTOOLBAR_H__279AAE23_78C5_11D1_B53C_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_LSTTOOLBAR_H__279AAE23_78C5_11D1_B53C_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// LstToolBar.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLstToolBar window
|
||||
|
||||
class CLstToolBar : public CToolBar
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CLstToolBar();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CLstToolBar)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CLstToolBar();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CLstToolBar)
|
||||
afx_msg void OnParentNotify(UINT message, LPARAM lParam);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_LSTTOOLBAR_H__279AAE23_78C5_11D1_B53C_00AA00A410FC__INCLUDED_)
|
1062
q3radiant/MAP.CPP
1062
q3radiant/MAP.CPP
File diff suppressed because it is too large
Load Diff
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// map.h -- the state of the current world that all views are displaying
|
||||
|
||||
extern char currentmap[1024];
|
||||
|
||||
// head/tail of doubly linked lists
|
||||
extern brush_t active_brushes; // brushes currently being displayed
|
||||
extern brush_t selected_brushes; // highlighted
|
||||
|
||||
|
||||
extern CPtrArray& g_ptrSelectedFaces;
|
||||
extern CPtrArray& g_ptrSelectedFaceBrushes;
|
||||
//extern face_t *selected_face;
|
||||
//extern brush_t *selected_face_brush;
|
||||
extern brush_t filtered_brushes; // brushes that have been filtered or regioned
|
||||
|
||||
extern entity_t entities;
|
||||
extern entity_t *world_entity; // the world entity is NOT included in
|
||||
// the entities chain
|
||||
|
||||
extern qboolean modified; // for quit confirmations
|
||||
|
||||
extern vec3_t region_mins, region_maxs;
|
||||
extern qboolean region_active;
|
||||
|
||||
void Map_LoadFile (char *filename);
|
||||
void Map_SaveFile (char *filename, qboolean use_region);
|
||||
void Map_New (void);
|
||||
void Map_BuildBrushData(void);
|
||||
|
||||
void Map_RegionOff (void);
|
||||
void Map_RegionXY (void);
|
||||
void Map_RegionTallBrush (void);
|
||||
void Map_RegionBrush (void);
|
||||
void Map_RegionSelectedBrushes (void);
|
||||
qboolean Map_IsBrushFiltered (brush_t *b);
|
||||
|
||||
void Map_SaveSelected(CMemFile* pMemFile, CMemFile* pPatchFile = NULL);
|
||||
void Map_ImportBuffer (char* buf);
|
|
@ -1,311 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// mathlib.c -- math primitives
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cmdlib.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
vec3_t vec3_origin = {0.0f,0.0f,0.0f};
|
||||
|
||||
|
||||
float VectorLength(vec3_t v)
|
||||
{
|
||||
int i;
|
||||
float length;
|
||||
|
||||
length = 0.0f;
|
||||
for (i=0 ; i< 3 ; i++)
|
||||
length += v[i]*v[i];
|
||||
length = (float)sqrt (length);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
qboolean VectorCompare (vec3_t v1, vec3_t v2)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
if (fabs(v1[i]-v2[i]) > EQUAL_EPSILON)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
vec_t Q_rint (vec_t in)
|
||||
{
|
||||
if (g_PrefsDlg.m_bNoClamp)
|
||||
return in;
|
||||
else
|
||||
return (float)floor (in + 0.5);
|
||||
}
|
||||
|
||||
void VectorMA (vec3_t va, float scale, vec3_t vb, vec3_t vc)
|
||||
{
|
||||
vc[0] = va[0] + scale*vb[0];
|
||||
vc[1] = va[1] + scale*vb[1];
|
||||
vc[2] = va[2] + scale*vb[2];
|
||||
}
|
||||
|
||||
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross)
|
||||
{
|
||||
cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||
cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||
cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||
}
|
||||
|
||||
vec_t _DotProduct (vec3_t v1, vec3_t v2)
|
||||
{
|
||||
return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
|
||||
}
|
||||
|
||||
void _VectorSubtract (vec3_t va, vec3_t vb, vec3_t out)
|
||||
{
|
||||
out[0] = va[0]-vb[0];
|
||||
out[1] = va[1]-vb[1];
|
||||
out[2] = va[2]-vb[2];
|
||||
}
|
||||
|
||||
void _VectorAdd (vec3_t va, vec3_t vb, vec3_t out)
|
||||
{
|
||||
out[0] = va[0]+vb[0];
|
||||
out[1] = va[1]+vb[1];
|
||||
out[2] = va[2]+vb[2];
|
||||
}
|
||||
|
||||
void _VectorCopy (vec3_t in, vec3_t out)
|
||||
{
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = in[2];
|
||||
}
|
||||
|
||||
vec_t VectorNormalize (vec3_t v)
|
||||
{
|
||||
int i;
|
||||
float length;
|
||||
|
||||
length = 0.0f;
|
||||
for (i=0 ; i< 3 ; i++)
|
||||
length += v[i]*v[i];
|
||||
length = (float)sqrt (length);
|
||||
if (length == 0)
|
||||
return (vec_t)0;
|
||||
|
||||
for (i=0 ; i< 3 ; i++)
|
||||
v[i] /= length;
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
void VectorInverse (vec3_t v)
|
||||
{
|
||||
v[0] = -v[0];
|
||||
v[1] = -v[1];
|
||||
v[2] = -v[2];
|
||||
}
|
||||
|
||||
void VectorScale (vec3_t v, vec_t scale, vec3_t out)
|
||||
{
|
||||
out[0] = v[0] * scale;
|
||||
out[1] = v[1] * scale;
|
||||
out[2] = v[2] * scale;
|
||||
}
|
||||
|
||||
|
||||
void VectorRotate (vec3_t vIn, vec3_t vRotation, vec3_t out)
|
||||
{
|
||||
vec3_t vWork, va;
|
||||
VectorCopy(vIn, va);
|
||||
VectorCopy(va, vWork);
|
||||
int nIndex[3][2];
|
||||
nIndex[0][0] = 1; nIndex[0][1] = 2;
|
||||
nIndex[1][0] = 2; nIndex[1][1] = 0;
|
||||
nIndex[2][0] = 0; nIndex[2][1] = 1;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (vRotation[i] != 0)
|
||||
{
|
||||
double dAngle = vRotation[i] * Q_PI / 180.0;
|
||||
double c = cos(dAngle);
|
||||
double s = sin(dAngle);
|
||||
vWork[nIndex[i][0]] = va[nIndex[i][0]] * c - va[nIndex[i][1]] * s;
|
||||
vWork[nIndex[i][1]] = va[nIndex[i][0]] * s + va[nIndex[i][1]] * c;
|
||||
}
|
||||
VectorCopy(vWork, va);
|
||||
}
|
||||
VectorCopy(vWork, out);
|
||||
}
|
||||
|
||||
void VectorRotate (vec3_t vIn, vec3_t vRotation, vec3_t vOrigin, vec3_t out)
|
||||
{
|
||||
vec3_t vTemp, vTemp2;
|
||||
VectorSubtract(vIn, vOrigin, vTemp);
|
||||
VectorRotate(vTemp, vRotation, vTemp2);
|
||||
VectorAdd(vTemp2, vOrigin, out);
|
||||
}
|
||||
|
||||
void VectorPolar(vec3_t v, float radius, float theta, float phi)
|
||||
{
|
||||
v[0]=float(radius * cos(theta) * cos(phi));
|
||||
v[1]=float(radius * sin(theta) * cos(phi));
|
||||
v[2]=float(radius * sin(phi));
|
||||
}
|
||||
|
||||
void VectorSnap(vec3_t v)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
v[i] = floor (v[i] + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void _Vector5Add (vec5_t va, vec5_t vb, vec5_t out)
|
||||
{
|
||||
out[0] = va[0]+vb[0];
|
||||
out[1] = va[1]+vb[1];
|
||||
out[2] = va[2]+vb[2];
|
||||
out[3] = va[3]+vb[3];
|
||||
out[4] = va[4]+vb[4];
|
||||
}
|
||||
|
||||
void _Vector5Scale (vec5_t v, vec_t scale, vec5_t out)
|
||||
{
|
||||
out[0] = v[0] * scale;
|
||||
out[1] = v[1] * scale;
|
||||
out[2] = v[2] * scale;
|
||||
out[3] = v[3] * scale;
|
||||
out[4] = v[4] * scale;
|
||||
}
|
||||
|
||||
void _Vector53Copy (vec5_t in, vec3_t out)
|
||||
{
|
||||
out[0] = in[0];
|
||||
out[1] = in[1];
|
||||
out[2] = in[2];
|
||||
}
|
||||
|
||||
// NOTE: added these from Ritual's Q3Radiant
|
||||
void ClearBounds (vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
mins[0] = mins[1] = mins[2] = 99999;
|
||||
maxs[0] = maxs[1] = maxs[2] = -99999;
|
||||
}
|
||||
|
||||
void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
int i;
|
||||
vec_t val;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
val = v[i];
|
||||
if (val < mins[i])
|
||||
mins[i] = val;
|
||||
if (val > maxs[i])
|
||||
maxs[i] = val;
|
||||
}
|
||||
}
|
||||
|
||||
#define PITCH 0 // up / down
|
||||
#define YAW 1 // left / right
|
||||
#define ROLL 2 // fall over
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
|
||||
{
|
||||
float angle;
|
||||
static float sr, sp, sy, cr, cp, cy;
|
||||
// static to help MS compiler fp bugs
|
||||
|
||||
angle = angles[YAW] * (M_PI*2 / 360);
|
||||
sy = sin(angle);
|
||||
cy = cos(angle);
|
||||
angle = angles[PITCH] * (M_PI*2 / 360);
|
||||
sp = sin(angle);
|
||||
cp = cos(angle);
|
||||
angle = angles[ROLL] * (M_PI*2 / 360);
|
||||
sr = sin(angle);
|
||||
cr = cos(angle);
|
||||
|
||||
if (forward)
|
||||
{
|
||||
forward[0] = cp*cy;
|
||||
forward[1] = cp*sy;
|
||||
forward[2] = -sp;
|
||||
}
|
||||
if (right)
|
||||
{
|
||||
right[0] = -sr*sp*cy+cr*sy;
|
||||
right[1] = -sr*sp*sy-cr*cy;
|
||||
right[2] = -sr*cp;
|
||||
}
|
||||
if (up)
|
||||
{
|
||||
up[0] = cr*sp*cy+sr*sy;
|
||||
up[1] = cr*sp*sy-sr*cy;
|
||||
up[2] = cr*cp;
|
||||
}
|
||||
}
|
||||
|
||||
void VectorToAngles( vec3_t vec, vec3_t angles )
|
||||
{
|
||||
float forward;
|
||||
float yaw, pitch;
|
||||
|
||||
if ( ( vec[ 0 ] == 0 ) && ( vec[ 1 ] == 0 ) )
|
||||
{
|
||||
yaw = 0;
|
||||
if ( vec[ 2 ] > 0 )
|
||||
{
|
||||
pitch = 90;
|
||||
}
|
||||
else
|
||||
{
|
||||
pitch = 270;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yaw = atan2( vec[ 1 ], vec[ 0 ] ) * 180 / M_PI;
|
||||
if ( yaw < 0 )
|
||||
{
|
||||
yaw += 360;
|
||||
}
|
||||
|
||||
forward = ( float )sqrt( vec[ 0 ] * vec[ 0 ] + vec[ 1 ] * vec[ 1 ] );
|
||||
pitch = atan2( vec[ 2 ], forward ) * 180 / M_PI;
|
||||
if ( pitch < 0 )
|
||||
{
|
||||
pitch += 360;
|
||||
}
|
||||
}
|
||||
|
||||
angles[ 0 ] = pitch;
|
||||
angles[ 1 ] = yaw;
|
||||
angles[ 2 ] = 0;
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __MATHLIB__
|
||||
#define __MATHLIB__
|
||||
|
||||
// mathlib.h
|
||||
|
||||
#include <math.h>
|
||||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec3_t[3];
|
||||
typedef vec_t vec5_t[5];
|
||||
|
||||
#define SIDE_FRONT 0
|
||||
#define SIDE_ON 2
|
||||
#define SIDE_BACK 1
|
||||
#define SIDE_CROSS -2
|
||||
|
||||
#define Q_PI 3.14159265358979323846
|
||||
|
||||
extern vec3_t vec3_origin;
|
||||
|
||||
#define EQUAL_EPSILON 0.001
|
||||
|
||||
qboolean VectorCompare (vec3_t v1, vec3_t v2);
|
||||
|
||||
#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2])
|
||||
#define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
|
||||
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
|
||||
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
|
||||
#define VectorSet(v, a, b, c) {v[0]=a;v[1]=b;v[2]=c;}
|
||||
|
||||
vec_t Q_rint (vec_t in);
|
||||
vec_t _DotProduct (vec3_t v1, vec3_t v2);
|
||||
void _VectorSubtract (vec3_t va, vec3_t vb, vec3_t out);
|
||||
void _VectorAdd (vec3_t va, vec3_t vb, vec3_t out);
|
||||
void _VectorCopy (vec3_t in, vec3_t out);
|
||||
|
||||
float VectorLength(vec3_t v);
|
||||
|
||||
void VectorMA (vec3_t va, float scale, vec3_t vb, vec3_t vc);
|
||||
|
||||
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
|
||||
vec_t VectorNormalize (vec3_t v);
|
||||
void VectorInverse (vec3_t v);
|
||||
void VectorScale (vec3_t v, vec_t scale, vec3_t out);
|
||||
void VectorPolar(vec3_t v, float radius, float theta, float phi);
|
||||
void VectorSnap(vec3_t v);
|
||||
|
||||
void _Vector53Copy (vec5_t in, vec3_t out);
|
||||
void _Vector5Scale (vec5_t v, vec_t scale, vec5_t out);
|
||||
void _Vector5Add (vec5_t va, vec5_t vb, vec5_t out);
|
||||
|
||||
// NOTE: added these from Ritual's Q3Radiant
|
||||
void ClearBounds (vec3_t mins, vec3_t maxs);
|
||||
void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs);
|
||||
|
||||
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
|
||||
void VectorToAngles( vec3_t vec, vec3_t angles );
|
||||
#define VectorClear(x) {x[0] = x[1] = x[2] = 0;}
|
||||
|
||||
#define ZERO_EPSILON 1.0E-6
|
||||
#define RAD2DEG( a ) ( ( (a) * 180.0f ) / Q_PI )
|
||||
#define DEG2RAD( a ) ( ( (a) * Q_PI ) / 180.0f )
|
||||
|
||||
|
||||
#endif
|
|
@ -1,671 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//*************************************************************
|
||||
// File name: mru.c
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
// Routines for MRU support
|
||||
//
|
||||
// Development Team:
|
||||
//
|
||||
// Gilles Vollant (100144.2636@compuserve.com)
|
||||
//
|
||||
//*************************************************************
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mru.h"
|
||||
// CreateMruMenu : MRUMENU constructor
|
||||
// wNbLruShowInit : nb of item showed in menu
|
||||
// wNbLruMenuInit : nb of item stored in memory
|
||||
// wMaxSizeLruItemInit : size max. of filename
|
||||
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// CreateMruMenu()
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Allocate and Initialize an MRU and return a pointer on it
|
||||
//
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// WORD wNbLruShowInit - Maximum number of item displayed on menu
|
||||
// WORD wNbLruMenuInit - Maximum number of item stored in memory
|
||||
// WORD wMaxSizeLruItemInit - Maximum size of an item (ie size of pathname)
|
||||
// WORD wIdMruInit - ID of the first item in the menu (default:IDMRU)
|
||||
//
|
||||
//
|
||||
// Return: (LPMRUMENU)
|
||||
//
|
||||
// Pointer on a MRUMENU structure, used by other function
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// wNbLruShowInit <= wNbLruMenuInit
|
||||
//
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
|
||||
LPMRUMENU CreateMruMenu (WORD wNbLruShowInit,
|
||||
WORD wNbLruMenuInit,WORD wMaxSizeLruItemInit,WORD wIdMruInit)
|
||||
{
|
||||
LPMRUMENU lpMruMenu;
|
||||
lpMruMenu = (LPMRUMENU)GlobalAllocPtr(GHND,sizeof(MRUMENU));
|
||||
|
||||
lpMruMenu->wNbItemFill = 0;
|
||||
lpMruMenu->wNbLruMenu = wNbLruMenuInit;
|
||||
lpMruMenu->wNbLruShow = wNbLruShowInit;
|
||||
lpMruMenu->wIdMru = wIdMruInit;
|
||||
lpMruMenu->wMaxSizeLruItem = wMaxSizeLruItemInit;
|
||||
lpMruMenu->lpMRU = (LPSTR)GlobalAllocPtr(GHND,
|
||||
lpMruMenu->wNbLruMenu*(UINT)lpMruMenu->wMaxSizeLruItem);
|
||||
if (lpMruMenu->lpMRU == NULL)
|
||||
{
|
||||
GlobalFreePtr(lpMruMenu);
|
||||
lpMruMenu = NULL;
|
||||
}
|
||||
return lpMruMenu;
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// CreateMruMenuDefault()
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// Allocate and Initialize an MRU and return a pointer on it
|
||||
// Use default parameter
|
||||
//
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
//
|
||||
// Return: (LPMRUMENU)
|
||||
//
|
||||
// Pointer on a MRUMENU structure, used by other function
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
//
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
|
||||
LPMRUMENU CreateMruMenuDefault()
|
||||
{
|
||||
return CreateMruMenu (NBMRUMENUSHOW,NBMRUMENU,MAXSIZEMRUITEM,IDMRU);
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// DeleteMruMenu()
|
||||
//
|
||||
// Purpose:
|
||||
// Destructor :
|
||||
// Clean and free a MRUMENU structure
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU, allocated
|
||||
// by CreateMruMenu() or CreateMruMenuDefault()
|
||||
//
|
||||
//
|
||||
// Return: void
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
//
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
void DeleteMruMenu(LPMRUMENU lpMruMenu)
|
||||
{
|
||||
GlobalFreePtr(lpMruMenu->lpMRU);
|
||||
GlobalFreePtr(lpMruMenu);
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// SetNbLruShow()
|
||||
//
|
||||
// Purpose:
|
||||
// Change the maximum number of item displayed on menu
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// WORD wNbLruShowInit - Maximum number of item displayed on menu
|
||||
//
|
||||
//
|
||||
// Return: void
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
//
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
void SetNbLruShow (LPMRUMENU lpMruMenu,WORD wNbLruShowInit)
|
||||
{
|
||||
lpMruMenu->wNbLruShow = min(wNbLruShowInit,lpMruMenu->wNbLruMenu);
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// SetMenuItem()
|
||||
//
|
||||
// Purpose:
|
||||
// Set the filename of an item
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// WORD wItem - Number of Item to set, zero based
|
||||
// LPSTR lpItem - String, contain the filename of the item
|
||||
//
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// used when load .INI or reg database
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
BOOL SetMenuItem (LPMRUMENU lpMruMenu,WORD wItem,LPSTR lpItem)
|
||||
{
|
||||
if (wItem >= NBMRUMENU)
|
||||
return FALSE;
|
||||
_fstrncpy((lpMruMenu->lpMRU) +
|
||||
((lpMruMenu->wMaxSizeLruItem) * (UINT)wItem),
|
||||
lpItem,lpMruMenu->wMaxSizeLruItem-1);
|
||||
lpMruMenu->wNbItemFill = max(lpMruMenu->wNbItemFill,wItem+1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// GetMenuItem()
|
||||
//
|
||||
// Purpose:
|
||||
// Get the filename of an item
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// WORD wItem - Number of Item to set, zero based
|
||||
// BOOL fIDMBased - TRUE : wItem is based on ID menu item
|
||||
// FALSE : wItem is zero-based
|
||||
// LPSTR lpItem - String where the filename of the item will be
|
||||
// stored by GetMenuItem()
|
||||
// UINT uiSize - Size of the lpItem buffer
|
||||
//
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// Used for saving in .INI or reg database, or when user select
|
||||
// an MRU in File menu
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
BOOL GetMenuItem (LPMRUMENU lpMruMenu,WORD wItem,
|
||||
BOOL fIDMBased,LPSTR lpItem,UINT uiSize)
|
||||
{
|
||||
if (fIDMBased)
|
||||
wItem -= (lpMruMenu->wIdMru + 1);
|
||||
if (wItem >= lpMruMenu->wNbItemFill)
|
||||
return FALSE;
|
||||
_fstrncpy(lpItem,(lpMruMenu->lpMRU) +
|
||||
((lpMruMenu->wMaxSizeLruItem) * (UINT)(wItem)),uiSize);
|
||||
*(lpItem+uiSize-1) = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// AddNewItem()
|
||||
//
|
||||
// Purpose:
|
||||
// Add an item at the begin of the list
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// LPSTR lpItem - String contain the filename to add
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// Used when used open a file (using File Open common
|
||||
// dialog, Drag and drop or MRU)
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
void AddNewItem (LPMRUMENU lpMruMenu,LPSTR lpItem)
|
||||
{
|
||||
WORD i,j;
|
||||
for (i=0;i<lpMruMenu->wNbItemFill;i++)
|
||||
if (lstrcmpi(lpItem,(lpMruMenu->lpMRU) +
|
||||
((lpMruMenu->wMaxSizeLruItem) * (UINT)i)) == 0)
|
||||
{
|
||||
// Shift the other items
|
||||
for (j=i;j>0;j--)
|
||||
lstrcpy((lpMruMenu->lpMRU) + (lpMruMenu->wMaxSizeLruItem * (UINT)j),
|
||||
(lpMruMenu->lpMRU) + (lpMruMenu->wMaxSizeLruItem * (UINT)(j-1)));
|
||||
_fstrncpy(lpMruMenu->lpMRU,lpItem,lpMruMenu->wMaxSizeLruItem-1);
|
||||
return ;
|
||||
}
|
||||
lpMruMenu->wNbItemFill = min(lpMruMenu->wNbItemFill+1,lpMruMenu->wNbLruMenu);
|
||||
for (i=lpMruMenu->wNbItemFill-1;i>0;i--)
|
||||
lstrcpy(lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)i),
|
||||
lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)(i-1)));
|
||||
_fstrncpy(lpMruMenu->lpMRU,lpItem,lpMruMenu->wMaxSizeLruItem-1);
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// DelMenuItem()
|
||||
//
|
||||
// Purpose:
|
||||
// Delete an item
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// WORD wItem - Number of Item to set, zero based
|
||||
// BOOL fIDMBased - TRUE : wItem is based on ID menu item
|
||||
// FALSE : wItem is zero-based
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// Used when used open a file, using MRU, and when an error
|
||||
// occured (by example, when file was deleted)
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
BOOL DelMenuItem(LPMRUMENU lpMruMenu,WORD wItem,BOOL fIDMBased)
|
||||
{
|
||||
WORD i;
|
||||
if (fIDMBased)
|
||||
wItem -= (lpMruMenu->wIdMru + 1);
|
||||
if (lpMruMenu->wNbItemFill <= wItem)
|
||||
return FALSE;
|
||||
lpMruMenu->wNbItemFill--;
|
||||
for (i=wItem;i<lpMruMenu->wNbItemFill;i++)
|
||||
lstrcpy(lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)i),
|
||||
lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem * (UINT)(i+1)));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// PlaceMenuMRUItem()
|
||||
//
|
||||
// Purpose:
|
||||
// Add MRU at the end of a menu
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// HMENU hMenu - Handle of menu where MRU must be added
|
||||
// UINT uiItem - Item of menu entry where MRU must be added
|
||||
//
|
||||
// Return: void
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// Used MRU is modified, for refresh the File menu
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
void PlaceMenuMRUItem(LPMRUMENU lpMruMenu,HMENU hMenu,UINT uiItem)
|
||||
{
|
||||
int i;
|
||||
WORD wNbShow;
|
||||
if (hMenu == NULL)
|
||||
return;
|
||||
// remove old MRU in menu
|
||||
for (i=0;i<=(int)(lpMruMenu->wNbLruMenu);i++)
|
||||
RemoveMenu(hMenu,i+lpMruMenu->wIdMru,MF_BYCOMMAND);
|
||||
|
||||
if (lpMruMenu->wNbItemFill == 0)
|
||||
return;
|
||||
|
||||
// If they are item, insert a separator before the files
|
||||
InsertMenu(hMenu,uiItem,MF_SEPARATOR,lpMruMenu->wIdMru,NULL);
|
||||
|
||||
wNbShow = min(lpMruMenu->wNbItemFill,lpMruMenu->wNbLruShow);
|
||||
for (i=(int)wNbShow-1;i>=0;i--)
|
||||
{
|
||||
LPSTR lpTxt;
|
||||
if (lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20))
|
||||
{
|
||||
wsprintf(lpTxt,"&%lu %s",
|
||||
(DWORD)(i+1),lpMruMenu->lpMRU + (lpMruMenu->wMaxSizeLruItem*(UINT)i));
|
||||
InsertMenu(hMenu,(((WORD)i)!=(wNbShow-1)) ? (lpMruMenu->wIdMru+i+2) : lpMruMenu->wIdMru,
|
||||
MF_STRING,lpMruMenu->wIdMru+i+1,lpTxt);
|
||||
GlobalFreePtr(lpTxt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// SaveMruInIni()
|
||||
//
|
||||
// Purpose:
|
||||
// Save MRU in a private .INI
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// LPSTR lpszSection - Points to a null-terminated string containing
|
||||
// the name of the section
|
||||
// LPSTR lpszFile - Points to a null-terminated string that names
|
||||
// the initialization file.
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// See WritePrivateProfileString API for more info on lpszSection and lpszFile
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
BOOL SaveMruInIni(LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpszFile)
|
||||
{
|
||||
LPSTR lpTxt;
|
||||
WORD i;
|
||||
|
||||
lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20);
|
||||
if (lpTxt == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (i=0;i<lpMruMenu->wNbLruMenu;i++)
|
||||
{
|
||||
char szEntry[16];
|
||||
wsprintf(szEntry,"File%lu",(DWORD)i+1);
|
||||
if (!GetMenuItem(lpMruMenu,i,FALSE,lpTxt,lpMruMenu->wMaxSizeLruItem + 10))
|
||||
*lpTxt = '\0';
|
||||
WritePrivateProfileString(lpszSection,szEntry,lpTxt,lpszFile);
|
||||
}
|
||||
GlobalFreePtr(lpTxt);
|
||||
WritePrivateProfileString(NULL,NULL,NULL,lpszFile); // flush cache
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// LoadMruInIni()
|
||||
//
|
||||
// Purpose:
|
||||
// Load MRU from a private .INI
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// LPSTR lpszSection - Points to a null-terminated string containing
|
||||
// the name of the section
|
||||
// LPSTR lpszFile - Points to a null-terminated string that names
|
||||
// the initialization file.
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// See GetPrivateProfileString API for more info on lpszSection and lpszFile
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
BOOL LoadMruInIni(LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpszFile)
|
||||
{
|
||||
LPSTR lpTxt;
|
||||
WORD i;
|
||||
lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20);
|
||||
if (lpTxt == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (i=0;i<lpMruMenu->wNbLruMenu;i++)
|
||||
{
|
||||
char szEntry[16];
|
||||
|
||||
wsprintf(szEntry,"File%lu",(DWORD)i+1);
|
||||
GetPrivateProfileString(lpszSection,szEntry,"",lpTxt,
|
||||
lpMruMenu->wMaxSizeLruItem + 10,lpszFile);
|
||||
if (*lpTxt == '\0')
|
||||
break;
|
||||
SetMenuItem(lpMruMenu,i,lpTxt);
|
||||
}
|
||||
GlobalFreePtr(lpTxt);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
BOOL IsWin395OrHigher(void)
|
||||
{
|
||||
WORD wVer;
|
||||
|
||||
wVer = LOWORD(GetVersion());
|
||||
wVer = (((WORD)LOBYTE(wVer)) << 8) | (WORD)HIBYTE(wVer);
|
||||
|
||||
return (wVer >= 0x035F); // 5F = 95 dec
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// SaveMruInReg()
|
||||
//
|
||||
// Purpose:
|
||||
// Save MRU in the registry
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// LPSTR lpszKey - Points to a null-terminated string
|
||||
// specifying the name of a key that
|
||||
// this function opens or creates.
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// Win32 function designed for Windows NT and Windows 95
|
||||
// See RegCreateKeyEx API for more info on lpszKey
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
BOOL SaveMruInReg(LPMRUMENU lpMruMenu,LPSTR lpszKey)
|
||||
{
|
||||
LPSTR lpTxt;
|
||||
WORD i;
|
||||
HKEY hCurKey;
|
||||
DWORD dwDisp;
|
||||
|
||||
lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20);
|
||||
if (lpTxt == NULL)
|
||||
return FALSE;
|
||||
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER,lpszKey,0,NULL,
|
||||
REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hCurKey,&dwDisp);
|
||||
|
||||
for (i=0;i<lpMruMenu->wNbLruMenu;i++)
|
||||
{
|
||||
char szEntry[16];
|
||||
wsprintf(szEntry,"File%lu",(DWORD)i+1);
|
||||
if (!GetMenuItem(lpMruMenu,i,FALSE,lpTxt,lpMruMenu->wMaxSizeLruItem + 10))
|
||||
*lpTxt = '\0';
|
||||
RegSetValueEx(hCurKey,szEntry,0,REG_SZ,(unsigned char*)lpTxt,lstrlen(lpTxt));
|
||||
}
|
||||
RegCloseKey(hCurKey);
|
||||
GlobalFreePtr(lpTxt);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// LoadMruInReg()
|
||||
//
|
||||
// Purpose:
|
||||
// Load MRU from the registry
|
||||
//
|
||||
// Parameters:
|
||||
// LPMRUMENU lpMruMenu - pointer on MRUMENU
|
||||
// LPSTR lpszKey - Points to a null-terminated string
|
||||
// specifying the name of a key that
|
||||
// this function opens or creates.
|
||||
//
|
||||
// Return: (BOOL)
|
||||
// TRUE - Function run successfully
|
||||
// FALSE - Function don't run successfully
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// Win32 function designed for Windows NT and Windows 95
|
||||
// See RegOpenKeyEx API for more info on lpszKey
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
BOOL LoadMruInReg(LPMRUMENU lpMruMenu,LPSTR lpszKey)
|
||||
{
|
||||
LPSTR lpTxt;
|
||||
WORD i;
|
||||
HKEY hCurKey;
|
||||
DWORD dwType;
|
||||
lpTxt = (LPSTR)GlobalAllocPtr(GHND,lpMruMenu->wMaxSizeLruItem + 20);
|
||||
if (lpTxt == NULL)
|
||||
return FALSE;
|
||||
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER,lpszKey,0,KEY_READ,&hCurKey);
|
||||
|
||||
|
||||
for (i=0;i<lpMruMenu->wNbLruMenu;i++)
|
||||
{
|
||||
char szEntry[16];
|
||||
DWORD dwSizeBuf;
|
||||
wsprintf(szEntry,"File%lu",(DWORD)i+1);
|
||||
*lpTxt = '\0';
|
||||
dwSizeBuf = lpMruMenu->wMaxSizeLruItem + 10;
|
||||
RegQueryValueEx(hCurKey,szEntry,NULL,&dwType,(LPBYTE)lpTxt,&dwSizeBuf);
|
||||
*(lpTxt+dwSizeBuf)='\0';
|
||||
if (*lpTxt == '\0')
|
||||
break;
|
||||
SetMenuItem(lpMruMenu,i,lpTxt);
|
||||
}
|
||||
RegCloseKey(hCurKey);
|
||||
GlobalFreePtr(lpTxt);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************
|
||||
//
|
||||
// GetWin32Kind()
|
||||
//
|
||||
// Purpose:
|
||||
// Get the Win32 platform
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// Return: (WIN32KIND)
|
||||
// WINNT - Run under Windows NT
|
||||
// WIN32S - Run under Windows 3.1x + Win32s
|
||||
// WIN95ORGREATHER - Run under Windows 95
|
||||
//
|
||||
//
|
||||
// Comments:
|
||||
// Win32 function designed for Windows NT and Windows 95
|
||||
// See RegOpenKeyEx API for more info on lpszKey
|
||||
//
|
||||
// History: Date Author Comment
|
||||
// 09/24/94 G. Vollant Created
|
||||
//
|
||||
//*************************************************************
|
||||
WIN32KIND GetWin32Kind()
|
||||
{
|
||||
BOOL IsWin395OrHigher(void);
|
||||
|
||||
WORD wVer;
|
||||
|
||||
if ((GetVersion() & 0x80000000) == 0)
|
||||
return WINNT;
|
||||
wVer = LOWORD(GetVersion());
|
||||
wVer = (((WORD)LOBYTE(wVer)) << 8) | (WORD)HIBYTE(wVer);
|
||||
|
||||
if (wVer >= 0x035F)
|
||||
return WIN95ORGREATHER;
|
||||
else
|
||||
return WIN32S;
|
||||
}
|
||||
#endif
|
100
q3radiant/MRU.H
100
q3radiant/MRU.H
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//*************************************************************
|
||||
// File name: mru.h
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
// Header for MRU support
|
||||
//
|
||||
// Development Team:
|
||||
//
|
||||
// Gilles Vollant (100144.2636@compuserve.com)
|
||||
//
|
||||
//*************************************************************
|
||||
|
||||
#ifndef __MRU_H__
|
||||
#define __MRU_H__
|
||||
|
||||
#define NBMRUMENUSHOW 6 // Default number of MRU showed in the menu File
|
||||
#define NBMRUMENU 9 // Default number of MRU stored
|
||||
#define IDMRU 8000 // Default First ID of MRU
|
||||
#ifdef OFS_MAXPATHNAME
|
||||
#define MAXSIZEMRUITEM OFS_MAXPATHNAME
|
||||
#else
|
||||
#define MAXSIZEMRUITEM 128 // Default max size of an entry
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD wNbItemFill;
|
||||
WORD wNbLruShow;
|
||||
WORD wNbLruMenu;
|
||||
WORD wMaxSizeLruItem;
|
||||
WORD wIdMru;
|
||||
LPSTR lpMRU;
|
||||
} MRUMENU;
|
||||
|
||||
typedef MRUMENU FAR * LPMRUMENU;
|
||||
|
||||
#ifdef __cplusplus
|
||||
LPMRUMENU CreateMruMenu (WORD wNbLruShowInit=NBMRUMENUSHOW,
|
||||
WORD wNbLruMenuInit=NBMRUMENU,
|
||||
WORD wMaxSizeLruItemInit=MAXSIZEMRUITEM,
|
||||
WORD wIdMruInit=IDMRU);
|
||||
#else
|
||||
LPMRUMENU CreateMruMenu (WORD wNbLruShowInit,
|
||||
WORD wNbLruMenuInit,
|
||||
WORD wMaxSizeLruItemInit,
|
||||
WORD wIdMruInit);
|
||||
#endif
|
||||
|
||||
LPMRUMENU CreateMruMenuDefault();
|
||||
void DeleteMruMenu (LPMRUMENU lpMruMenu);
|
||||
|
||||
void SetNbLruShow (LPMRUMENU lpMruMenu,WORD wNbLruShowInit);
|
||||
BOOL SetMenuItem (LPMRUMENU lpMruMenu,WORD wItem,
|
||||
LPSTR lpItem);
|
||||
BOOL GetMenuItem (LPMRUMENU lpMruMenu,WORD wItem,
|
||||
BOOL fIDMBased,LPSTR lpItem,UINT uiSize);
|
||||
BOOL DelMenuItem (LPMRUMENU lpMruMenu,WORD wItem,BOOL fIDMBased);
|
||||
void AddNewItem (LPMRUMENU lpMruMenu,LPSTR lpItem);
|
||||
void PlaceMenuMRUItem(LPMRUMENU lpMruMenu,HMENU hMenu,UINT uiItem);
|
||||
|
||||
BOOL SaveMruInIni (LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpszFile);
|
||||
BOOL LoadMruInIni (LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpszFile);
|
||||
#ifdef WIN32
|
||||
BOOL SaveMruInReg (LPMRUMENU lpMruMenu,LPSTR lpszKey);
|
||||
BOOL LoadMruInReg (LPMRUMENU lpMruMenu,LPSTR lpszKey);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIN32S,
|
||||
WINNT,
|
||||
WIN95ORGREATHER
|
||||
} WIN32KIND;
|
||||
WIN32KIND GetWin32Kind();
|
||||
#endif
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,504 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// MainFrm.h : interface of the CMainFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MAINFRM_H__330BBF0A_731C_11D1_B539_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_MAINFRM_H__330BBF0A_731C_11D1_B539_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include "LstToolBar.h"
|
||||
#include "XYWnd.h"
|
||||
#include "TexWnd.h"
|
||||
#include "ZWnd.h"
|
||||
#include "CamWnd.h"
|
||||
#include "RADEditWnd.h"
|
||||
#include "TextureBar.h"
|
||||
#include "PlugInManager.h"
|
||||
#include "PlugIn.h"
|
||||
#include "groupdlg.h"
|
||||
|
||||
|
||||
const int RAD_SHIFT = 0x01;
|
||||
const int RAD_ALT = 0x02;
|
||||
const int RAD_CONTROL = 0x04;
|
||||
const int RAD_PRESS = 0x08;
|
||||
|
||||
struct SCommandInfo
|
||||
{
|
||||
char* m_strCommand;
|
||||
unsigned int m_nKey;
|
||||
unsigned int m_nModifiers;
|
||||
unsigned int m_nCommand;
|
||||
};
|
||||
|
||||
struct SKeyInfo
|
||||
{
|
||||
char* m_strName;
|
||||
unsigned int m_nVKKey;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CMainFrame : public CFrameWnd
|
||||
{
|
||||
DECLARE_DYNAMIC(CMainFrame)
|
||||
public:
|
||||
CMainFrame();
|
||||
void HandleKey(UINT nChar, UINT nRepCnt, UINT nFlags, bool bDown = true)
|
||||
{
|
||||
if (bDown)
|
||||
OnKeyDown(nChar, nRepCnt, nFlags);
|
||||
else
|
||||
OnKeyUp(nChar, nRepCnt, nFlags);
|
||||
};
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainFrame)
|
||||
public:
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
protected:
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
void UpdatePatchToolbarButtons();
|
||||
void NudgeSelection(int nDirection, int nAmount);
|
||||
void UpdateTextureBar();
|
||||
void SetButtonMenuStates();
|
||||
void SetTexValStatus();
|
||||
void SetGridStatus();
|
||||
void RoutineProcessing();
|
||||
CXYWnd* ActiveXY();
|
||||
void UpdateWindows(int nBits);
|
||||
void SetStatusText(int nPane, const char* pText);
|
||||
void UpdateStatusText();
|
||||
void SetWindowStyle(int nStyle);
|
||||
virtual ~CMainFrame();
|
||||
CXYWnd* GetXYWnd() {return m_pXYWnd;};
|
||||
CXYWnd* GetXZWnd() {return m_pXZWnd;};
|
||||
CXYWnd* GetYZWnd() {return m_pYZWnd;};
|
||||
CCamWnd* GetCamera() {return m_pCamWnd;};
|
||||
CTexWnd* GetTexWnd() {return m_pTexWnd;};
|
||||
void SetActiveXY(CXYWnd* p)
|
||||
{
|
||||
if (m_pActiveXY)
|
||||
m_pActiveXY->SetActive(false);
|
||||
|
||||
m_pActiveXY = p;
|
||||
|
||||
if (m_pActiveXY)
|
||||
m_pActiveXY->SetActive(true);
|
||||
|
||||
};
|
||||
int CurrentStyle() { return m_nCurrentStyle; };
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
CLstToolBar m_wndToolBar;
|
||||
CLstToolBar m_wndScaleBar;
|
||||
CDialogBar m_wndHelpBar;
|
||||
CTextureBar m_wndTextureBar;
|
||||
CSplitterWnd m_wndSplit;
|
||||
CSplitterWnd m_wndSplit2;
|
||||
CSplitterWnd m_wndSplit3;
|
||||
CXYWnd* m_pXYWnd;
|
||||
CXYWnd* m_pYZWnd;
|
||||
CXYWnd* m_pXZWnd;
|
||||
CCamWnd* m_pCamWnd;
|
||||
CTexWnd* m_pTexWnd;
|
||||
CZWnd* m_pZWnd;
|
||||
CRADEditWnd* m_pEditWnd;
|
||||
int m_nCurrentStyle;
|
||||
CString m_strStatus[15];
|
||||
CXYWnd* m_pActiveXY;
|
||||
bool m_bCamPreview;
|
||||
CPlugInManager m_PlugInMgr;
|
||||
int m_nNextPlugInID;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
bool m_bDoLoop;
|
||||
bool m_bSplittersOK;
|
||||
void CreateQEChildren();
|
||||
void LoadCommandMap();
|
||||
void ShowMenuItemKeyBindings(CMenu *pMenu);
|
||||
void SetEntityCheck();
|
||||
afx_msg LRESULT OnBSPStatus(UINT wParam, long lParam);
|
||||
afx_msg LRESULT OnBSPDone(UINT wParam, long lParam);
|
||||
public:
|
||||
void Nudge(int nDim, float fNudge);
|
||||
|
||||
CPlugInManager &GetPlugInMgr() {return m_PlugInMgr;};
|
||||
void AddPlugInMenuItem(CPlugIn* pPlugIn);
|
||||
void CleanPlugInMenu();
|
||||
|
||||
// these are public so i can easily reflect messages
|
||||
// from child windows..
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg void OnParentNotify(UINT message, LPARAM lParam);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void ToggleCamera();
|
||||
afx_msg void OnFileClose();
|
||||
afx_msg void OnFileExit();
|
||||
afx_msg void OnFileLoadproject();
|
||||
afx_msg void OnFileNew();
|
||||
afx_msg void OnFileOpen();
|
||||
afx_msg void OnFilePointfile();
|
||||
afx_msg void OnFilePrint();
|
||||
afx_msg void OnFilePrintPreview();
|
||||
afx_msg void OnFileSave();
|
||||
afx_msg void OnFileSaveas();
|
||||
afx_msg void OnView100();
|
||||
afx_msg void OnViewCenter();
|
||||
afx_msg void OnViewConsole();
|
||||
afx_msg void OnViewDownfloor();
|
||||
afx_msg void OnViewEntity();
|
||||
afx_msg void OnViewFront();
|
||||
afx_msg void OnViewShowblocks();
|
||||
afx_msg void OnViewShowclip();
|
||||
afx_msg void OnViewShowcoordinates();
|
||||
afx_msg void OnViewShowdetail();
|
||||
afx_msg void OnViewShowent();
|
||||
afx_msg void OnViewShowlights();
|
||||
afx_msg void OnViewShownames();
|
||||
afx_msg void OnViewShowpath();
|
||||
afx_msg void OnViewShowwater();
|
||||
afx_msg void OnViewShowworld();
|
||||
afx_msg void OnViewTexture();
|
||||
afx_msg void OnViewUpfloor();
|
||||
afx_msg void OnViewXy();
|
||||
afx_msg void OnViewZ100();
|
||||
afx_msg void OnViewZoomin();
|
||||
afx_msg void OnViewZoomout();
|
||||
afx_msg void OnViewZzoomin();
|
||||
afx_msg void OnViewZzoomout();
|
||||
afx_msg void OnViewSide();
|
||||
afx_msg void OnTexturesShowinuse();
|
||||
afx_msg void OnTexturesInspector();
|
||||
afx_msg void OnMiscBenchmark();
|
||||
afx_msg void OnMiscFindbrush();
|
||||
afx_msg void OnMiscGamma();
|
||||
afx_msg void OnMiscNextleakspot();
|
||||
afx_msg void OnMiscPreviousleakspot();
|
||||
afx_msg void OnMiscPrintxy();
|
||||
afx_msg void OnMiscSelectentitycolor();
|
||||
afx_msg void OnTexturebk();
|
||||
afx_msg void OnColorsMajor();
|
||||
afx_msg void OnColorsMinor();
|
||||
afx_msg void OnColorsXybk();
|
||||
afx_msg void OnBrush3sided();
|
||||
afx_msg void OnBrush4sided();
|
||||
afx_msg void OnBrush5sided();
|
||||
afx_msg void OnBrush6sided();
|
||||
afx_msg void OnBrush7sided();
|
||||
afx_msg void OnBrush8sided();
|
||||
afx_msg void OnBrush9sided();
|
||||
afx_msg void OnBrushArbitrarysided();
|
||||
afx_msg void OnBrushFlipx();
|
||||
afx_msg void OnBrushFlipy();
|
||||
afx_msg void OnBrushFlipz();
|
||||
afx_msg void OnBrushRotatex();
|
||||
afx_msg void OnBrushRotatey();
|
||||
afx_msg void OnBrushRotatez();
|
||||
afx_msg void OnRegionOff();
|
||||
afx_msg void OnRegionSetbrush();
|
||||
afx_msg void OnRegionSetselection();
|
||||
afx_msg void OnRegionSettallbrush();
|
||||
afx_msg void OnRegionSetxy();
|
||||
afx_msg void OnSelectionArbitraryrotation();
|
||||
afx_msg void OnSelectionClone();
|
||||
afx_msg void OnSelectionConnect();
|
||||
afx_msg void OnSelectionCsgsubtract();
|
||||
afx_msg void OnSelectionCsgmerge();
|
||||
afx_msg void OnSelectionNoOutline();
|
||||
afx_msg void OnSelectionDelete();
|
||||
afx_msg void OnSelectionDeselect();
|
||||
afx_msg void OnSelectionDragedges();
|
||||
afx_msg void OnSelectionDragvertecies();
|
||||
afx_msg void OnRaiseLowerTerrain();
|
||||
afx_msg void OnSelectionMakeDetail();
|
||||
afx_msg void OnSelectionMakeStructural();
|
||||
afx_msg void OnSelectionMakehollow();
|
||||
afx_msg void OnSelectionSelectcompletetall();
|
||||
afx_msg void OnSelectionSelectinside();
|
||||
afx_msg void OnSelectionSelectpartialtall();
|
||||
afx_msg void OnSelectionSelecttouching();
|
||||
afx_msg void OnSelectionUngroupentity();
|
||||
afx_msg void OnTexturesPopup();
|
||||
afx_msg void OnSplinesPopup();
|
||||
afx_msg void OnPopupSelection();
|
||||
afx_msg void OnViewChange();
|
||||
afx_msg void OnViewCameraupdate();
|
||||
afx_msg void OnUpdateViewCameraupdate(CCmdUI* pCmdUI);
|
||||
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
|
||||
afx_msg void OnHelpAbout();
|
||||
afx_msg void OnViewClipper();
|
||||
afx_msg void OnCameraAngledown();
|
||||
afx_msg void OnCameraAngleup();
|
||||
afx_msg void OnCameraBack();
|
||||
afx_msg void OnCameraDown();
|
||||
afx_msg void OnCameraForward();
|
||||
afx_msg void OnCameraLeft();
|
||||
afx_msg void OnCameraRight();
|
||||
afx_msg void OnCameraStrafeleft();
|
||||
afx_msg void OnCameraStraferight();
|
||||
afx_msg void OnCameraUp();
|
||||
afx_msg void OnGridToggle();
|
||||
afx_msg void OnPrefs();
|
||||
afx_msg void OnTogglecamera();
|
||||
afx_msg void OnToggleconsole();
|
||||
afx_msg void OnToggleview();
|
||||
afx_msg void OnTogglez();
|
||||
afx_msg void OnToggleLock();
|
||||
afx_msg void OnEditMapinfo();
|
||||
afx_msg void OnEditEntityinfo();
|
||||
afx_msg void OnBrushScripts();
|
||||
afx_msg void OnViewNextview();
|
||||
afx_msg void OnHelpCommandlist();
|
||||
afx_msg void OnFileNewproject();
|
||||
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnFlipClip();
|
||||
afx_msg void OnClipSelected();
|
||||
afx_msg void OnSplitSelected();
|
||||
afx_msg void OnToggleviewXz();
|
||||
afx_msg void OnToggleviewYz();
|
||||
afx_msg void OnColorsBrush();
|
||||
afx_msg void OnColorsClipper();
|
||||
afx_msg void OnColorsGridtext();
|
||||
afx_msg void OnColorsSelectedbrush();
|
||||
afx_msg void OnColorsGridblock();
|
||||
afx_msg void OnColorsViewname();
|
||||
afx_msg void OnColorSetoriginal();
|
||||
afx_msg void OnColorSetqer();
|
||||
afx_msg void OnColorSetblack();
|
||||
afx_msg void OnSnaptogrid();
|
||||
afx_msg void OnSelectScale();
|
||||
afx_msg void OnSelectMouserotate();
|
||||
afx_msg void OnEditCopybrush();
|
||||
afx_msg void OnEditPastebrush();
|
||||
afx_msg void OnEditUndo();
|
||||
afx_msg void OnEditRedo();
|
||||
afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
|
||||
afx_msg void OnSelectionInvert();
|
||||
afx_msg void OnSelectionTextureDec();
|
||||
afx_msg void OnSelectionTextureFit();
|
||||
afx_msg void OnSelectionTextureInc();
|
||||
afx_msg void OnSelectionTextureRotateclock();
|
||||
afx_msg void OnSelectionTextureRotatecounter();
|
||||
afx_msg void OnSelectionTextureScaledown();
|
||||
afx_msg void OnSelectionTextureScaleup();
|
||||
afx_msg void OnSelectionTextureShiftdown();
|
||||
afx_msg void OnSelectionTextureShiftleft();
|
||||
afx_msg void OnSelectionTextureShiftright();
|
||||
afx_msg void OnSelectionTextureShiftup();
|
||||
afx_msg void OnGridNext();
|
||||
afx_msg void OnGridPrev();
|
||||
afx_msg void OnSelectionTextureScaleLeft();
|
||||
afx_msg void OnSelectionTextureScaleRight();
|
||||
afx_msg void OnTextureReplaceall();
|
||||
afx_msg void OnScalelockx();
|
||||
afx_msg void OnScalelocky();
|
||||
afx_msg void OnScalelockz();
|
||||
afx_msg void OnSelectMousescale();
|
||||
afx_msg void OnViewCubicclipping();
|
||||
afx_msg void OnFileImport();
|
||||
afx_msg void OnFileProjectsettings();
|
||||
afx_msg void OnUpdateFileImport(CCmdUI* pCmdUI);
|
||||
afx_msg void OnViewCubein();
|
||||
afx_msg void OnViewCubeout();
|
||||
afx_msg void OnFileSaveregion();
|
||||
afx_msg void OnUpdateFileSaveregion(CCmdUI* pCmdUI);
|
||||
afx_msg void OnSelectionMovedown();
|
||||
afx_msg void OnSelectionMoveup();
|
||||
afx_msg void OnToolbarMain();
|
||||
afx_msg void OnToolbarTexture();
|
||||
afx_msg void OnSelectionPrint();
|
||||
afx_msg void OnSelectionTogglesizepaint();
|
||||
afx_msg void OnBrushMakecone();
|
||||
afx_msg void OnTexturesLoad();
|
||||
afx_msg void OnToggleRotatelock();
|
||||
afx_msg void OnCurveBevel();
|
||||
afx_msg void OnCurveCylinder();
|
||||
afx_msg void OnCurveEighthsphere();
|
||||
afx_msg void OnCurveEndcap();
|
||||
afx_msg void OnCurveHemisphere();
|
||||
afx_msg void OnCurveInvertcurve();
|
||||
afx_msg void OnCurveQuarter();
|
||||
afx_msg void OnCurveSphere();
|
||||
afx_msg void OnFileImportmap();
|
||||
afx_msg void OnFileExportmap();
|
||||
afx_msg void OnEditLoadprefab();
|
||||
afx_msg void OnViewShowcurves();
|
||||
afx_msg void OnSelectionSelectNudgedown();
|
||||
afx_msg void OnSelectionSelectNudgeleft();
|
||||
afx_msg void OnSelectionSelectNudgeright();
|
||||
afx_msg void OnSelectionSelectNudgeup();
|
||||
afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnTexturesLoadlist();
|
||||
afx_msg void OnDontselectcurve();
|
||||
afx_msg void OnConvertcurves();
|
||||
afx_msg void OnDynamicLighting();
|
||||
afx_msg void OnCurveSimplepatchmesh();
|
||||
afx_msg void OnPatchToggleBox();
|
||||
afx_msg void OnPatchWireframe();
|
||||
afx_msg void OnCurvePatchcone();
|
||||
afx_msg void OnCurvePatchtube();
|
||||
afx_msg void OnPatchWeld();
|
||||
afx_msg void OnCurvePatchbevel();
|
||||
afx_msg void OnCurvePatchendcap();
|
||||
afx_msg void OnCurvePatchinvertedbevel();
|
||||
afx_msg void OnCurvePatchinvertedendcap();
|
||||
afx_msg void OnPatchDrilldown();
|
||||
afx_msg void OnCurveInsertcolumn();
|
||||
afx_msg void OnCurveInsertrow();
|
||||
afx_msg void OnCurveDeletecolumn();
|
||||
afx_msg void OnCurveDeleterow();
|
||||
afx_msg void OnCurveInsertAddcolumn();
|
||||
afx_msg void OnCurveInsertAddrow();
|
||||
afx_msg void OnCurveInsertInsertcolumn();
|
||||
afx_msg void OnCurveInsertInsertrow();
|
||||
afx_msg void OnCurveNegative();
|
||||
afx_msg void OnCurveNegativeTextureX();
|
||||
afx_msg void OnCurveNegativeTextureY();
|
||||
afx_msg void OnCurveDeleteFirstcolumn();
|
||||
afx_msg void OnCurveDeleteFirstrow();
|
||||
afx_msg void OnCurveDeleteLastcolumn();
|
||||
afx_msg void OnCurveDeleteLastrow();
|
||||
afx_msg void OnPatchBend();
|
||||
afx_msg void OnPatchInsdel();
|
||||
afx_msg void OnPatchEnter();
|
||||
afx_msg void OnPatchTab();
|
||||
afx_msg void OnCurvePatchdensetube();
|
||||
afx_msg void OnCurvePatchverydensetube();
|
||||
afx_msg void OnCurveCap();
|
||||
afx_msg void OnCurveCapInvertedbevel();
|
||||
afx_msg void OnCurveCapInvertedendcap();
|
||||
afx_msg void OnCurveRedisperseCols();
|
||||
afx_msg void OnCurveRedisperseRows();
|
||||
afx_msg void OnPatchNaturalize();
|
||||
afx_msg void OnSnapToGrid();
|
||||
afx_msg void OnCurvePatchsquare();
|
||||
afx_msg void OnTerrainCreateFromBrush();
|
||||
afx_msg void OnTexturesTexturewindowscale10();
|
||||
afx_msg void OnTexturesTexturewindowscale100();
|
||||
afx_msg void OnTexturesTexturewindowscale200();
|
||||
afx_msg void OnTexturesTexturewindowscale25();
|
||||
afx_msg void OnTexturesTexturewindowscale50();
|
||||
afx_msg void OnTexturesFlush();
|
||||
afx_msg void OnCurveOverlayClear();
|
||||
afx_msg void OnCurveOverlaySet();
|
||||
afx_msg void OnCurveThicken();
|
||||
afx_msg void OnCurveCyclecap();
|
||||
afx_msg void OnCurveMatrixTranspose();
|
||||
afx_msg void OnTexturesReloadshaders();
|
||||
afx_msg void OnShowEntities();
|
||||
afx_msg void OnViewEntitiesasBoundingbox();
|
||||
afx_msg void OnViewEntitiesasSelectedskinned();
|
||||
afx_msg void OnViewEntitiesasSelectedwireframe();
|
||||
afx_msg void OnViewEntitiesasSkinned();
|
||||
afx_msg void OnViewEntitiesasSkinnedandboxed();
|
||||
afx_msg void OnViewEntitiesasWireframe();
|
||||
afx_msg void OnPluginsRefresh();
|
||||
afx_msg void OnViewShowhint();
|
||||
afx_msg void OnUpdateTexturesShowinuse(CCmdUI* pCmdUI);
|
||||
afx_msg void OnTexturesShowall();
|
||||
afx_msg void OnPatchInspector();
|
||||
afx_msg void OnViewOpengllighting();
|
||||
afx_msg void OnSelectAll();
|
||||
afx_msg void OnViewShowcaulk();
|
||||
afx_msg void OnCurveFreeze();
|
||||
afx_msg void OnCurveUnFreeze();
|
||||
afx_msg void OnCurveUnFreezeAll();
|
||||
afx_msg void OnSelectReselect();
|
||||
afx_msg void OnViewShowangles();
|
||||
afx_msg void OnEditSaveprefab();
|
||||
afx_msg void OnCurveMoreendcapsbevelsSquarebevel();
|
||||
afx_msg void OnCurveMoreendcapsbevelsSquareendcap();
|
||||
afx_msg void OnBrushPrimitivesSphere();
|
||||
afx_msg void OnViewCrosshair();
|
||||
afx_msg void OnViewHideshowHideselected();
|
||||
afx_msg void OnViewHideshowShowhidden();
|
||||
afx_msg void OnTexturesShadersShow();
|
||||
afx_msg void OnTexturesFlushUnused();
|
||||
afx_msg void OnViewGroups();
|
||||
afx_msg void OnDropGroupAddtoWorld();
|
||||
afx_msg void OnDropGroupName();
|
||||
afx_msg void OnDropGroupNewgroup();
|
||||
afx_msg void OnDropGroupRemove();
|
||||
afx_msg void OnSplinesMode();
|
||||
afx_msg void OnSplinesLoad();
|
||||
afx_msg void OnSplinesSave();
|
||||
afx_msg void OnSplinesEdit();
|
||||
afx_msg void OnSplineTest();
|
||||
afx_msg void OnSplinesTarget();
|
||||
afx_msg void OnSplinesTargetPoints();
|
||||
afx_msg void OnSplinesCameraPoints();
|
||||
afx_msg void OnPopupNewcameraInterpolated();
|
||||
afx_msg void OnPopupNewcameraSpline();
|
||||
afx_msg void OnPopupNewcameraFixed();
|
||||
//}}AFX_MSG
|
||||
afx_msg void OnMru(unsigned int nID);
|
||||
afx_msg void OnViewNearest(unsigned int nID);
|
||||
afx_msg void OnTextureWad(unsigned int nID);
|
||||
afx_msg void OnBspCommand(unsigned int nID);
|
||||
afx_msg void OnGrid1(unsigned int nID);
|
||||
afx_msg LRESULT OnDisplayChange(WPARAM wp, LPARAM lp);
|
||||
void CheckTextureScale(int id);
|
||||
afx_msg void OnPlugIn(unsigned int nID);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MAINFRM_H__330BBF0A_731C_11D1_B539_00AA00A410FC__INCLUDED_)
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// MapInfo.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "MapInfo.h"
|
||||
#include "qe3.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMapInfo dialog
|
||||
|
||||
|
||||
CMapInfo::CMapInfo(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CMapInfo::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CMapInfo)
|
||||
m_nNet = 0;
|
||||
m_nTotalBrushes = 0;
|
||||
m_nTotalEntities = 0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CMapInfo::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMapInfo)
|
||||
DDX_Control(pDX, IDC_LIST_ENTITIES, m_lstEntity);
|
||||
DDX_Text(pDX, IDC_EDIT_NET, m_nNet);
|
||||
DDX_Text(pDX, IDC_EDIT_TOTALBRUSHES, m_nTotalBrushes);
|
||||
DDX_Text(pDX, IDC_EDIT_TOTALENTITIES, m_nTotalEntities);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMapInfo, CDialog)
|
||||
//{{AFX_MSG_MAP(CMapInfo)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMapInfo message handlers
|
||||
|
||||
BOOL CMapInfo::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_nTotalBrushes = 0;
|
||||
m_nTotalEntities = 0;
|
||||
m_nNet = 0;
|
||||
for (brush_t* pBrush=active_brushes.next ; pBrush != &active_brushes ; pBrush=pBrush->next)
|
||||
{
|
||||
m_nTotalBrushes++;
|
||||
if (pBrush->owner == world_entity)
|
||||
m_nNet++;
|
||||
}
|
||||
|
||||
|
||||
CMapStringToPtr mapEntity;
|
||||
|
||||
int nValue = 0;
|
||||
for (entity_t* pEntity=entities.next ; pEntity != &entities ; pEntity=pEntity->next)
|
||||
{
|
||||
m_nTotalEntities++;
|
||||
nValue = 0;
|
||||
mapEntity.Lookup(pEntity->eclass->name, reinterpret_cast<void*&>(nValue));
|
||||
nValue++ ;
|
||||
mapEntity.SetAt(pEntity->eclass->name, reinterpret_cast<void*>(nValue));
|
||||
}
|
||||
|
||||
m_lstEntity.ResetContent();
|
||||
m_lstEntity.SetTabStops(96);
|
||||
CString strKey;
|
||||
POSITION pos = mapEntity.GetStartPosition();
|
||||
while (pos)
|
||||
{
|
||||
mapEntity.GetNextAssoc(pos, strKey, reinterpret_cast<void*&>(nValue));
|
||||
CString strList;
|
||||
strList.Format("%s\t%i", strKey, nValue);
|
||||
m_lstEntity.AddString(strList);
|
||||
}
|
||||
|
||||
UpdateData(FALSE);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_MAPINFO_H__C241B9A2_819F_11D1_B548_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_MAPINFO_H__C241B9A2_819F_11D1_B548_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// MapInfo.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMapInfo dialog
|
||||
|
||||
class CMapInfo : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CMapInfo(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMapInfo)
|
||||
enum { IDD = IDD_DLG_MAPINFO };
|
||||
CListBox m_lstEntity;
|
||||
int m_nNet;
|
||||
int m_nTotalBrushes;
|
||||
int m_nTotalEntities;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMapInfo)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMapInfo)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MAPINFO_H__C241B9A2_819F_11D1_B548_00AA00A410FC__INCLUDED_)
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.2.1 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/02/04 22:59:34 $
|
||||
// $Log: Messaging.cpp,v $
|
||||
// Revision 1.1.2.1 2000/02/04 22:59:34 ttimo
|
||||
// messaging API preview
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// implementation of IMessaging specific interface
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
CPtrArray l_Listeners[RADIANT_MSGCOUNT];
|
||||
CPtrArray l_WindowListeners;
|
||||
CXYWndWrapper l_XYWndWrapper;
|
||||
|
||||
void WINAPI QERApp_HookWindow(IWindowListener* pListen)
|
||||
{
|
||||
l_WindowListeners.Add( pListen );
|
||||
pListen->IncRef();
|
||||
}
|
||||
|
||||
void WINAPI QERApp_UnHookWindow(IWindowListener* pListen)
|
||||
{
|
||||
for ( int i = 0; i < l_WindowListeners.GetSize(); i++ )
|
||||
{
|
||||
if (l_WindowListeners.GetAt(i) == pListen)
|
||||
{
|
||||
l_WindowListeners.RemoveAt(i);
|
||||
pListen->DecRef();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
Sys_Printf("WARNING: IWindowListener not found in QERApp_UnHookWindow\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void DispatchOnMouseMove(UINT nFlags, int x, int y)
|
||||
{
|
||||
for( int i = 0; i < l_WindowListeners.GetSize(); i++ )
|
||||
static_cast<IWindowListener*>(l_WindowListeners.GetAt(i))->OnMouseMove( nFlags, x, y );
|
||||
}
|
||||
|
||||
bool DispatchOnLButtonDown(UINT nFlags, int x, int y)
|
||||
{
|
||||
for( int i = 0; i < l_WindowListeners.GetSize(); i++ )
|
||||
if (static_cast<IWindowListener*>(l_WindowListeners.GetAt(i))->OnLButtonDown( nFlags, x, y ))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DispatchOnLButtonUp(UINT nFlags, int x, int y)
|
||||
{
|
||||
for( int i = 0; i < l_WindowListeners.GetSize(); i++ )
|
||||
if (static_cast<IWindowListener*>(l_WindowListeners.GetAt(i))->OnLButtonUp( nFlags, x, y ))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void WINAPI QERApp_HookListener(IListener* pListen, int Msg)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (Msg >= RADIANT_MSGCOUNT)
|
||||
{
|
||||
Sys_Printf("ERROR: bad index in QERApp_HookListener\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
l_Listeners[Msg].Add( pListen );
|
||||
pListen->IncRef();
|
||||
}
|
||||
|
||||
int WINAPI QERApp_UnHookListener(IListener* pListen)
|
||||
{
|
||||
int count = 0;
|
||||
for( int i = 0; i<RADIANT_MSGCOUNT; i++ )
|
||||
for( int j = 0; j<l_Listeners[i].GetSize(); j++ )
|
||||
if (l_Listeners[i].GetAt(j) == pListen)
|
||||
{
|
||||
l_Listeners[i].RemoveAt(j);
|
||||
pListen->DecRef();
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void DispatchRadiantMsg( int Msg )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (Msg >= RADIANT_MSGCOUNT)
|
||||
{
|
||||
Sys_Printf("ERROR: bad index in DispatchRadiantMsg\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
for(int i = 0; i<l_Listeners[Msg].GetSize(); i++)
|
||||
static_cast<IListener *>(l_Listeners[Msg].GetAt(i))->DispatchRadiantMsg(Msg);
|
||||
}
|
||||
|
||||
void CXYWndWrapper::SnapToGrid( int x1, int y1, vec3_t pt )
|
||||
{
|
||||
CRect rctZ;
|
||||
g_pParentWnd->ActiveXY()->GetClientRect( rctZ );
|
||||
g_pParentWnd->ActiveXY()->SnapToPoint( x1, rctZ.Height() - 1 - y1, pt );
|
||||
}
|
||||
|
||||
IXYWndWrapper* WINAPI QERApp_GetXYWndWrapper()
|
||||
{
|
||||
return &l_XYWndWrapper;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.2.1 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/02/04 22:59:34 $
|
||||
// $Log: Messaging.h,v $
|
||||
// Revision 1.1.2.1 2000/02/04 22:59:34 ttimo
|
||||
// messaging API preview
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// headers for internal classes used in Messaging.cpp
|
||||
//
|
||||
|
||||
#ifndef __MESSAGING_H_
|
||||
#define __MESSAGING_H_
|
||||
|
||||
class CXYWndWrapper : public IXYWndWrapper
|
||||
{
|
||||
public:
|
||||
void SnapToGrid( int x1, int y1, vec3_t pt );
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// NameDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "NameDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNameDlg dialog
|
||||
|
||||
|
||||
CNameDlg::CNameDlg(const char *pName, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CNameDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CNameDlg)
|
||||
m_strName = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
m_strCaption = pName;
|
||||
}
|
||||
|
||||
|
||||
void CNameDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CNameDlg)
|
||||
DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CNameDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CNameDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNameDlg message handlers
|
||||
|
||||
void CNameDlg::OnOK()
|
||||
{
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
BOOL CNameDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
SetWindowText(m_strCaption);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_NAMEDLG_H__624F3290_976A_48A9_AE89_50CD1E6E2F9A__INCLUDED_)
|
||||
#define AFX_NAMEDLG_H__624F3290_976A_48A9_AE89_50CD1E6E2F9A__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// NameDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNameDlg dialog
|
||||
|
||||
class CNameDlg : public CDialog
|
||||
{
|
||||
CString m_strCaption;
|
||||
// Construction
|
||||
public:
|
||||
CNameDlg(const char *pName, CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CNameDlg)
|
||||
enum { IDD = IDD_NEWNAME };
|
||||
CString m_strName;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CNameDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CNameDlg)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_NAMEDLG_H__624F3290_976A_48A9_AE89_50CD1E6E2F9A__INCLUDED_)
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// NewProjDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "NewProjDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNewProjDlg dialog
|
||||
|
||||
|
||||
CNewProjDlg::CNewProjDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CNewProjDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CNewProjDlg)
|
||||
m_strName = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CNewProjDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CNewProjDlg)
|
||||
DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CNewProjDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CNewProjDlg)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNewProjDlg message handlers
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_NEWPROJDLG_H__1E2527A2_8447_11D1_B548_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_NEWPROJDLG_H__1E2527A2_8447_11D1_B548_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// NewProjDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CNewProjDlg dialog
|
||||
|
||||
class CNewProjDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CNewProjDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CNewProjDlg)
|
||||
enum { IDD = IDD_DLG_NEWPROJECT };
|
||||
CString m_strName;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CNewProjDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CNewProjDlg)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_NEWPROJDLG_H__1E2527A2_8447_11D1_B548_00AA00A410FC__INCLUDED_)
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "qe3.h"
|
||||
|
||||
char token[MAXTOKEN];
|
||||
qboolean unget;
|
||||
char *script_p;
|
||||
int scriptline;
|
||||
|
||||
void StartTokenParsing (char *data)
|
||||
{
|
||||
scriptline = 1;
|
||||
script_p = data;
|
||||
unget = false;
|
||||
}
|
||||
|
||||
qboolean WINAPI GetToken (qboolean crossline)
|
||||
{
|
||||
char *token_p;
|
||||
|
||||
if (unget) // is a token allready waiting?
|
||||
{
|
||||
unget = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// skip space
|
||||
//
|
||||
skipspace:
|
||||
while (*script_p <= 32)
|
||||
{
|
||||
if (!*script_p)
|
||||
{
|
||||
if (!crossline)
|
||||
Sys_Printf("Warning: Line %i is incomplete [01]\n",scriptline);
|
||||
return false;
|
||||
}
|
||||
if (*script_p++ == '\n')
|
||||
{
|
||||
if (!crossline)
|
||||
Sys_Printf("Warning: Line %i is incomplete [02]\n",scriptline);
|
||||
scriptline++;
|
||||
}
|
||||
}
|
||||
|
||||
if (script_p[0] == '/' && script_p[1] == '/') // comment field
|
||||
{
|
||||
if (!crossline)
|
||||
Sys_Printf("Warning: Line %i is incomplete [03]\n",scriptline);
|
||||
while (*script_p++ != '\n')
|
||||
if (!*script_p)
|
||||
{
|
||||
if (!crossline)
|
||||
Sys_Printf("Warning: Line %i is incomplete [04]\n",scriptline);
|
||||
return false;
|
||||
}
|
||||
goto skipspace;
|
||||
}
|
||||
|
||||
//
|
||||
// copy token
|
||||
//
|
||||
token_p = token;
|
||||
|
||||
if (*script_p == '"')
|
||||
{
|
||||
script_p++;
|
||||
//if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally
|
||||
// script_p++;
|
||||
while ( *script_p != '"' )
|
||||
{
|
||||
if (!*script_p)
|
||||
Error ("EOF inside quoted token");
|
||||
*token_p++ = *script_p++;
|
||||
if (token_p == &token[MAXTOKEN])
|
||||
Error ("Token too large on line %i",scriptline);
|
||||
}
|
||||
script_p++;
|
||||
//if (*script_p == '"') // handle double quotes i suspect they are put in by other editors cccasionally
|
||||
// script_p++;
|
||||
}
|
||||
else while ( *script_p > 32 )
|
||||
{
|
||||
*token_p++ = *script_p++;
|
||||
if (token_p == &token[MAXTOKEN])
|
||||
Error ("Token too large on line %i",scriptline);
|
||||
}
|
||||
|
||||
*token_p = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WINAPI UngetToken (void)
|
||||
{
|
||||
unget = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
TokenAvailable
|
||||
|
||||
Returns true if there is another token on the line
|
||||
==============
|
||||
*/
|
||||
qboolean TokenAvailable (void)
|
||||
{
|
||||
char *search_p;
|
||||
|
||||
search_p = script_p;
|
||||
|
||||
while ( *search_p <= 32)
|
||||
{
|
||||
if (*search_p == '\n')
|
||||
return false;
|
||||
if (*search_p == 0)
|
||||
return false;
|
||||
search_p++;
|
||||
}
|
||||
|
||||
if (*search_p == ';')
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// parse.h -- text file parsing routines
|
||||
|
||||
#define MAXTOKEN 1024
|
||||
|
||||
extern char token[MAXTOKEN];
|
||||
extern int scriptline;
|
||||
|
||||
// NOTE: added WINAPI call syntax to export these for plugins in _QERScripLibTable
|
||||
void StartTokenParsing (char *data);
|
||||
qboolean WINAPI GetToken (qboolean crossline);
|
||||
void WINAPI UngetToken (void);
|
||||
qboolean TokenAvailable (void);
|
||||
|
5136
q3radiant/PMESH.CPP
5136
q3radiant/PMESH.CPP
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "qe3.h"
|
||||
|
||||
|
||||
#define MAX_POINTFILE 8192
|
||||
static vec3_t s_pointvecs[MAX_POINTFILE];
|
||||
static int s_num_points, s_check_point;
|
||||
|
||||
void Pointfile_Delete (void)
|
||||
{
|
||||
char name[1024];
|
||||
|
||||
strcpy (name, currentmap);
|
||||
StripExtension (name);
|
||||
strcat (name, ".lin");
|
||||
|
||||
remove(name);
|
||||
}
|
||||
|
||||
// advance camera to next point
|
||||
void Pointfile_Next (void)
|
||||
{
|
||||
vec3_t dir;
|
||||
|
||||
if (s_check_point >= s_num_points-2)
|
||||
{
|
||||
Sys_Status ("End of pointfile", 0);
|
||||
return;
|
||||
}
|
||||
s_check_point++;
|
||||
VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetCamera()->Camera().origin);
|
||||
VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetXYWnd()->GetOrigin());
|
||||
VectorSubtract (s_pointvecs[s_check_point+1], g_pParentWnd->GetCamera()->Camera().origin, dir);
|
||||
VectorNormalize (dir);
|
||||
g_pParentWnd->GetCamera()->Camera().angles[1] = atan2 (dir[1], dir[0])*180/3.14159;
|
||||
g_pParentWnd->GetCamera()->Camera().angles[0] = asin (dir[2])*180/3.14159;
|
||||
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
|
||||
// advance camera to previous point
|
||||
void Pointfile_Prev (void)
|
||||
{
|
||||
vec3_t dir;
|
||||
|
||||
if ( s_check_point == 0)
|
||||
{
|
||||
Sys_Status ("Start of pointfile", 0);
|
||||
return;
|
||||
}
|
||||
s_check_point--;
|
||||
VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetCamera()->Camera().origin);
|
||||
VectorCopy (s_pointvecs[s_check_point], g_pParentWnd->GetXYWnd()->GetOrigin());
|
||||
VectorSubtract (s_pointvecs[s_check_point+1], g_pParentWnd->GetCamera()->Camera().origin, dir);
|
||||
VectorNormalize (dir);
|
||||
g_pParentWnd->GetCamera()->Camera().angles[1] = atan2 (dir[1], dir[0])*180/3.14159;
|
||||
g_pParentWnd->GetCamera()->Camera().angles[0] = asin (dir[2])*180/3.14159;
|
||||
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
|
||||
void WINAPI Pointfile_Check (void)
|
||||
{
|
||||
char name[1024];
|
||||
FILE *f;
|
||||
vec3_t v;
|
||||
|
||||
strcpy (name, currentmap);
|
||||
StripExtension (name);
|
||||
strcat (name, ".lin");
|
||||
|
||||
f = fopen (name, "r");
|
||||
if (!f)
|
||||
return;
|
||||
|
||||
Sys_Printf ("Reading pointfile %s\n", name);
|
||||
|
||||
if (!g_qeglobals.d_pointfile_display_list)
|
||||
g_qeglobals.d_pointfile_display_list = qglGenLists(1);
|
||||
|
||||
s_num_points = 0;
|
||||
qglNewList (g_qeglobals.d_pointfile_display_list, GL_COMPILE);
|
||||
qglColor3f (1, 0, 0);
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
qglDisable(GL_TEXTURE_1D);
|
||||
qglLineWidth (4);
|
||||
qglBegin(GL_LINE_STRIP);
|
||||
do
|
||||
{
|
||||
if (fscanf (f, "%f %f %f\n", &v[0], &v[1], &v[2]) != 3)
|
||||
break;
|
||||
if (s_num_points < MAX_POINTFILE)
|
||||
{
|
||||
VectorCopy (v, s_pointvecs[s_num_points]);
|
||||
s_num_points++;
|
||||
}
|
||||
qglVertex3fv (v);
|
||||
} while (1);
|
||||
qglEnd();
|
||||
qglLineWidth (1);
|
||||
qglEndList ();
|
||||
|
||||
s_check_point = 0;
|
||||
fclose (f);
|
||||
//Pointfile_Next ();
|
||||
}
|
||||
|
||||
void Pointfile_Draw( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
qglColor3f( 1.0F, 0.0F, 0.0F );
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
qglDisable(GL_TEXTURE_1D);
|
||||
qglLineWidth (4);
|
||||
qglBegin(GL_LINE_STRIP);
|
||||
for ( i = 0; i < s_num_points; i++ )
|
||||
{
|
||||
qglVertex3fv( s_pointvecs[i] );
|
||||
}
|
||||
qglEnd();
|
||||
qglLineWidth( 1 );
|
||||
}
|
||||
|
||||
void Pointfile_Clear (void)
|
||||
{
|
||||
if (!g_qeglobals.d_pointfile_display_list)
|
||||
return;
|
||||
|
||||
qglDeleteLists (g_qeglobals.d_pointfile_display_list, 1);
|
||||
g_qeglobals.d_pointfile_display_list = 0;
|
||||
Sys_UpdateWindows (W_ALL);
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// PatchDensityDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "PatchDensityDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPatchDensityDlg dialog
|
||||
|
||||
|
||||
CPatchDensityDlg::CPatchDensityDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CPatchDensityDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CPatchDensityDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CPatchDensityDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CPatchDensityDlg)
|
||||
DDX_Control(pDX, IDC_COMBO_WIDTH, m_wndWidth);
|
||||
DDX_Control(pDX, IDC_COMBO_HEIGHT, m_wndHeight);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPatchDensityDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CPatchDensityDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPatchDensityDlg message handlers
|
||||
|
||||
int g_nXLat[] = {3,5,7,9,11,13,15};
|
||||
|
||||
void CPatchDensityDlg::OnOK()
|
||||
{
|
||||
int nWidth = m_wndWidth.GetCurSel();
|
||||
int nHeight = m_wndHeight.GetCurSel();
|
||||
|
||||
if (nWidth >= 0 && nWidth <= 6 && nHeight >= 0 && nHeight <= 6)
|
||||
{
|
||||
Patch_GenericMesh(g_nXLat[nWidth], g_nXLat[nHeight], g_pParentWnd->ActiveXY()->GetViewType());
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
BOOL CPatchDensityDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_wndWidth.SetCurSel(0);
|
||||
m_wndHeight.SetCurSel(0);
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_PATCHDENSITYDLG_H__509162A1_1023_11D2_AFFB_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_PATCHDENSITYDLG_H__509162A1_1023_11D2_AFFB_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// PatchDensityDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPatchDensityDlg dialog
|
||||
|
||||
class CPatchDensityDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CPatchDensityDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CPatchDensityDlg)
|
||||
enum { IDD = IDD_DIALOG_NEWPATCH };
|
||||
CComboBox m_wndWidth;
|
||||
CComboBox m_wndHeight;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPatchDensityDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CPatchDensityDlg)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PATCHDENSITYDLG_H__509162A1_1023_11D2_AFFB_00AA00A410FC__INCLUDED_)
|
|
@ -1,354 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// PatchDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "PatchDialog.h"
|
||||
#include "TextureLayout.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPatchDialog dialog
|
||||
|
||||
CPatchDialog g_PatchDialog;
|
||||
|
||||
CPatchDialog::CPatchDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CPatchDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CPatchDialog)
|
||||
m_strName = _T("");
|
||||
m_fS = 0.0f;
|
||||
m_fT = 0.0f;
|
||||
m_fX = 0.0f;
|
||||
m_fY = 0.0f;
|
||||
m_fZ = 0.0f;
|
||||
m_fHScale = 0.05f;
|
||||
m_fHShift = 0.05f;
|
||||
m_fRotate = 45;
|
||||
m_fVScale = 0.05f;
|
||||
m_fVShift = 0.05f;
|
||||
//}}AFX_DATA_INIT
|
||||
m_Patch = NULL;
|
||||
}
|
||||
|
||||
|
||||
void CPatchDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CPatchDialog)
|
||||
DDX_Control(pDX, IDC_SPIN_VSHIFT, m_wndVShift);
|
||||
DDX_Control(pDX, IDC_SPIN_VSCALE, m_wndVScale);
|
||||
DDX_Control(pDX, IDC_SPIN_ROTATE, m_wndRotate);
|
||||
DDX_Control(pDX, IDC_SPIN_HSHIFT, m_wndHShift);
|
||||
DDX_Control(pDX, IDC_SPIN_HSCALE, m_wndHScale);
|
||||
DDX_Control(pDX, IDC_COMBO_TYPE, m_wndType);
|
||||
DDX_Control(pDX, IDC_COMBO_ROW, m_wndRows);
|
||||
DDX_Control(pDX, IDC_COMBO_COL, m_wndCols);
|
||||
DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
|
||||
DDX_Text(pDX, IDC_EDIT_S, m_fS);
|
||||
DDX_Text(pDX, IDC_EDIT_T, m_fT);
|
||||
DDX_Text(pDX, IDC_EDIT_X, m_fX);
|
||||
DDX_Text(pDX, IDC_EDIT_Y, m_fY);
|
||||
DDX_Text(pDX, IDC_EDIT_Z, m_fZ);
|
||||
DDX_Text(pDX, IDC_HSCALE, m_fHScale);
|
||||
DDX_Text(pDX, IDC_HSHIFT, m_fHShift);
|
||||
DDX_Text(pDX, IDC_ROTATE, m_fRotate);
|
||||
DDX_Text(pDX, IDC_VSCALE, m_fVScale);
|
||||
DDX_Text(pDX, IDC_VSHIFT, m_fVShift);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPatchDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CPatchDialog)
|
||||
ON_BN_CLICKED(IDC_BTN_PATCHDETAILS, OnBtnPatchdetails)
|
||||
ON_BN_CLICKED(IDC_BTN_PATCHFIT, OnBtnPatchfit)
|
||||
ON_BN_CLICKED(IDC_BTN_PATCHNATURAL, OnBtnPatchnatural)
|
||||
ON_BN_CLICKED(IDC_BTN_PATCHRESET, OnBtnPatchreset)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_COL, OnSelchangeComboCol)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_ROW, OnSelchangeComboRow)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_TYPE, OnSelchangeComboType)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_HSCALE, OnDeltaposSpin)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_ROTATE, OnDeltaposSpin)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_VSCALE, OnDeltaposSpin)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_VSHIFT, OnDeltaposSpin)
|
||||
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_HSHIFT, OnDeltaposSpin)
|
||||
ON_WM_DESTROY()
|
||||
ON_BN_CLICKED(ID_APPLY, OnApply)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPatchDialog message handlers
|
||||
|
||||
void CPatchDialog::OnBtnPatchdetails()
|
||||
{
|
||||
Patch_NaturalizeSelected(true);
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
void CPatchDialog::OnBtnPatchfit()
|
||||
{
|
||||
Patch_FitTexturing();
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
void CPatchDialog::OnBtnPatchnatural()
|
||||
{
|
||||
Patch_NaturalizeSelected();
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
void CPatchDialog::OnBtnPatchreset()
|
||||
{
|
||||
CTextureLayout dlg;
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
Patch_ResetTexturing(dlg.m_fX, dlg.m_fY);
|
||||
}
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
|
||||
void CPatchDialog::OnSelchangeComboCol()
|
||||
{
|
||||
UpdateRowColInfo();
|
||||
}
|
||||
|
||||
void CPatchDialog::OnSelchangeComboRow()
|
||||
{
|
||||
UpdateRowColInfo();
|
||||
}
|
||||
|
||||
void CPatchDialog::OnSelchangeComboType()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
}
|
||||
|
||||
void CPatchDialog::OnOK()
|
||||
{
|
||||
m_Patch = NULL;
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CPatchDialog::OnDeltaposSpin(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||
UpdateSpinners((pNMUpDown->iDelta > 0), pNMUpDown->hdr.idFrom);
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
BOOL CPatchDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
m_wndHScale.SetRange(0, 1000);
|
||||
m_wndVScale.SetRange(0, 1000);
|
||||
m_wndHShift.SetRange(0, 1000);
|
||||
m_wndVShift.SetRange(0, 1000);
|
||||
m_wndRotate.SetRange(0, 1000);
|
||||
|
||||
GetPatchInfo();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CPatchDialog::GetPatchInfo()
|
||||
{
|
||||
m_Patch = SinglePatchSelected();
|
||||
if (m_Patch != NULL)
|
||||
{
|
||||
CString str;
|
||||
int i;
|
||||
m_wndRows.ResetContent();
|
||||
for (i = 0; i < m_Patch->height; i++)
|
||||
{
|
||||
str.Format("%i", i);
|
||||
m_wndRows.AddString(str);
|
||||
}
|
||||
m_wndRows.SetCurSel(0);
|
||||
m_wndCols.ResetContent();
|
||||
for (i = 0; i < m_Patch->width; i++)
|
||||
{
|
||||
str.Format("%i", i);
|
||||
m_wndCols.AddString(str);
|
||||
}
|
||||
m_wndCols.SetCurSel(0);
|
||||
}
|
||||
UpdateRowColInfo();
|
||||
}
|
||||
|
||||
void CPatchDialog::SetPatchInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DoPatchInspector()
|
||||
{
|
||||
if (g_PatchDialog.GetSafeHwnd() == NULL)
|
||||
{
|
||||
g_PatchDialog.Create(IDD_DIALOG_PATCH);
|
||||
CRect rct;
|
||||
LONG lSize = sizeof(rct);
|
||||
if (LoadRegistryInfo("Radiant::PatchWindow", &rct, &lSize))
|
||||
{
|
||||
g_PatchDialog.SetWindowPos(NULL, rct.left, rct.top, 0,0, SWP_NOSIZE);
|
||||
}
|
||||
}
|
||||
g_PatchDialog.ShowWindow(SW_SHOW);
|
||||
g_PatchDialog.GetPatchInfo();
|
||||
}
|
||||
|
||||
void UpdatePatchInspector()
|
||||
{
|
||||
if (g_PatchDialog.GetSafeHwnd() != NULL)
|
||||
{
|
||||
g_PatchDialog.UpdateInfo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CPatchDialog::OnDestroy()
|
||||
{
|
||||
if (GetSafeHwnd())
|
||||
{
|
||||
CRect rct;
|
||||
GetWindowRect(rct);
|
||||
SaveRegistryInfo("Radiant::PatchWindow", &rct, sizeof(rct));
|
||||
}
|
||||
CDialog::OnDestroy();
|
||||
}
|
||||
|
||||
void CPatchDialog::UpdateRowColInfo()
|
||||
{
|
||||
m_fX = m_fY = m_fZ = m_fS = m_fT = 0.0;
|
||||
|
||||
if (m_Patch != NULL)
|
||||
{
|
||||
int r = m_wndRows.GetCurSel();
|
||||
int c = m_wndCols.GetCurSel();
|
||||
if (r >= 0 && r < m_Patch->height && c >= 0 && c < m_Patch->width)
|
||||
{
|
||||
m_fX = m_Patch->ctrl[c][r].xyz[0];
|
||||
m_fY = m_Patch->ctrl[c][r].xyz[1];
|
||||
m_fZ = m_Patch->ctrl[c][r].xyz[2];
|
||||
m_fS = m_Patch->ctrl[c][r].st[0];
|
||||
m_fT = m_Patch->ctrl[c][r].st[1];
|
||||
}
|
||||
}
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
void CPatchDialog::UpdateInfo()
|
||||
{
|
||||
GetPatchInfo();
|
||||
}
|
||||
|
||||
void CPatchDialog::OnApply()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
if (m_Patch != NULL)
|
||||
{
|
||||
int r = m_wndRows.GetCurSel();
|
||||
int c = m_wndCols.GetCurSel();
|
||||
if (r >= 0 && r < m_Patch->height && c >= 0 && c < m_Patch->width)
|
||||
{
|
||||
m_Patch->ctrl[c][r].xyz[0] = m_fX;
|
||||
m_Patch->ctrl[c][r].xyz[1] = m_fY;
|
||||
m_Patch->ctrl[c][r].xyz[2] = m_fZ;
|
||||
m_Patch->ctrl[c][r].st[0] = m_fS;
|
||||
m_Patch->ctrl[c][r].st[1] = m_fT;
|
||||
m_Patch->bDirty = true;
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPatchDialog::UpdateSpinners(bool bUp, int nID)
|
||||
{
|
||||
texdef_t td;
|
||||
|
||||
td.rotate = 0.0;
|
||||
td.scale[0] = td.scale[1] = 0.0;
|
||||
td.shift[0] = td.shift[1] = 0.0;
|
||||
td.contents = 0;
|
||||
td.flags = 0;
|
||||
td.value = 0;
|
||||
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (nID == IDC_SPIN_ROTATE)
|
||||
{
|
||||
if (bUp)
|
||||
td.rotate = m_fRotate;
|
||||
else
|
||||
td.rotate = -m_fRotate;
|
||||
}
|
||||
else if (nID == IDC_SPIN_HSCALE)
|
||||
{
|
||||
if (bUp)
|
||||
td.scale[0] = 1 - m_fHScale;
|
||||
else
|
||||
td.scale[0] = 1 + m_fHScale;
|
||||
}
|
||||
else if (nID == IDC_SPIN_VSCALE)
|
||||
{
|
||||
if (bUp)
|
||||
td.scale[1] = 1 - m_fVScale;
|
||||
else
|
||||
td.scale[1] = 1 + m_fVScale;
|
||||
}
|
||||
|
||||
else if (nID == IDC_SPIN_HSHIFT)
|
||||
{
|
||||
if (bUp)
|
||||
td.shift[0] = m_fHShift;
|
||||
else
|
||||
td.shift[0] = -m_fHShift;
|
||||
}
|
||||
else if (nID == IDC_SPIN_VSHIFT)
|
||||
{
|
||||
if (bUp)
|
||||
td.shift[1] = m_fVShift;
|
||||
else
|
||||
td.shift[1] = -m_fVShift;
|
||||
}
|
||||
|
||||
Patch_SetTextureInfo(&td);
|
||||
Sys_UpdateWindows(W_CAMERA);
|
||||
}
|
||||
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_PATCHDIALOG_H__DE62DFB4_E9EC_11D2_A509_0020AFEB881A__INCLUDED_)
|
||||
#define AFX_PATCHDIALOG_H__DE62DFB4_E9EC_11D2_A509_0020AFEB881A__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// PatchDialog.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPatchDialog dialog
|
||||
|
||||
class CPatchDialog : public CDialog
|
||||
{
|
||||
patchMesh_t *m_Patch;
|
||||
// Construction
|
||||
public:
|
||||
void UpdateInfo();
|
||||
void SetPatchInfo();
|
||||
void GetPatchInfo();
|
||||
CPatchDialog(CWnd* pParent = NULL); // standard constructor
|
||||
void UpdateSpinners(bool bUp, int nID);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CPatchDialog)
|
||||
enum { IDD = IDD_DIALOG_PATCH };
|
||||
CSpinButtonCtrl m_wndVShift;
|
||||
CSpinButtonCtrl m_wndVScale;
|
||||
CSpinButtonCtrl m_wndRotate;
|
||||
CSpinButtonCtrl m_wndHShift;
|
||||
CSpinButtonCtrl m_wndHScale;
|
||||
CComboBox m_wndType;
|
||||
CComboBox m_wndRows;
|
||||
CComboBox m_wndCols;
|
||||
CString m_strName;
|
||||
float m_fS;
|
||||
float m_fT;
|
||||
float m_fX;
|
||||
float m_fY;
|
||||
float m_fZ;
|
||||
float m_fHScale;
|
||||
float m_fHShift;
|
||||
float m_fRotate;
|
||||
float m_fVScale;
|
||||
float m_fVShift;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPatchDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
void UpdateRowColInfo();
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CPatchDialog)
|
||||
afx_msg void OnBtnPatchdetails();
|
||||
afx_msg void OnBtnPatchfit();
|
||||
afx_msg void OnBtnPatchnatural();
|
||||
afx_msg void OnBtnPatchreset();
|
||||
afx_msg void OnSelchangeComboCol();
|
||||
afx_msg void OnSelchangeComboRow();
|
||||
afx_msg void OnSelchangeComboType();
|
||||
virtual void OnOK();
|
||||
afx_msg void OnDeltaposSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnApply();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PATCHDIALOG_H__DE62DFB4_E9EC_11D2_A509_0020AFEB881A__INCLUDED_)
|
|
@ -1,297 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// PlugIn.cpp: implementation of the CPlugIn class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Radiant.h"
|
||||
#include "PlugIn.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CPlugIn::CPlugIn()
|
||||
{
|
||||
m_hDLL = NULL;
|
||||
m_pQERPlugEntitiesFactory = NULL;
|
||||
}
|
||||
|
||||
CPlugIn::~CPlugIn()
|
||||
{
|
||||
if (m_pQERPlugEntitiesFactory)
|
||||
delete m_pQERPlugEntitiesFactory;
|
||||
if (m_hDLL != NULL)
|
||||
free();
|
||||
}
|
||||
|
||||
bool CPlugIn::load(const char *p)
|
||||
{
|
||||
m_hDLL = ::LoadLibrary(p);
|
||||
if (m_hDLL != NULL)
|
||||
{
|
||||
m_pfnInit = reinterpret_cast<PFN_QERPLUG_INIT>(::GetProcAddress(m_hDLL, QERPLUG_INIT));
|
||||
if (m_pfnInit != NULL)
|
||||
{
|
||||
m_strVersion = (*m_pfnInit)(AfxGetApp()->m_hInstance, g_pParentWnd->GetSafeHwnd());
|
||||
Sys_Printf("Loaded plugin > %s\n", m_strVersion);
|
||||
|
||||
m_pfnGetName = reinterpret_cast<PFN_QERPLUG_GETNAME>(::GetProcAddress(m_hDLL, QERPLUG_GETNAME));
|
||||
if (m_pfnGetName != NULL)
|
||||
{
|
||||
m_strName = (*m_pfnGetName)();
|
||||
}
|
||||
|
||||
m_pfnGetCommandList = reinterpret_cast<PFN_QERPLUG_GETCOMMANDLIST>(::GetProcAddress(m_hDLL, QERPLUG_GETCOMMANDLIST));
|
||||
if (m_pfnGetCommandList)
|
||||
{
|
||||
CString str = (*m_pfnGetCommandList)();
|
||||
char cTemp[1024];
|
||||
strcpy(cTemp, str);
|
||||
char* token = strtok(cTemp, ",;");
|
||||
if (token && *token == ' ')
|
||||
{
|
||||
while (*token == ' ')
|
||||
token++;
|
||||
}
|
||||
while (token != NULL)
|
||||
{
|
||||
m_CommandStrings.Add(token);
|
||||
token = strtok(NULL, ",;");
|
||||
}
|
||||
}
|
||||
|
||||
m_pfnDispatch = reinterpret_cast<PFN_QERPLUG_DISPATCH>(::GetProcAddress(m_hDLL, QERPLUG_DISPATCH));
|
||||
m_pfnGetFuncTable = reinterpret_cast<PFN_QERPLUG_GETFUNCTABLE>(::GetProcAddress(m_hDLL, QERPLUG_GETFUNCTABLE));
|
||||
|
||||
m_pfnGetTextureInfo = reinterpret_cast<PFN_QERPLUG_GETTEXTUREINFO>(::GetProcAddress(m_hDLL, QERPLUG_GETTEXTUREINFO));
|
||||
m_pfnLoadTexture = reinterpret_cast<PFN_QERPLUG_LOADTEXTURE>(::GetProcAddress(m_hDLL, QERPLUG_LOADTEXTURE));
|
||||
|
||||
m_pfnGetSurfaceFlags = reinterpret_cast<PFN_QERPLUG_GETSURFACEFLAGS>(::GetProcAddress(m_hDLL, QERPLUG_GETSURFACEFLAGS));
|
||||
|
||||
m_pfnRegisterPluginEntities = reinterpret_cast<PFN_QERPLUG_REGISTERPLUGINENTITIES>(::GetProcAddress(m_hDLL, QERPLUG_REGISTERPLUGINENTITIES));
|
||||
|
||||
m_pfnInitSurfaceProperties = reinterpret_cast<PFN_QERPLUG_INITSURFACEPROPERTIES>(::GetProcAddress(m_hDLL, QERPLUG_INITSURFACEPROPERTIES));
|
||||
|
||||
m_pfnRequestInterface = reinterpret_cast<PFN_QERPLUG_REQUESTINTERFACE>(::GetProcAddress(m_hDLL, QERPLUG_REQUESTINTERFACE));
|
||||
|
||||
return (m_pfnDispatch != NULL && m_pfnGetFuncTable != NULL);
|
||||
//--return true;
|
||||
}
|
||||
Sys_Printf("FAILED to Load plugin > %s\n", p);
|
||||
}
|
||||
LPVOID lpMsgBuf;
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
Sys_Printf("LoadLibrary failed on %s: GetLastError: %s\n", p, lpMsgBuf );
|
||||
// Free the buffer.
|
||||
LocalFree( lpMsgBuf );
|
||||
free();
|
||||
return false;
|
||||
}
|
||||
|
||||
_QERTextureInfo* CPlugIn::getTextureInfo()
|
||||
{
|
||||
if (m_pfnGetTextureInfo != NULL)
|
||||
{
|
||||
return reinterpret_cast<_QERTextureInfo*>((*m_pfnGetTextureInfo)());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CPlugIn::loadTexture(LPCSTR pFilename)
|
||||
{
|
||||
if (m_pfnLoadTexture != NULL)
|
||||
{
|
||||
(*m_pfnLoadTexture)(pFilename);
|
||||
}
|
||||
}
|
||||
|
||||
LPVOID CPlugIn::getSurfaceFlags()
|
||||
{
|
||||
if (m_pfnGetSurfaceFlags != NULL)
|
||||
{
|
||||
return reinterpret_cast<LPVOID>((*m_pfnGetSurfaceFlags)());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CPlugIn::free()
|
||||
{
|
||||
if (m_hDLL != NULL)
|
||||
::FreeLibrary(m_hDLL);
|
||||
m_hDLL = NULL;
|
||||
}
|
||||
|
||||
const char* CPlugIn::getVersionStr()
|
||||
{
|
||||
return m_pfnGetName();
|
||||
}
|
||||
|
||||
const char* CPlugIn::getMenuName()
|
||||
{
|
||||
return m_strName;
|
||||
}
|
||||
|
||||
int CPlugIn::getCommandCount()
|
||||
{
|
||||
return m_CommandStrings.GetSize();
|
||||
}
|
||||
|
||||
const char* CPlugIn::getCommand(int n)
|
||||
{
|
||||
return m_CommandStrings.GetAt(n);
|
||||
}
|
||||
|
||||
void CPlugIn::dispatchCommand(const char* p, vec3_t vMin, vec3_t vMax, BOOL bSingleBrush)
|
||||
{
|
||||
if (m_pfnDispatch)
|
||||
{
|
||||
(*m_pfnDispatch)(p, vMin, vMax, bSingleBrush);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugIn::addMenuID(int n)
|
||||
{
|
||||
m_CommandIDs.Add(n);
|
||||
}
|
||||
|
||||
bool CPlugIn::ownsCommandID(int n)
|
||||
{
|
||||
for (int i = 0; i < m_CommandIDs.GetSize(); i++)
|
||||
{
|
||||
if (m_CommandIDs.GetAt(i) == n)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void* CPlugIn::getFuncTable()
|
||||
{
|
||||
if (m_pfnGetFuncTable)
|
||||
{
|
||||
return (*m_pfnGetFuncTable)();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CPlugIn::RegisterPluginEntities()
|
||||
{
|
||||
// if we found the QERPlug_RegisterPluginEntities export, it means this plugin provides his own entities
|
||||
if (m_pfnRegisterPluginEntities)
|
||||
{
|
||||
// resquest a _QERPlugEntitiesFactory
|
||||
if (m_pfnRequestInterface)
|
||||
{
|
||||
m_pQERPlugEntitiesFactory = new _QERPlugEntitiesFactory;
|
||||
m_pQERPlugEntitiesFactory->m_nSize = sizeof(_QERPlugEntitiesFactory);
|
||||
if (m_pfnRequestInterface( QERPlugEntitiesFactory_GUID, m_pQERPlugEntitiesFactory ))
|
||||
{
|
||||
// create an IEpair interface for the project settings
|
||||
CEpairsWrapper *pProjectEp = new CEpairsWrapper( g_qeglobals.d_project_entity );
|
||||
m_pfnRegisterPluginEntities( pProjectEp );
|
||||
}
|
||||
else
|
||||
Sys_Printf( "WARNING: failed to request QERPlugEntitiesFactory from plugin %s\n", m_strName.GetBuffer(0) );
|
||||
}
|
||||
else
|
||||
Sys_Printf( "WARNING: QERPlug_RequestInterface not found in %s\n", m_strName.GetBuffer(0) );
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugIn::InitBSPFrontendPlugin()
|
||||
{
|
||||
if (m_pfnRequestInterface)
|
||||
{
|
||||
// request a _QERPlugBSPFrontendTable
|
||||
g_BSPFrontendTable.m_nSize = sizeof( _QERPlugBSPFrontendTable );
|
||||
if ( m_pfnRequestInterface( QERPlugBSPFrontendTable_GUID, &g_BSPFrontendTable ) )
|
||||
{
|
||||
g_qeglobals.bBSPFrontendPlugin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugIn::InitSurfacePlugin()
|
||||
{
|
||||
// if we found the QERPlug_InitSurfaceProperties export, it means this plugin does surface properties
|
||||
if (m_pfnInitSurfaceProperties)
|
||||
{
|
||||
if (g_qeglobals.bSurfacePropertiesPlugin)
|
||||
{
|
||||
Sys_Printf( "WARNING: conflict for surface properties plugins. %s ignored.\n", m_strName );
|
||||
return;
|
||||
}
|
||||
if (m_pfnRequestInterface)
|
||||
{
|
||||
// call the plugin surface properties init
|
||||
m_pfnInitSurfaceProperties();
|
||||
// request filling of the global _QERPlugSurfaceTable
|
||||
g_SurfaceTable.m_nSize = sizeof( g_SurfaceTable );
|
||||
if ( m_pfnRequestInterface( QERPlugSurfaceTable_GUID, &g_SurfaceTable ) )
|
||||
{
|
||||
// update the global so we know we have a surface properties plugin
|
||||
g_qeglobals.bSurfacePropertiesPlugin = true;
|
||||
}
|
||||
else
|
||||
Sys_Printf( "WARNING: _QERPlugSurfaceTable interface request failed for surface plugin\n" );
|
||||
}
|
||||
else
|
||||
Sys_Printf("WARNING: QERPlug_RequestInterface export not found in surface properties plugin.\n");
|
||||
}
|
||||
}
|
||||
|
||||
// create a plugin entity
|
||||
// e is the entity being created
|
||||
// e->eclass is the plugin eclass info
|
||||
// e->epairs will be accessed by the plugin entity through a IEpair interface
|
||||
IPluginEntity * CPlugIn::CreatePluginEntity(entity_t *e)
|
||||
{
|
||||
if (m_pQERPlugEntitiesFactory)
|
||||
{
|
||||
// create an IEpair interface for e->epairs
|
||||
CEpairsWrapper *pEp = new CEpairsWrapper( e );
|
||||
IPluginEntity *pEnt = m_pQERPlugEntitiesFactory->m_pfnCreateEntity( e->eclass, pEp );
|
||||
if ( pEnt )
|
||||
return pEnt;
|
||||
delete pEp;
|
||||
return NULL;
|
||||
}
|
||||
Sys_Printf("WARNING: unexpected m_pQERPlugEntitiesFactory is NULL in CPlugin::CreatePluginEntity\n");
|
||||
return NULL;
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// PlugIn.h: interface for the CPlugIn class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_PLUGIN_H__B501A832_5755_11D2_B084_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_PLUGIN_H__B501A832_5755_11D2_B084_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
class CPlugIn : public CObject
|
||||
{
|
||||
private:
|
||||
HMODULE m_hDLL;
|
||||
PFN_QERPLUG_INIT m_pfnInit;
|
||||
PFN_QERPLUG_GETNAME m_pfnGetName;
|
||||
PFN_QERPLUG_GETCOMMANDLIST m_pfnGetCommandList;
|
||||
PFN_QERPLUG_DISPATCH m_pfnDispatch;
|
||||
PFN_QERPLUG_GETFUNCTABLE m_pfnGetFuncTable;
|
||||
PFN_QERPLUG_GETTEXTUREINFO m_pfnGetTextureInfo;
|
||||
PFN_QERPLUG_LOADTEXTURE m_pfnLoadTexture;
|
||||
PFN_QERPLUG_GETSURFACEFLAGS m_pfnGetSurfaceFlags;
|
||||
PFN_QERPLUG_REGISTERPLUGINENTITIES m_pfnRegisterPluginEntities;
|
||||
PFN_QERPLUG_INITSURFACEPROPERTIES m_pfnInitSurfaceProperties;
|
||||
PFN_QERPLUG_REQUESTINTERFACE m_pfnRequestInterface;
|
||||
CWordArray m_CommandIDs;
|
||||
CStringArray m_CommandStrings;
|
||||
CString m_strName;
|
||||
CString m_strVersion;
|
||||
|
||||
// for plugins that provide plugin entities
|
||||
_QERPlugEntitiesFactory* m_pQERPlugEntitiesFactory;
|
||||
|
||||
public:
|
||||
void InitBSPFrontendPlugin();
|
||||
IPluginEntity * CreatePluginEntity( entity_t * );
|
||||
HMODULE GetDLLModule() { return m_hDLL; }
|
||||
void InitSurfacePlugin();
|
||||
void RegisterPluginEntities();
|
||||
void* getFuncTable();
|
||||
bool ownsCommandID(int n);
|
||||
void addMenuID(int n);
|
||||
CPlugIn();
|
||||
virtual ~CPlugIn();
|
||||
bool load(const char *p);
|
||||
void free();
|
||||
const char* getVersionStr();
|
||||
const char* getMenuName();
|
||||
int getCommandCount();
|
||||
const char* getCommand(int n);
|
||||
void dispatchCommand(const char* p, vec3_t vMin, vec3_t vMax, BOOL bSingleBrush);
|
||||
|
||||
_QERTextureInfo *getTextureInfo();
|
||||
void loadTexture(LPCSTR pFilename);
|
||||
|
||||
LPVOID getSurfaceFlags();
|
||||
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_PLUGIN_H__B501A832_5755_11D2_B084_00AA00A410FC__INCLUDED_)
|
File diff suppressed because it is too large
Load Diff
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// PlugInManager.h: interface for the CPlugInManager class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_PLUGINMANAGER_H__CFB18412_55FE_11D2_B082_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_PLUGINMANAGER_H__CFB18412_55FE_11D2_B082_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
class CPlugInManager
|
||||
{
|
||||
private:
|
||||
CObArray m_PlugIns;
|
||||
CPtrArray m_BrushHandles;
|
||||
CPtrArray m_SelectedBrushHandles;
|
||||
CPtrArray m_ActiveBrushHandles;
|
||||
|
||||
CPlugIn *m_pTexturePlug;
|
||||
CPlugIn *m_pSurfaceListPlug;
|
||||
|
||||
// v1.70
|
||||
// brushes of the current entity ( see m_SelectedBrushHandles and m_ActiveBrushHandles )
|
||||
CPtrArray m_EntityBrushHandles;
|
||||
// allocated entities, not commited yet ( see m_BrushHandles )
|
||||
CPtrArray m_EntityHandles;
|
||||
|
||||
// tells in which array to look when given a patch index
|
||||
enum EPatchesMode { EActivePatches, ESelectedPatches, EAllocatedPatches } PatchesMode;
|
||||
// patches handles (brush_t*)
|
||||
CPtrArray m_PatchesHandles;
|
||||
// plugin-allocated patches, not commited yet (patchMesh_t*)
|
||||
CPtrArray m_PluginPatches;
|
||||
|
||||
public:
|
||||
CPlugIn * PluginForModule( HMODULE hPlug );
|
||||
CPtrArray& GetActiveHandles() {return m_ActiveBrushHandles; };
|
||||
CPtrArray& GetSelectedHandles() {return m_SelectedBrushHandles; };
|
||||
CPtrArray& GetPluginPatches() {return m_PluginPatches; };
|
||||
brush_t* FindBrushHandle(void *vp);
|
||||
patchMesh_t* FindPatchHandle(int index);
|
||||
int CreatePatchHandle();
|
||||
int AllocateActivePatchHandles();
|
||||
int AllocateSelectedPatchHandles();
|
||||
void CommitPatchHandleToMap(int index, patchMesh_t *pMesh, char *texName);
|
||||
void ReleasePatchesHandles() { m_PatchesHandles.RemoveAll(); m_PluginPatches.RemoveAll(); }
|
||||
void AddFaceToBrushHandle(void *vp, vec3_t v1, vec3_t v2, vec3_t v3);
|
||||
void CommitBrushHandleToMap(void *vp);
|
||||
void DeleteBrushHandle(LPVOID vp);
|
||||
LPVOID CreateBrushHandle();
|
||||
void Dispatch(int n, const char *p);
|
||||
void Cleanup();
|
||||
void Init(const char* pPath);
|
||||
CPlugInManager();
|
||||
virtual ~CPlugInManager();
|
||||
|
||||
// the texture manager front ends the single load
|
||||
// addins (texture, model, map formats.. etc.)
|
||||
_QERTextureInfo* GetTextureInfo();
|
||||
void LoadTexture(const char *pFilename);
|
||||
|
||||
LPVOID GetSurfaceFlags();
|
||||
|
||||
// v1.70
|
||||
CPtrArray& GetEntityBrushHandles() {return m_EntityBrushHandles; };
|
||||
CPtrArray& GetEntityHandles() {return m_EntityHandles; };
|
||||
// the vpBrush needs to be in m_BrushHandles
|
||||
void CommitBrushHandleToEntity( LPVOID vpBrush, LPVOID vpEntity );
|
||||
// the vpEntity needs to be in m_EntityHandles
|
||||
void CommitEntityHandleToMap( LPVOID vpEntity );
|
||||
|
||||
protected:
|
||||
int FillFuncTable(CPlugIn *pPlug); // PGM
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_PLUGINMANAGER_H__CFB18412_55FE_11D2_B082_00AA00A410FC__INCLUDED_)
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $LogFile$
|
||||
// $Revision: 1.1.1.4 $
|
||||
// $Author: ttimo $
|
||||
// $Date: 2000/01/18 00:17:34 $
|
||||
// $Log: PluginEntities.cpp,v $
|
||||
// Revision 1.1.1.4 2000/01/18 00:17:34 ttimo
|
||||
// merging in for RC
|
||||
//
|
||||
// Revision 1.3 2000/01/17 23:53:42 TBesset
|
||||
// ready for merge in sourceforge (RC candidate)
|
||||
//
|
||||
// Revision 1.2 2000/01/07 16:40:11 TBesset
|
||||
// merged from BSP frontend
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:34 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.1.1.1.2.1 1999/12/29 21:39:38 TBesset
|
||||
// updated to update3 from Robert
|
||||
//
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:34 TBesset
|
||||
// Q3Radiant public version
|
||||
// Revision 1.1.1.3 1999/12/29 18:31:34 TBesset
|
||||
// Q3Radiant public version
|
||||
//
|
||||
// Revision 1.2 1999/11/22 17:46:46 Timo & Christine
|
||||
// merged EARadiant into the main tree
|
||||
// bug fixes for Q3Plugin / EAPlugin
|
||||
// export for Robert
|
||||
//
|
||||
// Revision 1.1.2.1 1999/11/03 20:38:01 Timo & Christine
|
||||
// MEAN plugin for Q3Radiant, alpha version
|
||||
//
|
||||
//
|
||||
// DESCRIPTION:
|
||||
// implementation of IPluginEntities specific interface
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "io.h"
|
||||
|
||||
// is Eclass_InitForModelDirectory
|
||||
int WINAPI QERApp_EClassScanDir( char *path, HMODULE hPlug )
|
||||
{
|
||||
struct _finddata_t fileinfo;
|
||||
int handle;
|
||||
char temp[ _MAX_PATH ];
|
||||
char filebase[ _MAX_PATH ];
|
||||
char filename[ _MAX_PATH ];
|
||||
char *s;
|
||||
eclass_t *e;
|
||||
QE_ConvertDOSToUnixName( temp, path );
|
||||
strcpy (filebase, path);
|
||||
s = filebase + strlen(filebase)-1;
|
||||
while (*s != '\\' && *s != '/' && s!=filebase)
|
||||
s--;
|
||||
*s = 0;
|
||||
handle = _findfirst (path, &fileinfo);
|
||||
if (handle != -1)
|
||||
{
|
||||
do
|
||||
{
|
||||
sprintf (filename, "%s\\%s", filebase, fileinfo.name);
|
||||
Eclass_ScanFile (filename);
|
||||
|
||||
if (eclass_found)
|
||||
{
|
||||
e = eclass_e;
|
||||
e->modelpath = strdup( fileinfo.name );
|
||||
e->nShowFlags |= ECLASS_PLUGINENTITY;
|
||||
e->hPlug = hPlug;
|
||||
}
|
||||
} while (_findnext( handle, &fileinfo ) != -1);
|
||||
|
||||
_findclose (handle);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,578 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// PrefsDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "PrefsDlg.h"
|
||||
#include "shlobj.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define PREF_SECTION "Prefs"
|
||||
#define INTERNAL_SECTION "Internals"
|
||||
#define MOUSE_KEY "MouseButtons"
|
||||
#define WINDOW_KEY "QE4StyleWindows"
|
||||
#define LAYOUT_KEY "WindowLayout"
|
||||
#define Q2_KEY "Quake2Dir"
|
||||
#define RUNQ2_KEY "RunQuake2Run"
|
||||
#define TLOCK_KEY "TextureLock"
|
||||
#define RLOCK_KEY "RotateLock"
|
||||
#define LOADLAST_KEY "LoadLast"
|
||||
#define LOADLASTMAP_KEY "LoadLastMap"
|
||||
#define LASTPROJ_KEY "LastProject"
|
||||
#define LASTMAP_KEY "LastMap"
|
||||
#define RUN_KEY "RunBefore"
|
||||
#define _3DFX_KEY "Use3Dfx"
|
||||
#define FACE_KEY "NewFaceGrab"
|
||||
#define BSP_KEY "InternalBSP"
|
||||
#define RCLICK_KEY "NewRightClick"
|
||||
#define VERTEX_KEY "NewVertex"
|
||||
#define AUTOSAVE_KEY "Autosave"
|
||||
#define AUTOSAVETIME_KEY "AutosaveMinutes"
|
||||
#define PAK_KEY "UsePAK"
|
||||
#define NEWAPPLY_KEY "ApplyDismissesSurface"
|
||||
#define HACK_KEY "Gatewayescapehack"
|
||||
#define TEXTURE_KEY "NewTextureWindowStuff"
|
||||
#define TINYBRUSH_KEY "CleanTinyBrushes"
|
||||
#define TINYSIZE_KEY "CleanTinyBrusheSize"
|
||||
#define SNAPSHOT_KEY "Snapshots"
|
||||
#define PAKFILE_KEY "PAKFile"
|
||||
#define STATUS_KEY "StatusPointSize"
|
||||
#define MOVESPEED_KEY "MoveSpeed"
|
||||
#define ANGLESPEED_KEY "AngleSpeed"
|
||||
#define SETGAME_KEY "UseSetGame"
|
||||
#define CAMXYUPDATE_KEY "CamXYUpdate"
|
||||
#define LIGHTDRAW_KEY "NewLightStyle"
|
||||
#define WHATGAME_KEY "WhichGame"
|
||||
#define CUBICCLIP_KEY "CubicClipping"
|
||||
#define CUBICSCALE_KEY "CubicScale"
|
||||
#define ALTEDGE_KEY "ALTEdgeDrag"
|
||||
#define TEXTUREBAR_KEY "UseTextureBar"
|
||||
#define FACECOLORS_KEY "FaceColors"
|
||||
#define QE4PAINT_KEY "QE4Paint"
|
||||
#define SNAPT_KEY "SnapT"
|
||||
#define XZVIS_KEY "XZVIS"
|
||||
#define YZVIS_KEY "YZVIS"
|
||||
#define ZVIS_KEY "ZVIS"
|
||||
#define SIZEPAINT_KEY "SizePainting"
|
||||
#define DLLENTITIES_KEY "DLLEntities"
|
||||
#define WIDETOOLBAR_KEY "WideToolBar"
|
||||
#define NOCLAMP_KEY "NoClamp"
|
||||
#define PREFAB_KEY "PrefabPath"
|
||||
#define USERINI_KEY "UserINIPath"
|
||||
#define ROTATION_KEY "Rotation"
|
||||
#define SGIOPENGL_KEY "SGIOpenGL"
|
||||
#define BUGGYICD_KEY "BuggyICD"
|
||||
#define HICOLOR_KEY "HiColorTextures"
|
||||
#define CHASEMOUSE_KEY "ChaseMouse"
|
||||
#define ENTITYSHOW_KEY "EntityShow"
|
||||
#define TEXTURESCALE_KEY "TextureScale"
|
||||
#define TEXTURESCROLLBAR_KEY "TextureScrollbar"
|
||||
#define DISPLAYLISTS_KEY "UseDisplayLists"
|
||||
#define NORMALIZECOLORS_KEY "NormalizeColors"
|
||||
#define SHADERS_KEY "UseShaders"
|
||||
#define SWITCHCLIP_KEY "SwitchClipKey"
|
||||
#define SELWHOLEENTS_KEY "SelectWholeEntitiesKey"
|
||||
#define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
|
||||
#define TEXTUREQUALITY_KEY "TextureQuality"
|
||||
#define SHOWSHADERS_KEY "ShowShaders"
|
||||
#define SHADERTEST_KEY "ShaderTest"
|
||||
#define GLLIGHTING_KEY "UseGLLighting"
|
||||
#define LOADSHADERS_KEY "LoadShaders"
|
||||
#define NOSTIPPLE_KEY "NoStipple"
|
||||
#define UNDOLEVELS_KEY "UndoLevels"
|
||||
|
||||
#define MOUSE_DEF 1
|
||||
#define WINDOW_DEF 0
|
||||
#define Q2_DEF "c:\\quake2\\quake2.exe"
|
||||
#define Q3_DEF "c:\\Program Files\\Quake III Arena\\quake3.exe"
|
||||
#define PAKFILE_DEF "c:\\quake2\\baseq2\\pak0.pak"
|
||||
#define RUNQ2_DEF 0
|
||||
#define TLOCK_DEF 1
|
||||
#define LOADLAST_DEF 1
|
||||
#define RUN_DEF 0
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPrefsDlg dialog
|
||||
|
||||
|
||||
CPrefsDlg::CPrefsDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CPrefsDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CPrefsDlg)
|
||||
m_strQuake2 = _T("c:\\quake3\\");
|
||||
m_nMouse = 1;
|
||||
m_nView = 0;
|
||||
m_bLoadLast = FALSE;
|
||||
m_bFace = FALSE;
|
||||
m_bInternalBSP = FALSE;
|
||||
m_bRightClick = FALSE;
|
||||
m_bRunQuake = FALSE;
|
||||
m_bSetGame = FALSE;
|
||||
m_bVertex = FALSE;
|
||||
m_bAutoSave = TRUE;
|
||||
m_bNewApplyHandling = FALSE;
|
||||
m_strAutoSave = _T("5");
|
||||
m_bPAK = FALSE;
|
||||
m_bLoadLastMap = FALSE;
|
||||
m_bTextureWindow = FALSE;
|
||||
m_bSnapShots = FALSE;
|
||||
m_fTinySize = 0.5;
|
||||
m_bCleanTiny = FALSE;
|
||||
m_strPAKFile = _T("c:\\quake2\\baseq2\\pak0.pak");
|
||||
m_nStatusSize = 10;
|
||||
m_bCamXYUpdate = FALSE;
|
||||
m_bNewLightDraw = FALSE;
|
||||
m_strPrefabPath = _T("");
|
||||
m_nWhatGame = 0;
|
||||
m_strWhatGame = _T("Quake3");
|
||||
m_bALTEdge = FALSE;
|
||||
m_bTextureBar = FALSE;
|
||||
m_bFaceColors = FALSE;
|
||||
m_bQE4Painting = TRUE;
|
||||
m_bSnapTToGrid = FALSE;
|
||||
m_bXZVis = FALSE;
|
||||
m_bYZVis = FALSE;
|
||||
m_bZVis = FALSE;
|
||||
m_bSizePaint = FALSE;
|
||||
m_bDLLEntities = FALSE;
|
||||
m_bWideToolbar = TRUE;
|
||||
m_bNoClamp = FALSE;
|
||||
m_strUserPath = _T("");
|
||||
m_nRotation = 0;
|
||||
m_bSGIOpenGL = FALSE;
|
||||
m_bBuggyICD = FALSE;
|
||||
m_bHiColorTextures = TRUE;
|
||||
m_bChaseMouse = FALSE;
|
||||
m_bTextureScrollbar = TRUE;
|
||||
m_bDisplayLists = TRUE;
|
||||
m_bShowShaders = FALSE;
|
||||
m_nShader = -1;
|
||||
m_bNoStipple = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
//LoadPrefs();
|
||||
m_bSelectCurves = TRUE;
|
||||
m_bSelectTerrain = TRUE;
|
||||
m_nEntityShowState = 0;
|
||||
m_nTextureScale = 2;
|
||||
m_bSwitchClip = FALSE;
|
||||
m_bSelectWholeEntities = TRUE;
|
||||
m_nTextureQuality = 3;
|
||||
m_bShowShaders = TRUE;
|
||||
m_bGLLighting = FALSE;
|
||||
m_nShader = 0;
|
||||
m_nUndoLevels = 64;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CPrefsDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CPrefsDlg)
|
||||
DDX_Control(pDX, IDC_SPIN_UNDO, m_wndUndoSpin);
|
||||
DDX_Control(pDX, IDC_SPIN_POINTSIZE, m_wndFontSpin);
|
||||
DDX_Control(pDX, IDC_SLIDER_TEXTUREQUALITY, m_wndTexturequality);
|
||||
DDX_Control(pDX, IDC_COMBO_WHATGAME, m_wndWhatGame);
|
||||
DDX_Control(pDX, IDC_SLIDER_CAMSPEED, m_wndCamSpeed);
|
||||
DDX_Control(pDX, IDC_SPIN_AUTOSAVE, m_wndSpin);
|
||||
DDX_Text(pDX, IDC_EDIT_QUAKE2, m_strQuake2);
|
||||
DDX_Radio(pDX, IDC_RADIO_MOUSE, m_nMouse);
|
||||
DDX_Radio(pDX, IDC_RADIO_VIEWTYPE, m_nView);
|
||||
DDX_Check(pDX, IDC_CHECK_LOADLAST, m_bLoadLast);
|
||||
DDX_Check(pDX, IDC_CHECK_FACE, m_bFace);
|
||||
DDX_Check(pDX, IDC_CHECK_INTERNALBSP, m_bInternalBSP);
|
||||
DDX_Check(pDX, IDC_CHECK_RIGHTCLICK, m_bRightClick);
|
||||
DDX_Check(pDX, IDC_CHECK_RUNQUAKE, m_bRunQuake);
|
||||
DDX_Check(pDX, IDC_CHECK_SETGAME, m_bSetGame);
|
||||
DDX_Check(pDX, IDC_CHECK_VERTEX, m_bVertex);
|
||||
DDX_Check(pDX, IDC_CHECK_AUTOSAVE, m_bAutoSave);
|
||||
DDX_Text(pDX, IDC_EDIT_AUTOSAVE, m_strAutoSave);
|
||||
DDX_Check(pDX, IDC_CHECK_PAK, m_bPAK);
|
||||
DDX_Check(pDX, IDC_CHECK_LOADLASTMAP, m_bLoadLastMap);
|
||||
DDX_Check(pDX, IDC_CHECK_TEXTUREWINDOW, m_bTextureWindow);
|
||||
DDX_Check(pDX, IDC_CHECK_SNAPSHOTS, m_bSnapShots);
|
||||
DDX_Text(pDX, IDC_EDIT_PAKFILE, m_strPAKFile);
|
||||
DDX_Text(pDX, IDC_EDIT_STATUSPOINTSIZE, m_nStatusSize);
|
||||
DDV_MinMaxInt(pDX, m_nStatusSize, 2, 14);
|
||||
DDX_Check(pDX, IDC_CHECK_CAMXYUPDATE, m_bCamXYUpdate);
|
||||
DDX_Check(pDX, IDC_CHECK_LIGHTDRAW, m_bNewLightDraw);
|
||||
DDX_Text(pDX, IDC_EDIT_PREFABPATH, m_strPrefabPath);
|
||||
DDX_CBString(pDX, IDC_COMBO_WHATGAME, m_strWhatGame);
|
||||
DDX_Check(pDX, IDC_CHECK_ALTDRAG, m_bALTEdge);
|
||||
DDX_Check(pDX, IDC_CHECK_TEXTURETOOLBAR, m_bTextureBar);
|
||||
DDX_Check(pDX, IDC_CHECK_FACECOLOR, m_bFaceColors);
|
||||
DDX_Check(pDX, IDC_CHECK_QE4PAINTING, m_bQE4Painting);
|
||||
DDX_Check(pDX, IDC_CHECK_SNAPT, m_bSnapTToGrid);
|
||||
DDX_Check(pDX, IDC_CHECK_SIZEPAINT, m_bSizePaint);
|
||||
DDX_Check(pDX, IDC_CHECK_DLLENTITIES, m_bDLLEntities);
|
||||
DDX_Check(pDX, IDC_CHECK_WIDETOOLBAR, m_bWideToolbar);
|
||||
DDX_Check(pDX, IDC_CHECK_NOCLAMP, m_bNoClamp);
|
||||
DDX_Text(pDX, IDC_EDIT_USERPATH, m_strUserPath);
|
||||
DDX_Text(pDX, IDC_EDIT_ROTATION, m_nRotation);
|
||||
DDX_Check(pDX, IDC_CHECK_SGIOPENGL, m_bSGIOpenGL);
|
||||
DDX_Check(pDX, IDC_CHECK_BUGGYICD, m_bBuggyICD);
|
||||
DDX_Check(pDX, IDC_CHECK_HICOLOR, m_bHiColorTextures);
|
||||
DDX_Check(pDX, IDC_CHECK_MOUSECHASE, m_bChaseMouse);
|
||||
DDX_Check(pDX, IDC_CHECK_TEXTURESCROLLBAR, m_bTextureScrollbar);
|
||||
DDX_Check(pDX, IDC_CHECK_DISPLAYLISTS, m_bDisplayLists);
|
||||
DDX_CBIndex(pDX, IDC_COMBO_SHADERS, m_nShader);
|
||||
DDX_Check(pDX, IDC_CHECK_NOSTIPPLE, m_bNoStipple);
|
||||
DDX_Text(pDX, IDC_EDIT_UNDOLEVELS, m_nUndoLevels);
|
||||
DDV_MinMaxInt(pDX, m_nUndoLevels, 1, 64);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPrefsDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CPrefsDlg)
|
||||
ON_BN_CLICKED(IDC_BTN_BROWSE, OnBtnBrowse)
|
||||
ON_BN_CLICKED(IDC_BTN_BROWSEPAK, OnBtnBrowsepak)
|
||||
ON_BN_CLICKED(IDC_BTN_BROWSEPREFAB, OnBtnBrowseprefab)
|
||||
ON_BN_CLICKED(IDC_BTN_BROWSEUSERINI, OnBtnBrowseuserini)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_WHATGAME, OnSelchangeComboWhatgame)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPrefsDlg message handlers
|
||||
|
||||
void CPrefsDlg::OnBtnBrowse()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
CFileDialog dlg(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Executables (*.exe)|*.exe||", this);
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
m_strQuake2 = dlg.GetPathName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CPrefsDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
m_wndSpin.SetRange(1,60);
|
||||
m_wndCamSpeed.SetRange(10, 800);
|
||||
m_wndCamSpeed.SetPos(m_nMoveSpeed);
|
||||
|
||||
this->m_wndTexturequality.SetRange(0, 3);
|
||||
this->m_wndTexturequality.SetPos(m_nTextureQuality);
|
||||
|
||||
m_wndFontSpin.SetRange(4,24);
|
||||
m_wndUndoSpin.SetRange(1,64);
|
||||
|
||||
m_wndWhatGame.AddString("Quake2");
|
||||
m_wndWhatGame.AddString("Quake3");
|
||||
|
||||
GetDlgItem(IDC_CHECK_HICOLOR)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_CHECK_NOCLAMP)->EnableWindow(TRUE);
|
||||
|
||||
//GetDlgItem(IDC_CHECK_NOCLAMP)->EnableWindow(FALSE);
|
||||
|
||||
m_wndWhatGame.SelectString(-1,m_strWhatGame);
|
||||
if (strstr(m_strWhatGame, "Quake3") != NULL)
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(TRUE);
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CPrefsDlg::OnOK()
|
||||
{
|
||||
m_nMoveSpeed = m_wndCamSpeed.GetPos();
|
||||
m_nAngleSpeed = (float)m_nMoveSpeed * 0.50;
|
||||
this->m_nTextureQuality = m_wndTexturequality.GetPos();
|
||||
SavePrefs();
|
||||
|
||||
if (g_pParentWnd)
|
||||
g_pParentWnd->SetGridStatus();
|
||||
Sys_UpdateWindows(W_ALL);
|
||||
Undo_SetMaxSize(m_nUndoLevels);
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CPrefsDlg::LoadPrefs()
|
||||
{
|
||||
CString strBuff;
|
||||
CString strPrefab = g_strAppPath;
|
||||
AddSlash(strPrefab);
|
||||
strPrefab += "Prefabs\\";
|
||||
|
||||
m_nMouse = AfxGetApp()->GetProfileInt(PREF_SECTION, MOUSE_KEY, MOUSE_DEF);
|
||||
if (m_nMouse == 0)
|
||||
m_nMouseButtons = 2;
|
||||
else
|
||||
m_nMouseButtons = 3;
|
||||
|
||||
m_nView = AfxGetApp()->GetProfileInt(PREF_SECTION, WINDOW_KEY, WINDOW_DEF);
|
||||
m_strQuake2 = AfxGetApp()->GetProfileString(PREF_SECTION, Q2_KEY, Q2_DEF);
|
||||
m_bRunQuake = AfxGetApp()->GetProfileInt(PREF_SECTION, RUNQ2_KEY, RUNQ2_DEF);
|
||||
m_bTextureLock = AfxGetApp()->GetProfileInt(PREF_SECTION, TLOCK_KEY, TLOCK_DEF);
|
||||
m_bRotateLock = AfxGetApp()->GetProfileInt(PREF_SECTION, RLOCK_KEY, TLOCK_DEF);
|
||||
m_strLastProject = AfxGetApp()->GetProfileString(PREF_SECTION, LASTPROJ_KEY, "");
|
||||
m_strLastMap = AfxGetApp()->GetProfileString(PREF_SECTION, LASTMAP_KEY, "");
|
||||
m_bLoadLast = AfxGetApp()->GetProfileInt(PREF_SECTION, LOADLAST_KEY, LOADLAST_DEF);
|
||||
m_bRunBefore = AfxGetApp()->GetProfileInt(INTERNAL_SECTION, RUN_KEY, RUN_DEF);
|
||||
//m_b3Dfx = AfxGetApp()->GetProfileInt(PREF_SECTION, _3DFX_KEY, 0);
|
||||
m_bFace = AfxGetApp()->GetProfileInt(PREF_SECTION, FACE_KEY, 1);
|
||||
m_bInternalBSP = AfxGetApp()->GetProfileInt(PREF_SECTION, BSP_KEY, 0);
|
||||
m_bRightClick = AfxGetApp()->GetProfileInt(PREF_SECTION, RCLICK_KEY, 1);
|
||||
m_bVertex = AfxGetApp()->GetProfileInt(PREF_SECTION, VERTEX_KEY, 1);
|
||||
m_bAutoSave = AfxGetApp()->GetProfileInt(PREF_SECTION, AUTOSAVE_KEY, 1);
|
||||
m_bPAK = AfxGetApp()->GetProfileInt(PREF_SECTION, PAK_KEY, 1);
|
||||
m_bNewApplyHandling = AfxGetApp()->GetProfileInt(PREF_SECTION, NEWAPPLY_KEY, 0);
|
||||
m_bLoadLastMap = AfxGetApp()->GetProfileInt(PREF_SECTION, LOADLASTMAP_KEY, 0);
|
||||
m_bGatewayHack = AfxGetApp()->GetProfileInt(PREF_SECTION, HACK_KEY, 0);
|
||||
m_bTextureWindow = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTURE_KEY, 0);
|
||||
m_bCleanTiny = AfxGetApp()->GetProfileInt(PREF_SECTION, TINYBRUSH_KEY, 0);
|
||||
strBuff = AfxGetApp()->GetProfileString(PREF_SECTION, TINYSIZE_KEY, "0.5");
|
||||
m_fTinySize = atof(strBuff);
|
||||
m_nAutoSave = AfxGetApp()->GetProfileInt(PREF_SECTION, AUTOSAVETIME_KEY, 5);
|
||||
m_strAutoSave.Format("%i", m_nAutoSave);
|
||||
m_bSnapShots = AfxGetApp()->GetProfileInt(PREF_SECTION, SNAPSHOT_KEY, 0);
|
||||
m_strPAKFile = AfxGetApp()->GetProfileString(PREF_SECTION, PAKFILE_KEY, PAKFILE_DEF);
|
||||
m_nStatusSize = AfxGetApp()->GetProfileInt(PREF_SECTION, STATUS_KEY, 10);
|
||||
m_nMoveSpeed = AfxGetApp()->GetProfileInt(PREF_SECTION, MOVESPEED_KEY, 400);
|
||||
m_nAngleSpeed = AfxGetApp()->GetProfileInt(PREF_SECTION, ANGLESPEED_KEY, 300);
|
||||
m_bSetGame = AfxGetApp()->GetProfileInt(PREF_SECTION, SETGAME_KEY, 0);
|
||||
m_bCamXYUpdate = AfxGetApp()->GetProfileInt(PREF_SECTION, CAMXYUPDATE_KEY, 1);
|
||||
m_bNewLightDraw = AfxGetApp()->GetProfileInt(PREF_SECTION, LIGHTDRAW_KEY, 1);
|
||||
m_bCubicClipping = AfxGetApp()->GetProfileInt(PREF_SECTION, CUBICCLIP_KEY, 1);
|
||||
m_nCubicScale = AfxGetApp()->GetProfileInt(PREF_SECTION, CUBICSCALE_KEY, 13);
|
||||
m_bALTEdge = AfxGetApp()->GetProfileInt(PREF_SECTION, ALTEDGE_KEY, 0);
|
||||
m_bTextureBar = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTUREBAR_KEY, 0);
|
||||
m_strWhatGame = AfxGetApp()->GetProfileString(PREF_SECTION, WHATGAME_KEY, "Quake3");
|
||||
m_bFaceColors = AfxGetApp()->GetProfileInt(PREF_SECTION, FACECOLORS_KEY, 0);
|
||||
m_bQE4Painting = AfxGetApp()->GetProfileInt(PREF_SECTION, QE4PAINT_KEY, 1);
|
||||
m_bSnapTToGrid = AfxGetApp()->GetProfileInt(PREF_SECTION, SNAPT_KEY, 0);
|
||||
m_bXZVis = AfxGetApp()->GetProfileInt(PREF_SECTION, XZVIS_KEY, 0);
|
||||
m_bYZVis = AfxGetApp()->GetProfileInt(PREF_SECTION, YZVIS_KEY, 0);
|
||||
m_bZVis = AfxGetApp()->GetProfileInt(PREF_SECTION, ZVIS_KEY, 1);
|
||||
m_bSizePaint = AfxGetApp()->GetProfileInt(PREF_SECTION, SIZEPAINT_KEY, 0);
|
||||
m_bDLLEntities = AfxGetApp()->GetProfileInt(PREF_SECTION, DLLENTITIES_KEY, 0);
|
||||
m_bWideToolbar = AfxGetApp()->GetProfileInt(PREF_SECTION, WIDETOOLBAR_KEY, 1);
|
||||
m_bNoClamp = AfxGetApp()->GetProfileInt(PREF_SECTION, NOCLAMP_KEY, 0);
|
||||
m_strPrefabPath = AfxGetApp()->GetProfileString(PREF_SECTION, PREFAB_KEY, strPrefab);
|
||||
m_strUserPath = AfxGetApp()->GetProfileString(PREF_SECTION, USERINI_KEY, "");
|
||||
m_nRotation = AfxGetApp()->GetProfileInt(PREF_SECTION, ROTATION_KEY, 45);
|
||||
m_bSGIOpenGL = AfxGetApp()->GetProfileInt(PREF_SECTION, SGIOPENGL_KEY, 0);
|
||||
m_bBuggyICD = AfxGetApp()->GetProfileInt(PREF_SECTION, BUGGYICD_KEY, 0);
|
||||
m_bHiColorTextures = AfxGetApp()->GetProfileInt(PREF_SECTION, HICOLOR_KEY, 1);
|
||||
m_bChaseMouse = AfxGetApp()->GetProfileInt(PREF_SECTION, CHASEMOUSE_KEY, 1);
|
||||
m_nEntityShowState = AfxGetApp()->GetProfileInt(PREF_SECTION, ENTITYSHOW_KEY, 0);
|
||||
m_nTextureScale = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTURESCALE_KEY, 50);
|
||||
m_bTextureScrollbar = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTURESCROLLBAR_KEY, TRUE);
|
||||
m_bDisplayLists = AfxGetApp()->GetProfileInt(PREF_SECTION, DISPLAYLISTS_KEY, TRUE);
|
||||
m_bSwitchClip = AfxGetApp()->GetProfileInt(PREF_SECTION, SWITCHCLIP_KEY, TRUE);
|
||||
m_bSelectWholeEntities = AfxGetApp()->GetProfileInt(PREF_SECTION, SELWHOLEENTS_KEY, TRUE);
|
||||
m_nTextureQuality = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTUREQUALITY_KEY, 6);
|
||||
m_bShowShaders = AfxGetApp()->GetProfileInt(PREF_SECTION, SHOWSHADERS_KEY, TRUE);
|
||||
m_bGLLighting = AfxGetApp()->GetProfileInt(PREF_SECTION, GLLIGHTING_KEY, FALSE);
|
||||
m_nShader = AfxGetApp()->GetProfileInt(PREF_SECTION, LOADSHADERS_KEY, 0);
|
||||
m_bNoStipple = AfxGetApp()->GetProfileInt(PREF_SECTION, NOSTIPPLE_KEY, 0);
|
||||
m_nUndoLevels = AfxGetApp()->GetProfileInt(PREF_SECTION, UNDOLEVELS_KEY, 0);
|
||||
|
||||
if (m_bRunBefore == FALSE)
|
||||
{
|
||||
SetGamePrefs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CPrefsDlg::SavePrefs()
|
||||
{
|
||||
if (GetSafeHwnd())
|
||||
UpdateData(TRUE);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, MOUSE_KEY, m_nMouse);
|
||||
if (m_nMouse == 0)
|
||||
m_nMouseButtons = 2;
|
||||
else
|
||||
m_nMouseButtons = 3;
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, WINDOW_KEY, m_nView);
|
||||
AfxGetApp()->WriteProfileString(PREF_SECTION, Q2_KEY, m_strQuake2);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, RUNQ2_KEY, m_bRunQuake);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, TLOCK_KEY, m_bTextureLock);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, RLOCK_KEY, m_bRotateLock);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, LOADLAST_KEY, m_bLoadLast);
|
||||
AfxGetApp()->WriteProfileString(PREF_SECTION, LASTPROJ_KEY, m_strLastProject);
|
||||
AfxGetApp()->WriteProfileString(PREF_SECTION, LASTMAP_KEY, m_strLastMap);
|
||||
AfxGetApp()->WriteProfileInt(INTERNAL_SECTION, RUN_KEY, m_bRunBefore);
|
||||
//AfxGetApp()->WriteProfileInt(PREF_SECTION, _3DFX_KEY, m_b3Dfx);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, FACE_KEY, m_bFace);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, BSP_KEY, m_bInternalBSP);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, RCLICK_KEY, m_bRightClick);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, VERTEX_KEY, m_bVertex);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, AUTOSAVE_KEY, m_bAutoSave);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, PAK_KEY, m_bPAK);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, LOADLASTMAP_KEY, m_bLoadLastMap);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTURE_KEY, m_bTextureWindow);
|
||||
m_nAutoSave = atoi(m_strAutoSave);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, AUTOSAVETIME_KEY, m_nAutoSave);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SNAPSHOT_KEY, m_bSnapShots);
|
||||
AfxGetApp()->WriteProfileString(PREF_SECTION, PAKFILE_KEY, m_strPAKFile);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, STATUS_KEY, m_nStatusSize);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SETGAME_KEY, m_bSetGame);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, CAMXYUPDATE_KEY, m_bCamXYUpdate);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, LIGHTDRAW_KEY, m_bNewLightDraw);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, MOVESPEED_KEY, m_nMoveSpeed);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, ANGLESPEED_KEY, m_nAngleSpeed);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, CUBICCLIP_KEY, m_bCubicClipping);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, CUBICSCALE_KEY, m_nCubicScale);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, ALTEDGE_KEY, m_bALTEdge);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTUREBAR_KEY, m_bTextureBar);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, FACECOLORS_KEY, m_bFaceColors);
|
||||
AfxGetApp()->WriteProfileString(PREF_SECTION, WHATGAME_KEY, m_strWhatGame);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, QE4PAINT_KEY, m_bQE4Painting);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SNAPT_KEY, m_bSnapTToGrid);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, XZVIS_KEY, m_bXZVis);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, YZVIS_KEY, m_bYZVis);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, ZVIS_KEY, m_bZVis);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SIZEPAINT_KEY, m_bSizePaint);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, DLLENTITIES_KEY, m_bDLLEntities);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, WIDETOOLBAR_KEY, m_bWideToolbar);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, NOCLAMP_KEY, m_bNoClamp);
|
||||
AfxGetApp()->WriteProfileString(PREF_SECTION, PREFAB_KEY, m_strPrefabPath);
|
||||
AfxGetApp()->WriteProfileString(PREF_SECTION, USERINI_KEY, m_strUserPath);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, ROTATION_KEY, m_nRotation);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SGIOPENGL_KEY, m_bSGIOpenGL);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, BUGGYICD_KEY, m_bBuggyICD);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, HICOLOR_KEY, m_bHiColorTextures);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, CHASEMOUSE_KEY, m_bChaseMouse);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, ENTITYSHOW_KEY, m_nEntityShowState);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTURESCALE_KEY, m_nTextureScale);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTURESCROLLBAR_KEY, m_bTextureScrollbar);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, DISPLAYLISTS_KEY, m_bDisplayLists);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SWITCHCLIP_KEY, m_bSwitchClip);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SELWHOLEENTS_KEY, m_bSelectWholeEntities);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTUREQUALITY_KEY, m_nTextureQuality);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, SHOWSHADERS_KEY, m_bShowShaders);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, GLLIGHTING_KEY, m_bGLLighting);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, LOADSHADERS_KEY, m_nShader);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, NOSTIPPLE_KEY, m_bNoStipple);
|
||||
AfxGetApp()->WriteProfileInt(PREF_SECTION, UNDOLEVELS_KEY, m_nUndoLevels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CPrefsDlg::OnBtnBrowsepak()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
CFileDialog dlg(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "PAK files (*.pak)|*.pak||", this);
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
m_strPAKFile = dlg.GetPathName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void CPrefsDlg::OnBtnBrowseprefab()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
BROWSEINFO bi;
|
||||
CString strPath;
|
||||
char* p = strPath.GetBuffer(MAX_PATH+1);
|
||||
bi.hwndOwner = GetSafeHwnd();
|
||||
bi.pidlRoot = NULL;
|
||||
bi.pszDisplayName = p;
|
||||
bi.lpszTitle = "Load textures from path";
|
||||
bi.ulFlags = 0;
|
||||
bi.lpfn = NULL;
|
||||
bi.lParam = NULL;
|
||||
bi.iImage = 0;
|
||||
LPITEMIDLIST pidlBrowse;
|
||||
pidlBrowse = SHBrowseForFolder(&bi);
|
||||
if (pidlBrowse)
|
||||
{
|
||||
SHGetPathFromIDList(pidlBrowse, p);
|
||||
strPath.ReleaseBuffer();
|
||||
AddSlash(strPath);
|
||||
m_strPrefabPath = strPath;
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void CPrefsDlg::OnBtnBrowseuserini()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
CFileDialog dlg(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "INI files (*.ini)|*.ini||", this);
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
m_strUserPath = dlg.GetPathName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void CPrefsDlg::OnSelchangeComboWhatgame()
|
||||
{
|
||||
int n = m_wndWhatGame.GetCurSel();
|
||||
if (n >= 0)
|
||||
{
|
||||
m_wndWhatGame.GetLBText(n, m_strWhatGame);
|
||||
}
|
||||
SetGamePrefs();
|
||||
}
|
||||
|
||||
void CPrefsDlg::SetGamePrefs()
|
||||
{
|
||||
if (strstr(m_strWhatGame, "Quake3") != NULL)
|
||||
{
|
||||
m_bHiColorTextures = TRUE;
|
||||
m_bWideToolbar = TRUE;
|
||||
m_strPAKFile = "PK3 files are loaded from the baseq3 path";
|
||||
m_bInternalBSP = FALSE;
|
||||
if (GetSafeHwnd())
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bHiColorTextures = FALSE;
|
||||
m_bWideToolbar = FALSE;
|
||||
m_strPAKFile = PAKFILE_DEF;
|
||||
if (GetSafeHwnd())
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(TRUE);
|
||||
}
|
||||
}
|
||||
SavePrefs();
|
||||
}
|
|
@ -1,161 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !defined(AFX_PREFSDLG_H__DC829122_812D_11D1_B548_00AA00A410FC__INCLUDED_)
|
||||
#define AFX_PREFSDLG_H__DC829122_812D_11D1_B548_00AA00A410FC__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
// PrefsDlg.h : header file
|
||||
//
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPrefsDlg dialog
|
||||
|
||||
#define MAX_TEXTURE_QUALITY 3
|
||||
|
||||
class CPrefsDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
// these mirror what goes in the combo box
|
||||
enum {SHADER_NONE = 0, SHADER_COMMON, SHADER_ALL};
|
||||
void LoadPrefs();
|
||||
void SavePrefs();
|
||||
void SetGamePrefs();
|
||||
CPrefsDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CPrefsDlg)
|
||||
enum { IDD = IDD_DLG_PREFS };
|
||||
CSpinButtonCtrl m_wndUndoSpin;
|
||||
CSpinButtonCtrl m_wndFontSpin;
|
||||
CSliderCtrl m_wndTexturequality;
|
||||
CComboBox m_wndWhatGame;
|
||||
CSliderCtrl m_wndCamSpeed;
|
||||
CSpinButtonCtrl m_wndSpin;
|
||||
CString m_strQuake2;
|
||||
int m_nMouse;
|
||||
int m_nView;
|
||||
BOOL m_bTextureLock;
|
||||
BOOL m_bLoadLast;
|
||||
BOOL m_bRunBefore;
|
||||
CString m_strLastProject;
|
||||
CString m_strLastMap;
|
||||
BOOL m_bFace;
|
||||
BOOL m_bInternalBSP;
|
||||
BOOL m_bRightClick;
|
||||
BOOL m_bRunQuake;
|
||||
BOOL m_bSetGame;
|
||||
BOOL m_bVertex;
|
||||
BOOL m_bAutoSave;
|
||||
BOOL m_bNewApplyHandling;
|
||||
CString m_strAutoSave;
|
||||
BOOL m_bPAK;
|
||||
BOOL m_bLoadLastMap;
|
||||
BOOL m_bGatewayHack;
|
||||
BOOL m_bTextureWindow;
|
||||
BOOL m_bSnapShots;
|
||||
float m_fTinySize;
|
||||
BOOL m_bCleanTiny;
|
||||
CString m_strPAKFile;
|
||||
int m_nStatusSize;
|
||||
BOOL m_bCamXYUpdate;
|
||||
BOOL m_bNewLightDraw;
|
||||
CString m_strPrefabPath;
|
||||
int m_nWhatGame;
|
||||
CString m_strWhatGame;
|
||||
BOOL m_bALTEdge;
|
||||
BOOL m_bTextureBar;
|
||||
BOOL m_bFaceColors;
|
||||
BOOL m_bQE4Painting;
|
||||
BOOL m_bSnapTToGrid;
|
||||
BOOL m_bXZVis;
|
||||
BOOL m_bYZVis;
|
||||
BOOL m_bZVis;
|
||||
BOOL m_bSizePaint;
|
||||
BOOL m_bDLLEntities;
|
||||
BOOL m_bRotateLock;
|
||||
BOOL m_bWideToolbar;
|
||||
BOOL m_bNoClamp;
|
||||
CString m_strUserPath;
|
||||
int m_nRotation;
|
||||
BOOL m_bSGIOpenGL;
|
||||
BOOL m_bBuggyICD;
|
||||
BOOL m_bHiColorTextures;
|
||||
BOOL m_bChaseMouse;
|
||||
BOOL m_bTextureScrollbar;
|
||||
BOOL m_bDisplayLists;
|
||||
BOOL m_bShowShaders;
|
||||
int m_nShader;
|
||||
BOOL m_bNoStipple;
|
||||
int m_nUndoLevels;
|
||||
//}}AFX_DATA
|
||||
int m_nMouseButtons;
|
||||
int m_nAngleSpeed;
|
||||
int m_nMoveSpeed;
|
||||
int m_nAutoSave;
|
||||
bool m_bCubicClipping;
|
||||
int m_nCubicScale;
|
||||
BOOL m_bSelectCurves;
|
||||
BOOL m_bSelectTerrain;
|
||||
int m_nEntityShowState;
|
||||
int m_nTextureScale;
|
||||
BOOL m_bNormalizeColors;
|
||||
BOOL m_bSwitchClip;
|
||||
BOOL m_bSelectWholeEntities;
|
||||
int m_nTextureQuality;
|
||||
BOOL m_bGLLighting;
|
||||
|
||||
// brush primitive mode
|
||||
//++timo moved into g_qeglobals
|
||||
// BOOL m_bBrushPrimitMode;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPrefsDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CPrefsDlg)
|
||||
afx_msg void OnBtnBrowse();
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void OnOK();
|
||||
afx_msg void OnBtnBrowsepak();
|
||||
afx_msg void OnBtnBrowseprefab();
|
||||
afx_msg void OnBtnBrowseuserini();
|
||||
afx_msg void OnSelchangeComboWhatgame();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_PREFSDLG_H__DC829122_812D_11D1_B548_00AA00A410FC__INCLUDED_)
|
|
@ -1,751 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "qe3.h"
|
||||
#include "PrefsDlg.h"
|
||||
#include <direct.h>
|
||||
#include <sys\stat.h>
|
||||
|
||||
QEGlobals_t g_qeglobals;
|
||||
|
||||
void WINAPI QE_CheckOpenGLForErrors(void)
|
||||
{
|
||||
CString strMsg;
|
||||
int i = qglGetError();
|
||||
if (i != GL_NO_ERROR)
|
||||
{
|
||||
if (i == GL_OUT_OF_MEMORY)
|
||||
{
|
||||
//strMsg.Format("OpenGL out of memory error %s\nDo you wish to save before exiting?", qgluErrorString((GLenum)i));
|
||||
if (MessageBox(g_qeglobals.d_hwndMain, strMsg, "Q3Radiant Error", MB_YESNO) == IDYES)
|
||||
{
|
||||
Map_SaveFile(NULL, false);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//strMsg.Format("Warning: OpenGL Error %s\n ", qgluErrorString((GLenum)i));
|
||||
Sys_Printf (strMsg.GetBuffer(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *ExpandReletivePath (char *p)
|
||||
{
|
||||
static char temp[1024];
|
||||
char *base;
|
||||
|
||||
if (!p || !p[0])
|
||||
return NULL;
|
||||
if (p[0] == '/' || p[0] == '\\')
|
||||
return p;
|
||||
|
||||
base = ValueForKey(g_qeglobals.d_project_entity, "basepath");
|
||||
sprintf (temp, "%s/%s", base, p);
|
||||
return temp;
|
||||
}
|
||||
|
||||
char *copystring (char *s)
|
||||
{
|
||||
char *b;
|
||||
b = (char*)malloc(strlen(s)+1);
|
||||
strcpy (b,s);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
bool DoesFileExist(const char* pBuff, long& lSize)
|
||||
{
|
||||
CFile file;
|
||||
if (file.Open(pBuff, CFile::modeRead | CFile::shareDenyNone))
|
||||
{
|
||||
lSize += file.GetLength();
|
||||
file.Close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Map_Snapshot()
|
||||
{
|
||||
CString strMsg;
|
||||
// we need to do the following
|
||||
// 1. make sure the snapshot directory exists (create it if it doesn't)
|
||||
// 2. find out what the lastest save is based on number
|
||||
// 3. inc that and save the map
|
||||
CString strOrgPath, strOrgFile;
|
||||
ExtractPath_and_Filename(currentmap, strOrgPath, strOrgFile);
|
||||
AddSlash(strOrgPath);
|
||||
strOrgPath += "snapshots";
|
||||
bool bGo = true;
|
||||
struct _stat Stat;
|
||||
if (_stat(strOrgPath, &Stat) == -1)
|
||||
{
|
||||
bGo = (_mkdir(strOrgPath) != -1);
|
||||
}
|
||||
AddSlash(strOrgPath);
|
||||
if (bGo)
|
||||
{
|
||||
int nCount = 0;
|
||||
long lSize = 0;
|
||||
CString strNewPath = strOrgPath;
|
||||
strNewPath += strOrgFile;
|
||||
CString strFile;
|
||||
while (bGo)
|
||||
{
|
||||
strFile.Format("%s.%i", strNewPath, nCount);
|
||||
bGo = DoesFileExist(strFile, lSize);
|
||||
nCount++;
|
||||
}
|
||||
// strFile has the next available slot
|
||||
Map_SaveFile(strFile.GetBuffer(0), false);
|
||||
Sys_SetTitle (currentmap);
|
||||
if (lSize > 12 * 1024 * 1024) // total size of saves > 4 mb
|
||||
{
|
||||
Sys_Printf("The snapshot files in the [%s] directory total more than 4 megabytes. You might consider cleaning the directory up.", strOrgPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strMsg.Format("Snapshot save failed.. unabled to create directory\n%s", strOrgPath);
|
||||
g_pParentWnd->MessageBox(strMsg);
|
||||
}
|
||||
}
|
||||
/*
|
||||
===============
|
||||
QE_CheckAutoSave
|
||||
|
||||
If five minutes have passed since making a change
|
||||
and the map hasn't been saved, save it out.
|
||||
===============
|
||||
*/
|
||||
|
||||
|
||||
void QE_CheckAutoSave( void )
|
||||
{
|
||||
static clock_t s_start;
|
||||
clock_t now;
|
||||
|
||||
now = clock();
|
||||
|
||||
if ( modified != 1 || !s_start)
|
||||
{
|
||||
s_start = now;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( now - s_start > ( CLOCKS_PER_SEC * 60 * g_PrefsDlg.m_nAutoSave))
|
||||
{
|
||||
|
||||
if (g_PrefsDlg.m_bAutoSave)
|
||||
{
|
||||
CString strMsg = g_PrefsDlg.m_bSnapShots ? "Autosaving snapshot..." : "Autosaving...";
|
||||
Sys_Printf(strMsg.GetBuffer(0));
|
||||
Sys_Printf("\n");
|
||||
Sys_Status (strMsg.GetBuffer(0),0);
|
||||
|
||||
// only snapshot if not working on a default map
|
||||
if (g_PrefsDlg.m_bSnapShots && stricmp(currentmap, "unnamed.map") != 0)
|
||||
{
|
||||
Map_Snapshot();
|
||||
}
|
||||
else
|
||||
{
|
||||
Map_SaveFile (ValueForKey(g_qeglobals.d_project_entity, "autosave"), false);
|
||||
}
|
||||
|
||||
Sys_Status ("Autosaving...Saved.", 0 );
|
||||
modified = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Printf ("Autosave skipped...\n");
|
||||
Sys_Status ("Autosave skipped...", 0 );
|
||||
}
|
||||
s_start = now;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int BuildShortPathName(const char* pPath, char* pBuffer, int nBufferLen)
|
||||
{
|
||||
char *pFile = NULL;
|
||||
int nResult = GetFullPathName(pPath, nBufferLen, pBuffer, &pFile);
|
||||
nResult = GetShortPathName(pPath, pBuffer, nBufferLen);
|
||||
if (nResult == 0)
|
||||
strcpy(pBuffer, pPath); // Use long filename
|
||||
return nResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char *g_pPathFixups[]=
|
||||
{
|
||||
"basepath",
|
||||
"remotebasepath",
|
||||
"entitypath",
|
||||
"texturepath",
|
||||
"autosave",
|
||||
"mapspath"
|
||||
};
|
||||
|
||||
const int g_nPathFixupCount = sizeof(g_pPathFixups) / sizeof(const char*);
|
||||
|
||||
/*
|
||||
===========
|
||||
QE_LoadProject
|
||||
===========
|
||||
*/
|
||||
qboolean QE_LoadProject (char *projectfile)
|
||||
{
|
||||
char *data;
|
||||
|
||||
Sys_Printf ("QE_LoadProject (%s)\n", projectfile);
|
||||
|
||||
if ( LoadFileNoCrash (projectfile, (void **)&data) == -1)
|
||||
return false;
|
||||
|
||||
g_strProject = projectfile;
|
||||
|
||||
CString strData = data;
|
||||
free(data);
|
||||
|
||||
CString strQ2Path = g_PrefsDlg.m_strQuake2;
|
||||
CString strQ2File;
|
||||
ExtractPath_and_Filename(g_PrefsDlg.m_strQuake2, strQ2Path, strQ2File);
|
||||
AddSlash(strQ2Path);
|
||||
|
||||
|
||||
char* pBuff = new char[1024];
|
||||
|
||||
BuildShortPathName(strQ2Path, pBuff, 1024);
|
||||
FindReplace(strData, "__Q2PATH", pBuff);
|
||||
BuildShortPathName(g_strAppPath, pBuff, 1024);
|
||||
FindReplace(strData, "__QERPATH", pBuff);
|
||||
|
||||
char* pFile;
|
||||
if (GetFullPathName(projectfile, 1024, pBuff, &pFile))
|
||||
{
|
||||
g_PrefsDlg.m_strLastProject = pBuff;
|
||||
BuildShortPathName(g_PrefsDlg.m_strLastProject, pBuff, 1024);
|
||||
g_PrefsDlg.m_strLastProject = pBuff;
|
||||
g_PrefsDlg.SavePrefs();
|
||||
|
||||
ExtractPath_and_Filename(pBuff, strQ2Path, strQ2File);
|
||||
int nLen = strQ2Path.GetLength();
|
||||
if (nLen > 0)
|
||||
{
|
||||
if (strQ2Path[nLen - 1] == '\\')
|
||||
strQ2Path.SetAt(nLen-1,'\0');
|
||||
char* pBuffer = strQ2Path.GetBufferSetLength(_MAX_PATH + 1);
|
||||
int n = strQ2Path.ReverseFind('\\');
|
||||
if (n >=0 )
|
||||
pBuffer[n + 1] = '\0';
|
||||
strQ2Path.ReleaseBuffer();
|
||||
FindReplace(strData, "__QEPROJPATH", strQ2Path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StartTokenParsing (strData.GetBuffer(0));
|
||||
g_qeglobals.d_project_entity = Entity_Parse (true);
|
||||
if (!g_qeglobals.d_project_entity)
|
||||
Error ("Couldn't parse %s", projectfile);
|
||||
|
||||
for (int i = 0; i < g_nPathFixupCount; i++)
|
||||
{
|
||||
char *pPath = ValueForKey (g_qeglobals.d_project_entity, g_pPathFixups[i]);
|
||||
if (pPath[0] != '\\' && pPath[0] != '/')
|
||||
{
|
||||
if (GetFullPathName(pPath, 1024, pBuff, &pFile))
|
||||
{
|
||||
SetKeyValue(g_qeglobals.d_project_entity, g_pPathFixups[i], pBuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete []pBuff;
|
||||
|
||||
// set here some default project settings you need
|
||||
if ( strlen( ValueForKey( g_qeglobals.d_project_entity, "brush_primit" ) ) == 0 )
|
||||
{
|
||||
SetKeyValue( g_qeglobals.d_project_entity, "brush_primit", "0" );
|
||||
}
|
||||
|
||||
g_qeglobals.m_bBrushPrimitMode = IntForKey( g_qeglobals.d_project_entity, "brush_primit" );
|
||||
|
||||
|
||||
Eclass_InitForSourceDirectory (ValueForKey (g_qeglobals.d_project_entity, "entitypath"));
|
||||
FillClassList(); // list in entity window
|
||||
|
||||
Map_New();
|
||||
|
||||
|
||||
FillTextureMenu();
|
||||
FillBSPMenu();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
QE_SaveProject
|
||||
===========
|
||||
*/
|
||||
//extern char *bsp_commands[256];
|
||||
|
||||
qboolean QE_SaveProject (const char* pProjectFile)
|
||||
{
|
||||
//char filename[1024];
|
||||
FILE *fp;
|
||||
epair_t *ep;
|
||||
|
||||
//sprintf (filename, "%s\\%s.prj", g_projectdir, g_username);
|
||||
|
||||
if (!(fp = fopen (pProjectFile, "w+")))
|
||||
Error ("Could not open project file!");
|
||||
|
||||
fprintf (fp, "{\n");
|
||||
for (ep = g_qeglobals.d_project_entity->epairs; ep; ep=ep->next)
|
||||
fprintf (fp, "\"%s\" \"%s\"\n", ep->key, ep->value);
|
||||
fprintf (fp, "}\n");
|
||||
|
||||
fclose (fp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
QE_KeyDown
|
||||
===========
|
||||
*/
|
||||
#define SPEED_MOVE 32
|
||||
#define SPEED_TURN 22.5
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
ConnectEntities
|
||||
|
||||
Sets target / targetname on the two entities selected
|
||||
from the first selected to the secon
|
||||
===============
|
||||
*/
|
||||
void ConnectEntities (void)
|
||||
{
|
||||
entity_t *e1, *e2, *e;
|
||||
char *target, *tn;
|
||||
int maxtarg, targetnum;
|
||||
char newtarg[32];
|
||||
|
||||
if (g_qeglobals.d_select_count != 2)
|
||||
{
|
||||
Sys_Status ("Must have two brushes selected.", 0);
|
||||
Sys_Beep ();
|
||||
return;
|
||||
}
|
||||
|
||||
e1 = g_qeglobals.d_select_order[0]->owner;
|
||||
e2 = g_qeglobals.d_select_order[1]->owner;
|
||||
|
||||
if (e1 == world_entity || e2 == world_entity)
|
||||
{
|
||||
Sys_Status ("Can't connect to the world.", 0);
|
||||
Sys_Beep ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e1 == e2)
|
||||
{
|
||||
Sys_Status ("Brushes are from same entity.", 0);
|
||||
Sys_Beep ();
|
||||
return;
|
||||
}
|
||||
|
||||
target = ValueForKey (e1, "target");
|
||||
if (target && target[0])
|
||||
strcpy (newtarg, target);
|
||||
else
|
||||
{
|
||||
target = ValueForKey (e2, "targetname");
|
||||
if (target && target[0])
|
||||
strcpy (newtarg, target);
|
||||
else
|
||||
{
|
||||
// make a unique target value
|
||||
maxtarg = 0;
|
||||
for (e=entities.next ; e != &entities ; e=e->next)
|
||||
{
|
||||
tn = ValueForKey (e, "targetname");
|
||||
if (tn && tn[0])
|
||||
{
|
||||
targetnum = atoi(tn+1);
|
||||
if (targetnum > maxtarg)
|
||||
maxtarg = targetnum;
|
||||
}
|
||||
}
|
||||
sprintf (newtarg, "t%i", maxtarg+1);
|
||||
}
|
||||
}
|
||||
|
||||
SetKeyValue (e1, "target", newtarg);
|
||||
SetKeyValue (e2, "targetname", newtarg);
|
||||
Sys_UpdateWindows (W_XY | W_CAMERA);
|
||||
|
||||
Select_Deselect();
|
||||
Select_Brush (g_qeglobals.d_select_order[1]);
|
||||
}
|
||||
|
||||
qboolean QE_SingleBrush (bool bQuiet)
|
||||
{
|
||||
if ( (selected_brushes.next == &selected_brushes)
|
||||
|| (selected_brushes.next->next != &selected_brushes) )
|
||||
{
|
||||
if (!bQuiet)
|
||||
{
|
||||
Sys_Printf ("Error: you must have a single brush selected\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (selected_brushes.next->owner->eclass->fixedsize)
|
||||
{
|
||||
if (!bQuiet)
|
||||
{
|
||||
Sys_Printf ("Error: you cannot manipulate fixed size entities\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QE_Init (void)
|
||||
{
|
||||
/*
|
||||
** initialize variables
|
||||
*/
|
||||
g_qeglobals.d_gridsize = 8;
|
||||
g_qeglobals.d_showgrid = true;
|
||||
|
||||
/*
|
||||
** other stuff
|
||||
*/
|
||||
Texture_Init (true);
|
||||
//Cam_Init ();
|
||||
//XY_Init ();
|
||||
Z_Init ();
|
||||
Terrain_Init();
|
||||
}
|
||||
|
||||
void WINAPI QE_ConvertDOSToUnixName( char *dst, const char *src )
|
||||
{
|
||||
while ( *src )
|
||||
{
|
||||
if ( *src == '\\' )
|
||||
*dst = '/';
|
||||
else
|
||||
*dst = *src;
|
||||
dst++; src++;
|
||||
}
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
int g_numbrushes, g_numentities;
|
||||
|
||||
void QE_CountBrushesAndUpdateStatusBar( void )
|
||||
{
|
||||
static int s_lastbrushcount, s_lastentitycount;
|
||||
static qboolean s_didonce;
|
||||
|
||||
//entity_t *e;
|
||||
brush_t *b, *next;
|
||||
|
||||
g_numbrushes = 0;
|
||||
g_numentities = 0;
|
||||
|
||||
if ( active_brushes.next != NULL )
|
||||
{
|
||||
for ( b = active_brushes.next ; b != NULL && b != &active_brushes ; b=next)
|
||||
{
|
||||
next = b->next;
|
||||
if (b->brush_faces )
|
||||
{
|
||||
if ( !b->owner->eclass->fixedsize)
|
||||
g_numbrushes++;
|
||||
else
|
||||
g_numentities++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if ( entities.next != NULL )
|
||||
{
|
||||
for ( e = entities.next ; e != &entities && g_numentities != MAX_MAP_ENTITIES ; e = e->next)
|
||||
{
|
||||
g_numentities++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if ( ( ( g_numbrushes != s_lastbrushcount ) || ( g_numentities != s_lastentitycount ) ) || ( !s_didonce ) )
|
||||
{
|
||||
Sys_UpdateStatusBar();
|
||||
|
||||
s_lastbrushcount = g_numbrushes;
|
||||
s_lastentitycount = g_numentities;
|
||||
s_didonce = true;
|
||||
}
|
||||
}
|
||||
|
||||
char com_token[1024];
|
||||
qboolean com_eof;
|
||||
|
||||
/*
|
||||
================
|
||||
I_FloatTime
|
||||
================
|
||||
*/
|
||||
double I_FloatTime (void)
|
||||
{
|
||||
time_t t;
|
||||
|
||||
time (&t);
|
||||
|
||||
return t;
|
||||
#if 0
|
||||
// more precise, less portable
|
||||
struct timeval tp;
|
||||
struct timezone tzp;
|
||||
static int secbase;
|
||||
|
||||
gettimeofday(&tp, &tzp);
|
||||
|
||||
if (!secbase)
|
||||
{
|
||||
secbase = tp.tv_sec;
|
||||
return tp.tv_usec/1000000.0;
|
||||
}
|
||||
|
||||
return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
COM_Parse
|
||||
|
||||
Parse a token out of a string
|
||||
==============
|
||||
*/
|
||||
char *COM_Parse (char *data)
|
||||
{
|
||||
int c;
|
||||
int len;
|
||||
|
||||
len = 0;
|
||||
com_token[0] = 0;
|
||||
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
// skip whitespace
|
||||
skipwhite:
|
||||
while ( (c = *data) <= ' ')
|
||||
{
|
||||
if (c == 0)
|
||||
{
|
||||
com_eof = true;
|
||||
return NULL; // end of file;
|
||||
}
|
||||
data++;
|
||||
}
|
||||
|
||||
// skip // comments
|
||||
if (c=='/' && data[1] == '/')
|
||||
{
|
||||
while (*data && *data != '\n')
|
||||
data++;
|
||||
goto skipwhite;
|
||||
}
|
||||
|
||||
|
||||
// handle quoted strings specially
|
||||
if (c == '\"')
|
||||
{
|
||||
data++;
|
||||
do
|
||||
{
|
||||
c = *data++;
|
||||
if (c=='\"')
|
||||
{
|
||||
com_token[len] = 0;
|
||||
return data;
|
||||
}
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
} while (1);
|
||||
}
|
||||
|
||||
// parse single characters
|
||||
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
|
||||
{
|
||||
com_token[len] = c;
|
||||
len++;
|
||||
com_token[len] = 0;
|
||||
return data+1;
|
||||
}
|
||||
|
||||
// parse a regular word
|
||||
do
|
||||
{
|
||||
com_token[len] = c;
|
||||
data++;
|
||||
len++;
|
||||
c = *data;
|
||||
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
|
||||
break;
|
||||
} while (c>32);
|
||||
|
||||
com_token[len] = 0;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
MISC FUNCTIONS
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
|
||||
|
||||
int argc;
|
||||
char *argv[MAX_NUM_ARGVS];
|
||||
|
||||
/*
|
||||
============
|
||||
ParseCommandLine
|
||||
============
|
||||
*/
|
||||
void ParseCommandLine (char *lpCmdLine)
|
||||
{
|
||||
argc = 1;
|
||||
argv[0] = "programname";
|
||||
|
||||
while (*lpCmdLine && (argc < MAX_NUM_ARGVS))
|
||||
{
|
||||
while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
|
||||
lpCmdLine++;
|
||||
|
||||
if (*lpCmdLine)
|
||||
{
|
||||
argv[argc] = lpCmdLine;
|
||||
argc++;
|
||||
|
||||
while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
|
||||
lpCmdLine++;
|
||||
|
||||
if (*lpCmdLine)
|
||||
{
|
||||
*lpCmdLine = 0;
|
||||
lpCmdLine++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
CheckParm
|
||||
|
||||
Checks for the given parameter in the program's command line arguments
|
||||
Returns the argument number (1 to argc-1) or 0 if not present
|
||||
=================
|
||||
*/
|
||||
int CheckParm (char *check)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1;i<argc;i++)
|
||||
{
|
||||
if ( stricmp(check, argv[i]) )
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
ParseNum / ParseHex
|
||||
==============
|
||||
*/
|
||||
int ParseHex (char *hex)
|
||||
{
|
||||
char *str;
|
||||
int num;
|
||||
|
||||
num = 0;
|
||||
str = hex;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
num <<= 4;
|
||||
if (*str >= '0' && *str <= '9')
|
||||
num += *str-'0';
|
||||
else if (*str >= 'a' && *str <= 'f')
|
||||
num += 10 + *str-'a';
|
||||
else if (*str >= 'A' && *str <= 'F')
|
||||
num += 10 + *str-'A';
|
||||
else
|
||||
Error ("Bad hex number: %s",hex);
|
||||
str++;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
int ParseNum (char *str)
|
||||
{
|
||||
if (str[0] == '$')
|
||||
return ParseHex (str+1);
|
||||
if (str[0] == '0' && str[1] == 'x')
|
||||
return ParseHex (str+2);
|
||||
return atol (str);
|
||||
}
|
||||
|
||||
|
669
q3radiant/QE3.H
669
q3radiant/QE3.H
|
@ -1,669 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __QE3_H__
|
||||
#define __QE3_H__
|
||||
|
||||
// disable data conversion warnings for gl
|
||||
#pragma warning(disable : 4244) // MIPS
|
||||
#pragma warning(disable : 4136) // X86
|
||||
#pragma warning(disable : 4051) // ALPHA
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "qgl.h"
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
|
||||
// this define to use HTREEITEM and MFC stuff in the headers
|
||||
#define QERTYPES_USE_MFC
|
||||
#include "qertypes.h"
|
||||
#include "../libs/cmdlib.h"
|
||||
#include "mathlib.h"
|
||||
#include "parse.h"
|
||||
#include "lbmlib.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include "afxres.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "qedefs.h"
|
||||
|
||||
#include "qfiles.h"
|
||||
|
||||
#include "textures.h"
|
||||
#include "brush.h"
|
||||
#include "entity.h"
|
||||
#include "map.h"
|
||||
#include "select.h"
|
||||
#include "splines/splines.h"
|
||||
|
||||
#include "camera.h"
|
||||
#include "xy.h"
|
||||
#include "z.h"
|
||||
#include "mru.h"
|
||||
|
||||
#include "undo.h"
|
||||
|
||||
#include "terrain.h"
|
||||
|
||||
// the dec offsetof macro doesn't work very well...
|
||||
#define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
|
||||
|
||||
|
||||
// set these before calling CheckParm
|
||||
extern int myargc;
|
||||
extern char **myargv;
|
||||
|
||||
double I_FloatTime (void);
|
||||
|
||||
void Error (char *error, ...);
|
||||
void Warning (char *error, ...);
|
||||
int CheckParm (char *check);
|
||||
void ParseCommandLine (char *lpCmdLine);
|
||||
|
||||
|
||||
int ParseNum (char *str);
|
||||
|
||||
|
||||
char *COM_Parse (char *data);
|
||||
|
||||
extern char com_token[1024];
|
||||
extern qboolean com_eof;
|
||||
|
||||
#define MAX_NUM_ARGVS 32
|
||||
extern int argc;
|
||||
extern char *argv[MAX_NUM_ARGVS];
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int p1, p2;
|
||||
face_t *f1, *f2;
|
||||
} pedge_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int iSize;
|
||||
int iTexMenu; // nearest, linear, etc
|
||||
float fGamma; // gamma for textures
|
||||
char szProject[256]; // last project loaded
|
||||
vec3_t colors[COLOR_LAST];
|
||||
qboolean show_names;
|
||||
qboolean show_coordinates;
|
||||
int exclude;
|
||||
int m_nTextureTweak;
|
||||
} SavedInfo_t;
|
||||
|
||||
//
|
||||
// system functions
|
||||
//
|
||||
// TTimo NOTE: WINAPI funcs can be accessed by plugins
|
||||
void Sys_UpdateStatusBar( void );
|
||||
void WINAPI Sys_UpdateWindows (int bits);
|
||||
void Sys_Beep (void);
|
||||
void Sys_ClearPrintf (void);
|
||||
void Sys_Printf (char *text, ...);
|
||||
double Sys_DoubleTime (void);
|
||||
void Sys_GetCursorPos (int *x, int *y);
|
||||
void Sys_SetCursorPos (int x, int y);
|
||||
void Sys_SetTitle (char *text);
|
||||
void Sys_BeginWait (void);
|
||||
void Sys_EndWait (void);
|
||||
void Sys_Status(const char *psz, int part);
|
||||
|
||||
/*
|
||||
** most of the QE globals are stored in this structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
qboolean d_showgrid;
|
||||
int d_gridsize;
|
||||
|
||||
int d_num_entities;
|
||||
|
||||
entity_t *d_project_entity;
|
||||
|
||||
float d_new_brush_bottom_z,
|
||||
d_new_brush_top_z;
|
||||
|
||||
HINSTANCE d_hInstance;
|
||||
|
||||
HGLRC d_hglrcBase;
|
||||
HDC d_hdcBase;
|
||||
|
||||
HWND d_hwndMain;
|
||||
HWND d_hwndCamera;
|
||||
HWND d_hwndEdit;
|
||||
HWND d_hwndEntity;
|
||||
HWND d_hwndTexture;
|
||||
HWND d_hwndXY;
|
||||
HWND d_hwndZ;
|
||||
HWND d_hwndStatus;
|
||||
HWND d_hwndGroup;
|
||||
HWND d_hwndMedia;
|
||||
|
||||
vec3_t d_points[MAX_POINTS];
|
||||
int d_numpoints;
|
||||
pedge_t d_edges[MAX_EDGES];
|
||||
int d_numedges;
|
||||
|
||||
// terrain variables
|
||||
float d_terrainBrushSize;
|
||||
terrainnoise_t d_terrainNoiseType;
|
||||
terrainfalloff_t d_terrainFalloff;
|
||||
terrainbrush_t d_terrainBrush;
|
||||
int d_terrainWidth;
|
||||
int d_terrainHeight;
|
||||
|
||||
terrainVert_t *d_terrapoints[MAX_TERRA_POINTS];
|
||||
int d_numterrapoints;
|
||||
|
||||
|
||||
int d_num_move_points;
|
||||
float *d_move_points[4096];
|
||||
|
||||
qtexture_t *d_qtextures;
|
||||
|
||||
texturewin_t d_texturewin;
|
||||
|
||||
int d_pointfile_display_list;
|
||||
|
||||
xy_t d_xyOld;
|
||||
|
||||
LPMRUMENU d_lpMruMenu;
|
||||
|
||||
SavedInfo_t d_savedinfo;
|
||||
|
||||
int d_workcount;
|
||||
|
||||
// connect entities uses the last two brushes selected
|
||||
int d_select_count;
|
||||
brush_t *d_select_order[2];
|
||||
vec3_t d_select_translate; // for dragging w/o making new display lists
|
||||
select_t d_select_mode;
|
||||
idPointListInterface *selectObject; //
|
||||
|
||||
int d_font_list;
|
||||
|
||||
int d_parsed_brushes;
|
||||
|
||||
qboolean show_blocks;
|
||||
|
||||
// Timo
|
||||
// tells if we are internally using brush primitive (texture coordinates and map format)
|
||||
// this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" )
|
||||
// NOTE: must keep the two ones in sync
|
||||
BOOL m_bBrushPrimitMode;
|
||||
|
||||
// used while importing brush data from file or memory buffer
|
||||
// tells if conversion between map format and internal preferences ( m_bBrushPrimitMode ) is needed
|
||||
qboolean bNeedConvert;
|
||||
qboolean bOldBrushes;
|
||||
qboolean bPrimitBrushes;
|
||||
|
||||
vec3_t d_vAreaTL;
|
||||
vec3_t d_vAreaBR;
|
||||
|
||||
// tells if we are using .INI files for prefs instead of registry
|
||||
qboolean use_ini;
|
||||
// even in .INI mode we use the registry for all void* prefs
|
||||
char use_ini_registry[64];
|
||||
|
||||
//Timo
|
||||
// tells we have surface properties plugin
|
||||
qboolean bSurfacePropertiesPlugin;
|
||||
// tells we are using a BSP frontend plugin
|
||||
qboolean bBSPFrontendPlugin;
|
||||
|
||||
qboolean dontDrawSelectedOutlines;
|
||||
|
||||
} QEGlobals_t;
|
||||
|
||||
//void *qmalloc (size_t size);
|
||||
char *copystring (char *s);
|
||||
char *ExpandReletivePath (char *p);
|
||||
|
||||
void Pointfile_Delete (void);
|
||||
void WINAPI Pointfile_Check (void);
|
||||
void Pointfile_Next (void);
|
||||
void Pointfile_Prev (void);
|
||||
void Pointfile_Clear (void);
|
||||
void Pointfile_Draw( void );
|
||||
void Pointfile_Load( void );
|
||||
|
||||
//
|
||||
// drag.c
|
||||
//
|
||||
void Drag_Begin (int x, int y, int buttons,
|
||||
vec3_t xaxis, vec3_t yaxis,
|
||||
vec3_t origin, vec3_t dir);
|
||||
void Drag_MouseMoved (int x, int y, int buttons);
|
||||
void Drag_MouseUp (int nButtons = 0);
|
||||
|
||||
//
|
||||
// csg.c
|
||||
//
|
||||
void CSG_MakeHollow (void);
|
||||
void CSG_Subtract (void);
|
||||
void CSG_Merge (void);
|
||||
|
||||
//
|
||||
// vertsel.c
|
||||
//
|
||||
|
||||
void SetupVertexSelection (void);
|
||||
void SelectEdgeByRay (vec3_t org, vec3_t dir);
|
||||
void SelectVertexByRay (vec3_t org, vec3_t dir);
|
||||
|
||||
void ConnectEntities (void);
|
||||
|
||||
extern int update_bits;
|
||||
|
||||
extern int screen_width;
|
||||
extern int screen_height;
|
||||
|
||||
extern HANDLE bsp_process;
|
||||
extern HANDLE g_hBSPOutput;
|
||||
extern HANDLE g_hBSPInput;
|
||||
|
||||
|
||||
char *TranslateString (char *buf);
|
||||
|
||||
void ProjectDialog (void);
|
||||
|
||||
void FillTextureMenu (CStringArray* pArray = NULL);
|
||||
void FillBSPMenu (void);
|
||||
|
||||
BOOL CALLBACK Win_Dialog (
|
||||
HWND hwndDlg, // handle to dialog box
|
||||
UINT uMsg, // message
|
||||
WPARAM wParam, // first message parameter
|
||||
LPARAM lParam // second message parameter
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// win_cam.c
|
||||
//
|
||||
void WCam_Create (HINSTANCE hInstance);
|
||||
|
||||
|
||||
//
|
||||
// win_xy.c
|
||||
//
|
||||
void WXY_Create (HINSTANCE hInstance);
|
||||
|
||||
//
|
||||
// win_z.c
|
||||
//
|
||||
void WZ_Create (HINSTANCE hInstance);
|
||||
|
||||
//
|
||||
// win_ent.c
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// win_main.c
|
||||
//
|
||||
void Main_Create (HINSTANCE hInstance);
|
||||
extern BOOL SaveWindowState(HWND hWnd, const char *pszName);
|
||||
extern BOOL LoadWindowState(HWND hWnd, const char *pszName);
|
||||
|
||||
extern BOOL SaveRegistryInfo(const char *pszName, void *pvBuf, long lSize);
|
||||
extern BOOL LoadRegistryInfo(const char *pszName, void *pvBuf, long *plSize);
|
||||
|
||||
//
|
||||
// entityw.c
|
||||
//
|
||||
BOOL CreateEntityWindow(HINSTANCE hInstance);
|
||||
void FillClassList (void);
|
||||
BOOL UpdateEntitySel(eclass_t *pec);
|
||||
void SetInspectorMode(int iType);
|
||||
int DrawTexControls(HWND hWnd);
|
||||
void SetSpawnFlags(void);
|
||||
void GetSpawnFlags(void);
|
||||
void SetKeyValuePairs(bool bClearMD3 = false);
|
||||
extern void BuildGammaTable(float g);
|
||||
BOOL GetSelectAllCriteria(CString &strKey, CString &strVal);
|
||||
|
||||
|
||||
// win_dlg.c
|
||||
|
||||
void DoGamma(void);
|
||||
void DoFind(void);
|
||||
void DoRotate(void);
|
||||
void DoSides(bool bCone = false, bool bSphere = false, bool bTorus = false);
|
||||
void DoAbout(void);
|
||||
void DoSurface();
|
||||
|
||||
/*
|
||||
** QE function declarations
|
||||
*/
|
||||
void QE_CheckAutoSave( void );
|
||||
void WINAPI QE_ConvertDOSToUnixName( char *dst, const char *src );
|
||||
void QE_CountBrushesAndUpdateStatusBar( void );
|
||||
void WINAPI QE_CheckOpenGLForErrors(void);
|
||||
void QE_ExpandBspString (char *bspaction, char *out, char *mapname, bool useTemps);
|
||||
void QE_Init (void);
|
||||
qboolean QE_KeyDown (int key, int nFlags = 0);
|
||||
qboolean QE_LoadProject (char *projectfile);
|
||||
qboolean QE_SingleBrush (bool bQuiet = false);
|
||||
|
||||
|
||||
// sys stuff
|
||||
void Sys_MarkMapModified (void);
|
||||
|
||||
/*
|
||||
** QE Win32 function declarations
|
||||
*/
|
||||
int WINAPI QEW_SetupPixelFormat(HDC hDC, qboolean zbuffer );
|
||||
void QEW_StopGL( HWND hWnd, HGLRC hGLRC, HDC hDC );
|
||||
|
||||
/*
|
||||
** extern declarations
|
||||
*/
|
||||
extern QEGlobals_t g_qeglobals;
|
||||
|
||||
//++timo clean (moved into qertypes.h)
|
||||
//enum VIEWTYPE {YZ, XZ, XY};
|
||||
qboolean IsBrushSelected(brush_t* bSel);
|
||||
|
||||
// curve brushes
|
||||
|
||||
void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom,
|
||||
qboolean s1, qboolean s2, qboolean s3, qboolean s4);
|
||||
|
||||
void Curve_Invert (void);
|
||||
|
||||
void Curve_AddFakePlanes( brush_t *B );
|
||||
void Curve_StripFakePlanes( brush_t *B );
|
||||
void Curve_BuildPoints (brush_t *b);
|
||||
void Curve_XYDraw (brush_t *b);
|
||||
void Curve_CameraDraw (brush_t *b);
|
||||
|
||||
void Curve_WriteFile (char *name);
|
||||
|
||||
|
||||
// patch stuff
|
||||
|
||||
extern bool g_bSameView;
|
||||
extern int g_nPatchClickedView;
|
||||
bool within(vec3_t vTest, vec3_t vTL, vec3_t vBR);
|
||||
|
||||
void Brush_RebuildBrush(brush_t *b, vec3_t vMins, vec3_t vMaxs );
|
||||
patchMesh_t* MakeNewPatch();
|
||||
brush_t* AddBrushForPatch(patchMesh_t *pm, bool bLinkToWorld = true);
|
||||
brush_t* Patch_GenericMesh(int nWidth, int nHeight, int nOrientation = 2, bool bDeleteSource = true, bool bOverride = false);
|
||||
void Patch_ReadFile (char *name);
|
||||
void Patch_WriteFile (char *name);
|
||||
void Patch_BuildPoints (brush_t *b);
|
||||
void Patch_Move(patchMesh_t *p, const vec3_t vMove, bool bRebuild = false);
|
||||
//++timo had to add a default value for bSnap (see Patch_ApplyMatrix call from Select_ApplyMatrix in select.cpp)
|
||||
void Patch_ApplyMatrix(patchMesh_t *p, const vec3_t vOrigin, const vec3_t vMatrix[3], bool bSnap = false);
|
||||
void Patch_EditPatch();
|
||||
void Patch_Deselect();
|
||||
void Patch_Deselect(patchMesh_t *p);
|
||||
void Patch_Delete(patchMesh_t *p);
|
||||
int Patch_MemorySize(patchMesh_t *p);
|
||||
void Patch_Select(patchMesh_t *p);
|
||||
void Patch_Scale(patchMesh_t *p, const vec3_t vOrigin, const vec3_t vAmt, bool bRebuilt = true);
|
||||
void Patch_Cleanup();
|
||||
void Patch_SetView(int n);
|
||||
void Patch_SetTexture(patchMesh_t *p, texdef_t *tex_def, IPluginTexdef* pPlugTexdef = NULL);
|
||||
void Patch_BrushToMesh(bool bCone = false, bool bBevel = false, bool bEndcap = false, bool bSquare = false, int nHeight = 3);
|
||||
bool Patch_DragScale(patchMesh_t *p, vec3_t vAmt, vec3_t vMove);
|
||||
void Patch_ReadBuffer(char* pBuff, bool bSelect = false);
|
||||
void Patch_WriteFile (CMemFile* pMemFile);
|
||||
void Patch_UpdateSelected(vec3_t vMove);
|
||||
void Patch_AddRow(patchMesh_t *p);
|
||||
brush_t* Patch_Parse(bool bOld);
|
||||
void Patch_Write (patchMesh_t *p, FILE *f);
|
||||
void Patch_Write (patchMesh_t *p, CMemFile *file);
|
||||
void Patch_AdjustColumns(patchMesh_t *p, int nCols);
|
||||
void Patch_AdjustRows(patchMesh_t *p, int nRows);
|
||||
void Patch_AdjustSelected(bool bInsert, bool bColumn, bool bFlag);
|
||||
patchMesh_t* Patch_Duplicate(patchMesh_t *pFrom);
|
||||
void Patch_RotateTexture(patchMesh_t *p, float fAngle);
|
||||
void Patch_ScaleTexture(patchMesh_t *p, float fx, float fy, bool bFixup = true);
|
||||
void Patch_ShiftTexture(patchMesh_t *p, float fx, float fy);
|
||||
void Patch_DrawCam(patchMesh_t *p);
|
||||
void Patch_DrawXY(patchMesh_t *p);
|
||||
void Patch_InsertColumn(patchMesh_t *p, bool bAdd);
|
||||
void Patch_InsertRow(patchMesh_t *p, bool bAdd);
|
||||
void Patch_RemoveRow(patchMesh_t *p, bool bFirst);
|
||||
void Patch_RemoveColumn(patchMesh_t *p, bool bFirst);
|
||||
void Patch_ToggleInverted();
|
||||
void Patch_Restore(patchMesh_t *p);
|
||||
void Patch_Save(patchMesh_t *p);
|
||||
void Patch_SetTextureInfo(texdef_t* pt);
|
||||
void Patch_NaturalTexturing();
|
||||
void Patch_ResetTexturing(float fx, float fy);
|
||||
void Patch_FitTexturing();
|
||||
void Patch_BendToggle();
|
||||
void Patch_StartInsDel();
|
||||
void Patch_BendHandleTAB();
|
||||
void Patch_BendHandleENTER();
|
||||
void Patch_SelectBendNormal();
|
||||
void Patch_SelectBendAxis();
|
||||
bool WINAPI OnlyPatchesSelected();
|
||||
bool WINAPI AnyPatchesSelected();
|
||||
patchMesh_t* SinglePatchSelected();
|
||||
void Patch_CapCurrent(bool bInvertedBevel = false, bool bInvertedEndcap = false);
|
||||
void Patch_DisperseRows();
|
||||
void Patch_DisperseColumns();
|
||||
void Patch_NaturalizeSelected(bool bCap = false, bool bCycleCap = false);
|
||||
void Patch_SelectAreaPoints();
|
||||
void Patch_InvertTexture(bool bY);
|
||||
void Patch_InsDelToggle();
|
||||
void Patch_InsDelHandleTAB();
|
||||
void Patch_InsDelHandleENTER();
|
||||
void Patch_SetOverlays();
|
||||
void Patch_ClearOverlays();
|
||||
void Patch_Thicken(int nAmount, bool bSeam);
|
||||
void Patch_Transpose();
|
||||
void Patch_Freeze();
|
||||
void Patch_UnFreeze(bool bAll);
|
||||
const char* Patch_GetTextureName();
|
||||
void Patch_FindReplaceTexture(brush_t *pb, const char *pFind, const char *pReplace, bool bForce);
|
||||
void Patch_ReplaceQTexture(brush_t *pb, qtexture_t *pOld, qtexture_t *pNew);
|
||||
void Select_SnapToGrid();
|
||||
extern bool g_bPatchShowBounds;
|
||||
extern bool g_bPatchWireFrame;
|
||||
extern bool g_bPatchWeld;
|
||||
extern bool g_bPatchDrillDown;
|
||||
extern bool g_bPatchInsertMode;
|
||||
extern bool g_bPatchBendMode;
|
||||
extern vec3_t g_vBendOrigin;
|
||||
void Patch_FromTriangle(vec5_t vx, vec5_t vy, vec5_t vz);
|
||||
const char* Patch_GetKeyValue(patchMesh_t *p, const char *pKey);
|
||||
void Patch_SetEpair(patchMesh_t *p, const char *pKey, const char *pValue);
|
||||
|
||||
|
||||
|
||||
// group stuff
|
||||
// group_t are loaded / saved through "group_info" entities
|
||||
// they hold epairs for group settings and additionnal access info (tree nodes)
|
||||
typedef struct group_s
|
||||
{
|
||||
struct group_s *next;
|
||||
epair_t *epairs;
|
||||
HTREEITEM itemOwner;
|
||||
} group_t;
|
||||
|
||||
// NOTES: grouping only enabled in brush primitives mode
|
||||
// grouping works by naming brushes and setting display properties
|
||||
// the group hierarchy is not related with the map hierarchy (entity list, brushes etc.)
|
||||
// brushes with no group are under the "world" node (default for all brushes)
|
||||
// void Group_GetListFromWorld(CStringArray *pArray);
|
||||
void Group_RemoveListFromWorld();
|
||||
// void Group_SetListToWorld(CStringArray *pArray);
|
||||
// void Group_BuildTree(CTreeCtrl *pTree);
|
||||
// void Group_DecomposeTree(CTreeCtrl *pTree);
|
||||
// save group_t as "classname" "group_info" things
|
||||
void Group_Save(FILE *f);
|
||||
// clean the brushes ownerItem, clean the treeview and rebuild everything
|
||||
// is usually called when loading a new map, but may be called anytime
|
||||
void Group_Init();
|
||||
void Group_Add(entity_t *e);
|
||||
|
||||
// remove a brush from it's current group, will erase the "group" epair if any, and delete the tree control node
|
||||
void Group_RemoveBrush(brush_t *b);
|
||||
void Group_AddToWorld(brush_t *b);
|
||||
// will remove brush of it's current group if any, and will add it wherever needed according to it's "group" key
|
||||
void Group_AddToProperGroup(brush_t *b);
|
||||
void Group_AddToSelected(brush_t *b);
|
||||
// allocate a new group, set name
|
||||
group_t* Group_Alloc(const char *name);
|
||||
// we use entities to store information about the groups
|
||||
// these entities are not linked into the world, and they have no brushes
|
||||
// only loaded / saved in map file
|
||||
group_t* Group_ForName(const char *name);
|
||||
|
||||
// Timo
|
||||
// new brush primitive stuff
|
||||
void ComputeAxisBase(vec3_t normal,vec3_t texS,vec3_t texT );
|
||||
void FaceToBrushPrimitFace(face_t *f);
|
||||
void EmitBrushPrimitTextureCoordinates(face_t *, winding_t *);
|
||||
// EmitTextureCoordinates, is old code used for brush to brush primitive conversion
|
||||
void EmitTextureCoordinates ( float *xyzst, qtexture_t *q, face_t *f);
|
||||
void BrushPrimit_Parse(brush_t *);
|
||||
// compute a fake shift scale rot representation from the texture matrix
|
||||
void TexMatToFakeTexCoords( vec_t texMat[2][3], float shift[2], float *rot, float scale[2] );
|
||||
void FakeTexCoordsToTexMat( float shift[2], float rot, float scale[2], vec_t texMat[2][3] );
|
||||
void ConvertTexMatWithQTexture( brushprimit_texdef_t *texMat1, qtexture_t *qtex1, brushprimit_texdef_t *texMat2, qtexture_t *qtex2 );
|
||||
// texture locking
|
||||
void Face_MoveTexture_BrushPrimit(face_t *f, vec3_t delta);
|
||||
void Select_ShiftTexture_BrushPrimit( face_t *f, int x, int y );
|
||||
void RotateFaceTexture_BrushPrimit(face_t *f, int nAxis, float fDeg, vec3_t vOrigin );
|
||||
// used in CCamWnd::ShiftTexture_BrushPrimit
|
||||
void ComputeBest2DVector( vec3_t v, vec3_t X, vec3_t Y, int &x, int &y );
|
||||
|
||||
|
||||
//
|
||||
// eclass.cpp
|
||||
//
|
||||
extern qboolean parsing_single;
|
||||
extern qboolean eclass_found;
|
||||
extern eclass_t *eclass_e;
|
||||
void Eclass_ScanFile( char *filename );
|
||||
|
||||
// for interfaces, we require main plugin header included
|
||||
#include "qerplugin.h"
|
||||
|
||||
//
|
||||
// SurfaceDlg.cpp and surface properties plugin
|
||||
//
|
||||
//++timo some patch in/out stuff is in there, needs to be moved out in a dedicated interface
|
||||
void WINAPI Patch_Rebuild(patchMesh_t *p);
|
||||
#include "isurfaceplugin.h"
|
||||
extern _QERPlugSurfaceTable g_SurfaceTable;
|
||||
|
||||
//
|
||||
// OpenGL interface
|
||||
//
|
||||
#include "igl.h"
|
||||
HGLRC WINAPI QERApp_GetQeglobalsHGLRC();
|
||||
void WINAPI QERApp_HookXYGLWindow(IGLWindow* pGLW);
|
||||
void WINAPI QERApp_UnHookGLWindow(IGLWindow* pGLW);
|
||||
void DrawPluginEntities( VIEWTYPE vt );
|
||||
|
||||
//
|
||||
// ISelectedFace interface
|
||||
//
|
||||
#include "ISelectedFace.h"
|
||||
int WINAPI QERApp_ISelectedFace_GetTextureNumber();
|
||||
int WINAPI QERApp_GetFaceInfo(_QERFaceData *pFaceData, winding_t *pWinding);
|
||||
int WINAPI QERApp_SetFaceInfo(_QERFaceData *pFaceData);
|
||||
void WINAPI QERApp_GetTextureSize( int Size[2] );
|
||||
|
||||
//
|
||||
// IEpairs interface
|
||||
//
|
||||
#include "IEpairs.h"
|
||||
#include "EpairsWrapper.h"
|
||||
|
||||
//
|
||||
// IPluginEntities interface
|
||||
//
|
||||
#include "IPluginEntities.h"
|
||||
int WINAPI QERApp_EClassScanDir( char *dir, HMODULE plugID );
|
||||
|
||||
//
|
||||
// ShaderInfo.cpp
|
||||
//
|
||||
#include "ShaderInfo.h"
|
||||
|
||||
//
|
||||
// TexWnd.cpp
|
||||
//
|
||||
CShaderInfo* hasShader(const char *pName);
|
||||
|
||||
//
|
||||
// IScripLib interface
|
||||
// GetToken, UnGetToken, etc.
|
||||
#include "IScriplib.h"
|
||||
extern FILE *g_File;
|
||||
void WINAPI QERApp_MapPrintf_FILE( char *text, ... );
|
||||
|
||||
//
|
||||
// ISurfacePlugin interface
|
||||
//
|
||||
void WINAPI QERApp_GetTwoSelectedPatch( patchMesh_t **p1, patchMesh_t **p2 );
|
||||
|
||||
//
|
||||
// IBSPFrontend interface
|
||||
//
|
||||
#include "IBSPFrontend.h"
|
||||
extern _QERPlugBSPFrontendTable g_BSPFrontendTable;
|
||||
extern CStringArray g_BSPFrontendCommands;
|
||||
|
||||
//
|
||||
// IMessaging interface
|
||||
#include "IMessaging.h"
|
||||
#include "Messaging.h"
|
||||
void WINAPI QERApp_HookWindow(IWindowListener* pListen);
|
||||
void WINAPI QERApp_UnHookWindow(IWindowListener* pListen);
|
||||
IXYWndWrapper* WINAPI QERApp_GetXYWndWrapper();
|
||||
void WINAPI QERApp_HookListener(IListener* pListen, int Msg);
|
||||
int WINAPI QERApp_UnHookListener(IListener* pListen);
|
||||
void DispatchRadiantMsg( int Msg );
|
||||
// dispatch for IWindowListener entities
|
||||
void DispatchOnMouseMove(UINT nFlags, int x, int y);
|
||||
bool DispatchOnLButtonDown(UINT nFlags, int x, int y);
|
||||
bool DispatchOnLButtonUp(UINT nFlags, int x, int y);
|
||||
|
||||
//
|
||||
// IShaders interface
|
||||
CShaderInfo* SetNameShaderInfo(qtexture_t* q, const char* pPath, const char* pName);
|
||||
qtexture_t* Texture_LoadTGATexture (unsigned char* pPixels, int nWidth, int nHeight, char* pPath, int nFlags, int nContents, int nValue );
|
||||
#include "IShaders.h"
|
||||
qtexture_t* WINAPI QERApp_TryTextureForName(const char* name);
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __QEDEFS_H__
|
||||
#define __QEDEFS_H__
|
||||
|
||||
#define QE_VERSION 0x0501
|
||||
|
||||
#define QE3_STYLE (WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CHILD)
|
||||
#define QE3_STYLE2 (WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU)
|
||||
#define QE3_CHILDSTYLE (WS_OVERLAPPED | WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION | WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZEBOX)
|
||||
|
||||
#define QE3_SPLITTER_STYLE (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
|
||||
|
||||
|
||||
|
||||
#define QE_AUTOSAVE_INTERVAL 5 // number of minutes between autosaves
|
||||
|
||||
#define _3DFXCAMERA_WINDOW_CLASS "Q3DFXCamera"
|
||||
#define CAMERA_WINDOW_CLASS "QCamera"
|
||||
#define XY_WINDOW_CLASS "QXY"
|
||||
#define Z_WINDOW_CLASS "QZ"
|
||||
#define ENT_WINDOW_CLASS "QENT"
|
||||
#define TEXTURE_WINDOW_CLASS "QTEX"
|
||||
|
||||
#define ZWIN_WIDTH 40
|
||||
#define CWIN_SIZE (0.4)
|
||||
|
||||
#define MAX_EDGES 512
|
||||
//#define MAX_POINTS 1024
|
||||
#define MAX_POINTS 2048
|
||||
|
||||
#define MAX_TERRA_POINTS 4096
|
||||
|
||||
#define CMD_TEXTUREWAD 60000
|
||||
#define CMD_BSPCOMMAND 61000
|
||||
|
||||
#define PITCH 0
|
||||
#define YAW 1
|
||||
#define ROLL 2
|
||||
|
||||
#define QE_TIMER0 1
|
||||
|
||||
#define PLANE_X 0
|
||||
#define PLANE_Y 1
|
||||
#define PLANE_Z 2
|
||||
#define PLANE_ANYX 3
|
||||
#define PLANE_ANYY 4
|
||||
#define PLANE_ANYZ 5
|
||||
|
||||
#define ON_EPSILON 0.01
|
||||
|
||||
#define KEY_FORWARD 1
|
||||
#define KEY_BACK 2
|
||||
#define KEY_TURNLEFT 4
|
||||
#define KEY_TURNRIGHT 8
|
||||
#define KEY_LEFT 16
|
||||
#define KEY_RIGHT 32
|
||||
#define KEY_LOOKUP 64
|
||||
#define KEY_LOOKDOWN 128
|
||||
#define KEY_UP 256
|
||||
#define KEY_DOWN 512
|
||||
|
||||
// xy.c
|
||||
#define EXCLUDE_LIGHTS 0x01
|
||||
#define EXCLUDE_ENT 0x02
|
||||
#define EXCLUDE_PATHS 0x04
|
||||
#define EXCLUDE_WATER 0x08
|
||||
#define EXCLUDE_WORLD 0x10
|
||||
#define EXCLUDE_CLIP 0x20
|
||||
#define EXCLUDE_DETAIL 0x40
|
||||
#define EXCLUDE_CURVES 0x80
|
||||
#define INCLUDE_EASY 0x100
|
||||
#define INCLUDE_NORMAL 0x200
|
||||
#define INCLUDE_HARD 0x400
|
||||
#define INCLUDE_DEATHMATCH 0x800
|
||||
#define EXCLUDE_HINT 0x1000
|
||||
#define EXCLUDE_CAULK 0x2000
|
||||
#define EXCLUDE_ANGLES 0x4000
|
||||
#define EXCLUDE_TERRAIN 0x8000
|
||||
|
||||
|
||||
//
|
||||
// menu indexes for modifying menus
|
||||
//
|
||||
#define MENU_VIEW 2
|
||||
#define MENU_BSP 4
|
||||
#define MENU_TEXTURE 6
|
||||
#define MENU_PLUGIN 11
|
||||
|
||||
|
||||
// odd things not in windows header...
|
||||
#define VK_COMMA 188
|
||||
#define VK_PERIOD 190
|
||||
|
||||
/*
|
||||
** window bits
|
||||
*/
|
||||
//++timo moved to qertypes.h
|
||||
// clean
|
||||
/*
|
||||
#define W_CAMERA 0x0001
|
||||
#define W_XY 0x0002
|
||||
#define W_XY_OVERLAY 0x0004
|
||||
#define W_Z 0x0008
|
||||
#define W_TEXTURE 0x0010
|
||||
#define W_Z_OVERLAY 0x0020
|
||||
#define W_CONSOLE 0x0040
|
||||
#define W_ENTITY 0x0080
|
||||
#define W_CAMERA_IFON 0x0100
|
||||
#define W_XZ 0x0200 //--| only used for patch vertex manip stuff
|
||||
#define W_YZ 0x0400 //--|
|
||||
#define W_ALL 0xFFFFFFFF
|
||||
*/
|
||||
|
||||
#define COLOR_TEXTUREBACK 0
|
||||
#define COLOR_GRIDBACK 1
|
||||
#define COLOR_GRIDMINOR 2
|
||||
#define COLOR_GRIDMAJOR 3
|
||||
#define COLOR_CAMERABACK 4
|
||||
#define COLOR_ENTITY 5
|
||||
#define COLOR_GRIDBLOCK 6
|
||||
#define COLOR_GRIDTEXT 7
|
||||
#define COLOR_BRUSHES 8
|
||||
#define COLOR_SELBRUSHES 9
|
||||
#define COLOR_CLIPPER 10
|
||||
#define COLOR_VIEWNAME 11
|
||||
#define COLOR_LAST 12
|
||||
|
||||
// classes
|
||||
#define ENTITY_WIREFRAME 0x00001
|
||||
#define ENTITY_SKIN_MODEL 0x00010
|
||||
#define ENTITY_SELECTED_ONLY 0x00100
|
||||
#define ENTITY_BOXED 0x01000
|
||||
|
||||
// menu settings
|
||||
#define ENTITY_BOX 0x01000
|
||||
#define ENTITY_WIRE 0x00001
|
||||
#define ENTITY_SELECTED 0x00101
|
||||
#define ENTITY_SKINNED 0x00010
|
||||
#define ENTITY_SKINNED_BOXED 0x01010
|
||||
#define ENTITY_SELECTED_SKIN 0x00110
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,454 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
// qertypes.h
|
||||
//
|
||||
// common types
|
||||
// merged from brush.h, etc. for plugin support
|
||||
//
|
||||
#ifndef _QERTYPE_H
|
||||
#define _QERTYPE_H
|
||||
|
||||
#ifndef __BYTEBOOL__
|
||||
#define __BYTEBOOL__
|
||||
typedef boolean qboolean;
|
||||
//typedef unsigned char byte;
|
||||
#endif
|
||||
|
||||
#define MAXPOINTS 16
|
||||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec2_t[2];
|
||||
typedef vec_t vec3_t[3];
|
||||
|
||||
#include "splines/math_vector.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
class texdef_t
|
||||
{
|
||||
public:
|
||||
texdef_t()
|
||||
{
|
||||
name = new char[1];
|
||||
name[0] = '\0';
|
||||
}
|
||||
~texdef_t()
|
||||
{
|
||||
delete []name;
|
||||
name = NULL;
|
||||
}
|
||||
|
||||
const char *Name( void )
|
||||
{
|
||||
if ( name ) {
|
||||
return name;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void SetName(const char *p)
|
||||
{
|
||||
if (name)
|
||||
{
|
||||
delete []name;
|
||||
}
|
||||
if (p)
|
||||
{
|
||||
name = strcpy(new char[strlen(p)+1], p);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = new char[1];
|
||||
name[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
texdef_t& operator =(const texdef_t& rhs)
|
||||
{
|
||||
if (&rhs != this)
|
||||
{
|
||||
SetName(rhs.name);
|
||||
shift[0] = rhs.shift[0];
|
||||
shift[1] = rhs.shift[1];
|
||||
rotate = rhs.rotate;
|
||||
scale[0] = rhs.scale[0];
|
||||
scale[1] = rhs.scale[1];
|
||||
contents = rhs.contents;
|
||||
flags = rhs.flags;
|
||||
value = rhs.value;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
//char name[128];
|
||||
char *name;
|
||||
float shift[2];
|
||||
float rotate;
|
||||
float scale[2];
|
||||
int contents;
|
||||
int flags;
|
||||
int value;
|
||||
};
|
||||
|
||||
// Timo
|
||||
// new brush primitive texdef
|
||||
typedef struct brushprimit_texdef_s
|
||||
{
|
||||
vec_t coords[2][3];
|
||||
} brushprimit_texdef_t;
|
||||
|
||||
class texturewin_t
|
||||
{
|
||||
public:
|
||||
texturewin_t()
|
||||
{
|
||||
}
|
||||
~texturewin_t()
|
||||
{
|
||||
}
|
||||
int width, height;
|
||||
int originy;
|
||||
// add brushprimit_texdef_t for brush primitive coordinates storage
|
||||
brushprimit_texdef_t brushprimit_texdef;
|
||||
int m_nTotalHeight;
|
||||
// surface plugin, must be casted to a IPluginTexdef*
|
||||
void* pTexdef;
|
||||
texdef_t texdef;
|
||||
};
|
||||
|
||||
#define QER_TRANS 0x00000001
|
||||
#define QER_NOCARVE 0x00000002
|
||||
|
||||
typedef struct qtexture_s
|
||||
{
|
||||
struct qtexture_s *next;
|
||||
char name[64]; // includes partial directory and extension
|
||||
int width, height;
|
||||
int contents;
|
||||
int flags;
|
||||
int value;
|
||||
int texture_number; // gl bind number
|
||||
|
||||
// name of the .shader file
|
||||
char shadername[1024]; // old shader stuff
|
||||
qboolean bFromShader; // created from a shader
|
||||
float fTrans; // amount of transparency
|
||||
int nShaderFlags; // qer_ shader flags
|
||||
vec3_t color; // for flat shade mode
|
||||
qboolean inuse; // true = is present on the level
|
||||
|
||||
// cast this one to an IPluginQTexture if you are using it
|
||||
// NOTE: casting can be done with a GETPLUGINQTEXTURE defined in isurfaceplugin.h
|
||||
// TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginQTexture *pPluginQTexture } kind of thing ?
|
||||
void *pData;
|
||||
|
||||
//++timo FIXME: this is the actual filename of the texture
|
||||
// this will be removed after shader code cleanup
|
||||
char filename[64];
|
||||
|
||||
} qtexture_t;
|
||||
|
||||
// NOTE: don't trust this definition!
|
||||
// you should read float points[..][5]
|
||||
// see NewWinding definition
|
||||
#define MAX_POINTS_ON_WINDING 64
|
||||
typedef struct
|
||||
{
|
||||
int numpoints;
|
||||
int maxpoints;
|
||||
float points[8][5]; // variable sized
|
||||
} winding_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t normal;
|
||||
double dist;
|
||||
int type;
|
||||
} plane_t;
|
||||
|
||||
//++timo texdef and brushprimit_texdef are static
|
||||
// TODO : do dynamic ?
|
||||
typedef struct face_s
|
||||
{
|
||||
struct face_s *next;
|
||||
struct face_s *original; //used for vertex movement
|
||||
vec3_t planepts[3];
|
||||
texdef_t texdef;
|
||||
plane_t plane;
|
||||
|
||||
winding_t *face_winding;
|
||||
|
||||
vec3_t d_color;
|
||||
qtexture_t *d_texture;
|
||||
|
||||
// Timo new brush primit texdef
|
||||
brushprimit_texdef_t brushprimit_texdef;
|
||||
|
||||
// cast this one to an IPluginTexdef if you are using it
|
||||
// NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h
|
||||
// TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?
|
||||
void *pData;
|
||||
} face_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t xyz;
|
||||
float sideST[2];
|
||||
float capST[2];
|
||||
} curveVertex_t;
|
||||
|
||||
typedef struct {
|
||||
curveVertex_t v[2];
|
||||
} sideVertex_t;
|
||||
|
||||
|
||||
#define MIN_PATCH_WIDTH 3
|
||||
#define MIN_PATCH_HEIGHT 3
|
||||
|
||||
#define MAX_PATCH_WIDTH 16
|
||||
#define MAX_PATCH_HEIGHT 16
|
||||
|
||||
// patch type info
|
||||
// type in lower 16 bits, flags in upper
|
||||
// endcaps directly follow this patch in the list
|
||||
|
||||
// types
|
||||
#define PATCH_GENERIC 0x00000000 // generic flat patch
|
||||
#define PATCH_CYLINDER 0x00000001 // cylinder
|
||||
#define PATCH_BEVEL 0x00000002 // bevel
|
||||
#define PATCH_ENDCAP 0x00000004 // endcap
|
||||
#define PATCH_HEMISPHERE 0x00000008 // hemisphere
|
||||
#define PATCH_CONE 0x00000010 // cone
|
||||
#define PATCH_TRIANGLE 0x00000020 // simple tri, assumes 3x3 patch
|
||||
|
||||
// behaviour styles
|
||||
#define PATCH_CAP 0x00001000 // flat patch applied as a cap
|
||||
#define PATCH_SEAM 0x00002000 // flat patch applied as a seam
|
||||
#define PATCH_THICK 0x00004000 // patch applied as a thick portion
|
||||
|
||||
// styles
|
||||
#define PATCH_BEZIER 0x00000000 // default bezier
|
||||
#define PATCH_BSPLINE 0x10000000 // bspline
|
||||
|
||||
#define PATCH_TYPEMASK 0x00000fff //
|
||||
#define PATCH_BTYPEMASK 0x0000f000 //
|
||||
#define PATCH_STYLEMASK 0xffff0000 //
|
||||
|
||||
typedef struct {
|
||||
vec3_t xyz;
|
||||
float st[2];
|
||||
float lightmap[2];
|
||||
vec3_t normal;
|
||||
} drawVert_t;
|
||||
|
||||
// used in brush primitive AND entities
|
||||
typedef struct epair_s
|
||||
{
|
||||
struct epair_s *next;
|
||||
char *key;
|
||||
char *value;
|
||||
} epair_t;
|
||||
|
||||
struct brush_s;
|
||||
typedef struct brush_s brush_t;
|
||||
|
||||
typedef struct {
|
||||
int width, height; // in control points, not patches
|
||||
int contents, flags, value, type;
|
||||
qtexture_t *d_texture;
|
||||
drawVert_t ctrl[MAX_PATCH_WIDTH][MAX_PATCH_HEIGHT];
|
||||
brush_t *pSymbiot;
|
||||
qboolean bSelected;
|
||||
qboolean bOverlay;
|
||||
qboolean bDirty;
|
||||
int nListID;
|
||||
epair_t *epairs;
|
||||
// cast this one to an IPluginTexdef if you are using it
|
||||
// NOTE: casting can be done with a GETPLUGINTEXDEF defined in isurfaceplugin.h
|
||||
// TODO: if the __ISURFACEPLUGIN_H_ header is used, use a union { void *pData; IPluginTexdef *pPluginTexdef } kind of thing ?
|
||||
void *pData;
|
||||
} patchMesh_t;
|
||||
|
||||
typedef struct {
|
||||
int index;
|
||||
qtexture_t *texture;
|
||||
texdef_t texdef;
|
||||
} terrainFace_t;
|
||||
|
||||
typedef struct {
|
||||
float height;
|
||||
float scale;
|
||||
terrainFace_t tri;
|
||||
vec4_t rgba;
|
||||
vec3_t normal;
|
||||
vec3_t xyz;
|
||||
} terrainVert_t;
|
||||
|
||||
#define MAX_TERRAIN_TEXTURES 128
|
||||
typedef struct {
|
||||
int width, height;
|
||||
|
||||
vec3_t mins, maxs;
|
||||
vec3_t origin;
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
|
||||
int numtextures;
|
||||
qtexture_t *textures[ MAX_TERRAIN_TEXTURES ];
|
||||
|
||||
terrainVert_t *heightmap; // width * height
|
||||
|
||||
epair_t *epairs;
|
||||
|
||||
brush_s *pSymbiot;
|
||||
bool bSelected;
|
||||
bool bDirty;
|
||||
int nListID;
|
||||
} terrainMesh_t;
|
||||
|
||||
typedef struct brush_s
|
||||
{
|
||||
struct brush_s *prev, *next; // links in active/selected
|
||||
struct brush_s *oprev, *onext; // links in entity
|
||||
struct entity_s *owner;
|
||||
vec3_t mins, maxs;
|
||||
face_t *brush_faces;
|
||||
|
||||
qboolean bModelFailed;
|
||||
//
|
||||
// curve brush extensions
|
||||
// all are derived from brush_faces
|
||||
qboolean patchBrush;
|
||||
qboolean hiddenBrush;
|
||||
qboolean terrainBrush;
|
||||
|
||||
//int nPatchID;
|
||||
|
||||
patchMesh_t *pPatch;
|
||||
terrainMesh_t *pTerrain;
|
||||
|
||||
struct entity_s *pUndoOwner;
|
||||
|
||||
int undoId; //undo ID
|
||||
int redoId; //redo ID
|
||||
int ownerId; //entityId of the owner entity for undo
|
||||
|
||||
// TTimo: HTREEITEM is MFC, some plugins really don't like it
|
||||
#ifdef QERTYPES_USE_MFC
|
||||
int numberId; // brush number
|
||||
HTREEITEM itemOwner; // owner for grouping
|
||||
#else
|
||||
int numberId;
|
||||
DWORD itemOwner;
|
||||
#endif
|
||||
|
||||
// brush primitive only
|
||||
epair_t *epairs;
|
||||
|
||||
} brush_t;
|
||||
|
||||
|
||||
#define MAX_FLAGS 8
|
||||
|
||||
|
||||
typedef struct trimodel_t
|
||||
{
|
||||
vec3_t v[3];
|
||||
float st[3][2];
|
||||
} trimodel;
|
||||
|
||||
typedef struct entitymodel_t
|
||||
{
|
||||
struct entitymodel_t *pNext;
|
||||
int nTriCount;
|
||||
trimodel *pTriList;
|
||||
int nTextureBind;
|
||||
int nSkinWidth;
|
||||
int nSkinHeight;
|
||||
int nModelPosition;
|
||||
} entitymodel;
|
||||
|
||||
|
||||
// eclass show flags
|
||||
|
||||
#define ECLASS_LIGHT 0x00000001
|
||||
#define ECLASS_ANGLE 0x00000002
|
||||
#define ECLASS_PATH 0x00000004
|
||||
#define ECLASS_MISCMODEL 0x00000008
|
||||
#define ECLASS_PLUGINENTITY 0x00000010
|
||||
|
||||
typedef struct eclass_s
|
||||
{
|
||||
struct eclass_s *next;
|
||||
char *name;
|
||||
qboolean fixedsize;
|
||||
qboolean unknown; // wasn't found in source
|
||||
vec3_t mins, maxs;
|
||||
vec3_t color;
|
||||
texdef_t texdef;
|
||||
char *comments;
|
||||
char flagnames[MAX_FLAGS][32];
|
||||
|
||||
/*
|
||||
int nTriCount;
|
||||
trimodel *pTriList;
|
||||
int nTextureBind;
|
||||
int nSkinWidth, nSkinHeight;
|
||||
*/
|
||||
entitymodel *model;
|
||||
char *modelpath;
|
||||
char *skinpath;
|
||||
int nFrame;
|
||||
unsigned int nShowFlags;
|
||||
|
||||
HMODULE hPlug;
|
||||
} eclass_t;
|
||||
|
||||
extern eclass_t *eclass;
|
||||
|
||||
/*
|
||||
** window bits
|
||||
*/
|
||||
#define W_CAMERA 0x0001
|
||||
#define W_XY 0x0002
|
||||
#define W_XY_OVERLAY 0x0004
|
||||
#define W_Z 0x0008
|
||||
#define W_TEXTURE 0x0010
|
||||
#define W_Z_OVERLAY 0x0020
|
||||
#define W_CONSOLE 0x0040
|
||||
#define W_ENTITY 0x0080
|
||||
#define W_CAMERA_IFON 0x0100
|
||||
#define W_XZ 0x0200 //--| only used for patch vertex manip stuff
|
||||
#define W_YZ 0x0400 //--|
|
||||
#define W_GROUP 0x0800
|
||||
#define W_MEDIA 0x1000
|
||||
#define W_ALL 0xFFFFFFFF
|
||||
|
||||
// used in some Drawing routines
|
||||
enum VIEWTYPE {YZ, XZ, XY};
|
||||
|
||||
enum terrainnoise_t { NOISE_NONE, NOISE_PLUS, NOISE_PLUSMINUS };
|
||||
enum terrainbrush_t { TERRAIN_BRUSH_CIRCLE, TERRAIN_BRUSH_SQUARE };
|
||||
enum terrainfalloff_t { TERRAIN_FALLOFF_LINEAR, TERRAIN_FALLOFF_CURVED };
|
||||
|
||||
#endif
|
|
@ -1,481 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
//
|
||||
// qfiles.h: quake file formats
|
||||
// This file must be identical in the quake and utils directories
|
||||
//
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.MD2 triangle model file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
|
||||
#define ALIAS_VERSION 8
|
||||
|
||||
#define MAX_TRIANGLES 4096
|
||||
#define MAX_VERTS 2048
|
||||
#define MAX_FRAMES 512
|
||||
#define MAX_MD2SKINS 32
|
||||
#define MAX_SKINNAME 64
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short s;
|
||||
short t;
|
||||
} dstvert_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short index_xyz[3];
|
||||
short index_st[3];
|
||||
} dtriangle_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte v[3]; // scaled byte to fit in frame mins/maxs
|
||||
byte lightnormalindex;
|
||||
} dtrivertx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float scale[3]; // multiply byte verts by this
|
||||
float translate[3]; // then add this
|
||||
char name[16]; // frame name from grabbing
|
||||
dtrivertx_t verts[1]; // variable sized
|
||||
} daliasframe_t;
|
||||
|
||||
|
||||
// the glcmd format:
|
||||
// a positive integer starts a tristrip command, followed by that many
|
||||
// vertex structures.
|
||||
// a negative integer starts a trifan command, followed by -x vertexes
|
||||
// a zero indicates the end of the command list.
|
||||
// a vertex consists of a floating point s, a floating point t,
|
||||
// and an integer vertex index.
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int framesize; // byte size of each frame
|
||||
|
||||
int num_skins;
|
||||
int num_xyz;
|
||||
int num_st; // greater than num_xyz for seams
|
||||
int num_tris;
|
||||
int num_glcmds; // dwords in strip/fan command list
|
||||
int num_frames;
|
||||
|
||||
int ofs_skins; // each skin is a MAX_SKINNAME string
|
||||
int ofs_st; // byte offset from start for stverts
|
||||
int ofs_tris; // offset for dtriangles
|
||||
int ofs_frames; // offset for first frame
|
||||
int ofs_glcmds;
|
||||
int ofs_end; // end of file
|
||||
|
||||
} dmdl_t;
|
||||
|
||||
#define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
|
||||
#define MAX_QPATH 64 // max length of a quake game pathname
|
||||
#define MD3_XYZ_SCALE (1.0/64)
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
char name[MAX_QPATH]; // model name
|
||||
|
||||
int flags;
|
||||
|
||||
int numFrames;
|
||||
int numTags;
|
||||
int numSurfaces;
|
||||
|
||||
int numSkins;
|
||||
|
||||
int ofsFrames; // offset for first frame
|
||||
int ofsTags; // numFrames * numTags
|
||||
int ofsSurfaces; // first surface, others follow
|
||||
|
||||
int ofsEnd; // end of file
|
||||
} md3Header_t;
|
||||
|
||||
typedef struct {
|
||||
int ident; //
|
||||
|
||||
char name[MAX_QPATH]; // polyset name
|
||||
|
||||
int flags;
|
||||
int numFrames; // all surfaces in a model should have the same
|
||||
|
||||
int numShaders; // all surfaces in a model should have the same
|
||||
int numVerts;
|
||||
|
||||
int numTriangles;
|
||||
int ofsTriangles;
|
||||
|
||||
int ofsShaders; // offset from start of md3Surface_t
|
||||
int ofsSt; // texture coords are common for all frames
|
||||
int ofsXyzNormals; // numVerts * numFrames
|
||||
|
||||
int ofsEnd; // next surface follows
|
||||
|
||||
} md3Surface_t;
|
||||
|
||||
typedef struct {
|
||||
char name[MAX_QPATH];
|
||||
int shaderIndex; // for in-game use
|
||||
} md3Shader_t;
|
||||
|
||||
typedef struct {
|
||||
int indexes[3];
|
||||
} md3Triangle_t;
|
||||
|
||||
typedef struct {
|
||||
float st[2];
|
||||
} md3St_t;
|
||||
|
||||
typedef struct {
|
||||
short xyz[3];
|
||||
short normal;
|
||||
} md3XyzNormal_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float st[2];
|
||||
int nVertIndex;
|
||||
} glst_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nCount;
|
||||
int ObjectIndex;
|
||||
glst_t GlSt;
|
||||
} gl_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.SP2 sprite file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I')
|
||||
// little-endian "IDS2"
|
||||
#define SPRITE_VERSION 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int width, height;
|
||||
int origin_x, origin_y; // raster coordinates inside pic
|
||||
char name[MAX_SKINNAME]; // name of pcx file
|
||||
} dsprframe_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
int numframes;
|
||||
dsprframe_t frames[1]; // variable sized
|
||||
} dsprite_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
.WAL texture file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
#define MIPLEVELS 4
|
||||
typedef struct miptex_s
|
||||
{
|
||||
char name[32];
|
||||
unsigned width, height;
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
char animname[32]; // next frame in animation chain
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
} miptex_t;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
.BSP file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
|
||||
// little-endian "IBSP"
|
||||
|
||||
#define BSPVERSION 36
|
||||
|
||||
|
||||
// upper design bounds
|
||||
// leaffaces, leafbrushes, planes, and verts are still bounded by
|
||||
// 16 bit short limits
|
||||
#define MAX_MAP_MODELS 1024
|
||||
#define MAX_MAP_BRUSHES 8192
|
||||
#define MAX_MAP_ENTITIES 2048
|
||||
#define MAX_MAP_ENTSTRING 0x20000
|
||||
#define MAX_MAP_TEXINFO 8192
|
||||
|
||||
#define MAX_MAP_PLANES 65536
|
||||
#define MAX_MAP_NODES 65536
|
||||
#define MAX_MAP_BRUSHSIDES 65536
|
||||
#define MAX_MAP_LEAFS 65536
|
||||
#define MAX_MAP_VERTS 65536
|
||||
#define MAX_MAP_FACES 65536
|
||||
#define MAX_MAP_LEAFFACES 65536
|
||||
#define MAX_MAP_LEAFBRUSHES 65536
|
||||
#define MAX_MAP_PORTALS 65536
|
||||
#define MAX_MAP_EDGES 128000
|
||||
#define MAX_MAP_SURFEDGES 256000
|
||||
#define MAX_MAP_LIGHTING 0x200000
|
||||
#define MAX_MAP_VISIBILITY 0x100000
|
||||
|
||||
#define MAX_WORLD_COORD ( 128*1024 )
|
||||
#define MIN_WORLD_COORD ( -128*1024 )
|
||||
#define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
|
||||
|
||||
#define MAX_BRUSH_SIZE ( WORLD_SIZE )
|
||||
|
||||
// key / value pair sizes
|
||||
|
||||
#define MAX_KEY 32
|
||||
#define MAX_VALUE 1024
|
||||
|
||||
//=============================================================================
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fileofs, filelen;
|
||||
} lump_t;
|
||||
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_PLANES 1
|
||||
#define LUMP_VERTEXES 2
|
||||
#define LUMP_VISIBILITY 3
|
||||
#define LUMP_NODES 4
|
||||
#define LUMP_TEXINFO 5
|
||||
#define LUMP_FACES 6
|
||||
#define LUMP_LIGHTING 7
|
||||
#define LUMP_LEAFS 8
|
||||
#define LUMP_LEAFFACES 9
|
||||
#define LUMP_LEAFBRUSHES 10
|
||||
#define LUMP_EDGES 11
|
||||
#define LUMP_SURFEDGES 12
|
||||
#define LUMP_MODELS 13
|
||||
#define LUMP_BRUSHES 14
|
||||
#define LUMP_BRUSHSIDES 15
|
||||
#define LUMP_POP 16
|
||||
|
||||
#define HEADER_LUMPS 17
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
lump_t lumps[HEADER_LUMPS];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3], maxs[3];
|
||||
float origin[3]; // for sounds or lights
|
||||
int headnode;
|
||||
int firstface, numfaces; // submodels just draw faces
|
||||
// without walking the bsp tree
|
||||
} dmodel_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float point[3];
|
||||
} dvertex_t;
|
||||
|
||||
|
||||
// 0-2 are axial planes
|
||||
#define PLANE_X 0
|
||||
#define PLANE_Y 1
|
||||
#define PLANE_Z 2
|
||||
|
||||
// 3-5 are non-axial planes snapped to the nearest
|
||||
#define PLANE_ANYX 3
|
||||
#define PLANE_ANYY 4
|
||||
#define PLANE_ANYZ 5
|
||||
|
||||
// planes (x&~1) and (x&~1)+1 are allways opposites
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float normal[3];
|
||||
float dist;
|
||||
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
|
||||
} dplane_t;
|
||||
|
||||
|
||||
// contents flags are seperate bits
|
||||
// a given brush can contribute multiple content bits
|
||||
// multiple brushes can be in a single leaf
|
||||
|
||||
// lower bits are stronger, and will eat weaker brushes completely
|
||||
#define CONTENTS_SOLID 1 // an eye is never valid in a solid
|
||||
#define CONTENTS_WINDOW 2 // translucent, but not watery
|
||||
#define CONTENTS_AUX 4
|
||||
#define CONTENTS_LAVA 8
|
||||
#define CONTENTS_SLIME 16
|
||||
#define CONTENTS_WATER 32
|
||||
#define CONTENTS_MIST 64
|
||||
#define LAST_VISIBLE_CONTENTS 64
|
||||
|
||||
// remaining contents are non-visible, and don't eat brushes
|
||||
#define CONTENTS_PLAYERCLIP 0x10000
|
||||
#define CONTENTS_MONSTERCLIP 0x20000
|
||||
|
||||
// currents can be added to any other contents, and may be mixed
|
||||
#define CONTENTS_CURRENT_0 0x40000
|
||||
#define CONTENTS_CURRENT_90 0x80000
|
||||
#define CONTENTS_CURRENT_180 0x100000
|
||||
#define CONTENTS_CURRENT_270 0x200000
|
||||
#define CONTENTS_CURRENT_UP 0x400000
|
||||
#define CONTENTS_CURRENT_DOWN 0x800000
|
||||
|
||||
#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
|
||||
|
||||
#define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
|
||||
#define CONTENTS_DEADMONSTER 0x4000000 // corpse
|
||||
#define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
|
||||
#define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
|
||||
#define CONTENTS_LADDER 0x20000000 // ladder
|
||||
#define CONTENTS_NEGATIVE_CURVE 0x40000000 // reverse inside / outside
|
||||
|
||||
#define CONTENTS_KEEP (CONTENTS_DETAIL | CONTENTS_NEGATIVE_CURVE)
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
short mins[3]; // for frustom culling
|
||||
short maxs[3];
|
||||
unsigned short firstface;
|
||||
unsigned short numfaces; // counting both sides
|
||||
} dnode_t;
|
||||
|
||||
|
||||
typedef struct texinfo_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t][xyz offset]
|
||||
int flags; // miptex flags + overrides
|
||||
int value; // light emission, etc
|
||||
char texture[32]; // texture name (textures/*.wal)
|
||||
int nexttexinfo; // for animations, -1 = end of chain
|
||||
} texinfo_t;
|
||||
|
||||
|
||||
#define SURF_LIGHT 0x1 // value will hold the light strength
|
||||
|
||||
#define SURF_SLICK 0x2 // effects game physics
|
||||
|
||||
#define SURF_SKY 0x4 // don't draw, but add to skybox
|
||||
#define SURF_WARP 0x8 // turbulent water warp
|
||||
#define SURF_TRANS33 0x10
|
||||
#define SURF_TRANS66 0x20
|
||||
#define SURF_FLOWING 0x40 // scroll towards angle
|
||||
#define SURF_NODRAW 0x80 // don't bother referencing the texture
|
||||
|
||||
#define SURF_PATCH 0x20000000
|
||||
#define SURF_CURVE_FAKE 0x40000000
|
||||
#define SURF_CURVE 0x80000000
|
||||
#define SURF_KEEP (SURF_CURVE | SURF_CURVE_FAKE | SURF_PATCH)
|
||||
|
||||
// note that edge 0 is never used, because negative edge nums are used for
|
||||
// counterclockwise use of the edge in a face
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v[2]; // vertex numbers
|
||||
} dedge_t;
|
||||
|
||||
#define MAXLIGHTMAPS 4
|
||||
typedef struct
|
||||
{
|
||||
unsigned short planenum;
|
||||
short side;
|
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
short numedges;
|
||||
short texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
} dface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int contents; // OR of all brushes (not needed?)
|
||||
|
||||
int pvsofs; // -1 = no info
|
||||
int phsofs; // -1 = no info
|
||||
|
||||
short mins[3]; // for frustum culling
|
||||
short maxs[3];
|
||||
|
||||
unsigned short firstleafface;
|
||||
unsigned short numleaffaces;
|
||||
|
||||
unsigned short firstleafbrush;
|
||||
unsigned short numleafbrushes;
|
||||
} dleaf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short planenum; // facing out of the leaf
|
||||
short texinfo;
|
||||
} dbrushside_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int firstside;
|
||||
int numsides;
|
||||
int contents;
|
||||
} dbrush_t;
|
||||
|
||||
#define ANGLE_UP -1
|
||||
#define ANGLE_DOWN -2
|
||||
|
456
q3radiant/QGL.H
456
q3radiant/QGL.H
|
@ -1,456 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
/*
|
||||
** QGL.H
|
||||
*/
|
||||
|
||||
#ifndef __QGL_H__
|
||||
#define __QGL_H__
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <gl/gl.h>
|
||||
#include <gl/glu.h>
|
||||
|
||||
int QGL_Init( const char *dllname, const char* pGluName );
|
||||
void QGL_Shutdown();
|
||||
|
||||
#ifndef APIENTRY
|
||||
# define APIENTRY
|
||||
#endif
|
||||
|
||||
extern void ( APIENTRY * qglAccum )(GLenum op, GLfloat value);
|
||||
extern void ( APIENTRY * qglAlphaFunc )(GLenum func, GLclampf ref);
|
||||
extern GLboolean ( APIENTRY * qglAreTexturesResident )(GLsizei n, const GLuint *textures, GLboolean *residences);
|
||||
extern void ( APIENTRY * qglArrayElement )(GLint i);
|
||||
extern void ( APIENTRY * qglBegin )(GLenum mode);
|
||||
extern void ( APIENTRY * qglBindTexture )(GLenum target, GLuint texture);
|
||||
extern void ( APIENTRY * qglBitmap )(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
|
||||
extern void ( APIENTRY * qglBlendFunc )(GLenum sfactor, GLenum dfactor);
|
||||
extern void ( APIENTRY * qglCallList )(GLuint list);
|
||||
extern void ( APIENTRY * qglCallLists )(GLsizei n, GLenum type, const GLvoid *lists);
|
||||
extern void ( APIENTRY * qglClear )(GLbitfield mask);
|
||||
extern void ( APIENTRY * qglClearAccum )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
extern void ( APIENTRY * qglClearColor )(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
extern void ( APIENTRY * qglClearDepth )(GLclampd depth);
|
||||
extern void ( APIENTRY * qglClearIndex )(GLfloat c);
|
||||
extern void ( APIENTRY * qglClearStencil )(GLint s);
|
||||
extern void ( APIENTRY * qglClipPlane )(GLenum plane, const GLdouble *equation);
|
||||
extern void ( APIENTRY * qglColor3b )(GLbyte red, GLbyte green, GLbyte blue);
|
||||
extern void ( APIENTRY * qglColor3bv )(const GLbyte *v);
|
||||
extern void ( APIENTRY * qglColor3d )(GLdouble red, GLdouble green, GLdouble blue);
|
||||
extern void ( APIENTRY * qglColor3dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglColor3f )(GLfloat red, GLfloat green, GLfloat blue);
|
||||
extern void ( APIENTRY * qglColor3fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglColor3i )(GLint red, GLint green, GLint blue);
|
||||
extern void ( APIENTRY * qglColor3iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglColor3s )(GLshort red, GLshort green, GLshort blue);
|
||||
extern void ( APIENTRY * qglColor3sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglColor3ub )(GLubyte red, GLubyte green, GLubyte blue);
|
||||
extern void ( APIENTRY * qglColor3ubv )(const GLubyte *v);
|
||||
extern void ( APIENTRY * qglColor3ui )(GLuint red, GLuint green, GLuint blue);
|
||||
extern void ( APIENTRY * qglColor3uiv )(const GLuint *v);
|
||||
extern void ( APIENTRY * qglColor3us )(GLushort red, GLushort green, GLushort blue);
|
||||
extern void ( APIENTRY * qglColor3usv )(const GLushort *v);
|
||||
extern void ( APIENTRY * qglColor4b )(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
|
||||
extern void ( APIENTRY * qglColor4bv )(const GLbyte *v);
|
||||
extern void ( APIENTRY * qglColor4d )(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
|
||||
extern void ( APIENTRY * qglColor4dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglColor4f )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
extern void ( APIENTRY * qglColor4fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglColor4i )(GLint red, GLint green, GLint blue, GLint alpha);
|
||||
extern void ( APIENTRY * qglColor4iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglColor4s )(GLshort red, GLshort green, GLshort blue, GLshort alpha);
|
||||
extern void ( APIENTRY * qglColor4sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglColor4ub )(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
|
||||
extern void ( APIENTRY * qglColor4ubv )(const GLubyte *v);
|
||||
extern void ( APIENTRY * qglColor4ui )(GLuint red, GLuint green, GLuint blue, GLuint alpha);
|
||||
extern void ( APIENTRY * qglColor4uiv )(const GLuint *v);
|
||||
extern void ( APIENTRY * qglColor4us )(GLushort red, GLushort green, GLushort blue, GLushort alpha);
|
||||
extern void ( APIENTRY * qglColor4usv )(const GLushort *v);
|
||||
extern void ( APIENTRY * qglColorMask )(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
extern void ( APIENTRY * qglColorMaterial )(GLenum face, GLenum mode);
|
||||
extern void ( APIENTRY * qglColorPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
extern void ( APIENTRY * qglCopyPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
|
||||
extern void ( APIENTRY * qglCopyTexImage1D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
|
||||
extern void ( APIENTRY * qglCopyTexImage2D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
extern void ( APIENTRY * qglCopyTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
|
||||
extern void ( APIENTRY * qglCopyTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
extern void ( APIENTRY * qglCullFace )(GLenum mode);
|
||||
extern void ( APIENTRY * qglDeleteLists )(GLuint list, GLsizei range);
|
||||
extern void ( APIENTRY * qglDeleteTextures )(GLsizei n, const GLuint *textures);
|
||||
extern void ( APIENTRY * qglDepthFunc )(GLenum func);
|
||||
extern void ( APIENTRY * qglDepthMask )(GLboolean flag);
|
||||
extern void ( APIENTRY * qglDepthRange )(GLclampd zNear, GLclampd zFar);
|
||||
extern void ( APIENTRY * qglDisable )(GLenum cap);
|
||||
extern void ( APIENTRY * qglDisableClientState )(GLenum array);
|
||||
extern void ( APIENTRY * qglDrawArrays )(GLenum mode, GLint first, GLsizei count);
|
||||
extern void ( APIENTRY * qglDrawBuffer )(GLenum mode);
|
||||
extern void ( APIENTRY * qglDrawElements )(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
extern void ( APIENTRY * qglDrawPixels )(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void ( APIENTRY * qglEdgeFlag )(GLboolean flag);
|
||||
extern void ( APIENTRY * qglEdgeFlagPointer )(GLsizei stride, const GLvoid *pointer);
|
||||
extern void ( APIENTRY * qglEdgeFlagv )(const GLboolean *flag);
|
||||
extern void ( APIENTRY * qglEnable )(GLenum cap);
|
||||
extern void ( APIENTRY * qglEnableClientState )(GLenum array);
|
||||
extern void ( APIENTRY * qglEnd )(void);
|
||||
extern void ( APIENTRY * qglEndList )(void);
|
||||
extern void ( APIENTRY * qglEvalCoord1d )(GLdouble u);
|
||||
extern void ( APIENTRY * qglEvalCoord1dv )(const GLdouble *u);
|
||||
extern void ( APIENTRY * qglEvalCoord1f )(GLfloat u);
|
||||
extern void ( APIENTRY * qglEvalCoord1fv )(const GLfloat *u);
|
||||
extern void ( APIENTRY * qglEvalCoord2d )(GLdouble u, GLdouble v);
|
||||
extern void ( APIENTRY * qglEvalCoord2dv )(const GLdouble *u);
|
||||
extern void ( APIENTRY * qglEvalCoord2f )(GLfloat u, GLfloat v);
|
||||
extern void ( APIENTRY * qglEvalCoord2fv )(const GLfloat *u);
|
||||
extern void ( APIENTRY * qglEvalMesh1 )(GLenum mode, GLint i1, GLint i2);
|
||||
extern void ( APIENTRY * qglEvalMesh2 )(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
|
||||
extern void ( APIENTRY * qglEvalPoint1 )(GLint i);
|
||||
extern void ( APIENTRY * qglEvalPoint2 )(GLint i, GLint j);
|
||||
extern void ( APIENTRY * qglFeedbackBuffer )(GLsizei size, GLenum type, GLfloat *buffer);
|
||||
extern void ( APIENTRY * qglFinish )(void);
|
||||
extern void ( APIENTRY * qglFlush )(void);
|
||||
extern void ( APIENTRY * qglFogf )(GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglFogfv )(GLenum pname, const GLfloat *params);
|
||||
extern void ( APIENTRY * qglFogi )(GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglFogiv )(GLenum pname, const GLint *params);
|
||||
extern void ( APIENTRY * qglFrontFace )(GLenum mode);
|
||||
extern void ( APIENTRY * qglFrustum )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
|
||||
extern GLuint ( APIENTRY * qglGenLists )(GLsizei range);
|
||||
extern void ( APIENTRY * qglGenTextures )(GLsizei n, GLuint *textures);
|
||||
extern void ( APIENTRY * qglGetBooleanv )(GLenum pname, GLboolean *params);
|
||||
extern void ( APIENTRY * qglGetClipPlane )(GLenum plane, GLdouble *equation);
|
||||
extern void ( APIENTRY * qglGetDoublev )(GLenum pname, GLdouble *params);
|
||||
extern GLenum ( APIENTRY * qglGetError )(void);
|
||||
extern void ( APIENTRY * qglGetFloatv )(GLenum pname, GLfloat *params);
|
||||
extern void ( APIENTRY * qglGetIntegerv )(GLenum pname, GLint *params);
|
||||
extern void ( APIENTRY * qglGetLightfv )(GLenum light, GLenum pname, GLfloat *params);
|
||||
extern void ( APIENTRY * qglGetLightiv )(GLenum light, GLenum pname, GLint *params);
|
||||
extern void ( APIENTRY * qglGetMapdv )(GLenum target, GLenum query, GLdouble *v);
|
||||
extern void ( APIENTRY * qglGetMapfv )(GLenum target, GLenum query, GLfloat *v);
|
||||
extern void ( APIENTRY * qglGetMapiv )(GLenum target, GLenum query, GLint *v);
|
||||
extern void ( APIENTRY * qglGetMaterialfv )(GLenum face, GLenum pname, GLfloat *params);
|
||||
extern void ( APIENTRY * qglGetMaterialiv )(GLenum face, GLenum pname, GLint *params);
|
||||
extern void ( APIENTRY * qglGetPixelMapfv )(GLenum map, GLfloat *values);
|
||||
extern void ( APIENTRY * qglGetPixelMapuiv )(GLenum map, GLuint *values);
|
||||
extern void ( APIENTRY * qglGetPixelMapusv )(GLenum map, GLushort *values);
|
||||
extern void ( APIENTRY * qglGetPointerv )(GLenum pname, GLvoid* *params);
|
||||
extern void ( APIENTRY * qglGetPolygonStipple )(GLubyte *mask);
|
||||
extern const GLubyte * ( APIENTRY * qglGetString )(GLenum name);
|
||||
extern void ( APIENTRY * qglGetTexEnvfv )(GLenum target, GLenum pname, GLfloat *params);
|
||||
extern void ( APIENTRY * qglGetTexEnviv )(GLenum target, GLenum pname, GLint *params);
|
||||
extern void ( APIENTRY * qglGetTexGendv )(GLenum coord, GLenum pname, GLdouble *params);
|
||||
extern void ( APIENTRY * qglGetTexGenfv )(GLenum coord, GLenum pname, GLfloat *params);
|
||||
extern void ( APIENTRY * qglGetTexGeniv )(GLenum coord, GLenum pname, GLint *params);
|
||||
extern void ( APIENTRY * qglGetTexImage )(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
|
||||
extern void ( APIENTRY * qglGetTexLevelParameterfv )(GLenum target, GLint level, GLenum pname, GLfloat *params);
|
||||
extern void ( APIENTRY * qglGetTexLevelParameteriv )(GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
extern void ( APIENTRY * qglGetTexParameterfv )(GLenum target, GLenum pname, GLfloat *params);
|
||||
extern void ( APIENTRY * qglGetTexParameteriv )(GLenum target, GLenum pname, GLint *params);
|
||||
extern void ( APIENTRY * qglHint )(GLenum target, GLenum mode);
|
||||
extern void ( APIENTRY * qglIndexMask )(GLuint mask);
|
||||
extern void ( APIENTRY * qglIndexPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
extern void ( APIENTRY * qglIndexd )(GLdouble c);
|
||||
extern void ( APIENTRY * qglIndexdv )(const GLdouble *c);
|
||||
extern void ( APIENTRY * qglIndexf )(GLfloat c);
|
||||
extern void ( APIENTRY * qglIndexfv )(const GLfloat *c);
|
||||
extern void ( APIENTRY * qglIndexi )(GLint c);
|
||||
extern void ( APIENTRY * qglIndexiv )(const GLint *c);
|
||||
extern void ( APIENTRY * qglIndexs )(GLshort c);
|
||||
extern void ( APIENTRY * qglIndexsv )(const GLshort *c);
|
||||
extern void ( APIENTRY * qglIndexub )(GLubyte c);
|
||||
extern void ( APIENTRY * qglIndexubv )(const GLubyte *c);
|
||||
extern void ( APIENTRY * qglInitNames )(void);
|
||||
extern void ( APIENTRY * qglInterleavedArrays )(GLenum format, GLsizei stride, const GLvoid *pointer);
|
||||
extern GLboolean ( APIENTRY * qglIsEnabled )(GLenum cap);
|
||||
extern GLboolean ( APIENTRY * qglIsList )(GLuint list);
|
||||
extern GLboolean ( APIENTRY * qglIsTexture )(GLuint texture);
|
||||
extern void ( APIENTRY * qglLightModelf )(GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglLightModelfv )(GLenum pname, const GLfloat *params);
|
||||
extern void ( APIENTRY * qglLightModeli )(GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglLightModeliv )(GLenum pname, const GLint *params);
|
||||
extern void ( APIENTRY * qglLightf )(GLenum light, GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglLightfv )(GLenum light, GLenum pname, const GLfloat *params);
|
||||
extern void ( APIENTRY * qglLighti )(GLenum light, GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglLightiv )(GLenum light, GLenum pname, const GLint *params);
|
||||
extern void ( APIENTRY * qglLineStipple )(GLint factor, GLushort pattern);
|
||||
extern void ( APIENTRY * qglLineWidth )(GLfloat width);
|
||||
extern void ( APIENTRY * qglListBase )(GLuint base);
|
||||
extern void ( APIENTRY * qglLoadIdentity )(void);
|
||||
extern void ( APIENTRY * qglLoadMatrixd )(const GLdouble *m);
|
||||
extern void ( APIENTRY * qglLoadMatrixf )(const GLfloat *m);
|
||||
extern void ( APIENTRY * qglLoadName )(GLuint name);
|
||||
extern void ( APIENTRY * qglLogicOp )(GLenum opcode);
|
||||
extern void ( APIENTRY * qglMap1d )(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
|
||||
extern void ( APIENTRY * qglMap1f )(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
|
||||
extern void ( APIENTRY * qglMap2d )(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
|
||||
extern void ( APIENTRY * qglMap2f )(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
|
||||
extern void ( APIENTRY * qglMapGrid1d )(GLint un, GLdouble u1, GLdouble u2);
|
||||
extern void ( APIENTRY * qglMapGrid1f )(GLint un, GLfloat u1, GLfloat u2);
|
||||
extern void ( APIENTRY * qglMapGrid2d )(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
|
||||
extern void ( APIENTRY * qglMapGrid2f )(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
|
||||
extern void ( APIENTRY * qglMaterialf )(GLenum face, GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglMaterialfv )(GLenum face, GLenum pname, const GLfloat *params);
|
||||
extern void ( APIENTRY * qglMateriali )(GLenum face, GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglMaterialiv )(GLenum face, GLenum pname, const GLint *params);
|
||||
extern void ( APIENTRY * qglMatrixMode )(GLenum mode);
|
||||
extern void ( APIENTRY * qglMultMatrixd )(const GLdouble *m);
|
||||
extern void ( APIENTRY * qglMultMatrixf )(const GLfloat *m);
|
||||
extern void ( APIENTRY * qglNewList )(GLuint list, GLenum mode);
|
||||
extern void ( APIENTRY * qglNormal3b )(GLbyte nx, GLbyte ny, GLbyte nz);
|
||||
extern void ( APIENTRY * qglNormal3bv )(const GLbyte *v);
|
||||
extern void ( APIENTRY * qglNormal3d )(GLdouble nx, GLdouble ny, GLdouble nz);
|
||||
extern void ( APIENTRY * qglNormal3dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglNormal3f )(GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
extern void ( APIENTRY * qglNormal3fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglNormal3i )(GLint nx, GLint ny, GLint nz);
|
||||
extern void ( APIENTRY * qglNormal3iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglNormal3s )(GLshort nx, GLshort ny, GLshort nz);
|
||||
extern void ( APIENTRY * qglNormal3sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglNormalPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
extern void ( APIENTRY * qglOrtho )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
|
||||
extern void ( APIENTRY * qglPassThrough )(GLfloat token);
|
||||
extern void ( APIENTRY * qglPixelMapfv )(GLenum map, GLsizei mapsize, const GLfloat *values);
|
||||
extern void ( APIENTRY * qglPixelMapuiv )(GLenum map, GLsizei mapsize, const GLuint *values);
|
||||
extern void ( APIENTRY * qglPixelMapusv )(GLenum map, GLsizei mapsize, const GLushort *values);
|
||||
extern void ( APIENTRY * qglPixelStoref )(GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglPixelStorei )(GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglPixelTransferf )(GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglPixelTransferi )(GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglPixelZoom )(GLfloat xfactor, GLfloat yfactor);
|
||||
extern void ( APIENTRY * qglPointSize )(GLfloat size);
|
||||
extern void ( APIENTRY * qglPolygonMode )(GLenum face, GLenum mode);
|
||||
extern void ( APIENTRY * qglPolygonOffset )(GLfloat factor, GLfloat units);
|
||||
extern void ( APIENTRY * qglPolygonStipple )(const GLubyte *mask);
|
||||
extern void ( APIENTRY * qglPopAttrib )(void);
|
||||
extern void ( APIENTRY * qglPopClientAttrib )(void);
|
||||
extern void ( APIENTRY * qglPopMatrix )(void);
|
||||
extern void ( APIENTRY * qglPopName )(void);
|
||||
extern void ( APIENTRY * qglPrioritizeTextures )(GLsizei n, const GLuint *textures, const GLclampf *priorities);
|
||||
extern void ( APIENTRY * qglPushAttrib )(GLbitfield mask);
|
||||
extern void ( APIENTRY * qglPushClientAttrib )(GLbitfield mask);
|
||||
extern void ( APIENTRY * qglPushMatrix )(void);
|
||||
extern void ( APIENTRY * qglPushName )(GLuint name);
|
||||
extern void ( APIENTRY * qglRasterPos2d )(GLdouble x, GLdouble y);
|
||||
extern void ( APIENTRY * qglRasterPos2dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglRasterPos2f )(GLfloat x, GLfloat y);
|
||||
extern void ( APIENTRY * qglRasterPos2fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglRasterPos2i )(GLint x, GLint y);
|
||||
extern void ( APIENTRY * qglRasterPos2iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglRasterPos2s )(GLshort x, GLshort y);
|
||||
extern void ( APIENTRY * qglRasterPos2sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglRasterPos3d )(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void ( APIENTRY * qglRasterPos3dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglRasterPos3f )(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void ( APIENTRY * qglRasterPos3fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglRasterPos3i )(GLint x, GLint y, GLint z);
|
||||
extern void ( APIENTRY * qglRasterPos3iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglRasterPos3s )(GLshort x, GLshort y, GLshort z);
|
||||
extern void ( APIENTRY * qglRasterPos3sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglRasterPos4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern void ( APIENTRY * qglRasterPos4dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglRasterPos4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern void ( APIENTRY * qglRasterPos4fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglRasterPos4i )(GLint x, GLint y, GLint z, GLint w);
|
||||
extern void ( APIENTRY * qglRasterPos4iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglRasterPos4s )(GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
extern void ( APIENTRY * qglRasterPos4sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglReadBuffer )(GLenum mode);
|
||||
extern void ( APIENTRY * qglReadPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
|
||||
extern void ( APIENTRY * qglRectd )(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
|
||||
extern void ( APIENTRY * qglRectdv )(const GLdouble *v1, const GLdouble *v2);
|
||||
extern void ( APIENTRY * qglRectf )(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
|
||||
extern void ( APIENTRY * qglRectfv )(const GLfloat *v1, const GLfloat *v2);
|
||||
extern void ( APIENTRY * qglRecti )(GLint x1, GLint y1, GLint x2, GLint y2);
|
||||
extern void ( APIENTRY * qglRectiv )(const GLint *v1, const GLint *v2);
|
||||
extern void ( APIENTRY * qglRects )(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
||||
extern void ( APIENTRY * qglRectsv )(const GLshort *v1, const GLshort *v2);
|
||||
extern GLint ( APIENTRY * qglRenderMode )(GLenum mode);
|
||||
extern void ( APIENTRY * qglRotated )(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void ( APIENTRY * qglRotatef )(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void ( APIENTRY * qglScaled )(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void ( APIENTRY * qglScalef )(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void ( APIENTRY * qglScissor )(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
extern void ( APIENTRY * qglSelectBuffer )(GLsizei size, GLuint *buffer);
|
||||
extern void ( APIENTRY * qglShadeModel )(GLenum mode);
|
||||
extern void ( APIENTRY * qglStencilFunc )(GLenum func, GLint ref, GLuint mask);
|
||||
extern void ( APIENTRY * qglStencilMask )(GLuint mask);
|
||||
extern void ( APIENTRY * qglStencilOp )(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
extern void ( APIENTRY * qglTexCoord1d )(GLdouble s);
|
||||
extern void ( APIENTRY * qglTexCoord1dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglTexCoord1f )(GLfloat s);
|
||||
extern void ( APIENTRY * qglTexCoord1fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglTexCoord1i )(GLint s);
|
||||
extern void ( APIENTRY * qglTexCoord1iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglTexCoord1s )(GLshort s);
|
||||
extern void ( APIENTRY * qglTexCoord1sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglTexCoord2d )(GLdouble s, GLdouble t);
|
||||
extern void ( APIENTRY * qglTexCoord2dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglTexCoord2f )(GLfloat s, GLfloat t);
|
||||
extern void ( APIENTRY * qglTexCoord2fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglTexCoord2i )(GLint s, GLint t);
|
||||
extern void ( APIENTRY * qglTexCoord2iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglTexCoord2s )(GLshort s, GLshort t);
|
||||
extern void ( APIENTRY * qglTexCoord2sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglTexCoord3d )(GLdouble s, GLdouble t, GLdouble r);
|
||||
extern void ( APIENTRY * qglTexCoord3dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglTexCoord3f )(GLfloat s, GLfloat t, GLfloat r);
|
||||
extern void ( APIENTRY * qglTexCoord3fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglTexCoord3i )(GLint s, GLint t, GLint r);
|
||||
extern void ( APIENTRY * qglTexCoord3iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglTexCoord3s )(GLshort s, GLshort t, GLshort r);
|
||||
extern void ( APIENTRY * qglTexCoord3sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglTexCoord4d )(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
|
||||
extern void ( APIENTRY * qglTexCoord4dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglTexCoord4f )(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
extern void ( APIENTRY * qglTexCoord4fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglTexCoord4i )(GLint s, GLint t, GLint r, GLint q);
|
||||
extern void ( APIENTRY * qglTexCoord4iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglTexCoord4s )(GLshort s, GLshort t, GLshort r, GLshort q);
|
||||
extern void ( APIENTRY * qglTexCoord4sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglTexCoordPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
extern void ( APIENTRY * qglTexEnvf )(GLenum target, GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglTexEnvfv )(GLenum target, GLenum pname, const GLfloat *params);
|
||||
extern void ( APIENTRY * qglTexEnvi )(GLenum target, GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglTexEnviv )(GLenum target, GLenum pname, const GLint *params);
|
||||
extern void ( APIENTRY * qglTexGend )(GLenum coord, GLenum pname, GLdouble param);
|
||||
extern void ( APIENTRY * qglTexGendv )(GLenum coord, GLenum pname, const GLdouble *params);
|
||||
extern void ( APIENTRY * qglTexGenf )(GLenum coord, GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglTexGenfv )(GLenum coord, GLenum pname, const GLfloat *params);
|
||||
extern void ( APIENTRY * qglTexGeni )(GLenum coord, GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglTexGeniv )(GLenum coord, GLenum pname, const GLint *params);
|
||||
extern void ( APIENTRY * qglTexImage1D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void ( APIENTRY * qglTexImage2D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void ( APIENTRY * qglTexParameterf )(GLenum target, GLenum pname, GLfloat param);
|
||||
extern void ( APIENTRY * qglTexParameterfv )(GLenum target, GLenum pname, const GLfloat *params);
|
||||
extern void ( APIENTRY * qglTexParameteri )(GLenum target, GLenum pname, GLint param);
|
||||
extern void ( APIENTRY * qglTexParameteriv )(GLenum target, GLenum pname, const GLint *params);
|
||||
extern void ( APIENTRY * qglTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void ( APIENTRY * qglTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void ( APIENTRY * qglTranslated )(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void ( APIENTRY * qglTranslatef )(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void ( APIENTRY * qglVertex2d )(GLdouble x, GLdouble y);
|
||||
extern void ( APIENTRY * qglVertex2dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglVertex2f )(GLfloat x, GLfloat y);
|
||||
extern void ( APIENTRY * qglVertex2fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglVertex2i )(GLint x, GLint y);
|
||||
extern void ( APIENTRY * qglVertex2iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglVertex2s )(GLshort x, GLshort y);
|
||||
extern void ( APIENTRY * qglVertex2sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglVertex3d )(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void ( APIENTRY * qglVertex3dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglVertex3f )(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void ( APIENTRY * qglVertex3fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglVertex3i )(GLint x, GLint y, GLint z);
|
||||
extern void ( APIENTRY * qglVertex3iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglVertex3s )(GLshort x, GLshort y, GLshort z);
|
||||
extern void ( APIENTRY * qglVertex3sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglVertex4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern void ( APIENTRY * qglVertex4dv )(const GLdouble *v);
|
||||
extern void ( APIENTRY * qglVertex4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern void ( APIENTRY * qglVertex4fv )(const GLfloat *v);
|
||||
extern void ( APIENTRY * qglVertex4i )(GLint x, GLint y, GLint z, GLint w);
|
||||
extern void ( APIENTRY * qglVertex4iv )(const GLint *v);
|
||||
extern void ( APIENTRY * qglVertex4s )(GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
extern void ( APIENTRY * qglVertex4sv )(const GLshort *v);
|
||||
extern void ( APIENTRY * qglVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
extern void ( APIENTRY * qglViewport )(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
extern void ( APIENTRY * qglPointParameterfEXT)( GLenum param, GLfloat value );
|
||||
extern void ( APIENTRY * qglPointParameterfvEXT)( GLenum param, const GLfloat *value );
|
||||
extern void ( APIENTRY * qglColorTableEXT)( int, int, int, int, int, const void * );
|
||||
|
||||
extern void ( APIENTRY * qglMTexCoord2fSGIS)( GLenum, GLfloat, GLfloat );
|
||||
extern void ( APIENTRY * qglSelectTextureSGIS)( GLenum );
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
extern int ( WINAPI * qwglChoosePixelFormat )(HDC, CONST PIXELFORMATDESCRIPTOR *);
|
||||
extern int ( WINAPI * qwglDescribePixelFormat) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
|
||||
extern int ( WINAPI * qwglGetPixelFormat)(HDC);
|
||||
extern BOOL ( WINAPI * qwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
|
||||
extern BOOL ( WINAPI * qwglSwapBuffers)(HDC);
|
||||
|
||||
extern BOOL ( WINAPI * qwglCopyContext)(HGLRC, HGLRC, UINT);
|
||||
extern HGLRC ( WINAPI * qwglCreateContext)(HDC);
|
||||
extern HGLRC ( WINAPI * qwglCreateLayerContext)(HDC, int);
|
||||
extern BOOL ( WINAPI * qwglDeleteContext)(HGLRC);
|
||||
extern HGLRC ( WINAPI * qwglGetCurrentContext)(VOID);
|
||||
extern HDC ( WINAPI * qwglGetCurrentDC)(VOID);
|
||||
extern PROC ( WINAPI * qwglGetProcAddress)(LPCSTR);
|
||||
extern BOOL ( WINAPI * qwglMakeCurrent)(HDC, HGLRC);
|
||||
extern BOOL ( WINAPI * qwglShareLists)(HGLRC, HGLRC);
|
||||
extern BOOL ( WINAPI * qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD);
|
||||
|
||||
extern BOOL ( WINAPI * qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT,
|
||||
FLOAT, int, LPGLYPHMETRICSFLOAT);
|
||||
|
||||
extern BOOL ( WINAPI * qwglDescribeLayerPlane)(HDC, int, int, UINT,
|
||||
LPLAYERPLANEDESCRIPTOR);
|
||||
extern int ( WINAPI * qwglSetLayerPaletteEntries)(HDC, int, int, int,
|
||||
CONST COLORREF *);
|
||||
extern int ( WINAPI * qwglGetLayerPaletteEntries)(HDC, int, int, int,
|
||||
COLORREF *);
|
||||
extern BOOL ( WINAPI * qwglRealizeLayerPalette)(HDC, int, BOOL);
|
||||
extern BOOL ( WINAPI * qwglSwapLayerBuffers)(HDC, UINT);
|
||||
|
||||
extern BOOL ( WINAPI * qwglSwapIntervalEXT)( int interval );
|
||||
|
||||
extern BOOL ( WINAPI * qwglGetDeviceGammaRampEXT ) ( unsigned char *pRed, unsigned char *pGreen, unsigned char *pBlue );
|
||||
extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed, const unsigned char *pGreen, const unsigned char *pBlue );
|
||||
|
||||
#endif
|
||||
|
||||
// glu stuff.. radiant only uses a couple
|
||||
extern int (APIENTRY* qgluBuild2DMipmaps) (GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, const void *data);
|
||||
extern void (APIENTRY* qgluPerspective) (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
|
||||
extern void (APIENTRY* qgluLookAt)(
|
||||
GLdouble eyex,
|
||||
GLdouble eyey,
|
||||
GLdouble eyez,
|
||||
GLdouble centerx,
|
||||
GLdouble centery,
|
||||
GLdouble centerz,
|
||||
GLdouble upx,
|
||||
GLdouble upy,
|
||||
GLdouble upz);
|
||||
|
||||
|
||||
// end of glu stuff
|
||||
|
||||
|
||||
/*
|
||||
** extension constants
|
||||
*/
|
||||
#define GL_POINT_SIZE_MIN_EXT 0x8126
|
||||
#define GL_POINT_SIZE_MAX_EXT 0x8127
|
||||
#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
|
||||
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
|
||||
|
||||
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
|
||||
|
||||
#define GL_TEXTURE0_SGIS 0x835E
|
||||
#define GL_TEXTURE1_SGIS 0x835F
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue