]> git.jsancho.org Git - lugaru.git/commitdiff
Awards.def
authorAlexander Monakov <amonakov@gmail.com>
Sun, 19 Dec 2010 21:14:53 +0000 (00:14 +0300)
committerAlexander Monakov <amonakov@gmail.com>
Sun, 19 Dec 2010 21:14:53 +0000 (00:14 +0300)
Source/Awards.def [new file with mode: 0644]
Source/Awards.h [new file with mode: 0644]
Source/Constants.h
Source/GameDraw.cpp

diff --git a/Source/Awards.def b/Source/Awards.def
new file mode 100644 (file)
index 0000000..f2bfe22
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+Copyright (C) 2010 - Lugaru authors
+
+This file is part of Lugaru.
+
+Lugaru 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.
+
+This program 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 this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*/
+
+DECLARE_AWARD(awardklutz, "Suicidal")
+DECLARE_AWARD(awardflawless, "Flawless!")
+DECLARE_AWARD(awardalldead, "Take no prisoners")
+DECLARE_AWARD(awardnodead, "Merciful")
+DECLARE_AWARD(awardstealth, "One with the shadows!")
+DECLARE_AWARD(awardswordsman, "Swordsman")
+DECLARE_AWARD(awardkungfu, "Unarmed!")
+DECLARE_AWARD(awardknifefighter, "Knife fighter")
+DECLARE_AWARD(awardcoward, "Coward")
+DECLARE_AWARD(awardevasion, "Escape artist")
+DECLARE_AWARD(awardacrobat, "Gymnast")
+DECLARE_AWARD(awardlongrange, "Blade slinger")
+DECLARE_AWARD(awardbrutal, "Brutal")
+DECLARE_AWARD(awardhyper, "Hyper")
+DECLARE_AWARD(awardaikido, "Aikido master!")
+DECLARE_AWARD(awardrambo, "Rambo")
+DECLARE_AWARD(awardfast, "Fast")
+DECLARE_AWARD(awardrealfast, "Real fast")
+DECLARE_AWARD(awarddamnfast, "Damn fast")
+DECLARE_AWARD(awardstrategy, "Divide and conquer")
+DECLARE_AWARD(awardbojutsu, "Bojutsu")
diff --git a/Source/Awards.h b/Source/Awards.h
new file mode 100644 (file)
index 0000000..46e8c3e
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+Copyright (C) 2010 - Lugaru authors
+
+This file is part of Lugaru.
+
+Lugaru 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.
+
+This program 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 this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*/
+
+#ifndef AWARDS_H
+#define AWARDS_H
+
+enum award_types {
+#define DECLARE_AWARD(id, name) id,
+#include "Awards.def"
+#undef DECLARE_AWARD
+award_count
+};
+
+static const char *award_names[award_count] = {
+#define DECLARE_AWARD(id, name) name,
+#include "Awards.def"
+#undef DECLARE_AWARD
+};
+
+#endif
+
index 4d50145921a653f5455ec892ac630120f07da843..d1b9ea534ec471daf00d5116aad662043fd33c7f 100644 (file)
@@ -25,28 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // cat src/Constants.h | sed -e 's/#define/const int/' -e 's/ [0-9]*$/ =&;/'
 // chew on that --Jookia
 
-const int awardklutz = 0;
-const int awardflawless = 1;
-const int awardalldead = 2;
-const int awardnodead = 3;
-const int awardstealth = 4;
-const int awardswordsman = 5;
-const int awardkungfu = 6;
-const int awardknifefighter = 7;
-const int awardcoward = 8;
-const int awardevasion = 9;
-const int awardacrobat = 10;
-const int awardlongrange = 11;
-const int awardbrutal = 12;
-const int awardhyper = 13;
-const int awardaikido = 14;
-const int awardrambo = 15;
-const int awardfast = 16;
-const int awardrealfast = 17;
-const int awarddamnfast = 18;
-const int awardstrategy = 19;
-const int awardbojutsu = 20;
-
 const int mapkilleveryone = 0;
 const int mapgosomewhere = 1;
 const int mapkillsomeone = 2;
index 2b5ebf681c4ffafbb0d2a586ff5125f0ccd949b4..7bc613ab0820537dd6d5e49481b74393fc5fec7c 100644 (file)
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "Game.h"
 #include "openal_wrapper.h"
 #include "Input.h"
+#include "Awards.h"
 
 using namespace std;
 
@@ -1843,32 +1844,8 @@ int Game::DrawGLScene(StereoSide side)
                        strcat(string,temp);
                        text.glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
 
-                       for(i=0;i<numawards;i++){
-                               if(i<6){
-                                       if(awards[i]==awardklutz)sprintf (string, "Suicidal");
-                                       if(awards[i]==awardflawless)sprintf (string, "Flawless!");
-                                       if(awards[i]==awardalldead)sprintf (string, "Take no prisoners");
-                                       if(awards[i]==awardnodead)sprintf (string, "Merciful");
-                                       if(awards[i]==awardstealth)sprintf (string, "One with the shadows!");
-                                       if(awards[i]==awardswordsman)sprintf (string, "Swordsman");
-                                       if(awards[i]==awardkungfu)sprintf (string, "Unarmed!");
-                                       if(awards[i]==awardknifefighter)sprintf (string, "Knife fighter");
-                                       if(awards[i]==awardcoward)sprintf (string, "Coward");
-                                       if(awards[i]==awardevasion)sprintf (string, "Escape artist");
-                                       if(awards[i]==awardacrobat)sprintf (string, "Gymnast");
-                                       if(awards[i]==awardlongrange)sprintf (string, "Blade slinger");
-                                       if(awards[i]==awardbrutal)sprintf (string, "Brutal");
-                                       if(awards[i]==awardhyper)sprintf (string, "Hyper");
-                                       if(awards[i]==awardaikido)sprintf (string, "Aikido master!");
-                                       if(awards[i]==awardrambo)sprintf (string, "Rambo");
-                                       if(awards[i]==awardfast)sprintf (string, "Fast");
-                                       if(awards[i]==awardrealfast)sprintf (string, "Real fast");
-                                       if(awards[i]==awarddamnfast)sprintf (string, "Damn fast");
-                                       if(awards[i]==awardstrategy)sprintf (string, "Divide and conquer");
-                                       if(awards[i]==awardbojutsu)sprintf (string, "Bojutsu");
-                                       text.glPrintOutlined(1024/30,768*6/8-90-40*i,string,1,2,1024,768);
-                               }
-                       }
+                       for (i = 0; i < numawards && i < 6; i++)
+                         text.glPrintOutlined(1024/30,768*6/8-90-40*i,award_names[awards[i]],1,2,1024,768);
                }
 
                if(drawmode!=normalmode){