- added leak_dumper header all over the place (not yet functional in linux)
- Bugfix for particle cleanup
This commit is contained in:
parent
5fdbce7651
commit
ab44c83168
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
#include "commander.h"
|
#include "commander.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::deque;
|
using std::deque;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "conversion.h"
|
#include "conversion.h"
|
||||||
#include "ai.h"
|
#include "ai.h"
|
||||||
#include "game_settings.h"
|
#include "game_settings.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Util::intToStr;
|
using Shared::Util::intToStr;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,315 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_AIRULE_H_
|
||||||
|
#define _GLEST_GAME_AIRULE_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "vec.h"
|
||||||
|
#include "skill_type.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
using Shared::Graphics::Vec2i;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
class Ai;
|
||||||
|
class Unit;
|
||||||
|
class UnitType;
|
||||||
|
class ProduceTask;
|
||||||
|
class BuildTask;
|
||||||
|
class UpgradeTask;
|
||||||
|
class ResourceType;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRule
|
||||||
|
//
|
||||||
|
/// An action that the AI will perform periodically
|
||||||
|
/// if the test succeeds
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRule{
|
||||||
|
protected:
|
||||||
|
Ai *ai;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRule(Ai *ai);
|
||||||
|
virtual ~AiRule() {}
|
||||||
|
|
||||||
|
virtual int getTestInterval() const= 0; //in milliseconds
|
||||||
|
virtual string getName() const= 0;
|
||||||
|
|
||||||
|
virtual bool test()= 0;
|
||||||
|
virtual void execute()= 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleWorkerHarvest
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleWorkerHarvest: public AiRule{
|
||||||
|
private:
|
||||||
|
int stoppedWorkerIndex;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleWorkerHarvest(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 2000;}
|
||||||
|
virtual string getName() const {return "Worker stopped => Order worker to harvest";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleRefreshHarvester
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleRefreshHarvester: public AiRule{
|
||||||
|
private:
|
||||||
|
int workerIndex;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleRefreshHarvester(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 20000;}
|
||||||
|
virtual string getName() const {return "Worker reasigned to needed resource";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleScoutPatrol
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleScoutPatrol: public AiRule{
|
||||||
|
public:
|
||||||
|
AiRuleScoutPatrol(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 10000;}
|
||||||
|
virtual string getName() const {return "Base is stable => Send scout patrol";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleRepair
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleRepair: public AiRule{
|
||||||
|
private:
|
||||||
|
int damagedUnitIndex;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleRepair(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 10000;}
|
||||||
|
virtual string getName() const {return "Building Damaged => Repair";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleReturnBase
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleReturnBase: public AiRule{
|
||||||
|
private:
|
||||||
|
int stoppedUnitIndex;
|
||||||
|
public:
|
||||||
|
AiRuleReturnBase(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 5000;}
|
||||||
|
virtual string getName() const {return "Stopped unit => Order return base";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleMassiveAttack
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleMassiveAttack: public AiRule{
|
||||||
|
private:
|
||||||
|
static const int baseRadius= 25;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vec2i attackPos;
|
||||||
|
Field field;
|
||||||
|
bool ultraAttack;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleMassiveAttack(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 1000;}
|
||||||
|
virtual string getName() const {return "Unit under attack => Order massive attack";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleAddTasks
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleAddTasks: public AiRule{
|
||||||
|
public:
|
||||||
|
AiRuleAddTasks(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 5000;}
|
||||||
|
virtual string getName() const {return "Tasks empty => Add tasks";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleBuildOneFarm
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleBuildOneFarm: public AiRule{
|
||||||
|
private:
|
||||||
|
const UnitType *farm;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleBuildOneFarm(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 10000;}
|
||||||
|
virtual string getName() const {return "No farms => Build one";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleProduceResourceProducer
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleProduceResourceProducer: public AiRule{
|
||||||
|
private:
|
||||||
|
static const int minStaticResources= 20;
|
||||||
|
static const int longInterval= 60000;
|
||||||
|
static const int shortInterval= 5000;
|
||||||
|
const ResourceType *rt;
|
||||||
|
int interval;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleProduceResourceProducer(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return interval;}
|
||||||
|
virtual string getName() const {return "No resources => Build Resource Producer";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleProduce
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleProduce: public AiRule{
|
||||||
|
private:
|
||||||
|
const ProduceTask *produceTask;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleProduce(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 2000;}
|
||||||
|
virtual string getName() const {return "Performing produce task";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void produceGeneric(const ProduceTask *pt);
|
||||||
|
void produceSpecific(const ProduceTask *pt);
|
||||||
|
};
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleBuild
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleBuild: public AiRule{
|
||||||
|
private:
|
||||||
|
const BuildTask *buildTask;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleBuild(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 2000;}
|
||||||
|
virtual string getName() const {return "Performing build task";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void buildGeneric(const BuildTask *bt);
|
||||||
|
void buildSpecific(const BuildTask *bt);
|
||||||
|
void buildBestBuilding(const vector<const UnitType*> &buildings);
|
||||||
|
|
||||||
|
bool isDefensive(const UnitType *building);
|
||||||
|
bool isResourceProducer(const UnitType *building);
|
||||||
|
bool isWarriorProducer(const UnitType *building);
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleUpgrade
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleUpgrade: public AiRule{
|
||||||
|
private:
|
||||||
|
const UpgradeTask *upgradeTask;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleUpgrade(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 2000;}
|
||||||
|
virtual string getName() const {return "Performing upgrade task";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void upgradeSpecific(const UpgradeTask *upgt);
|
||||||
|
void upgradeGeneric(const UpgradeTask *upgt);
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class AiRuleExpand
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class AiRuleExpand: public AiRule{
|
||||||
|
private:
|
||||||
|
static const int expandDistance= 30;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vec2i expandPos;
|
||||||
|
const UnitType *storeType;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AiRuleExpand(Ai *ai);
|
||||||
|
|
||||||
|
virtual int getTestInterval() const {return 30000;}
|
||||||
|
virtual string getName() const {return "Expanding";}
|
||||||
|
|
||||||
|
virtual bool test();
|
||||||
|
virtual void execute();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using Shared::Graphics::Vec2i;
|
using Shared::Graphics::Vec2i;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2009 Martiño Figueroa
|
// Copyright (C) 2001-2009 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Util::RandomGen;
|
using Shared::Util::RandomGen;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using Shared::Util::sharedLibVersionString;
|
using Shared::Util::sharedLibVersionString;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::deque;
|
using std::deque;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define _GLEST_GAME_CHATMANAGER_H_
|
#define _GLEST_GAME_CHATMANAGER_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "command_type.h"
|
#include "command_type.h"
|
||||||
#include "platform_util.h"
|
#include "platform_util.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
#include "chat_manager.h"
|
#include "chat_manager.h"
|
||||||
#include "script_manager.h"
|
#include "script_manager.h"
|
||||||
#include "game_settings.h"
|
#include "game_settings.h"
|
||||||
//#include "simple_threads.h"
|
|
||||||
#include "network_interface.h"
|
#include "network_interface.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using namespace Shared::PlatformCommon;
|
using namespace Shared::PlatformCommon;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include "conversion.h"
|
#include "conversion.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
|
|
||||||
#include "components.h"
|
#include "components.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::queue;
|
using std::queue;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "faction.h"
|
#include "faction.h"
|
||||||
#include "faction_type.h"
|
#include "faction_type.h"
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using namespace Shared::Graphics;
|
using namespace Shared::Graphics;
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
//#include <utility>
|
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "sound_container.h"
|
#include "sound_container.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_LANG_H_
|
||||||
|
#define _GLEST_GAME_LANG_H_
|
||||||
|
|
||||||
|
#include "properties.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
using Shared::Util::Properties;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Lang
|
||||||
|
//
|
||||||
|
// String table
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Lang{
|
||||||
|
private:
|
||||||
|
string language;
|
||||||
|
Properties strings;
|
||||||
|
Properties scenarioStrings;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Lang(){};
|
||||||
|
|
||||||
|
public:
|
||||||
|
static Lang &getInstance();
|
||||||
|
void loadStrings(const string &language);
|
||||||
|
void loadScenarioStrings(const string &scenarioDir, const string &scenarioName);
|
||||||
|
string get(const string &s);
|
||||||
|
string getScenarioString(const string &s);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,68 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_METRICS_H_
|
||||||
|
#define _GLEST_GAME_METRICS_H_
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Metrics
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Metrics{
|
||||||
|
private:
|
||||||
|
int virtualW;
|
||||||
|
int virtualH;
|
||||||
|
int screenW;
|
||||||
|
int screenH;
|
||||||
|
int minimapX;
|
||||||
|
int minimapY;
|
||||||
|
int minimapW;
|
||||||
|
int minimapH;
|
||||||
|
int displayX;
|
||||||
|
int displayY;
|
||||||
|
int displayH;
|
||||||
|
int displayW;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Metrics();
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const Metrics &getInstance();
|
||||||
|
|
||||||
|
int getVirtualW() const {return virtualW;}
|
||||||
|
int getVirtualH() const {return virtualH;}
|
||||||
|
int getScreenW() const {return screenW;}
|
||||||
|
int getScreenH() const {return screenH;}
|
||||||
|
int getMinimapX() const {return minimapX;}
|
||||||
|
int getMinimapY() const {return minimapY;}
|
||||||
|
int getMinimapW() const {return minimapW;}
|
||||||
|
int getMinimapH() const {return minimapH;}
|
||||||
|
int getDisplayX() const {return displayX;}
|
||||||
|
int getDisplayY() const {return displayY;}
|
||||||
|
int getDisplayH() const {return displayH;}
|
||||||
|
int getDisplayW() const {return displayW;}
|
||||||
|
float getAspectRatio() const;
|
||||||
|
|
||||||
|
int toVirtualX(int w) const;
|
||||||
|
int toVirtualY(int h) const;
|
||||||
|
|
||||||
|
bool isInDisplay(int x, int y) const;
|
||||||
|
bool isInMinimap(int x, int y) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -20,6 +20,7 @@
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "xml_parser.h"
|
#include "xml_parser.h"
|
||||||
#include "graphics_interface.h"
|
#include "graphics_interface.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using namespace Shared::Graphics;
|
using namespace Shared::Graphics;
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
# define IF_DEBUG_EDITION(x)
|
# define IF_DEBUG_EDITION(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
using namespace Shared::Graphics;
|
using namespace Shared::Graphics;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "xml_parser.h"
|
#include "xml_parser.h"
|
||||||
#include "graphics_interface.h"
|
#include "graphics_interface.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using namespace Shared::Graphics;
|
using namespace Shared::Graphics;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "command_type.h"
|
#include "command_type.h"
|
||||||
#include "game_util.h"
|
#include "game_util.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Util::RandomGen;
|
using Shared::Util::RandomGen;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_SELECTION_
|
||||||
|
#define _GLEST_GAME_SELECTION_
|
||||||
|
|
||||||
|
#include "unit.h"
|
||||||
|
#include <vector>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
class Gui;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Selection
|
||||||
|
//
|
||||||
|
/// List of selected units and groups
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Selection: public UnitObserver{
|
||||||
|
public:
|
||||||
|
typedef vector<Unit*> UnitContainer;
|
||||||
|
typedef UnitContainer::const_iterator UnitIterator;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const int maxGroups= 10;
|
||||||
|
static const int maxUnits= 16;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int factionIndex;
|
||||||
|
UnitContainer selectedUnits;
|
||||||
|
UnitContainer groups[maxGroups];
|
||||||
|
Gui *gui;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void init(Gui *gui, int factionIndex);
|
||||||
|
virtual ~Selection();
|
||||||
|
|
||||||
|
void select(Unit *unit);
|
||||||
|
void select(const UnitContainer &units);
|
||||||
|
void unSelect(int unitIndex);
|
||||||
|
void unSelect(const UnitContainer &units);
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
bool isEmpty() const {return selectedUnits.empty();}
|
||||||
|
bool isUniform() const;
|
||||||
|
bool isEnemy() const;
|
||||||
|
bool isComandable() const;
|
||||||
|
bool isCancelable() const;
|
||||||
|
bool isMeetable() const;
|
||||||
|
int getCount() const {return selectedUnits.size();}
|
||||||
|
const Unit *getUnit(int i) const {return selectedUnits[i];}
|
||||||
|
const Unit *getFrontUnit() const {return selectedUnits.front();}
|
||||||
|
Vec3f getRefPos() const;
|
||||||
|
bool hasUnit(const Unit* unit) const;
|
||||||
|
|
||||||
|
void assignGroup(int groupIndex);
|
||||||
|
void recallGroup(int groupIndex);
|
||||||
|
|
||||||
|
|
||||||
|
virtual void unitEvent(UnitObserver::Event event, const Unit *unit);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_INTRO_H_
|
||||||
|
#define _GLEST_GAME_INTRO_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "program.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "vec.h"
|
||||||
|
#include "texture.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
using Shared::Graphics::Vec2i;
|
||||||
|
using Shared::Graphics::Vec2f;
|
||||||
|
using Shared::Graphics::Vec3f;
|
||||||
|
using Shared::Graphics::Font2D;
|
||||||
|
using Shared::Graphics::Texture2D;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Text
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Text{
|
||||||
|
private:
|
||||||
|
string text;
|
||||||
|
Vec2i pos;
|
||||||
|
Vec2i size;
|
||||||
|
int time;
|
||||||
|
const Font2D *font;
|
||||||
|
const Texture2D *texture;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Text(const string &text, const Vec2i &pos, int time, const Font2D *font);
|
||||||
|
Text(const Texture2D *texture, const Vec2i &pos, const Vec2i &size, int time);
|
||||||
|
|
||||||
|
const string &getText() const {return text;}
|
||||||
|
const Font2D *getFont() const {return font;}
|
||||||
|
const Vec2i &getPos() const {return pos;}
|
||||||
|
const Vec2i &getSize() const {return size;}
|
||||||
|
int getTime() const {return time;}
|
||||||
|
const Texture2D *getTexture() const {return texture;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Intro
|
||||||
|
//
|
||||||
|
/// ProgramState representing the intro
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Intro: public ProgramState{
|
||||||
|
private:
|
||||||
|
static const int introTime;
|
||||||
|
static const int appearTime;
|
||||||
|
static const int showTime;
|
||||||
|
static const int disapearTime;
|
||||||
|
|
||||||
|
private:
|
||||||
|
vector<Text> texts;
|
||||||
|
int timer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Intro(Program *program);
|
||||||
|
virtual void update();
|
||||||
|
virtual void render();
|
||||||
|
virtual void keyDown(char key);
|
||||||
|
virtual void mouseUpLeft(int x, int y);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "window_gl.h"
|
#include "window_gl.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Platform::MouseButton;
|
using Shared::Platform::MouseButton;
|
||||||
using Shared::Platform::MouseState;
|
using Shared::Platform::MouseState;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "simple_threads.h"
|
#include "simple_threads.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Platform::MouseButton;
|
using Shared::Platform::MouseButton;
|
||||||
using Shared::Graphics::Context;
|
using Shared::Graphics::Context;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "components.h"
|
#include "components.h"
|
||||||
#include "menu_background.h"
|
#include "menu_background.h"
|
||||||
#include "game_settings.h"
|
#include "game_settings.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Graphics::RainParticleSystem;
|
using Shared::Graphics::RainParticleSystem;
|
||||||
using Shared::Graphics::FireParticleSystem;
|
using Shared::Graphics::FireParticleSystem;
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_MENUSTATEABOUT_H_
|
||||||
|
#define _GLEST_GAME_MENUSTATEABOUT_H_
|
||||||
|
|
||||||
|
#include "main_menu.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class MenuStateAbout
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class MenuStateAbout: public MenuState{
|
||||||
|
public:
|
||||||
|
static const int aboutStringCount1= 3;
|
||||||
|
static const int aboutStringCount2= 3;
|
||||||
|
static const int teammateCount= 9;
|
||||||
|
|
||||||
|
private:
|
||||||
|
GraphicButton buttonReturn;
|
||||||
|
GraphicLabel labelAbout1[aboutStringCount1];
|
||||||
|
GraphicLabel labelAbout2[aboutStringCount2];
|
||||||
|
GraphicLabel labelTeammateName[teammateCount];
|
||||||
|
GraphicLabel labelTeammateRole[teammateCount];
|
||||||
|
|
||||||
|
public:
|
||||||
|
MenuStateAbout(Program *program, MainMenu *mainMenu);
|
||||||
|
|
||||||
|
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||||
|
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||||
|
void render();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
#include "chat_manager.h"
|
#include "chat_manager.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
#include "chat_manager.h"
|
#include "chat_manager.h"
|
||||||
#include "simple_threads.h"
|
#include "simple_threads.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2005 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_MENUSTATEGRAPHICINFO_H_
|
||||||
|
#define _GLEST_GAME_MENUSTATEGRAPHICINFO_H_
|
||||||
|
|
||||||
|
#include "main_menu.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class MenuStateGraphicInfo
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class MenuStateGraphicInfo: public MenuState{
|
||||||
|
private:
|
||||||
|
GraphicButton buttonReturn;
|
||||||
|
GraphicLabel labelInfo;
|
||||||
|
GraphicLabel labelMoreInfo;
|
||||||
|
|
||||||
|
string glInfo;
|
||||||
|
string glMoreInfo;
|
||||||
|
public:
|
||||||
|
MenuStateGraphicInfo(Program *program, MainMenu *mainMenu);
|
||||||
|
|
||||||
|
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||||
|
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||||
|
void render();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -17,6 +17,7 @@
|
||||||
#include "chat_manager.h"
|
#include "chat_manager.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Util::Properties;
|
using Shared::Util::Properties;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "masterserver_info.h"
|
#include "masterserver_info.h"
|
||||||
#include "simple_threads.h"
|
#include "simple_threads.h"
|
||||||
#include "network_interface.h"
|
#include "network_interface.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2005 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_MENUSTATENEWGAME_H_
|
||||||
|
#define _GLEST_GAME_MENUSTATENEWGAME_H_
|
||||||
|
|
||||||
|
#include "main_menu.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class MenuStateNewGame
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class MenuStateNewGame: public MenuState{
|
||||||
|
private:
|
||||||
|
GraphicButton buttonCustomGame;
|
||||||
|
GraphicButton buttonScenario;
|
||||||
|
GraphicButton buttonTutorial;
|
||||||
|
GraphicButton buttonReturn;
|
||||||
|
|
||||||
|
public:
|
||||||
|
MenuStateNewGame(Program *program, MainMenu *mainMenu);
|
||||||
|
|
||||||
|
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||||
|
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||||
|
void update();
|
||||||
|
void render();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -13,6 +13,7 @@
|
||||||
#define _GLEST_GAME_MENUSTATEOPTIONS_H_
|
#define _GLEST_GAME_MENUSTATEOPTIONS_H_
|
||||||
|
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define _GLEST_GAME_MENUSTATEROOT_H_
|
#define _GLEST_GAME_MENUSTATEROOT_H_
|
||||||
|
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define _GLEST_GAME_MENUSTATESCENARIO_H_
|
#define _GLEST_GAME_MENUSTATESCENARIO_H_
|
||||||
|
|
||||||
#include "main_menu.h"
|
#include "main_menu.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "network_interface.h"
|
#include "network_interface.h"
|
||||||
//#include "game_settings.h"
|
|
||||||
|
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Platform::Ip;
|
using Shared::Platform::Ip;
|
||||||
using Shared::Platform::ClientSocket;
|
using Shared::Platform::ClientSocket;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "network_interface.h"
|
#include "network_interface.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "base_thread.h"
|
#include "base_thread.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Platform::ServerSocket;
|
using Shared::Platform::ServerSocket;
|
||||||
using Shared::Platform::Socket;
|
using Shared::Platform::Socket;
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#define _GLEST_GAME_MASTERSERVERINFO_H_
|
#define _GLEST_GAME_MASTERSERVERINFO_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "checksum.h"
|
#include "checksum.h"
|
||||||
#include "server_interface.h"
|
#include "server_interface.h"
|
||||||
#include "client_interface.h"
|
#include "client_interface.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Util::Checksum;
|
using Shared::Util::Checksum;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include "network_types.h"
|
#include "network_types.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Platform::Socket;
|
using Shared::Platform::Socket;
|
||||||
using Shared::Platform::int8;
|
using Shared::Platform::int8;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::min;
|
using std::min;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "network_interface.h"
|
#include "network_interface.h"
|
||||||
#include "connection_slot.h"
|
#include "connection_slot.h"
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using Shared::Platform::ServerSocket;
|
using Shared::Platform::ServerSocket;
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#define _GLEST_GAME_SOUNDCONTAINER_H_
|
#define _GLEST_GAME_SOUNDCONTAINER_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using Shared::Util::RandomGen;
|
using Shared::Util::RandomGen;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "simple_threads.h"
|
#include "simple_threads.h"
|
||||||
#include "platform_common.h"
|
#include "platform_common.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "unit.h"
|
#include "unit.h"
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
#ifndef _GLEST_GAME_RESOURCE_H_
|
||||||
|
#define _GLEST_GAME_RESOURCE_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "vec.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
using Shared::Graphics::Vec2i;
|
||||||
|
|
||||||
|
class ResourceType;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Resource
|
||||||
|
//
|
||||||
|
/// Amount of a given ResourceType
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Resource{
|
||||||
|
private:
|
||||||
|
int amount;
|
||||||
|
const ResourceType *type;
|
||||||
|
Vec2i pos;
|
||||||
|
int balance;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void init(const ResourceType *rt, int amount);
|
||||||
|
void init(const ResourceType *rt, const Vec2i &pos);
|
||||||
|
|
||||||
|
int getAmount() const {return amount;}
|
||||||
|
const ResourceType * getType() const {return type;}
|
||||||
|
Vec2i getPos() const {return pos;}
|
||||||
|
int getBalance() const {return balance;}
|
||||||
|
string getDescription() const;
|
||||||
|
|
||||||
|
void setAmount(int amount) {this->amount= amount;}
|
||||||
|
void setBalance(int balance) {this->balance= balance;}
|
||||||
|
|
||||||
|
bool decAmount(int i);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}// end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -259,7 +259,10 @@ Unit::~Unit(){
|
||||||
// If the unit is not visible we better make sure we cleanup associated particles
|
// If the unit is not visible we better make sure we cleanup associated particles
|
||||||
if(this->getVisible() == false) {
|
if(this->getVisible() == false) {
|
||||||
Renderer::getInstance().cleanupUnitParticleSystems(unitParticleSystems,rsGame);
|
Renderer::getInstance().cleanupUnitParticleSystems(unitParticleSystems,rsGame);
|
||||||
|
|
||||||
Renderer::getInstance().cleanupParticleSystems(fireParticleSystems,rsGame);
|
Renderer::getInstance().cleanupParticleSystems(fireParticleSystems,rsGame);
|
||||||
|
// Must set this to null of it will be used below in stopDamageParticles()
|
||||||
|
fire = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fade(and by this remove) all unit particle systems
|
// fade(and by this remove) all unit particle systems
|
||||||
|
@ -923,7 +926,7 @@ const CommandType *Unit::computeCommandType(const Vec2i &pos, const Unit *target
|
||||||
return commandType;
|
return commandType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::update(){
|
bool Unit::update() {
|
||||||
assert(progress<=1.f);
|
assert(progress<=1.f);
|
||||||
|
|
||||||
//highlight
|
//highlight
|
||||||
|
@ -1491,7 +1494,7 @@ CommandResult Unit::undoCommand(Command *command){
|
||||||
return crSuccess;
|
return crSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::stopDamageParticles(){
|
void Unit::stopDamageParticles() {
|
||||||
// stop fire
|
// stop fire
|
||||||
if(fire != NULL) {
|
if(fire != NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -1521,7 +1524,7 @@ void Unit::startDamageParticles(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// start fire
|
// start fire
|
||||||
if(type->getProperty(UnitType::pBurnable) && fire==NULL){
|
if(type->getProperty(UnitType::pBurnable) && fire == NULL) {
|
||||||
FireParticleSystem *fps;
|
FireParticleSystem *fps;
|
||||||
fps= new FireParticleSystem(200);
|
fps= new FireParticleSystem(200);
|
||||||
const Game *game = Renderer::getInstance().getGame();
|
const Game *game = Renderer::getInstance().getGame();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "skill_type.h"
|
#include "skill_type.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
#include "xml_parser.h"
|
#include "xml_parser.h"
|
||||||
#include "sound_container.h"
|
#include "sound_container.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_DAMAGEMULTIPLIER_H_
|
||||||
|
#define _GLEST_GAME_DAMAGEMULTIPLIER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class AttackType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class AttackType{
|
||||||
|
private:
|
||||||
|
string name;
|
||||||
|
int id;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int getId() const {return id;}
|
||||||
|
const string &getName() const {return name;}
|
||||||
|
|
||||||
|
void setName(const string &name) {this->name= name;}
|
||||||
|
void setId(int id) {this->id= id;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class ArmorType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class ArmorType{
|
||||||
|
private:
|
||||||
|
string name;
|
||||||
|
int id;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int getId() const {return id;}
|
||||||
|
const string &getName() const {return name;}
|
||||||
|
|
||||||
|
void setName(const string &name) {this->name= name;}
|
||||||
|
void setId(int id) {this->id= id;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class DamageMultiplierTable
|
||||||
|
//
|
||||||
|
/// Some attack types have bonuses against some
|
||||||
|
/// armor types and vice-versa
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class DamageMultiplierTable{
|
||||||
|
private:
|
||||||
|
float *values;
|
||||||
|
int attackTypeCount;
|
||||||
|
int armorTypeCount;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DamageMultiplierTable();
|
||||||
|
~DamageMultiplierTable();
|
||||||
|
|
||||||
|
void init(int attackTypeCount, int armorTypeCount);
|
||||||
|
float getDamageMultiplier(const AttackType *att, const ArmorType *art) const;
|
||||||
|
void setDamageMultiplier(const AttackType *att, const ArmorType *art, float value);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "unit_type.h"
|
#include "unit_type.h"
|
||||||
#include "upgrade_type.h"
|
#include "upgrade_type.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Sound::StrSound;
|
using Shared::Sound::StrSound;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
#ifndef _GLEST_GAME_OBJECTTYPE_H_
|
||||||
|
#define _GLEST_GAME_OBJECTTYPE_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "model.h"
|
||||||
|
#include "vec.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
using Shared::Graphics::Model;
|
||||||
|
using Shared::Graphics::Vec3f;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ObjectType
|
||||||
|
//
|
||||||
|
/// Each of the possible objects of the map: trees, stones ...
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ObjectType{
|
||||||
|
private:
|
||||||
|
typedef vector<Model*> Models;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const int tree1= 0;
|
||||||
|
static const int tree2= 1;
|
||||||
|
static const int choppedTree= 2;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Models models;
|
||||||
|
Vec3f color;
|
||||||
|
int objectClass;
|
||||||
|
bool walkable;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void init(int modelCount, int objectClass, bool walkable);
|
||||||
|
|
||||||
|
void loadModel(const string &path);
|
||||||
|
|
||||||
|
Model *getModel(int i) {return models[i];}
|
||||||
|
int getModelCount() const {return models.size();}
|
||||||
|
const Vec3f &getColor() const {return color;}
|
||||||
|
int getClass() const {return objectClass;}
|
||||||
|
bool getWalkable() const {return walkable;}
|
||||||
|
bool isATree() const {return objectClass==tree1 || objectClass==tree2;}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,66 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_RESOURCETYPE_H_
|
||||||
|
#define _GLEST_GAME_RESOURCETYPE_H_
|
||||||
|
|
||||||
|
#include "element_type.h"
|
||||||
|
#include "model.h"
|
||||||
|
#include "checksum.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
using Shared::Graphics::Model;
|
||||||
|
using Shared::Util::Checksum;
|
||||||
|
|
||||||
|
enum ResourceClass{
|
||||||
|
rcTech,
|
||||||
|
rcTileset,
|
||||||
|
rcStatic,
|
||||||
|
rcConsumable
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ResourceType
|
||||||
|
//
|
||||||
|
/// A type of resource that can be harvested or not
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ResourceType: public DisplayableType{
|
||||||
|
private:
|
||||||
|
ResourceClass resourceClass;
|
||||||
|
int tilesetObject; //used only if class==rcTileset
|
||||||
|
int resourceNumber; //used only if class==rcTech, resource number in the map
|
||||||
|
int interval; //used only if class==rcConsumable
|
||||||
|
int defResPerPatch; //used only if class==rcTileset || class==rcTech
|
||||||
|
bool recoup_cost;
|
||||||
|
|
||||||
|
Model *model;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void load(const string &dir, Checksum* checksum);
|
||||||
|
|
||||||
|
//get
|
||||||
|
int getClass() const {return resourceClass;}
|
||||||
|
int getTilesetObject() const {return tilesetObject;}
|
||||||
|
int getResourceNumber() const {return resourceNumber;}
|
||||||
|
int getInterval() const {return interval;}
|
||||||
|
int getDefResPerPatch() const {return defResPerPatch;}
|
||||||
|
const Model *getModel() const {return model;}
|
||||||
|
bool getRecoup_cost() const { return recoup_cost;}
|
||||||
|
|
||||||
|
static ResourceClass strToRc(const string &s);
|
||||||
|
};
|
||||||
|
|
||||||
|
}} //end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,293 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_SKILLTYPE_H_
|
||||||
|
#define _GLEST_GAME_SKILLTYPE_H_
|
||||||
|
|
||||||
|
#include "sound.h"
|
||||||
|
#include "vec.h"
|
||||||
|
#include "model.h"
|
||||||
|
#include "xml_parser.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "damage_multiplier.h"
|
||||||
|
#include "element_type.h"
|
||||||
|
#include "factory.h"
|
||||||
|
#include "sound_container.h"
|
||||||
|
#include "particle.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using Shared::Sound::StaticSound;
|
||||||
|
using Shared::Xml::XmlNode;
|
||||||
|
using Shared::Graphics::Vec3f;
|
||||||
|
using Shared::Graphics::Model;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
using Shared::Util::MultiFactory;
|
||||||
|
|
||||||
|
class ParticleSystemTypeProjectile;
|
||||||
|
class ParticleSystemTypeSplash;
|
||||||
|
class UnitParticleSystemType;
|
||||||
|
class FactionType;
|
||||||
|
class TechTree;
|
||||||
|
class Lang;
|
||||||
|
class TotalUpgrade;
|
||||||
|
|
||||||
|
|
||||||
|
enum Field{
|
||||||
|
fLand,
|
||||||
|
fAir,
|
||||||
|
|
||||||
|
fieldCount
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SkillClass{
|
||||||
|
scStop,
|
||||||
|
scMove,
|
||||||
|
scAttack,
|
||||||
|
scBuild,
|
||||||
|
scHarvest,
|
||||||
|
scRepair,
|
||||||
|
scBeBuilt,
|
||||||
|
scProduce,
|
||||||
|
scUpgrade,
|
||||||
|
scMorph,
|
||||||
|
scDie,
|
||||||
|
|
||||||
|
scCount
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef list<UnitParticleSystemType*> UnitParticleSystemTypes;
|
||||||
|
// =====================================================
|
||||||
|
// class SkillType
|
||||||
|
//
|
||||||
|
/// A basic action that an unit can perform
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class SkillType{
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SkillClass skillClass;
|
||||||
|
string name;
|
||||||
|
int mpCost;
|
||||||
|
int speed;
|
||||||
|
int animSpeed;
|
||||||
|
Model *animation;
|
||||||
|
SoundContainer sounds;
|
||||||
|
float soundStartTime;
|
||||||
|
public:
|
||||||
|
UnitParticleSystemTypes unitParticleSystemTypes;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//varios
|
||||||
|
virtual ~SkillType();
|
||||||
|
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, const FactionType *ft);
|
||||||
|
|
||||||
|
//get
|
||||||
|
const string &getName() const {return name;}
|
||||||
|
SkillClass getClass() const {return skillClass;}
|
||||||
|
int getEpCost() const {return mpCost;}
|
||||||
|
int getSpeed() const {return speed;}
|
||||||
|
int getAnimSpeed() const {return animSpeed;}
|
||||||
|
const Model *getAnimation() const {return animation;}
|
||||||
|
StaticSound *getSound() const {return sounds.getRandSound();}
|
||||||
|
float getSoundStartTime() const {return soundStartTime;}
|
||||||
|
|
||||||
|
//other
|
||||||
|
virtual string toString() const= 0;
|
||||||
|
virtual int getTotalSpeed(const TotalUpgrade *) const {return speed;}
|
||||||
|
static string skillClassToStr(SkillClass skillClass);
|
||||||
|
static string fieldToStr(Field field);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class StopSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class StopSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
StopSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class MoveSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class MoveSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
MoveSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
|
||||||
|
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class AttackSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class AttackSkillType: public SkillType{
|
||||||
|
private:
|
||||||
|
int attackStrength;
|
||||||
|
int attackVar;
|
||||||
|
int attackRange;
|
||||||
|
const AttackType *attackType;
|
||||||
|
bool attackFields[fieldCount];
|
||||||
|
float attackStartTime;
|
||||||
|
|
||||||
|
bool projectile;
|
||||||
|
ParticleSystemTypeProjectile* projectileParticleSystemType;
|
||||||
|
SoundContainer projSounds;
|
||||||
|
|
||||||
|
bool splash;
|
||||||
|
int splashRadius;
|
||||||
|
bool splashDamageAll;
|
||||||
|
ParticleSystemTypeSplash* splashParticleSystemType;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AttackSkillType();
|
||||||
|
~AttackSkillType();
|
||||||
|
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, const FactionType *ft);
|
||||||
|
virtual string toString() const;
|
||||||
|
|
||||||
|
//get
|
||||||
|
int getAttackStrength() const {return attackStrength;}
|
||||||
|
int getAttackVar() const {return attackVar;}
|
||||||
|
int getAttackRange() const {return attackRange;}
|
||||||
|
const AttackType *getAttackType() const {return attackType;}
|
||||||
|
bool getAttackField(Field field) const {return attackFields[field];}
|
||||||
|
float getAttackStartTime() const {return attackStartTime;}
|
||||||
|
|
||||||
|
//get proj
|
||||||
|
bool getProjectile() const {return projectile;}
|
||||||
|
ParticleSystemTypeProjectile * getProjParticleType() const {return projectileParticleSystemType;}
|
||||||
|
StaticSound *getProjSound() const {return projSounds.getRandSound();}
|
||||||
|
|
||||||
|
//get splash
|
||||||
|
bool getSplash() const {return splash;}
|
||||||
|
int getSplashRadius() const {return splashRadius;}
|
||||||
|
bool getSplashDamageAll() const {return splashDamageAll;}
|
||||||
|
ParticleSystemTypeSplash * getSplashParticleType() const {return splashParticleSystemType;}
|
||||||
|
|
||||||
|
//misc
|
||||||
|
int getTotalAttackStrength(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
int getTotalAttackRange(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class BuildSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class BuildSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
BuildSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class HarvestSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class HarvestSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
HarvestSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class RepairSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class RepairSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
RepairSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class ProduceSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class ProduceSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
ProduceSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
|
||||||
|
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class UpgradeSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class UpgradeSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
UpgradeSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
|
||||||
|
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class BeBuiltSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class BeBuiltSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
BeBuiltSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class MorphSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class MorphSkillType: public SkillType{
|
||||||
|
public:
|
||||||
|
MorphSkillType();
|
||||||
|
virtual string toString() const;
|
||||||
|
|
||||||
|
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class DieSkillType
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class DieSkillType: public SkillType{
|
||||||
|
private:
|
||||||
|
bool fade;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DieSkillType();
|
||||||
|
bool getFade() const {return fade;}
|
||||||
|
|
||||||
|
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, const FactionType *ft);
|
||||||
|
virtual string toString() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class SkillFactory
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class SkillTypeFactory: public MultiFactory<SkillType>{
|
||||||
|
private:
|
||||||
|
SkillTypeFactory();
|
||||||
|
public:
|
||||||
|
static SkillTypeFactory &getInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -18,6 +18,7 @@
|
||||||
#include "resource_type.h"
|
#include "resource_type.h"
|
||||||
#include "faction_type.h"
|
#include "faction_type.h"
|
||||||
#include "damage_multiplier.h"
|
#include "damage_multiplier.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "game_util.h"
|
#include "game_util.h"
|
||||||
#include "leak_dumper.h"
|
|
||||||
#include "unit_particle_type.h"
|
#include "unit_particle_type.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Xml;
|
using namespace Shared::Xml;
|
||||||
using namespace Shared::Graphics;
|
using namespace Shared::Graphics;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "sound_container.h"
|
#include "sound_container.h"
|
||||||
#include "checksum.h"
|
#include "checksum.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "element_type.h"
|
#include "element_type.h"
|
||||||
#include "checksum.h"
|
#include "checksum.h"
|
||||||
#include "conversion.h"
|
#include "conversion.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Util::Checksum;
|
using Shared::Util::Checksum;
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2005 Martiño Figueroa
|
// Copyright (C) 2001-2005 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "xml_parser.h"
|
#include "xml_parser.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _GLEST_GAME_SURFACEATLAS_H_
|
||||||
|
#define _GLEST_GAME_SURFACEATLAS_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
#include "texture.h"
|
||||||
|
#include "vec.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
using std::set;
|
||||||
|
using Shared::Graphics::Pixmap2D;
|
||||||
|
using Shared::Graphics::Texture2D;
|
||||||
|
using Shared::Graphics::Vec2i;
|
||||||
|
using Shared::Graphics::Vec2f;
|
||||||
|
|
||||||
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class SurfaceInfo
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class SurfaceInfo{
|
||||||
|
private:
|
||||||
|
const Pixmap2D *center;
|
||||||
|
const Pixmap2D *leftUp;
|
||||||
|
const Pixmap2D *rightUp;
|
||||||
|
const Pixmap2D *leftDown;
|
||||||
|
const Pixmap2D *rightDown;
|
||||||
|
Vec2f coord;
|
||||||
|
const Texture2D *texture;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SurfaceInfo(const Pixmap2D *center);
|
||||||
|
SurfaceInfo(const Pixmap2D *lu, const Pixmap2D *ru, const Pixmap2D *ld, const Pixmap2D *rd);
|
||||||
|
bool operator==(const SurfaceInfo &si) const;
|
||||||
|
|
||||||
|
const Pixmap2D *getCenter() const {return center;}
|
||||||
|
const Pixmap2D *getLeftUp() const {return leftUp;}
|
||||||
|
const Pixmap2D *getRightUp() const {return rightUp;}
|
||||||
|
const Pixmap2D *getLeftDown() const {return leftDown;}
|
||||||
|
const Pixmap2D *getRightDown() const {return rightDown;}
|
||||||
|
const Vec2f &getCoord() const {return coord;}
|
||||||
|
const Texture2D *getTexture() const {return texture;}
|
||||||
|
|
||||||
|
void setCoord(const Vec2f &coord) {this->coord= coord;}
|
||||||
|
void setTexture(const Texture2D *texture) {this->texture= texture;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class SurfaceAtlas
|
||||||
|
//
|
||||||
|
/// Holds all surface textures for a given Tileset
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class SurfaceAtlas{
|
||||||
|
private:
|
||||||
|
typedef vector<SurfaceInfo> SurfaceInfos;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SurfaceInfos surfaceInfos;
|
||||||
|
int surfaceSize;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SurfaceAtlas();
|
||||||
|
|
||||||
|
void addSurface(SurfaceInfo *si);
|
||||||
|
float getCoordStep() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void checkDimensions(const Pixmap2D *p);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -13,7 +13,6 @@
|
||||||
#define _GLEST_GAME_TILESET_H_
|
#define _GLEST_GAME_TILESET_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "graphics_interface.h"
|
#include "graphics_interface.h"
|
||||||
#include "xml_parser.h"
|
#include "xml_parser.h"
|
||||||
#include "object_type.h"
|
#include "object_type.h"
|
||||||
|
@ -21,6 +20,7 @@
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
#include "surface_atlas.h"
|
#include "surface_atlas.h"
|
||||||
#include "checksum.h"
|
#include "checksum.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "tileset.h"
|
#include "tileset.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "particle.h"
|
#include "particle.h"
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Graphics::ParticleObserver;
|
using Shared::Graphics::ParticleObserver;
|
||||||
using Shared::Util::RandomGen;
|
using Shared::Util::RandomGen;
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#define _GLEST_GAME_WATER_EFFECTS_H_
|
#define _GLEST_GAME_WATER_EFFECTS_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "unit_updater.h"
|
#include "unit_updater.h"
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "FileReader.h"
|
#include "FileReader.h"
|
||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#define FILE_READER_H
|
#define FILE_READER_H
|
||||||
|
|
||||||
#include "platform_util.h"
|
#include "platform_util.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -21,6 +20,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::map;
|
using std::map;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "JPGReader.h"
|
#include "JPGReader.h"
|
||||||
#include "PNGReader.h"
|
#include "PNGReader.h"
|
||||||
#include "TGAReader.h"
|
#include "TGAReader.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
//Initialize some objects
|
//Initialize some objects
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "FileReader.h"
|
#include "FileReader.h"
|
||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "FileReader.h"
|
#include "FileReader.h"
|
||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "FileReader.h"
|
#include "FileReader.h"
|
||||||
#include "pixmap.h"
|
#include "pixmap.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
#ifndef _SHARED_GRAPHICS_BUFFER_H_
|
||||||
|
#define _SHARED_GRAPHICS_BUFFER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class VertexBuffer
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class VertexBuffer{
|
||||||
|
private:
|
||||||
|
static const int texCoordCount = 8;
|
||||||
|
static const int attribCount = 8;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void *positionPointer;
|
||||||
|
void *normalPointer;
|
||||||
|
|
||||||
|
void *texCoordPointers[texCoordCount];
|
||||||
|
int texCoordCoordCounts[texCoordCount];
|
||||||
|
|
||||||
|
void *attribPointers[attribCount];
|
||||||
|
int attribCoordCounts[attribCount];
|
||||||
|
string attribNames[attribCount];
|
||||||
|
|
||||||
|
public:
|
||||||
|
VertexBuffer();
|
||||||
|
virtual ~VertexBuffer(){};
|
||||||
|
|
||||||
|
virtual void init(int size)= 0;
|
||||||
|
|
||||||
|
void setPositionPointer(void *pointer);
|
||||||
|
void setNormalPointer(void *pointer);
|
||||||
|
void setTexCoordPointer(void *pointer, int texCoordIndex, int coordCount);
|
||||||
|
void setAttribPointer(void *pointer, int attribIndex, int coordCount, const string &name);
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class IndexBuffer
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class IndexBuffer{
|
||||||
|
private:
|
||||||
|
void *indexPointer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
IndexBuffer();
|
||||||
|
virtual ~IndexBuffer(){}
|
||||||
|
|
||||||
|
virtual void init(int size)= 0;
|
||||||
|
|
||||||
|
void setIndexPointer(void *pointer);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "quaternion.h"
|
#include "quaternion.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define _SHARED_GRAPHICS_CONTEXT_H_
|
#define _SHARED_GRAPHICS_CONTEXT_H_
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest Shared Library (www.glest.org)
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
#define _SHARED_GRAPHICS_FONT_H_
|
#define _SHARED_GRAPHICS_FONT_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#define _SHARED_GRAPHICS_FONTMANAGER_H_
|
#define _SHARED_GRAPHICS_FONTMANAGER_H_
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_CONTEXTGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_CONTEXTGL_H_
|
||||||
|
|
||||||
|
#include "context.h"
|
||||||
|
#include "gl_wrap.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
using Platform::PlatformContextGl;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ContextGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ContextGl: public Context{
|
||||||
|
protected:
|
||||||
|
PlatformContextGl pcgl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
virtual void end();
|
||||||
|
virtual void reset(){};
|
||||||
|
|
||||||
|
virtual void makeCurrent();
|
||||||
|
virtual void swapBuffers();
|
||||||
|
|
||||||
|
const PlatformContextGl *getPlatformContextGl() const {return &pcgl;}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,59 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_FONTGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_FONTGL_H_
|
||||||
|
|
||||||
|
#include "font.h"
|
||||||
|
#include "opengl.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class FontGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class FontGl{
|
||||||
|
protected:
|
||||||
|
GLuint handle;
|
||||||
|
|
||||||
|
public:
|
||||||
|
GLuint getHandle() const {return handle;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Font2DGl
|
||||||
|
//
|
||||||
|
/// OpenGL bitmap font
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Font2DGl: public Font2D, public FontGl{
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
virtual void end();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Font3DGl
|
||||||
|
//
|
||||||
|
/// OpenGL outline font
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class Font3DGl: public Font3D, public FontGl{
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
virtual void end();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,44 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2005 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_GRAPHICSFACTORYBASICGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_GRAPHICSFACTORYBASICGL_H_
|
||||||
|
|
||||||
|
#include "graphics_factory.h"
|
||||||
|
#include "text_renderer_gl.h"
|
||||||
|
#include "model_renderer_gl.h"
|
||||||
|
#include "context_gl.h"
|
||||||
|
#include "model_gl.h"
|
||||||
|
#include "texture_gl.h"
|
||||||
|
#include "font_gl.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class GraphicsFactoryBasicGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class GraphicsFactoryBasicGl: public GraphicsFactory{
|
||||||
|
public:
|
||||||
|
virtual TextRenderer2D *newTextRenderer2D() {return new TextRenderer2DGl();}
|
||||||
|
virtual TextRenderer3D *newTextRenderer3D() {return new TextRenderer3DGl();}
|
||||||
|
virtual ModelRenderer *newModelRenderer() {return new ModelRendererGl();}
|
||||||
|
virtual Context *newContext() {return new ContextGl();}
|
||||||
|
virtual Model *newModel() {return new ModelGl();}
|
||||||
|
virtual Texture2D *newTexture2D() {return new Texture2DGl();}
|
||||||
|
virtual Font2D *newFont2D() {return new Font2DGl();}
|
||||||
|
virtual Font3D *newFont3D() {return new Font3DGl();}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,66 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_GRAPHICSFACTORYGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_GRAPHICSFACTORYGL_H_
|
||||||
|
|
||||||
|
#include "texture_manager.h"
|
||||||
|
#include "model_manager.h"
|
||||||
|
#include "particle.h"
|
||||||
|
#include "font_manager.h"
|
||||||
|
#include "graphics_factory.h"
|
||||||
|
#include "text_renderer_gl.h"
|
||||||
|
#include "model_renderer_gl.h"
|
||||||
|
#include "particle_renderer_gl.h"
|
||||||
|
#include "context_gl.h"
|
||||||
|
#include "model_gl.h"
|
||||||
|
#include "texture_gl.h"
|
||||||
|
#include "font_gl.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class GraphicsFactoryGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class GraphicsFactoryGl: public GraphicsFactory{
|
||||||
|
public:
|
||||||
|
//context
|
||||||
|
virtual Context *newContext() {return new ContextGl();}
|
||||||
|
|
||||||
|
//textures
|
||||||
|
virtual TextureManager *newTextureManager() {return new TextureManager();}
|
||||||
|
virtual Texture1D *newTexture1D() {return new Texture1DGl();}
|
||||||
|
virtual Texture2D *newTexture2D() {return new Texture2DGl();}
|
||||||
|
virtual Texture3D *newTexture3D() {return new Texture3DGl();}
|
||||||
|
virtual TextureCube *newTextureCube() {return new TextureCubeGl();}
|
||||||
|
|
||||||
|
//models
|
||||||
|
virtual ModelManager *newModelManager() {return new ModelManager();}
|
||||||
|
virtual ModelRenderer *newModelRenderer() {return new ModelRendererGl();}
|
||||||
|
virtual Model *newModel() {return new ModelGl();}
|
||||||
|
|
||||||
|
//text
|
||||||
|
virtual FontManager *newFontManager() {return new FontManager();}
|
||||||
|
virtual TextRenderer2D *newTextRenderer2D() {return new TextRenderer2DGl();}
|
||||||
|
virtual TextRenderer3D *newTextRenderer3D() {return new TextRenderer3DGl();}
|
||||||
|
virtual Font2D *newFont2D() {return new Font2DGl();}
|
||||||
|
virtual Font3D *newFont3D() {return new Font3DGl();}
|
||||||
|
|
||||||
|
//particles
|
||||||
|
virtual ParticleManager *newParticleManager() {return new ParticleManager();}
|
||||||
|
virtual ParticleRenderer *newParticleRenderer() {return new ParticleRendererGl();}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,63 @@
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_GRAPHICSFACTORYGL2_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_GRAPHICSFACTORYGL2_H_
|
||||||
|
|
||||||
|
#include "texture_manager.h"
|
||||||
|
#include "model_manager.h"
|
||||||
|
#include "font_manager.h"
|
||||||
|
#include "particle.h"
|
||||||
|
#include "graphics_factory.h"
|
||||||
|
#include "text_renderer_gl.h"
|
||||||
|
#include "model_renderer_gl.h"
|
||||||
|
#include "particle_renderer_gl.h"
|
||||||
|
#include "context_gl.h"
|
||||||
|
#include "model_gl.h"
|
||||||
|
#include "texture_gl.h"
|
||||||
|
#include "font_gl.h"
|
||||||
|
#include "shader_gl.h"
|
||||||
|
#include "shader_manager.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class GraphicsFactoryGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class GraphicsFactoryGl2: public GraphicsFactory{
|
||||||
|
public:
|
||||||
|
//context
|
||||||
|
virtual Context *newContext() {return new ContextGl();}
|
||||||
|
|
||||||
|
//textures
|
||||||
|
virtual TextureManager *newTextureManager() {return new TextureManager();}
|
||||||
|
virtual Texture1D *newTexture1D() {return new Texture1DGl();}
|
||||||
|
virtual Texture2D *newTexture2D() {return new Texture2DGl();}
|
||||||
|
virtual Texture3D *newTexture3D() {return new Texture3DGl();}
|
||||||
|
virtual TextureCube *newTextureCube() {return new TextureCubeGl();}
|
||||||
|
|
||||||
|
//models
|
||||||
|
virtual ModelManager *newModelManager() {return new ModelManager();}
|
||||||
|
virtual ModelRenderer *newModelRenderer() {return new ModelRendererGl();}
|
||||||
|
virtual Model *newModel() {return new ModelGl();}
|
||||||
|
|
||||||
|
//text
|
||||||
|
virtual FontManager *newFontManager() {return new FontManager();}
|
||||||
|
virtual TextRenderer2D *newTextRenderer2D() {return new TextRenderer2DGl();}
|
||||||
|
virtual TextRenderer3D *newTextRenderer3D() {return new TextRenderer3DGl();}
|
||||||
|
virtual Font2D *newFont2D() {return new Font2DGl();}
|
||||||
|
virtual Font3D *newFont3D() {return new Font3DGl();}
|
||||||
|
|
||||||
|
//particles
|
||||||
|
virtual ParticleManager *newParticleManager() {return new ParticleManager();}
|
||||||
|
virtual ParticleRenderer *newParticleRenderer() {return new ParticleRendererGl();}
|
||||||
|
|
||||||
|
//shaders
|
||||||
|
virtual ShaderManager *newShaderManager() {return new ShaderManager();}
|
||||||
|
virtual ShaderProgram *newShaderProgram() {return new ShaderProgramGl();}
|
||||||
|
virtual VertexShader *newVertexShader() {return new VertexShaderGl();}
|
||||||
|
virtual FragmentShader *newFragmentShader() {return new FragmentShaderGl();}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,32 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_MODELGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_MODELGL_H_
|
||||||
|
|
||||||
|
#include "model.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ModelGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ModelGl: public Model{
|
||||||
|
public:
|
||||||
|
virtual void init(){}
|
||||||
|
virtual void end(){}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,51 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_MODELRENDERERGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_MODELRENDERERGL_H_
|
||||||
|
|
||||||
|
#include "model_renderer.h"
|
||||||
|
#include "model.h"
|
||||||
|
#include "opengl.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ModelRendererGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ModelRendererGl: public ModelRenderer{
|
||||||
|
private:
|
||||||
|
bool rendering;
|
||||||
|
bool duplicateTexCoords;
|
||||||
|
int secondaryTexCoordUnit;
|
||||||
|
GLuint lastTexture;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ModelRendererGl();
|
||||||
|
virtual void begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback);
|
||||||
|
virtual void end();
|
||||||
|
virtual void render(const Model *model);
|
||||||
|
virtual void renderNormalsOnly(const Model *model);
|
||||||
|
|
||||||
|
void setDuplicateTexCoords(bool duplicateTexCoords) {this->duplicateTexCoords= duplicateTexCoords;}
|
||||||
|
void setSecondaryTexCoordUnit(int secondaryTexCoordUnit) {this->secondaryTexCoordUnit= secondaryTexCoordUnit;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void renderMesh(const Mesh *mesh);
|
||||||
|
void renderMeshNormals(const Mesh *mesh);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,69 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_OPENGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_OPENGL_H_
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include "conversion.h"
|
||||||
|
#include "gl_wrap.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::runtime_error;
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
using Util::intToStr;
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// Globals
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
bool isGlExtensionSupported(const char *extensionName);
|
||||||
|
bool isGlVersionSupported(int major, int minor, int release);
|
||||||
|
const char *getGlVersion();
|
||||||
|
const char *getGlRenderer();
|
||||||
|
const char *getGlVendor();
|
||||||
|
const char *getGlExtensions();
|
||||||
|
const char *getGlPlatformExtensions();
|
||||||
|
int getGlMaxLights();
|
||||||
|
int getGlMaxTextureSize();
|
||||||
|
int getGlMaxTextureUnits();
|
||||||
|
int getGlModelviewMatrixStackDepth();
|
||||||
|
int getGlProjectionMatrixStackDepth();
|
||||||
|
void checkGlExtension(const char *extensionName);
|
||||||
|
|
||||||
|
void inline _assertGl(const char *file, int line){
|
||||||
|
|
||||||
|
GLenum error= glGetError();
|
||||||
|
|
||||||
|
if(error != GL_NO_ERROR){
|
||||||
|
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||||
|
throw runtime_error("OpenGL error: "+string(errorString)+" at file: "+string(file)+", line "+intToStr(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define assertGl() ((void) 0);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define assertGl() _assertGl(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,51 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_PARTICLERENDERERGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_PARTICLERENDERERGL_H_
|
||||||
|
|
||||||
|
#include "particle_renderer.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ParticleRendererGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ParticleRendererGl: public ParticleRenderer{
|
||||||
|
public:
|
||||||
|
static const int bufferSize = 1024;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool rendering;
|
||||||
|
Vec3f vertexBuffer[bufferSize];
|
||||||
|
Vec2f texCoordBuffer[bufferSize];
|
||||||
|
Vec4f colorBuffer[bufferSize];
|
||||||
|
|
||||||
|
public:
|
||||||
|
//particles
|
||||||
|
ParticleRendererGl();
|
||||||
|
virtual void renderManager(ParticleManager *pm, ModelRenderer *mr);
|
||||||
|
virtual void renderSystem(ParticleSystem *ps);
|
||||||
|
virtual void renderSystemLine(ParticleSystem *ps);
|
||||||
|
virtual void renderSystemLineAlpha(ParticleSystem *ps);
|
||||||
|
virtual void renderSingleModel(AttackParticleSystem *ps, ModelRenderer *mr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void renderBufferQuads(int quadCount);
|
||||||
|
void renderBufferLines(int lineCount);
|
||||||
|
void setBlendMode(ParticleSystem::BlendMode blendMode);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,111 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code 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
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_GRAPHICS_GL_SHADERGL_H_
|
||||||
|
#define _SHARED_GRAPHICS_GL_SHADERGL_H_
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
#include "shader.h"
|
||||||
|
#include "opengl.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
using std::string;
|
||||||
|
using std::pair;
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ShaderProgramGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ShaderProgramGl: public ShaderProgram{
|
||||||
|
private:
|
||||||
|
typedef pair<string, int> AttributePair;
|
||||||
|
typedef vector<AttributePair> Attributes;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Attributes attributes;
|
||||||
|
GLhandleARB handle;
|
||||||
|
VertexShader *vertexShader;
|
||||||
|
FragmentShader *fragmentShader;
|
||||||
|
bool inited;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ShaderProgramGl();
|
||||||
|
|
||||||
|
GLhandleARB getHandle() const {return handle;}
|
||||||
|
|
||||||
|
virtual void init();
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
virtual void attach(VertexShader *vertexShader, FragmentShader *fragmentShader);
|
||||||
|
virtual bool link(string &messages);
|
||||||
|
virtual void activate();
|
||||||
|
virtual void deactivate();
|
||||||
|
|
||||||
|
virtual void setUniform(const string &name, int value);
|
||||||
|
virtual void setUniform(const string &name, float value);
|
||||||
|
virtual void setUniform(const string &name, const Vec2f &value);
|
||||||
|
virtual void setUniform(const string &name, const Vec3f &value);
|
||||||
|
virtual void setUniform(const string &name, const Vec4f &value);
|
||||||
|
virtual void setUniform(const string &name, const Matrix3f &value);
|
||||||
|
virtual void setUniform(const string &name, const Matrix4f &value);
|
||||||
|
|
||||||
|
void bindAttribute(const string &name, int index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
GLint getLocation(const string &name);
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class ShaderGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class ShaderGl: virtual public Shader{
|
||||||
|
protected:
|
||||||
|
GLhandleARB handle;
|
||||||
|
ShaderSource source;
|
||||||
|
bool inited;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ShaderGl();
|
||||||
|
|
||||||
|
const ShaderSource *getSource() const {return &source;}
|
||||||
|
GLhandleARB getHandle() const {return handle;}
|
||||||
|
|
||||||
|
virtual void load(const string &path);
|
||||||
|
virtual bool compile(string &messages);
|
||||||
|
virtual void end();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class VertexShaderGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class VertexShaderGl: public VertexShader, public ShaderGl{
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
};
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class FragmentShaderGl
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
class FragmentShaderGl: public FragmentShader, public ShaderGl{
|
||||||
|
public:
|
||||||
|
virtual void init();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -13,6 +13,7 @@
|
||||||
#define _SHARED_GRAPHICS_GL_TEXTRENDERERGL_H_
|
#define _SHARED_GRAPHICS_GL_TEXTRENDERERGL_H_
|
||||||
|
|
||||||
#include "text_renderer.h"
|
#include "text_renderer.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{ namespace Gl{
|
namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue