]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/bobtoolz/funchandlers-ctf-GTK.cpp
reformat code! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / contrib / bobtoolz / funchandlers-ctf-GTK.cpp
index 637cf5a2c11da51552c93e03d8f1c856ae52d560..302fcd431b19f88350d2a99e14ff24982570c0ed 100644 (file)
@@ -29,8 +29,8 @@
 #include "funchandlers.h"
 
 // for ctf texture changer
-list<Str> clrList_Blue;
-list<Str> clrList_Red;
+list <Str> clrList_Blue;
+list <Str> clrList_Red;
 
 BOOL clrLst1Loaded = FALSE;
 BOOL clrLst2Loaded = FALSE;
@@ -41,17 +41,18 @@ BOOL clrLst2Loaded = FALSE;
 //    Helper Functions    //
 //========================//
 
-void LoadLists(){
-       char buffer[256];
-
-       if ( !clrLst1Loaded ) {
-               clrLst1Loaded = LoadExclusionList( GetFilename( buffer, "plugins/bt/ctf-blue.txt" ), &clrList_Blue );
-               LoadExclusionList( GetFilename( buffer, "plugins/bt/blue.txt" ), &clrList_Blue );
-       }
-       if ( !clrLst2Loaded ) {
-               clrLst2Loaded = LoadExclusionList( GetFilename( buffer, "plugins/bt/ctf-red.txt" ), &clrList_Red );
-               LoadExclusionList( GetFilename( buffer, "plugins/bt/red.txt" ), &clrList_Red );
-       }
+void LoadLists()
+{
+    char buffer[256];
+
+    if (!clrLst1Loaded) {
+        clrLst1Loaded = LoadExclusionList(GetFilename(buffer, "plugins/bt/ctf-blue.txt"), &clrList_Blue);
+        LoadExclusionList(GetFilename(buffer, "plugins/bt/blue.txt"), &clrList_Blue);
+    }
+    if (!clrLst2Loaded) {
+        clrLst2Loaded = LoadExclusionList(GetFilename(buffer, "plugins/bt/ctf-red.txt"), &clrList_Red);
+        LoadExclusionList(GetFilename(buffer, "plugins/bt/red.txt"), &clrList_Red);
+    }
 }
 
 
@@ -59,49 +60,48 @@ void LoadLists(){
 //     Main Functions     //
 //========================//
 
-void DoCTFColourChanger(){
-       if ( !clrLst1Loaded || !clrLst2Loaded ) {
-               DoMessageBox( "CTF texture lists not found, this function will terminate.", "Error", MB_OK );
-               return;
-       }
-
-       int ret = DoCTFColourChangeBox();
-       if ( ret == IDCANCEL ) {
-               return;
-       }
+void DoCTFColourChanger()
+{
+    if (!clrLst1Loaded || !clrLst2Loaded) {
+        DoMessageBox("CTF texture lists not found, this function will terminate.", "Error", MB_OK);
+        return;
+    }
 
-       int cnt = Min( clrList_Blue.size(), clrList_Red.size() );
+    int ret = DoCTFColourChangeBox();
+    if (ret == IDCANCEL) {
+        return;
+    }
 
-       list<Str>::const_iterator Texture_change;
-       list<Str>::const_iterator Texture_new;
+    int cnt = Min(clrList_Blue.size(), clrList_Red.size());
 
-       float fDummy[2];
+    list<Str>::const_iterator Texture_change;
+    list<Str>::const_iterator Texture_new;
 
-       int eCnt = g_FuncTable.m_pfnGetEntityCount();
+    float fDummy[2];
 
-       DMap world;
-       world.LoadAll( TRUE );
+    int eCnt = g_FuncTable.m_pfnGetEntityCount();
 
-       if ( ret == IDYES ) {
-               Texture_change =    clrList_Blue.begin();
-               Texture_new =       clrList_Red.begin();
-       }
-       else
-       {
-               Texture_change =    clrList_Red.begin();
-               Texture_new =       clrList_Blue.begin();
-       }
+    DMap world;
+    world.LoadAll(TRUE);
+
+    if (ret == IDYES) {
+        Texture_change = clrList_Blue.begin();
+        Texture_new = clrList_Red.begin();
+    } else {
+        Texture_change = clrList_Red.begin();
+        Texture_new = clrList_Blue.begin();
+    }
 
-       for ( int i = 0; i < cnt; i++ )
-       {
-               world.ResetTextures( ( *Texture_change ).c_str(), fDummy, fDummy, 0, ( *Texture_new ).c_str(), TRUE );
+    for (int i = 0; i < cnt; i++) {
+        world.ResetTextures((*Texture_change).c_str(), fDummy, fDummy, 0, (*Texture_new).c_str(), TRUE);
 
-               Texture_change++;
-               Texture_new++;
-       }
+        Texture_change++;
+        Texture_new++;
+    }
 }
 
-void DoSwapLights(){
+void DoSwapLights()
+{
 /*     DMap world;
     world.LoadAll();
 
@@ -118,85 +118,77 @@ void DoSwapLights(){
         }
     }*/
 
-       int cnt = g_FuncTable.m_pfnGetEntityCount();
-
-       for ( int i = 0; i < cnt; i++ )
-       {
-               void* ent = g_FuncTable.m_pfnGetEntityHandle( i );
-
-               for ( epair_t* epList = *g_FuncTable.m_pfnGetEntityKeyValList( ent ); epList; epList = epList->next )
-               {
-                       if ( !stricmp( "_color", epList->key ) ) {
-                               float r, g, b;
-                               sscanf( epList->value, "%f %f %f", &r, &g, &b );
-                               sprintf( epList->value, "%f %f %f", b, g, r );
-                       }
-               }
-       }
+    int cnt = g_FuncTable.m_pfnGetEntityCount();
+
+    for (int i = 0; i < cnt; i++) {
+        void *ent = g_FuncTable.m_pfnGetEntityHandle(i);
+
+        for (epair_t *epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList = epList->next) {
+            if (!stricmp("_color", epList->key)) {
+                float r, g, b;
+                sscanf(epList->value, "%f %f %f", &r, &g, &b);
+                sprintf(epList->value, "%f %f %f", b, g, r);
+            }
+        }
+    }
 }
 
-void DoChangeAngles(){
-       int cnt = g_FuncTable.m_pfnGetEntityCount();
-
-       for ( int i = 0; i < cnt; i++ )
-       {
-               void* ent = g_FuncTable.m_pfnGetEntityHandle( i );
-
-               for ( epair_t* epList = *g_FuncTable.m_pfnGetEntityKeyValList( ent ); epList; epList = epList->next )
-               {
-                       if ( !stricmp( "angle", epList->key ) ) {
-                               float angle;
-                               sscanf( epList->value, "%f", &angle );
-                               angle += 180;
-                               while ( angle > 360 )
-                                       angle -= 360;
-
-                               sprintf( epList->value, "%f", angle );
-                       }
-               }
-       }
+void DoChangeAngles()
+{
+    int cnt = g_FuncTable.m_pfnGetEntityCount();
+
+    for (int i = 0; i < cnt; i++) {
+        void *ent = g_FuncTable.m_pfnGetEntityHandle(i);
+
+        for (epair_t *epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList = epList->next) {
+            if (!stricmp("angle", epList->key)) {
+                float angle;
+                sscanf(epList->value, "%f", &angle);
+                angle += 180;
+                while (angle > 360) {
+                    angle -= 360;
+                }
+
+                sprintf(epList->value, "%f", angle);
+            }
+        }
+    }
 }
 
-void DoSwapSpawns(){
-       int cnt = g_FuncTable.m_pfnGetEntityCount();
-
-       for ( int i = 0; i < cnt; i++ )
-       {
-               void* ent = g_FuncTable.m_pfnGetEntityHandle( i );
-
-               for ( epair_t* epList = *g_FuncTable.m_pfnGetEntityKeyValList( ent ); epList; epList = epList->next )
-               {
-                       if ( !stricmp( "classname", epList->key ) ) {
-                               if ( !strcmp( epList->value, "team_CTF_redplayer" ) ) {
-                                       sprintf( epList->value, "team_CTF_blueplayer" );
-                               }
-                               else if ( !strcmp( epList->value, "team_CTF_blueplayer" ) ) {
-                                       sprintf( epList->value, "team_CTF_redplayer" );
-                               }
-
-                               if ( !strcmp( epList->value, "team_CTF_redspawn" ) ) {
-                                       sprintf( epList->value, "team_CTF_bluespawn" );
-                               }
-                               else if ( !strcmp( epList->value, "team_CTF_bluespawn" ) ) {
-                                       sprintf( epList->value, "team_CTF_redspawn" );
-                               }
-
-                               if ( !strcmp( epList->value, "team_CTF_redflag" ) ) {
-                                       sprintf( epList->value, "team_CTF_blueflag" );
-                               }
-                               else if ( !strcmp( epList->value, "team_CTF_blueflag" ) ) {
-                                       sprintf( epList->value, "team_CTF_redflag" )
-                                       ;
-                               }
-                               if ( !strcmp( epList->value, "team_redobelisk" ) ) {
-                                       sprintf( epList->value, "team_blueobelisk" );
-                               }
-                               else if ( !strcmp( epList->value, "team_blueobelisk" ) ) {
-                                       sprintf( epList->value, "team_redobelisk" );
-                               }
-                       }
-               }
-       }
+void DoSwapSpawns()
+{
+    int cnt = g_FuncTable.m_pfnGetEntityCount();
+
+    for (int i = 0; i < cnt; i++) {
+        void *ent = g_FuncTable.m_pfnGetEntityHandle(i);
+
+        for (epair_t *epList = *g_FuncTable.m_pfnGetEntityKeyValList(ent); epList; epList = epList->next) {
+            if (!stricmp("classname", epList->key)) {
+                if (!strcmp(epList->value, "team_CTF_redplayer")) {
+                    sprintf(epList->value, "team_CTF_blueplayer");
+                } else if (!strcmp(epList->value, "team_CTF_blueplayer")) {
+                    sprintf(epList->value, "team_CTF_redplayer");
+                }
+
+                if (!strcmp(epList->value, "team_CTF_redspawn")) {
+                    sprintf(epList->value, "team_CTF_bluespawn");
+                } else if (!strcmp(epList->value, "team_CTF_bluespawn")) {
+                    sprintf(epList->value, "team_CTF_redspawn");
+                }
+
+                if (!strcmp(epList->value, "team_CTF_redflag")) {
+                    sprintf(epList->value, "team_CTF_blueflag");
+                } else if (!strcmp(epList->value, "team_CTF_blueflag")) {
+                    sprintf(epList->value, "team_CTF_redflag");
+                }
+                if (!strcmp(epList->value, "team_redobelisk")) {
+                    sprintf(epList->value, "team_blueobelisk");
+                } else if (!strcmp(epList->value, "team_blueobelisk")) {
+                    sprintf(epList->value, "team_redobelisk");
+                }
+            }
+        }
+    }
 }
 
 /*void test()