Merge branch 'develop' of github.com:MegaGlest/megaglest-source into develop
This commit is contained in:
commit
9e676a6e0e
|
@ -435,6 +435,7 @@
|
|||
<ClCompile Include="..\..\..\source\glest_game\network\server_interface.cpp" />
|
||||
<ClCompile Include="..\..\..\source\glest_game\sound\sound_container.cpp" />
|
||||
<ClCompile Include="..\..\..\source\glest_game\sound\sound_renderer.cpp" />
|
||||
<ClCompile Include="..\..\..\source\glest_game\types\projectile_type.cpp" />
|
||||
<ClCompile Include="..\..\..\source\glest_game\types\tileset_model_type.cpp" />
|
||||
<ClCompile Include="..\..\..\source\glest_game\type_instances\command.cpp" />
|
||||
<ClCompile Include="..\..\..\source\glest_game\type_instances\faction.cpp" />
|
||||
|
|
|
@ -480,12 +480,15 @@ void MainWindow::setupTimer() {
|
|||
}
|
||||
|
||||
void MainWindow::setupStartupSettings() {
|
||||
GLuint err = glewInit();
|
||||
if (GLEW_OK != err) {
|
||||
|
||||
glCanvas->setCurrentGLContext();
|
||||
|
||||
GLuint err = glewInit();
|
||||
if (GLEW_OK != err) {
|
||||
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
|
||||
//return 1;
|
||||
throw std::runtime_error((char *)glewGetErrorString(err));
|
||||
}
|
||||
}
|
||||
|
||||
renderer= Renderer::getInstance();
|
||||
|
||||
|
@ -567,12 +570,12 @@ MainWindow::~MainWindow(){
|
|||
void MainWindow::init() {
|
||||
|
||||
#if wxCHECK_VERSION(2, 9, 3)
|
||||
glCanvas->setCurrentGLContext();
|
||||
//glCanvas->setCurrentGLContext();
|
||||
//printf("setcurrent #1\n");
|
||||
#elif wxCHECK_VERSION(2, 9, 1)
|
||||
|
||||
#else
|
||||
glCanvas->SetCurrent();
|
||||
//glCanvas->SetCurrent();
|
||||
//printf("setcurrent #2\n");
|
||||
#endif
|
||||
|
||||
|
@ -585,10 +588,12 @@ void MainWindow::init() {
|
|||
void MainWindow::onPaint(wxPaintEvent &event) {
|
||||
if(!IsShown()) return;
|
||||
|
||||
#if wxCHECK_VERSION(2, 9, 3)
|
||||
#if wxCHECK_VERSION(2, 9, 4)
|
||||
//glCanvas->setCurrentGLContext();
|
||||
#elif wxCHECK_VERSION(2, 9, 3)
|
||||
|
||||
#elif wxCHECK_VERSION(2, 9, 1)
|
||||
glCanvas->setCurrentGLContext();
|
||||
//glCanvas->setCurrentGLContext();
|
||||
#endif
|
||||
|
||||
if(startupSettingsInited == false) {
|
||||
|
@ -756,8 +761,8 @@ void MainWindow::onClose(wxCloseEvent &event){
|
|||
delete timer;
|
||||
timer = NULL;
|
||||
|
||||
delete model;
|
||||
model = NULL;
|
||||
//delete model;
|
||||
//model = NULL;
|
||||
|
||||
delete renderer;
|
||||
renderer = NULL;
|
||||
|
@ -2029,7 +2034,7 @@ GlCanvas::GlCanvas(MainWindow * mainWindow, int *args)
|
|||
}
|
||||
|
||||
GlCanvas::~GlCanvas() {
|
||||
delete this->context;
|
||||
if(this->context) delete this->context;
|
||||
this->context = NULL;
|
||||
}
|
||||
|
||||
|
@ -2039,11 +2044,13 @@ void GlCanvas::setCurrentGLContext() {
|
|||
#if wxCHECK_VERSION(2, 9, 1)
|
||||
if(this->context == NULL) {
|
||||
this->context = new wxGLContext(this);
|
||||
//printf("Set ctx [%p]\n",this->context);
|
||||
}
|
||||
#endif
|
||||
//printf("Set ctx [%p]\n",this->context);
|
||||
if(this->context) {
|
||||
wxGLCanvas::SetCurrent(*this->context);
|
||||
//printf("Set ctx2 [%p]\n",this->context);
|
||||
}
|
||||
#else
|
||||
this->SetCurrent();
|
||||
|
|
|
@ -201,6 +201,7 @@ public:
|
|||
void onKeyDown(wxKeyEvent &event);
|
||||
void setCurrentGLContext();
|
||||
|
||||
wxGLContext * getCtx() { return context; }
|
||||
private:
|
||||
MainWindow *mainWindow;
|
||||
wxGLContext *context;
|
||||
|
|
|
@ -5464,19 +5464,21 @@ void Renderer::renderSelectionEffects(int healthbarMode) {
|
|||
currVec.y+= 0.3f;
|
||||
|
||||
//selection circle
|
||||
int finalHealthbarMode=hbvUndefined;
|
||||
if(healthbarMode==hbvUndefined) {
|
||||
finalHealthbarMode=unit->getFaction()->getType()->getHealthbarVisible();
|
||||
} else {
|
||||
finalHealthbarMode=healthbarMode;
|
||||
int finalHealthbarMode = hbvUndefined;
|
||||
if(healthbarMode == hbvUndefined) {
|
||||
finalHealthbarMode = unit->getFaction()->getType()->getHealthbarVisible();
|
||||
}
|
||||
bool healthbarsVisible=((finalHealthbarMode&hbvAlways)||(finalHealthbarMode&hbvSelected)||(finalHealthbarMode&hbvIfNeeded));
|
||||
float selectionCircleThickness=0.2f;
|
||||
float hpRatio;
|
||||
else {
|
||||
finalHealthbarMode = healthbarMode;
|
||||
}
|
||||
bool healthbarsVisible =((finalHealthbarMode & hbvAlways) ||
|
||||
(finalHealthbarMode & hbvSelected) ||
|
||||
(finalHealthbarMode & hbvIfNeeded));
|
||||
float selectionCircleThickness = 0.2f;
|
||||
float hpRatio = unit->getHpRatio();
|
||||
if(healthbarsVisible) {
|
||||
hpRatio=unit->getHpRatio();
|
||||
selectionCircleThickness=0.05f;
|
||||
hpRatio=1.0f;
|
||||
selectionCircleThickness = 0.05f;
|
||||
hpRatio = 1.0f;
|
||||
}
|
||||
|
||||
if(world->getThisFactionIndex() == unit->getFactionIndex()) {
|
||||
|
@ -5493,7 +5495,7 @@ void Renderer::renderSelectionEffects(int healthbarMode) {
|
|||
else if ( world->getThisTeamIndex() == unit->getTeam()) {
|
||||
glColor4f(hpRatio, hpRatio, 0, 0.3f);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
glColor4f(hpRatio, 0, 0, 0.3f);
|
||||
}
|
||||
renderSelectionCircle(currVec, unit->getType()->getSize(), selectionCircleRadius,selectionCircleThickness);
|
||||
|
|
|
@ -62,7 +62,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
|
|||
else {
|
||||
// All units are affected (including enemies)
|
||||
if(targetType == abtAll) {
|
||||
destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
destUnitMightApply = isInUnitListOrTags(dest->getType());
|
||||
}
|
||||
// Only same faction units are affected
|
||||
|
@ -70,7 +70,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
|
|||
//if(boostUnitList.empty() == true) {
|
||||
if(source->getFactionIndex() == dest->getFactionIndex()) {
|
||||
//destUnitMightApply = true;
|
||||
destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
destUnitMightApply = isInUnitListOrTags(dest->getType());
|
||||
}
|
||||
//}
|
||||
|
@ -80,7 +80,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
|
|||
//if(boostUnitList.empty() == true) {
|
||||
if(source->isAlly(dest) == true) {
|
||||
//destUnitMightApply = true;
|
||||
destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
destUnitMightApply = isInUnitListOrTags(dest->getType());
|
||||
}
|
||||
//}
|
||||
|
@ -90,7 +90,7 @@ bool AttackBoost::isAffected(const Unit *source, const Unit *dest) const {
|
|||
//if(boostUnitList.empty() == true) {
|
||||
if(source->isAlly(dest) == false) {
|
||||
//destUnitMightApply = true;
|
||||
destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
//destUnitMightApply = (boostUnitList.empty() && tags.empty());
|
||||
destUnitMightApply = isInUnitListOrTags(dest->getType());
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -141,6 +141,8 @@ UnitType::UnitType() : ProducibleType() {
|
|||
size=0;
|
||||
renderSize=0;
|
||||
height=0;
|
||||
burnHeight=0;
|
||||
targetHeight=0;
|
||||
|
||||
addItemToVault(&(this->maxHp),this->maxHp);
|
||||
addItemToVault(&(this->hpRegeneration),this->hpRegeneration);
|
||||
|
@ -644,7 +646,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
}
|
||||
}
|
||||
sortedItems.clear();
|
||||
hasDup = false;
|
||||
//hasDup = false;
|
||||
|
||||
// Lootable resources (resources given/lost on death)
|
||||
if(parametersNode->hasChild("resources-death")) {
|
||||
|
|
|
@ -79,6 +79,15 @@ private:
|
|||
bool negativeAllowed;
|
||||
|
||||
public:
|
||||
LootableResource() {
|
||||
type=NULL;
|
||||
amountValue=0;
|
||||
amountFactionPercent=0;
|
||||
lossValue=0;
|
||||
lossFactionPercent=0;
|
||||
negativeAllowed=false;
|
||||
}
|
||||
|
||||
const ResourceType* getResourceType() const {return type;}
|
||||
void setResourceType(const ResourceType *type) {this->type=type;}
|
||||
|
||||
|
@ -282,7 +291,7 @@ public:
|
|||
int getTargetHeight() const {return targetHeight;}
|
||||
int getStoredResourceCount() const {return (int)storedResources.size();}
|
||||
inline const Resource *getStoredResource(int i) const {return &storedResources[i];}
|
||||
int getLootableResourceCount() const {return lootableResources.size();}
|
||||
int getLootableResourceCount() const {return (int)lootableResources.size();}
|
||||
inline const LootableResource getLootableResource(int i) const {return lootableResources.at(i);}
|
||||
const set<string> &getTags() const {return tags;}
|
||||
bool getCellMapCell(int x, int y, CardinalDir facing) const;
|
||||
|
|
|
@ -781,7 +781,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
|||
|
||||
}
|
||||
sortedItems.clear();
|
||||
hasDup = false;
|
||||
//hasDup = false;
|
||||
|
||||
//effects -- get list of affected units
|
||||
const XmlNode *effectsNode= upgradeNode->getChild("effects");
|
||||
|
|
|
@ -120,6 +120,8 @@ public:
|
|||
moveSpeedIsMultiplier = false;
|
||||
prodSpeed = 0;
|
||||
prodSpeedIsMultiplier = false;
|
||||
attackSpeed = 0;
|
||||
attackSpeedIsMultiplier = false;
|
||||
}
|
||||
virtual ~UpgradeTypeBase() {}
|
||||
|
||||
|
|
|
@ -138,12 +138,12 @@ END_EVENT_TABLE()
|
|||
|
||||
void MainWindow::init(string fname) {
|
||||
#if wxCHECK_VERSION(2, 9, 3)
|
||||
glCanvas->setCurrentGLContext();
|
||||
//glCanvas->setCurrentGLContext();
|
||||
//printf("setcurrent #1\n");
|
||||
#elif wxCHECK_VERSION(2, 9, 1)
|
||||
|
||||
#else
|
||||
glCanvas->SetCurrent();
|
||||
//glCanvas->SetCurrent();
|
||||
//printf("setcurrent #2\n");
|
||||
#endif
|
||||
|
||||
|
@ -638,11 +638,17 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
return;
|
||||
}
|
||||
|
||||
#if wxCHECK_VERSION(2, 9, 3)
|
||||
//#if wxCHECK_VERSION(2, 9, 3)
|
||||
|
||||
#elif wxCHECK_VERSION(2, 9, 1)
|
||||
glCanvas->setCurrentGLContext();
|
||||
#endif
|
||||
//#elif wxCHECK_VERSION(2, 9, 1)
|
||||
// glCanvas->setCurrentGLContext();
|
||||
//#endif
|
||||
|
||||
static bool contextSet = false;
|
||||
if(contextSet == false) {
|
||||
contextSet = true;
|
||||
glCanvas->setCurrentGLContext();
|
||||
}
|
||||
|
||||
if(lastPaintEvent.getMillis() < 30) {
|
||||
sleep(1);
|
||||
|
|
|
@ -1099,7 +1099,7 @@ Model::Model() {
|
|||
}
|
||||
|
||||
Model::~Model() {
|
||||
delete [] meshes;
|
||||
if(meshes) delete [] meshes;
|
||||
meshes = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -619,7 +619,7 @@ void updatePathClimbingParts(string &path,bool processPreviousDirTokenCheck) {
|
|||
//printf("x [%d][%c] pos [%ld][%c] [%s]\n",x,path[x],(long int)pos,path[pos],path.substr(0,x+1).c_str());
|
||||
|
||||
if((path[x] == '/' || path[x] == '\\') && x != (int)pos) {
|
||||
string origLoop = path;
|
||||
//string origLoop = path;
|
||||
path.erase(x,(int)pos-x);
|
||||
|
||||
//printf("#5 [%d] [%d] [%d] CHANGE relative path from [%s] to [%s]\n",(int)pos,(int)x,(int)origLoop.length(),origLoop.c_str(),path.c_str());
|
||||
|
@ -2455,7 +2455,7 @@ void ValueCheckerVault::checkItemInVault(const void *ptr,int value) const {
|
|||
}
|
||||
|
||||
string getUserHome() {
|
||||
string home_folder = "";
|
||||
string home_folder;
|
||||
home_folder = safeCharPtrCopy(getenv("HOME"),8095);
|
||||
if(home_folder == "") {
|
||||
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|
||||
|
|
|
@ -136,6 +136,7 @@ static int getFileAndLine(char *function, void *address, char *file, size_t flen
|
|||
#if __APPLE_CC__
|
||||
//### TODO Will: still working this out
|
||||
int len = fread(buf,1,maxbufSize,f);
|
||||
pclose(f);
|
||||
buf[len] = 0;
|
||||
fprintf(stderr,"< %s",buf);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user