mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
* UFO: Alien Invasion surface plugin
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@201 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
f33fed31ce
commit
08391b4c93
8 changed files with 2764 additions and 0 deletions
8
plugins/surface_ufoai/surface_ufoai.def
Normal file
8
plugins/surface_ufoai/surface_ufoai.def
Normal file
|
@ -0,0 +1,8 @@
|
|||
; surface_ufoai.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "SURFACE_UFOAI"
|
||||
DESCRIPTION 'SURFACE_UFOAI Windows Dynamic Link Library'
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
Synapse_EnumerateInterfaces @1
|
75
plugins/surface_ufoai/surface_ufoai.vcproj
Normal file
75
plugins/surface_ufoai/surface_ufoai.vcproj
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" ?><VisualStudioProject Name="surface_ufoai" ProjectGUID="{65D02375-63EE-4A8A-9F8E-504B1D5A1D02}" ProjectType="Visual C++" RootNamespace="surface_ufoai" Version="8.00">
|
||||
<Platforms>
|
||||
<Platform Name="Win32"/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration CharacterSet="2" ConfigurationType="1" IntermediateDirectory="$(ConfigurationName)" Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" BasicRuntimeChecks="3" DebugInformationFormat="4" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" MinimalRebuild="true" Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="3" WarningLevel="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool GenerateDebugInformation="true" Name="VCLinkerTool" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
<Configuration CharacterSet="2" ConfigurationType="1" IntermediateDirectory="$(ConfigurationName)" Name="Release|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" WholeProgramOptimization="1">
|
||||
<Tool Name="VCPreBuildEventTool"/>
|
||||
<Tool Name="VCCustomBuildTool"/>
|
||||
<Tool Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool Name="VCMIDLTool"/>
|
||||
<Tool AdditionalIncludeDirectories=""$(SolutionDir)\include";"$(SolutionDir)\libs";"$(SolutionDir)\..\STLPort\stlport";"$(SolutionDir)\..\gtk2\include";"$(SolutionDir)\..\gtk2\include\glib-2.0";"$(SolutionDir)\..\gtk2\lib\glib-2.0\include";"$(SolutionDir)\..\libxml2\include"" DebugInformationFormat="3" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" WarningLevel="3"/>
|
||||
<Tool Name="VCManagedResourceCompilerTool"/>
|
||||
<Tool Name="VCResourceCompilerTool"/>
|
||||
<Tool Name="VCPreLinkEventTool"/>
|
||||
<Tool EnableCOMDATFolding="2" GenerateDebugInformation="true" Name="VCLinkerTool" OptimizeReferences="2" TargetMachine="1"/>
|
||||
<Tool Name="VCALinkTool"/>
|
||||
<Tool Name="VCManifestTool"/>
|
||||
<Tool Name="VCXDCMakeTool"/>
|
||||
<Tool Name="VCBscMakeTool"/>
|
||||
<Tool Name="VCFxCopTool"/>
|
||||
<Tool Name="VCAppVerifierTool"/>
|
||||
<Tool Name="VCWebDeploymentTool"/>
|
||||
<Tool Name="VCPostBuildEventTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" Name="Source Files">
|
||||
<File RelativePath=".\surface_ufoai.def">
|
||||
</File>
|
||||
<File RelativePath=".\surfacedialog.cpp">
|
||||
</File>
|
||||
<File RelativePath=".\surfaceflagsdialog_ufoai.cpp">
|
||||
</File>
|
||||
<File RelativePath=".\surfdlg_plugin.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter Filter="h;hpp;hxx;hm;inl" Name="Header Files">
|
||||
<File RelativePath=".\surfacedialog.h">
|
||||
</File>
|
||||
<File RelativePath=".\surfaceflagsdialog_ufoai.h">
|
||||
</File>
|
||||
<File RelativePath=".\surfdlg_plugin.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" Name="Resource Files">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1939
plugins/surface_ufoai/surfacedialog.cpp
Normal file
1939
plugins/surface_ufoai/surfacedialog.cpp
Normal file
File diff suppressed because it is too large
Load diff
31
plugins/surface_ufoai/surfacedialog.h
Normal file
31
plugins/surface_ufoai/surfacedialog.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef _SURFACEDIALOG_H_
|
||||
#define _SURFACEDIALOG_H_
|
||||
|
||||
void UpdateSurfaceDialog ();
|
||||
void DoSurface ();
|
||||
void ToggleSurface ();
|
||||
void SurfaceDlgFitAll ();
|
||||
GtkWidget *Get_SI_Module_Widget ();
|
||||
|
||||
#endif // _SURFACEDIALOG_H_
|
465
plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp
Normal file
465
plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp
Normal file
|
@ -0,0 +1,465 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "surfdlg_plugin.h"
|
||||
|
||||
#include "surfaceflagsdialog_ufoai.h"
|
||||
|
||||
GtkWidget *notebook1;
|
||||
|
||||
// 32 bit is the max
|
||||
#define MAX_BUTTONS 32
|
||||
|
||||
GtkWidget *surface_buttons[MAX_BUTTONS];
|
||||
GtkWidget *content_buttons[MAX_BUTTONS];
|
||||
|
||||
GtkWidget *value_entry;
|
||||
gboolean setup_buttons = TRUE;
|
||||
|
||||
int working_surface_flags;
|
||||
int surface_mask;
|
||||
int working_content_flags;
|
||||
int content_mask;
|
||||
int working_value;
|
||||
|
||||
inline void set_inconsistent(GtkWidget *toggle_button)
|
||||
{
|
||||
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON (toggle_button), TRUE);
|
||||
}
|
||||
|
||||
inline void clear_inconsistent(GtkWidget *toggle_button)
|
||||
{
|
||||
if ( gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (toggle_button)) )
|
||||
{
|
||||
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON (toggle_button), FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void clear_all_inconsistent(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_BUTTONS; i++) {
|
||||
clear_inconsistent( surface_buttons[i] );
|
||||
clear_inconsistent( content_buttons[i] );
|
||||
}
|
||||
}
|
||||
|
||||
void clear_all_buttons_and_values()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_BUTTONS; i++) {
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_buttons[i] ), FALSE);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_buttons[i] ), FALSE);
|
||||
}
|
||||
|
||||
gtk_entry_set_text( (GtkEntry *)value_entry, "");
|
||||
}
|
||||
|
||||
void SetFlagButtons_UFOAI(texdef_to_face_t *texdef_face_list, bool b_isListEmpty)
|
||||
{
|
||||
int contents = 0;
|
||||
int flags = 0;
|
||||
int value = 0;
|
||||
int diff_contents = 0;
|
||||
int diff_flags = 0;
|
||||
gboolean diff_value = FALSE;
|
||||
char tex_buff[11];
|
||||
texdef_t* tmp_texdef;
|
||||
texdef_to_face_t* temp_texdef_face_list;
|
||||
int i;
|
||||
|
||||
setup_buttons = TRUE;
|
||||
working_surface_flags = 0;
|
||||
surface_mask = 0;
|
||||
working_content_flags = 0;
|
||||
content_mask = 0;
|
||||
working_value = 0;
|
||||
|
||||
if (!b_isListEmpty) {
|
||||
tmp_texdef = &texdef_face_list->texdef;
|
||||
contents = tmp_texdef->contents;
|
||||
flags = tmp_texdef->flags;
|
||||
value = tmp_texdef->value;
|
||||
|
||||
Sys_Printf("Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value);
|
||||
Sys_Printf("Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value);
|
||||
|
||||
for (temp_texdef_face_list = texdef_face_list->next; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
|
||||
{
|
||||
tmp_texdef = &temp_texdef_face_list->texdef;
|
||||
diff_contents |= contents ^ tmp_texdef->contents; // Figure out which buttons are inconsistent
|
||||
diff_flags |= flags ^ tmp_texdef->flags;
|
||||
if (tmp_texdef->value != value)
|
||||
diff_value = TRUE;
|
||||
|
||||
Sys_Printf("Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value);
|
||||
Sys_Printf("Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value);
|
||||
}
|
||||
}
|
||||
|
||||
clear_all_inconsistent();
|
||||
|
||||
// If no faces/brushes are selected, clear everything and bail
|
||||
if (b_isListEmpty) {
|
||||
clear_all_buttons_and_values();
|
||||
setup_buttons = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_BUTTONS; i++) {
|
||||
// Set surface buttons to reflect brush/face flags, contents, and values
|
||||
if(diff_flags & (1 << i))
|
||||
set_inconsistent(surface_buttons[i]);
|
||||
else if(flags & (1 << i))
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (surface_buttons[i]), TRUE);
|
||||
else
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (surface_buttons[i]), FALSE);
|
||||
|
||||
if(diff_contents & (1 << i))
|
||||
set_inconsistent(content_buttons[i]);
|
||||
else if(contents & (1 << i))
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (content_buttons[i]), TRUE);
|
||||
else
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (content_buttons[i]), FALSE);
|
||||
}
|
||||
|
||||
// Set Value
|
||||
if (diff_value)
|
||||
gtk_entry_set_text( (GtkEntry *)value_entry, "");
|
||||
else {
|
||||
working_value = value;
|
||||
sprintf( tex_buff, "%d", value);
|
||||
gtk_entry_set_text( (GtkEntry *)value_entry, tex_buff);
|
||||
}
|
||||
|
||||
setup_buttons = FALSE;
|
||||
}
|
||||
|
||||
void SetChangeInFlags_Face_UFOAI (texdef_to_face_t *texdef_face_list)
|
||||
{
|
||||
texdef_to_face_t *temp_texdef_face_list;
|
||||
texdef_t *tmp_texdef;
|
||||
|
||||
for (temp_texdef_face_list = texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
|
||||
{
|
||||
tmp_texdef = &temp_texdef_face_list->texdef;
|
||||
tmp_texdef->flags = (tmp_texdef->flags & ~surface_mask) | working_surface_flags;
|
||||
tmp_texdef->contents = (tmp_texdef->contents & ~content_mask) | working_content_flags;
|
||||
tmp_texdef->value = working_value;
|
||||
Sys_Printf("content_flag: %d content_mask: %d\n",working_content_flags,content_mask);
|
||||
Sys_Printf("content: %d\n",tmp_texdef->contents);
|
||||
}
|
||||
}
|
||||
|
||||
inline void change_surfaceflag (GtkWidget *togglebutton, int sur_flag, gboolean change_flag_to)
|
||||
{
|
||||
if (!setup_buttons) // If we're setting up the buttons, we really don't need to
|
||||
{ // set flags that are already set
|
||||
if (gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (togglebutton))) // Clear out inconsistent, if set
|
||||
clear_inconsistent(GTK_WIDGET (togglebutton));
|
||||
|
||||
surface_mask |= sur_flag;
|
||||
|
||||
if (change_flag_to)
|
||||
working_surface_flags |= sur_flag;
|
||||
else
|
||||
working_surface_flags &= ~sur_flag;
|
||||
}
|
||||
}
|
||||
|
||||
inline void change_contentflag (GtkWidget *togglebutton, int content_flag, gboolean change_flag_to)
|
||||
{
|
||||
if ( (!setup_buttons) ) // If we're setting up the buttons, we really don't need to
|
||||
{ // set flags that are already set
|
||||
if (gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (togglebutton)))
|
||||
clear_inconsistent(togglebutton);
|
||||
//if (g_ptrSelectedFaces.GetSize() == 0) // Only changing content flags on whole brushes, not faces.
|
||||
//{
|
||||
content_mask |= content_flag;
|
||||
|
||||
if (change_flag_to)
|
||||
working_content_flags |= content_flag;
|
||||
else
|
||||
working_content_flags &= ~content_flag;
|
||||
//}
|
||||
Sys_Printf("content_flag: %d content_mask: %d\n",content_flag,content_mask);
|
||||
}
|
||||
}
|
||||
|
||||
// Surface Flags Callbacks
|
||||
void on_surface_button_toggled (GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
int flag = *(int*)user_data;
|
||||
change_surfaceflag(GTK_WIDGET (togglebutton), flag, (GTK_TOGGLE_BUTTON (togglebutton)->active));
|
||||
}
|
||||
|
||||
// Content Flags Callbacks
|
||||
void on_content_button_toggled (GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
int flag = *(int*)user_data;
|
||||
change_contentflag(GTK_WIDGET (togglebutton), flag, (GTK_TOGGLE_BUTTON (togglebutton)->active));
|
||||
}
|
||||
|
||||
// Value Entry Callback
|
||||
void on_value_entry_changed (GtkEditable *editable, gpointer user_data)
|
||||
{
|
||||
if ( (!setup_buttons) ) // If we're setting up the buttons, don't change value
|
||||
working_value = atoi( gtk_entry_get_text( (GtkEntry*)editable) );
|
||||
}
|
||||
|
||||
void on_value_entry_insert_text (GtkEditable *editable, gchar *new_text, gint new_text_length, gint *position, gpointer user_data)
|
||||
{
|
||||
int i, count=0;
|
||||
gchar *result;
|
||||
|
||||
// Limit input to digits, throwing out anything else
|
||||
// Modified from Gtk FAQ for text filtering of GtkEntry
|
||||
result = g_new (gchar, new_text_length);
|
||||
|
||||
for (i=0; i < new_text_length; i++) {
|
||||
if (!isdigit(new_text[i]))
|
||||
continue;
|
||||
result[count++] = new_text[i];
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
gtk_signal_handler_block_by_func (GTK_OBJECT (editable),
|
||||
GTK_SIGNAL_FUNC (on_value_entry_insert_text),
|
||||
user_data);
|
||||
gtk_editable_insert_text (editable, result, count, position);
|
||||
gtk_signal_handler_unblock_by_func (GTK_OBJECT (editable),
|
||||
GTK_SIGNAL_FUNC (on_value_entry_insert_text),
|
||||
user_data);
|
||||
}
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text");
|
||||
|
||||
g_free (result);
|
||||
}
|
||||
|
||||
void on_surfacebutton_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_notebook_set_page (GTK_NOTEBOOK(notebook1), 0);
|
||||
}
|
||||
|
||||
void on_contentbutton_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_notebook_set_page (GTK_NOTEBOOK(notebook1), 1);
|
||||
}
|
||||
|
||||
// FIXME: This should be in the ufoai.game
|
||||
static const char *surfaceFlags[] = {
|
||||
"light",
|
||||
"slick",
|
||||
"",
|
||||
"warp",
|
||||
"trans33",
|
||||
"trans66",
|
||||
"flow",
|
||||
"nodraw",
|
||||
"hint",
|
||||
"skip",
|
||||
"phong",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"alphatest",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
||||
static const char *contentFlags[] = {
|
||||
"solid",
|
||||
"window",
|
||||
"",
|
||||
"fireaffected",
|
||||
"",
|
||||
"water",
|
||||
"",
|
||||
"",
|
||||
"level1",
|
||||
"level2",
|
||||
"level3",
|
||||
"level4",
|
||||
"level5",
|
||||
"level6",
|
||||
"level7",
|
||||
"level8",
|
||||
"actorclip",
|
||||
"passable",
|
||||
"footstep",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"origin",
|
||||
"weaponclip",
|
||||
"",
|
||||
"detail",
|
||||
"",
|
||||
"",
|
||||
"stepon",
|
||||
""
|
||||
};
|
||||
|
||||
#define UFOAI_FLAG_BUTTON_BORDER 3
|
||||
|
||||
GtkWidget* Create_UFOAIFlagsDialog (GtkWidget* surfacedialog_widget)
|
||||
{
|
||||
GtkWidget *frame1;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *vbox3;
|
||||
GtkWidget *vbox4;
|
||||
GtkWidget *table4;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *hbox3;
|
||||
GtkWidget *hseparator1;
|
||||
GtkWidget *value_label;
|
||||
GtkWidget *label5;
|
||||
GtkWidget *table3;
|
||||
GtkWidget *label6;
|
||||
int flag = 0;
|
||||
int i, x, y;
|
||||
|
||||
frame1 = gtk_frame_new ("Flags");
|
||||
gtk_widget_show (frame1);
|
||||
gtk_container_add (GTK_CONTAINER (surfacedialog_widget), frame1);
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox1);
|
||||
gtk_container_add (GTK_CONTAINER (frame1), vbox1);
|
||||
|
||||
notebook1 = gtk_notebook_new ();
|
||||
gtk_widget_show (notebook1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);
|
||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook1), TRUE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (notebook1), 5);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox2);
|
||||
gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
|
||||
|
||||
table4 = gtk_table_new (8, 4, FALSE);
|
||||
gtk_widget_show (table4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), table4, TRUE, TRUE, 0);
|
||||
|
||||
y = -1;
|
||||
for (i = 0; i < MAX_BUTTONS; i++) {
|
||||
if (!(i % 4))
|
||||
y++;
|
||||
x = i % 4;
|
||||
flag = (1 << i);
|
||||
surface_buttons[i] = gtk_toggle_button_new_with_label (surfaceFlags[i]);
|
||||
gtk_signal_connect(GTK_OBJECT (surface_buttons[i]), "toggled", GTK_SIGNAL_FUNC(on_surface_button_toggled), &flag);
|
||||
gtk_widget_show(surface_buttons[i]);
|
||||
gtk_table_attach(GTK_TABLE (table4), surface_buttons[i], 0 + x, 1 + x, (0 + y), (1 + y),
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (surface_buttons[i]), UFOAI_FLAG_BUTTON_BORDER);
|
||||
}
|
||||
|
||||
hseparator1 = gtk_hseparator_new ();
|
||||
gtk_widget_show (hseparator1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hseparator1, FALSE, FALSE, 0);
|
||||
gtk_widget_set_usize (hseparator1, -2, 5);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
|
||||
|
||||
hbox3 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox3);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0);
|
||||
|
||||
vbox4 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox4);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), vbox4, TRUE, TRUE, 0);
|
||||
|
||||
value_label = gtk_label_new (" Value: ");
|
||||
gtk_widget_show (value_label);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), value_label, FALSE, FALSE, 0);
|
||||
|
||||
value_entry = gtk_entry_new ();
|
||||
gtk_signal_connect (GTK_OBJECT (value_entry), "changed",
|
||||
GTK_SIGNAL_FUNC (on_value_entry_changed),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (value_entry), "insert_text",
|
||||
GTK_SIGNAL_FUNC (on_value_entry_insert_text),
|
||||
NULL);
|
||||
gtk_entry_set_max_length( (GtkEntry *)value_entry, 11);
|
||||
gtk_widget_show (value_entry);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), value_entry, TRUE, TRUE, 0);
|
||||
|
||||
vbox3 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox3);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), vbox3, TRUE, TRUE, 0);
|
||||
|
||||
label5 = gtk_label_new ("Surface Flags");
|
||||
gtk_widget_show (label5);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label5);
|
||||
|
||||
table3 = gtk_table_new (8, 4, FALSE);
|
||||
gtk_widget_show (table3);
|
||||
gtk_container_add (GTK_CONTAINER (notebook1), table3);
|
||||
|
||||
y = -1;
|
||||
for (i = 0; i < MAX_BUTTONS; i++) {
|
||||
if (!(i % 4))
|
||||
y++;
|
||||
x = i % 4;
|
||||
flag = (1 << i);
|
||||
content_buttons[i] = gtk_toggle_button_new_with_label(contentFlags[i]);
|
||||
gtk_signal_connect(GTK_OBJECT (content_buttons[i]), "toggled", GTK_SIGNAL_FUNC (on_content_button_toggled), &flag);
|
||||
gtk_widget_show(content_buttons[i]);
|
||||
gtk_table_attach(GTK_TABLE (table3), content_buttons[i], 0 + x, 1 + x, (0 + y), (1 + y),
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (content_buttons[i]), UFOAI_FLAG_BUTTON_BORDER);
|
||||
}
|
||||
|
||||
label6 = gtk_label_new ("Content Flags");
|
||||
gtk_widget_show (label6);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label6);
|
||||
|
||||
return frame1;
|
||||
}
|
||||
|
25
plugins/surface_ufoai/surfaceflagsdialog_ufoai.h
Normal file
25
plugins/surface_ufoai/surfaceflagsdialog_ufoai.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef _SURFACEFLAGSDIALOG_UFOAI_H
|
||||
#define _SURFACEFLAGSDIALOG_UFOAI_H
|
||||
|
||||
#endif // _SURFACEFLAGSDIALOG_UFOAI_H
|
127
plugins/surface_ufoai/surfdlg_plugin.cpp
Normal file
127
plugins/surface_ufoai/surfdlg_plugin.cpp
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
Copyright (c) 2001, Loki software, inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
Neither the name of Loki software nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "surfdlg_plugin.h"
|
||||
#include "surfacedialog.h"
|
||||
|
||||
#include "synapse.h"
|
||||
|
||||
class CSynapseClient_SurfDLG : public CSynapseClient
|
||||
{
|
||||
public:
|
||||
// CSynapseClient API
|
||||
bool RequestAPI(APIDescriptor_t *pAPI);
|
||||
const char* GetInfo();
|
||||
const char* GetName();
|
||||
bool OnActivate();
|
||||
|
||||
CSynapseClient_SurfDLG() { }
|
||||
virtual ~CSynapseClient_SurfDLG() { }
|
||||
};
|
||||
|
||||
// =============================================================================
|
||||
// SYNAPSE
|
||||
|
||||
_QERFuncTable_1 g_FuncTable;
|
||||
_QERUndoTable g_UndoTable;
|
||||
_QERAppSurfaceTable g_AppSurfaceTable;
|
||||
_QERSelectedFaceTable g_SelectedFaceTable;
|
||||
_QERShadersTable g_ShadersTable;
|
||||
_QERAppShadersTable g_AppShadersTable;
|
||||
_QERAppDataTable g_AppDataTable;
|
||||
|
||||
CSynapseServer* g_pSynapseServer = NULL;
|
||||
CSynapseClient_SurfDLG g_SynapseClient;
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
#pragma GCC visibility push(default)
|
||||
#endif
|
||||
extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
|
||||
#if __GNUC__ >= 4
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
if (strcmp(version, SYNAPSE_VERSION))
|
||||
{
|
||||
Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
|
||||
return NULL;
|
||||
}
|
||||
g_pSynapseServer = pServer;
|
||||
g_pSynapseServer->IncRef();
|
||||
Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
|
||||
|
||||
g_SynapseClient.AddAPI(SURFACEDIALOG_MAJOR, "ufoai", sizeof(_QERPlugSurfaceTable));
|
||||
g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(_QERFuncTable_1), SYN_REQUIRE, &g_FuncTable);
|
||||
g_SynapseClient.AddAPI(UNDO_MAJOR, NULL, sizeof(_QERUndoTable), SYN_REQUIRE, &g_UndoTable);
|
||||
g_SynapseClient.AddAPI(APPSURFACEDIALOG_MAJOR, NULL, sizeof(_QERAppSurfaceTable), SYN_REQUIRE, &g_AppSurfaceTable);
|
||||
g_SynapseClient.AddAPI(SELECTEDFACE_MAJOR, NULL, sizeof(_QERSelectedFaceTable), SYN_REQUIRE, &g_SelectedFaceTable);
|
||||
g_SynapseClient.AddAPI(SHADERS_MAJOR, "ufoai", sizeof(_QERShadersTable), SYN_REQUIRE, &g_ShadersTable);
|
||||
g_SynapseClient.AddAPI(APPSHADERS_MAJOR, NULL, sizeof(_QERAppShadersTable), SYN_REQUIRE, &g_AppShadersTable);
|
||||
g_SynapseClient.AddAPI(DATA_MAJOR, NULL, sizeof(_QERAppDataTable), SYN_REQUIRE, &g_AppDataTable);
|
||||
|
||||
return &g_SynapseClient;
|
||||
}
|
||||
|
||||
bool CSynapseClient_SurfDLG::RequestAPI(APIDescriptor_t *pAPI)
|
||||
{
|
||||
if (!strcmp(pAPI->major_name, SURFACEDIALOG_MAJOR))
|
||||
{
|
||||
_QERPlugSurfaceTable* pSurfDialogTable= static_cast<_QERPlugSurfaceTable*>(pAPI->mpTable);
|
||||
if (!strcmp(pAPI->minor_name, "ufoai"))
|
||||
{
|
||||
pSurfDialogTable->m_pfnToggleSurface = &ToggleSurface;
|
||||
pSurfDialogTable->m_pfnDoSurface = &DoSurface;
|
||||
pSurfDialogTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog;
|
||||
pSurfDialogTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll;
|
||||
pSurfDialogTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "version.h"
|
||||
|
||||
const char* CSynapseClient_SurfDLG::GetInfo()
|
||||
{
|
||||
return "Surface Dialog (UFO: Alien Invasion) module built " __DATE__ " " RADIANT_VERSION;
|
||||
}
|
||||
|
||||
const char* CSynapseClient_SurfDLG::GetName()
|
||||
{
|
||||
return "surface";
|
||||
}
|
||||
|
||||
bool CSynapseClient_SurfDLG::OnActivate()
|
||||
{
|
||||
return true;
|
||||
}
|
94
plugins/surface_ufoai/surfdlg_plugin.h
Normal file
94
plugins/surface_ufoai/surfdlg_plugin.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
Copyright (c) 2001, Loki software, inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
Neither the name of Loki software nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SURFDLG_PLUGIN_H_
|
||||
#define _SURFDLG_PLUGIN_H_
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
typedef void* HMODULE;
|
||||
typedef void* LPVOID;
|
||||
typedef char* LPCSTR;
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
#include "qerplugin.h"
|
||||
#include "synapse.h"
|
||||
#include "iselectedface.h"
|
||||
#include "iundo.h"
|
||||
#include "ishaders.h"
|
||||
#include "mathlib.h"
|
||||
#include "missing.h"
|
||||
#include "idata.h"
|
||||
|
||||
#include "isurfaceplugin.h"
|
||||
|
||||
class SurfaceDialog : public IPluginTexdef
|
||||
{
|
||||
int refCount;
|
||||
public:
|
||||
// Increment the number of references to this object
|
||||
void IncRef () { refCount++; }
|
||||
// Decrement the reference count
|
||||
void DecRef () { if ( --refCount <= 0 ) delete this; }
|
||||
};
|
||||
|
||||
extern _QERFuncTable_1 g_FuncTable;
|
||||
extern _QERUndoTable g_UndoTable;
|
||||
extern _QERAppSurfaceTable g_AppSurfaceTable;
|
||||
extern _QERSelectedFaceTable g_SelectedFaceTable;
|
||||
extern _QERShadersTable g_ShadersTable;
|
||||
extern _QERAppShadersTable g_AppShadersTable;
|
||||
extern _QERAppDataTable g_AppDataTable;
|
||||
|
||||
#define GetSelectedFaceCount g_SelectedFaceTable.m_pfnGetSelectedFaceCount
|
||||
|
||||
#define Undo_Undo g_UndoTable.m_pfnUndo_Undo
|
||||
#define Undo_GetUndoId g_UndoTable.m_pfnUndo_GetUndoId
|
||||
|
||||
#define Sys_Printf g_FuncTable.m_pfnSysPrintf
|
||||
#define Sys_FPrintf g_FuncTable.m_pfnSysFPrintf
|
||||
#define Sys_UpdateWindows g_FuncTable.m_pfnSysUpdateWindows
|
||||
|
||||
|
||||
#define Select_FitTexture g_AppSurfaceTable.m_pfnSelect_FitTexture
|
||||
#define Get_SI_Inc g_AppSurfaceTable.m_pfnQERApp_QeglobalsSavedinfo_SIInc
|
||||
#define GridSize g_AppSurfaceTable.m_pfnQeglobalsGetGridSize
|
||||
#define FaceList_FitTexture g_AppSurfaceTable.m_pfnFaceList_FitTexture
|
||||
#define GetMainWindow g_AppSurfaceTable.m_pfnGetMainWindow
|
||||
#define GetSelectedFaceCountfromBrushes g_AppSurfaceTable.m_pfnGetSelectedFaceCountfromBrushes
|
||||
#define GetSelFacesTexdef g_AppSurfaceTable.m_pfnGetSelFacesTexdef
|
||||
#define SetTexdef_FaceList g_AppSurfaceTable.m_pfnSetTexdef_FaceList
|
||||
#define SetWinPos_from_Prefs g_AppSurfaceTable.m_pfnSetWinPos_From_Prefs
|
||||
|
||||
#define Texturewin g_AppShadersTable.m_pfnQeglobalsTexturewin
|
||||
|
||||
#endif // _SURFDLG_PLUGIN_H_
|
||||
|
Loading…
Reference in a new issue