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