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 //========================//
49 clrLst1Loaded = LoadExclusionList(GetFilename(buffer, "plugins/bt/ctf-blue.txt"), &clrList_Blue);
50 LoadExclusionList(GetFilename(buffer, "plugins/bt/blue.txt"), &clrList_Blue);
53 clrLst2Loaded = LoadExclusionList(GetFilename(buffer, "plugins/bt/ctf-red.txt"), &clrList_Red);
54 LoadExclusionList(GetFilename(buffer, "plugins/bt/red.txt"), &clrList_Red);
59 //========================//
61 //========================//
63 void DoCTFColourChanger()
65 if (!clrLst1Loaded || !clrLst2Loaded) {
66 DoMessageBox("CTF texture lists not found, this function will terminate.", "Error", MB_OK);
70 int ret = DoCTFColourChangeBox();
71 if (ret == IDCANCEL) {
75 int cnt = Min(clrList_Blue.size(), clrList_Red.size());
77 list<Str>::const_iterator Texture_change;
78 list<Str>::const_iterator Texture_new;
82 int eCnt = g_FuncTable.m_pfnGetEntityCount();
88 Texture_change = clrList_Blue.begin();
89 Texture_new = clrList_Red.begin();
91 Texture_change = clrList_Red.begin();
92 Texture_new = clrList_Blue.begin();
95 for (int i = 0; i < cnt; i++) {
96 world.ResetTextures((*Texture_change).c_str(), fDummy, fDummy, 0, (*Texture_new).c_str(), TRUE);
108 for(list<DEntity*>::const_iterator loopEnt = world.entityList.begin(); loopEnt != world.entityList.end(); loopEnt++)
110 DEntity* e = (*loopEnt);
111 DEPair* epLightColour = e->FindEPairByKey("_color");
115 sscanf(epLightColour->value, "%f %f %f", &r, &g, &b);
116 sprintf(epLightColour->value, "%f %f %f", b, g, r);
117 DMap::RebuildEntity(e);
121 int cnt = g_FuncTable.m_pfnGetEntityCount();
123 for (int i = 0; i < cnt; i++) {
124 void *ent = g_FuncTable.m_pfnGetEntityHandle(i);
126 for (epair_t *epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList = epList->next) {
127 if (!stricmp("_color", epList->key)) {
129 sscanf(epList->value, "%f %f %f", &r, &g, &b);
130 sprintf(epList->value, "%f %f %f", b, g, r);
136 void DoChangeAngles()
138 int cnt = g_FuncTable.m_pfnGetEntityCount();
140 for (int i = 0; i < cnt; i++) {
141 void *ent = g_FuncTable.m_pfnGetEntityHandle(i);
143 for (epair_t *epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList = epList->next) {
144 if (!stricmp("angle", epList->key)) {
146 sscanf(epList->value, "%f", &angle);
148 while (angle > 360) {
152 sprintf(epList->value, "%f", angle);
160 int cnt = g_FuncTable.m_pfnGetEntityCount();
162 for (int i = 0; i < cnt; i++) {
163 void *ent = g_FuncTable.m_pfnGetEntityHandle(i);
165 for (epair_t *epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList = epList->next) {
166 if (!stricmp("classname", epList->key)) {
167 if (!strcmp(epList->value, "team_CTF_redplayer")) {
168 sprintf(epList->value, "team_CTF_blueplayer");
169 } else if (!strcmp(epList->value, "team_CTF_blueplayer")) {
170 sprintf(epList->value, "team_CTF_redplayer");
173 if (!strcmp(epList->value, "team_CTF_redspawn")) {
174 sprintf(epList->value, "team_CTF_bluespawn");
175 } else if (!strcmp(epList->value, "team_CTF_bluespawn")) {
176 sprintf(epList->value, "team_CTF_redspawn");
179 if (!strcmp(epList->value, "team_CTF_redflag")) {
180 sprintf(epList->value, "team_CTF_blueflag");
181 } else if (!strcmp(epList->value, "team_CTF_blueflag")) {
182 sprintf(epList->value, "team_CTF_redflag");
184 if (!strcmp(epList->value, "team_redobelisk")) {
185 sprintf(epList->value, "team_blueobelisk");
186 } else if (!strcmp(epList->value, "team_blueobelisk")) {
187 sprintf(epList->value, "team_redobelisk");
199 for(list<DEntity*>::const_iterator ents = world.entityList.begin(); ents != world.entityList.end(); ents++)
201 (*ents)->RemoveFromRadiant();