windowed/fullscreen switch in options ( needed for windows )
watereffect improved for big unnits ( ElimiNator should test it )
This commit is contained in:
parent
1efc2dc0a6
commit
0dd135fc12
|
@ -1658,7 +1658,7 @@ void Renderer::renderWaterEffects(){
|
|||
Vec2i intPos= Vec2i(static_cast<int>(ws->getPos().x), static_cast<int>(ws->getPos().y));
|
||||
if(map->getSurfaceCell(Map::toSurfCoords(intPos))->isVisible(world->getThisTeamIndex())){
|
||||
|
||||
float scale= ws->getAnim();
|
||||
float scale= ws->getAnim()*ws->getSize();
|
||||
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f-ws->getAnim());
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
|
|
|
@ -160,6 +160,16 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
|||
listBoxScreenModes.setSelectedItem(currentResString);
|
||||
leftline-=30;
|
||||
|
||||
|
||||
//FullscreenWindowed
|
||||
labelFullscreenWindowed.init(leftLabelStart, leftline);
|
||||
listBoxFullscreenWindowed.init(leftColumnStart, leftline, 80);
|
||||
labelFullscreenWindowed.setText(lang.get("Windowed"));
|
||||
listBoxFullscreenWindowed.pushBackItem(lang.get("No"));
|
||||
listBoxFullscreenWindowed.pushBackItem(lang.get("Yes"));
|
||||
listBoxFullscreenWindowed.setSelectedItemIndex(clamp(config.getBool("Windowed"), false, true));
|
||||
leftline-=30;
|
||||
|
||||
//filter
|
||||
labelFilter.init(leftLabelStart, leftline);
|
||||
labelFilter.setText(lang.get("Filter"));
|
||||
|
@ -279,6 +289,15 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
return;
|
||||
}
|
||||
|
||||
bool currentFullscreenWindowed=config.getBool("Windowed");
|
||||
bool selectedFullscreenWindowed=listBoxFullscreenWindowed.getSelectedItemIndex();
|
||||
if(currentFullscreenWindowed!=selectedFullscreenWindowed){
|
||||
mainMessageBoxState=1;
|
||||
Lang &lang= Lang::getInstance();
|
||||
showMessageBox(lang.get("RestartNeeded"), lang.get("DisplaySettingsChanged"), false);
|
||||
return;
|
||||
}
|
||||
|
||||
saveConfig();
|
||||
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
||||
}
|
||||
|
@ -308,6 +327,7 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
listBoxVolumeMusic.mouseClick(x, y);
|
||||
listBoxScreenModes.mouseClick(x, y);
|
||||
listFontSizeAdjustment.mouseClick(x, y);
|
||||
listBoxFullscreenWindowed.mouseClick(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,6 +422,8 @@ void MenuStateOptions::render(){
|
|||
renderer.renderLabel(&labelServerPort);
|
||||
renderer.renderListBox(&listFontSizeAdjustment);
|
||||
renderer.renderLabel(&labelFontSizeAdjustment);
|
||||
renderer.renderLabel(&labelFullscreenWindowed);
|
||||
renderer.renderListBox(&listBoxFullscreenWindowed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,6 +443,7 @@ void MenuStateOptions::saveConfig(){
|
|||
int index= listBoxShadows.getSelectedItemIndex();
|
||||
config.setString("Shadows", Renderer::shadowsToStr(static_cast<Renderer::Shadows>(index)));
|
||||
|
||||
config.setBool("Windowed", listBoxFullscreenWindowed.getSelectedItemIndex());
|
||||
config.setString("Filter", listBoxFilter.getSelectedItem());
|
||||
config.setBool("Textures3D", listBoxTextures3D.getSelectedItemIndex());
|
||||
config.setBool("UnitParticles", listBoxUnitParticles.getSelectedItemIndex());
|
||||
|
@ -431,7 +454,6 @@ void MenuStateOptions::saveConfig(){
|
|||
CoreData::getInstance().getMenuMusic()->setVolume(strToInt(listBoxVolumeMusic.getSelectedItem())/100.f);
|
||||
config.setString("SoundVolumeMusic", listBoxVolumeMusic.getSelectedItem());
|
||||
|
||||
//just for the moment ....
|
||||
string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight");
|
||||
string selectedResolution=listBoxScreenModes.getSelectedItem();
|
||||
if(currentResolution!=selectedResolution){
|
||||
|
|
|
@ -55,6 +55,9 @@ private:
|
|||
GraphicListBox listBoxScreenModes;
|
||||
list<ModeInfo> modeInfos;
|
||||
|
||||
GraphicLabel labelFullscreenWindowed;
|
||||
GraphicListBox listBoxFullscreenWindowed;
|
||||
|
||||
GraphicLabel labelVideoSection;
|
||||
GraphicLabel labelAudioSection;
|
||||
GraphicLabel labelMiscSection;
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
// ==============================================================
|
||||
// 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
|
||||
// ==============================================================
|
||||
|
||||
#include "water_effects.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "map.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
// =====================================================
|
||||
// class WaterSplash
|
||||
// =====================================================
|
||||
|
||||
WaterSplash::WaterSplash(const Vec2f &pos, int size){
|
||||
this->pos= pos;
|
||||
this->size=1+(size-1)/2;
|
||||
anim= 0.f;
|
||||
enabled= true;
|
||||
|
||||
}
|
||||
|
||||
void WaterSplash::update(float amount){
|
||||
if(enabled){
|
||||
anim+= amount/size;
|
||||
if(anim>1.f){
|
||||
enabled= false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// class WaterEffects
|
||||
// ===============================
|
||||
|
||||
WaterEffects::WaterEffects(){
|
||||
anim= 0;
|
||||
}
|
||||
|
||||
void WaterEffects::update(){
|
||||
anim+= 0.5f/GameConstants::updateFps;
|
||||
if(anim>1.f){
|
||||
anim= 0;
|
||||
}
|
||||
for(int i=0; i<waterSplashes.size(); ++i){
|
||||
waterSplashes[i].update(1.f/GameConstants::updateFps);
|
||||
}
|
||||
}
|
||||
|
||||
void WaterEffects::addWaterSplash(const Vec2f &pos, int size){
|
||||
for(int i=0; i<waterSplashes.size(); ++i){
|
||||
if(!waterSplashes[i].getEnabled()){
|
||||
waterSplashes[i]= WaterSplash(pos,size);
|
||||
return;
|
||||
}
|
||||
}
|
||||
waterSplashes.push_back(WaterSplash(pos,size));
|
||||
}
|
||||
|
||||
}}//end namespace
|
|
@ -0,0 +1,77 @@
|
|||
// ==============================================================
|
||||
// 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_WATER_EFFECTS_H_
|
||||
#define _GLEST_GAME_WATER_EFFECTS_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "vec.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
using Shared::Graphics::Vec2f;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
class Map;
|
||||
|
||||
// =====================================================
|
||||
// class WaterSplash
|
||||
// =====================================================
|
||||
|
||||
class WaterSplash{
|
||||
private:
|
||||
Vec2f pos;
|
||||
int size;
|
||||
float anim;
|
||||
bool enabled;
|
||||
|
||||
public:
|
||||
WaterSplash(const Vec2f &pos, int size);
|
||||
|
||||
void update(float amount);
|
||||
|
||||
const Vec2f &getPos() const {return pos;}
|
||||
const int &getSize() const {return size;}
|
||||
float getAnim() const {return anim;}
|
||||
bool getEnabled() const {return enabled;}
|
||||
};
|
||||
|
||||
// ===============================
|
||||
// class WaterEffects
|
||||
//
|
||||
/// List of water splashes
|
||||
// ===============================
|
||||
|
||||
class WaterEffects{
|
||||
public:
|
||||
typedef vector<WaterSplash> WaterSplashes;
|
||||
|
||||
private:
|
||||
WaterSplashes waterSplashes;
|
||||
float anim;
|
||||
|
||||
public:
|
||||
WaterEffects();
|
||||
|
||||
void update();
|
||||
|
||||
float getAmin() const {return anim;}
|
||||
|
||||
void addWaterSplash(const Vec2f &pos, int size);
|
||||
int getWaterSplashCount() const {return waterSplashes.size();}
|
||||
const WaterSplash *getWaterSplash(int i) const {return &waterSplashes[i];}
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
|
@ -334,7 +334,7 @@ void World::moveUnitCells(Unit *unit){
|
|||
if(map.getSubmerged(map.getCell(unit->getLastPos()))){
|
||||
for(int i=0; i<3; ++i){
|
||||
waterEffects.addWaterSplash(
|
||||
Vec2f(unit->getLastPos().x+random.randRange(-0.4f, 0.4f), unit->getLastPos().y+random.randRange(-0.4f, 0.4f)));
|
||||
Vec2f(unit->getLastPos().x+random.randRange(-0.4f, 0.4f), unit->getLastPos().y+random.randRange(-0.4f, 0.4f)), unit->getType()->getSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue