]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/selectedface.cpp
Updating Windows compile guide after the major overhaul of Windows
[xonotic/netradiant.git] / radiant / selectedface.cpp
index 3954a0352cfce4dcfb1c743a1a35560e3b968ef0..69025b5d5deba14a6fabe08f7ef25eedbfd8d75f 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-//-----------------------------------------------------------------------------\r
-//\r
-// DESCRIPTION:\r
-// Quick interface hack for selected face interface\r
-// this one really needs more work, but I'm in a hurry with TexTool\r
-\r
-#include "stdafx.h"\r
-\r
-int WINAPI QERApp_GetSelectedFaceCount()\r
-{\r
-  return g_ptrSelectedFaces.GetSize();\r
-}\r
-\r
-face_t* WINAPI QERApp_GetSelectedFace(int iface)\r
-{\r
-  if (iface>=g_ptrSelectedFaces.GetSize())\r
-  {\r
-    Sys_FPrintf (SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n");\r
-    return NULL;\r
-  }\r
-  return reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));\r
-}\r
-\r
-brush_t* WINAPI QERApp_GetSelectedFaceBrush(int iface)\r
-{\r
-  if (iface>=g_ptrSelectedFaceBrushes.GetSize())\r
-  {\r
-    Sys_FPrintf (SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n");\r
-    return NULL;\r
-  }\r
-  return reinterpret_cast<brush_t*>(g_ptrSelectedFaceBrushes.GetAt(iface));\r
-}\r
-\r
-// NOTE: we expect pWinding to have MAX_POINTS_ON_WINDING points ready for writing\r
-int WINAPI QERApp_GetFaceInfo(int iface, _QERFaceData *pFaceData, winding_t *pWinding)\r
-{\r
-  int size;\r
-\r
-  if (iface>=g_ptrSelectedFaces.GetSize())\r
-  {\r
-    Sys_FPrintf (SYS_ERR, "QERApp_GetFaceInfo: selected faces count exceeded\n");\r
-    return 0;\r
-  }\r
-  if (!g_qeglobals.m_bBrushPrimitMode)\r
-  {\r
-    Sys_Printf("Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n");\r
-    return 0;\r
-  }\r
-  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));\r
-  strcpy( pFaceData->m_TextureName, selFace->texdef.GetName() );\r
-  VectorCopy( selFace->planepts[0], pFaceData->m_v1 );\r
-  VectorCopy( selFace->planepts[1], pFaceData->m_v2 );\r
-  VectorCopy( selFace->planepts[2], pFaceData->m_v3 );\r
-  pFaceData->m_bBPrimit = true;\r
-  memcpy( &pFaceData->brushprimit_texdef, &selFace->brushprimit_texdef, sizeof(brushprimit_texdef_t) );\r
-  size = (int)((winding_t *)0)->points[selFace->face_winding->numpoints];\r
-  memcpy( pWinding, selFace->face_winding, size );\r
-  return 1;\r
-}\r
-\r
-int WINAPI QERApp_SetFaceInfo(int iface, _QERFaceData *pFaceData)\r
-{\r
-  if (iface>=g_ptrSelectedFaces.GetSize())\r
-  {\r
-    Sys_FPrintf (SYS_ERR, "QERApp_SetFaceInfo: selected faces count exceeded\n");\r
-    return 0;\r
-  }\r
-  if (!g_qeglobals.m_bBrushPrimitMode)\r
-  {\r
-    Sys_Printf("Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n");\r
-    return 0;\r
-  }\r
-  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));\r
-  brush_t *selBrush = reinterpret_cast<brush_t*>(g_ptrSelectedFaceBrushes.GetAt(iface));\r
-  //strcpy( selected_face->texdef.name, pFaceData->m_TextureName );\r
-  selFace->texdef.SetName(pFaceData->m_TextureName);\r
-  VectorCopy( pFaceData->m_v1, selFace->planepts[0] );\r
-  VectorCopy( pFaceData->m_v2, selFace->planepts[1] );\r
-  VectorCopy( pFaceData->m_v3, selFace->planepts[2] );\r
-  memcpy( &selFace->brushprimit_texdef, &pFaceData->brushprimit_texdef, sizeof(brushprimit_texdef_t) );\r
-  Brush_Build( selBrush );\r
-  Sys_UpdateWindows(W_ALL);\r
-  return 1;\r
-}\r
-\r
-int WINAPI QERApp_ISelectedFace_GetTextureNumber(int iface)\r
-{\r
-  if (iface>=g_ptrSelectedFaces.GetSize())\r
-  {\r
-    Sys_FPrintf (SYS_ERR, "QERApp_ISelectedFace_GetTextureNumber: selected faces count exceeded\n");\r
-    return 0;\r
-  }\r
-  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));\r
-  return selFace->d_texture->texture_number;\r
-}\r
-\r
-void WINAPI QERApp_GetTextureSize (int iface, int Size[2])\r
-{\r
-  if (iface>=g_ptrSelectedFaces.GetSize())\r
-  {\r
-    Sys_FPrintf (SYS_ERR, "QERApp_GetTextureSize: selected faces count exceeded\n");\r
-    return;\r
-  }\r
-  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));\r
-  Size[0] = selFace->d_texture->width;\r
-  Size[1] = selFace->d_texture->height;\r
-}\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant 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.
+
+GtkRadiant 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 GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+//-----------------------------------------------------------------------------
+//
+// 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"
+
+int WINAPI QERApp_GetSelectedFaceCount()
+{
+  return g_ptrSelectedFaces.GetSize();
+}
+
+face_t* WINAPI QERApp_GetSelectedFace(int iface)
+{
+  if (iface>=g_ptrSelectedFaces.GetSize())
+  {
+    Sys_FPrintf (SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n");
+    return NULL;
+  }
+  return reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));
+}
+
+brush_t* WINAPI QERApp_GetSelectedFaceBrush(int iface)
+{
+  if (iface>=g_ptrSelectedFaceBrushes.GetSize())
+  {
+    Sys_FPrintf (SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n");
+    return NULL;
+  }
+  return reinterpret_cast<brush_t*>(g_ptrSelectedFaceBrushes.GetAt(iface));
+}
+
+// NOTE: we expect pWinding to have MAX_POINTS_ON_WINDING points ready for writing
+int WINAPI QERApp_GetFaceInfo(int iface, _QERFaceData *pFaceData, winding_t *pWinding)
+{
+  size_t size;
+
+  if (iface>=g_ptrSelectedFaces.GetSize())
+  {
+    Sys_FPrintf (SYS_ERR, "QERApp_GetFaceInfo: selected faces count exceeded\n");
+    return 0;
+  }
+  if (!g_qeglobals.m_bBrushPrimitMode)
+  {
+    Sys_Printf("Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n");
+    return 0;
+  }
+  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));
+  strcpy( pFaceData->m_TextureName, selFace->texdef.GetName() );
+  VectorCopy( selFace->planepts[0], pFaceData->m_v1 );
+  VectorCopy( selFace->planepts[1], pFaceData->m_v2 );
+  VectorCopy( selFace->planepts[2], pFaceData->m_v3 );
+  pFaceData->m_bBPrimit = true;
+  memcpy( &pFaceData->brushprimit_texdef, &selFace->brushprimit_texdef, sizeof(brushprimit_texdef_t) );
+  size = (size_t)((winding_t *)0)->points[selFace->face_winding->numpoints];
+  memcpy( pWinding, selFace->face_winding, size );
+  return 1;
+}
+
+int WINAPI QERApp_SetFaceInfo(int iface, _QERFaceData *pFaceData)
+{
+  if (iface>=g_ptrSelectedFaces.GetSize())
+  {
+    Sys_FPrintf (SYS_ERR, "QERApp_SetFaceInfo: selected faces count exceeded\n");
+    return 0;
+  }
+  if (!g_qeglobals.m_bBrushPrimitMode)
+  {
+    Sys_Printf("Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n");
+    return 0;
+  }
+  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));
+  brush_t *selBrush = reinterpret_cast<brush_t*>(g_ptrSelectedFaceBrushes.GetAt(iface));
+  //strcpy( selected_face->texdef.name, pFaceData->m_TextureName );
+  selFace->texdef.SetName(pFaceData->m_TextureName);
+  VectorCopy( pFaceData->m_v1, selFace->planepts[0] );
+  VectorCopy( pFaceData->m_v2, selFace->planepts[1] );
+  VectorCopy( pFaceData->m_v3, selFace->planepts[2] );
+  memcpy( &selFace->brushprimit_texdef, &pFaceData->brushprimit_texdef, sizeof(brushprimit_texdef_t) );
+  Brush_Build( selBrush );
+  Sys_UpdateWindows(W_ALL);
+  return 1;
+}
+
+int WINAPI QERApp_ISelectedFace_GetTextureNumber(int iface)
+{
+  if (iface>=g_ptrSelectedFaces.GetSize())
+  {
+    Sys_FPrintf (SYS_ERR, "QERApp_ISelectedFace_GetTextureNumber: selected faces count exceeded\n");
+    return 0;
+  }
+  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));
+  return selFace->d_texture->texture_number;
+}
+
+void WINAPI QERApp_GetTextureSize (int iface, int Size[2])
+{
+  if (iface>=g_ptrSelectedFaces.GetSize())
+  {
+    Sys_FPrintf (SYS_ERR, "QERApp_GetTextureSize: selected faces count exceeded\n");
+    return;
+  }
+  face_t *selFace = reinterpret_cast<face_t*>(g_ptrSelectedFaces.GetAt(iface));
+  Size[0] = selFace->d_texture->width;
+  Size[1] = selFace->d_texture->height;
+}