2 BobToolz plugin for GtkRadiant
\r
3 Copyright (C) 2001 Gordon Biggans
\r
5 This library is free software; you can redistribute it and/or
\r
6 modify it under the terms of the GNU Lesser General Public
\r
7 License as published by the Free Software Foundation; either
\r
8 version 2.1 of the License, or (at your option) any later version.
\r
10 This library is distributed in the hope that it will be useful,
\r
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
13 Lesser General Public License for more details.
\r
15 You should have received a copy of the GNU Lesser General Public
\r
16 License along with this library; if not, write to the Free Software
\r
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
22 #include "dialogs/dialogs-gtk.h"
\r
24 #include "DEntity.h"
\r
29 #include "funchandlers.h"
\r
31 // for ctf texture changer
\r
32 list<Str> clrList_Blue;
\r
33 list<Str> clrList_Red;
\r
35 BOOL clrLst1Loaded = FALSE;
\r
36 BOOL clrLst2Loaded = FALSE;
\r
40 //========================//
\r
41 // Helper Functions //
\r
42 //========================//
\r
50 clrLst1Loaded = LoadExclusionList(GetFilename(buffer, "plugins/bt/ctf-blue.txt"), &clrList_Blue);
\r
51 LoadExclusionList(GetFilename(buffer, "plugins/bt/blue.txt"), &clrList_Blue);
\r
55 clrLst2Loaded = LoadExclusionList(GetFilename(buffer, "plugins/bt/ctf-red.txt"), &clrList_Red);
\r
56 LoadExclusionList(GetFilename(buffer, "plugins/bt/red.txt"), &clrList_Red);
\r
61 //========================//
\r
62 // Main Functions //
\r
63 //========================//
\r
65 void DoCTFColourChanger()
\r
67 if(!clrLst1Loaded || !clrLst2Loaded)
\r
69 DoMessageBox("CTF texture lists not found, this function will terminate.", "Error", MB_OK);
\r
73 int ret = DoCTFColourChangeBox();
\r
77 int cnt = Min(clrList_Blue.size(), clrList_Red.size());
\r
79 list<Str>::const_iterator Texture_change;
\r
80 list<Str>::const_iterator Texture_new;
\r
84 int eCnt = g_FuncTable.m_pfnGetEntityCount();
\r
87 world.LoadAll(TRUE);
\r
91 Texture_change = clrList_Blue.begin();
\r
92 Texture_new = clrList_Red.begin();
\r
96 Texture_change = clrList_Red.begin();
\r
97 Texture_new = clrList_Blue.begin();
\r
100 for(int i = 0; i < cnt; i++)
\r
102 world.ResetTextures((*Texture_change).c_str(), fDummy, fDummy, 0, (*Texture_new).c_str(), TRUE);
\r
109 void DoSwapLights()
\r
114 for(list<DEntity*>::const_iterator loopEnt = world.entityList.begin(); loopEnt != world.entityList.end(); loopEnt++)
\r
116 DEntity* e = (*loopEnt);
\r
117 DEPair* epLightColour = e->FindEPairByKey("_color");
\r
121 sscanf(epLightColour->value, "%f %f %f", &r, &g, &b);
\r
122 sprintf(epLightColour->value, "%f %f %f", b, g, r);
\r
123 DMap::RebuildEntity(e);
\r
127 int cnt = g_FuncTable.m_pfnGetEntityCount();
\r
129 for(int i = 0; i < cnt; i++)
\r
131 void* ent = g_FuncTable.m_pfnGetEntityHandle(i);
\r
133 for(epair_t* epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList= epList->next)
\r
135 if(!stricmp("_color", epList->key))
\r
138 sscanf(epList->value, "%f %f %f", &r, &g, &b);
\r
139 sprintf(epList->value, "%f %f %f", b, g, r);
\r
145 void DoChangeAngles()
\r
147 int cnt = g_FuncTable.m_pfnGetEntityCount();
\r
149 for(int i = 0; i < cnt; i++)
\r
151 void* ent = g_FuncTable.m_pfnGetEntityHandle(i);
\r
153 for(epair_t* epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList= epList->next)
\r
155 if(!stricmp("angle", epList->key))
\r
158 sscanf(epList->value, "%f", &angle);
\r
163 sprintf(epList->value, "%f", angle);
\r
169 void DoSwapSpawns()
\r
171 int cnt = g_FuncTable.m_pfnGetEntityCount();
\r
173 for(int i = 0; i < cnt; i++)
\r
175 void* ent = g_FuncTable.m_pfnGetEntityHandle(i);
\r
177 for(epair_t* epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList= epList->next)
\r
179 if(!stricmp("classname", epList->key))
\r
181 if(!strcmp(epList->value, "team_CTF_redplayer"))
\r
182 sprintf(epList->value, "team_CTF_blueplayer");
\r
183 else if(!strcmp(epList->value, "team_CTF_blueplayer"))
\r
184 sprintf(epList->value, "team_CTF_redplayer");
\r
186 if(!strcmp(epList->value, "team_CTF_redspawn"))
\r
187 sprintf(epList->value, "team_CTF_bluespawn");
\r
188 else if(!strcmp(epList->value, "team_CTF_bluespawn"))
\r
189 sprintf(epList->value, "team_CTF_redspawn");
\r
191 if(!strcmp(epList->value, "team_CTF_redflag"))
\r
192 sprintf(epList->value, "team_CTF_blueflag");
\r
193 else if(!strcmp(epList->value, "team_CTF_blueflag"))
\r
194 sprintf(epList->value, "team_CTF_redflag")
\r
196 if(!strcmp(epList->value, "team_redobelisk"))
\r
197 sprintf(epList->value, "team_blueobelisk");
\r
198 else if(!strcmp(epList->value, "team_blueobelisk"))
\r
199 sprintf(epList->value, "team_redobelisk");
\r
210 for(list<DEntity*>::const_iterator ents = world.entityList.begin(); ents != world.entityList.end(); ents++)
\r
212 (*ents)->RemoveFromRadiant();
\r