mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
parent
dced6ec17c
commit
85f336cbaa
@ -1607,7 +1607,7 @@ void CAdvMapInt::fadventureOPtions()
|
|||||||
|
|
||||||
void CAdvMapInt::fsystemOptions()
|
void CAdvMapInt::fsystemOptions()
|
||||||
{
|
{
|
||||||
CSystemOptionsWindow * sysopWindow = new CSystemOptionsWindow(center(genRect(487, 481, 0, 0)), LOCPLINT);
|
CSystemOptionsWindow * sysopWindow = new CSystemOptionsWindow(Rect::createCentered(487, 481), LOCPLINT);
|
||||||
GH.pushInt(sysopWindow);
|
GH.pushInt(sysopWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1883,7 +1883,7 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
|
|||||||
k = arrowToNum(SDLKey(k));
|
k = arrowToNum(SDLKey(k));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!active)
|
if(!active || LOCPLINT->ctrlPressed())//ctrl makes arrow move screen, not hero
|
||||||
break;
|
break;
|
||||||
|
|
||||||
k -= SDLK_KP0 + 1;
|
k -= SDLK_KP0 + 1;
|
||||||
@ -1920,8 +1920,7 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Dir && key.state == SDL_PRESSED //arrow is pressed
|
if(Dir && key.state == SDL_PRESSED //arrow is pressed
|
||||||
&& (SDL_GetKeyState(NULL)[SDLK_LCTRL]
|
&& LOCPLINT->ctrlPressed()
|
||||||
|| SDL_GetKeyState(NULL)[SDLK_RCTRL])
|
|
||||||
)
|
)
|
||||||
scrollingDir |= Dir;
|
scrollingDir |= Dir;
|
||||||
else
|
else
|
||||||
|
@ -792,9 +792,15 @@ CBattleAttack::CBattleAttack(CBattleInterface * _owner, int _stackID, int _dest)
|
|||||||
attackedStack = LOCPLINT->cb->battleGetStackByPos(_dest, false);
|
attackedStack = LOCPLINT->cb->battleGetStackByPos(_dest, false);
|
||||||
attackingStack = LOCPLINT->cb->battleGetStackByID(_stackID, false);
|
attackingStack = LOCPLINT->cb->battleGetStackByID(_stackID, false);
|
||||||
|
|
||||||
assert(attackedStack && "attackedStack is NULL in CBattleAttack::CBattleAttack !\n");
|
|
||||||
assert(attackingStack && "attackingStack is NULL in CBattleAttack::CBattleAttack !\n");
|
assert(attackingStack && "attackingStack is NULL in CBattleAttack::CBattleAttack !\n");
|
||||||
|
if(attackingStack->creature->idNumber != 145) //catapult is allowed to attack not-creature
|
||||||
|
{
|
||||||
|
assert(attackedStack && "attackedStack is NULL in CBattleAttack::CBattleAttack !\n");
|
||||||
|
}
|
||||||
|
else //catapult can attack walls only
|
||||||
|
{
|
||||||
|
assert(LOCPLINT->cb->battleGetWallUnderHex(_dest) >= 0);
|
||||||
|
}
|
||||||
attackingStackPosBeforeReturn = attackingStack->position;
|
attackingStackPosBeforeReturn = attackingStack->position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#undef min;
|
#undef min
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CHeroWindow.cpp, part of VCMI engine
|
* CHeroWindow.cpp, part of VCMI engine
|
||||||
|
@ -252,7 +252,11 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details)
|
|||||||
adventureInt->heroList.draw(screen2);
|
adventureInt->heroList.draw(screen2);
|
||||||
|
|
||||||
if(details.result == TryMoveHero::TELEPORTATION || details.start == details.end)
|
if(details.result == TryMoveHero::TELEPORTATION || details.start == details.end)
|
||||||
|
{
|
||||||
|
adventureInt->paths.erase(ho); //if hero goes through teleport / gate his path will be erased
|
||||||
|
adventureInt->terrain.currentPath = NULL;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int3 hp = details.start;
|
int3 hp = details.start;
|
||||||
|
|
||||||
@ -1544,6 +1548,11 @@ void CPlayerInterface::objectRemoved( const CGObjectInstance *obj )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CPlayerInterface::ctrlPressed() const
|
||||||
|
{
|
||||||
|
return SDL_GetKeyState(NULL)[SDLK_LCTRL] || SDL_GetKeyState(NULL)[SDLK_RCTRL];
|
||||||
|
}
|
||||||
|
|
||||||
void SystemOptions::setMusicVolume( int newVolume )
|
void SystemOptions::setMusicVolume( int newVolume )
|
||||||
{
|
{
|
||||||
musicVolume = newVolume;
|
musicVolume = newVolume;
|
||||||
|
@ -190,6 +190,7 @@ public:
|
|||||||
void heroKilled(const CGHeroInstance* hero);
|
void heroKilled(const CGHeroInstance* hero);
|
||||||
void waitWhileDialog();
|
void waitWhileDialog();
|
||||||
bool shiftPressed() const; //determines if shift key is pressed (left or right or both)
|
bool shiftPressed() const; //determines if shift key is pressed (left or right or both)
|
||||||
|
bool ctrlPressed() const; //determines if ctrl key is pressed (left or right or both)
|
||||||
void redrawHeroWin(const CGHeroInstance * hero);
|
void redrawHeroWin(const CGHeroInstance * hero);
|
||||||
void updateWater();
|
void updateWater();
|
||||||
void showComp(SComponent comp); //TODO: comment me
|
void showComp(SComponent comp); //TODO: comment me
|
||||||
|
@ -776,3 +776,8 @@ bool isArrowKey( SDLKey key )
|
|||||||
{
|
{
|
||||||
return key >= SDLK_UP && key <= SDLK_LEFT;
|
return key >= SDLK_UP && key <= SDLK_LEFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect Rect::createCentered( int w, int h )
|
||||||
|
{
|
||||||
|
return Rect(screen->w/2 - w/2, screen->h/2 - h/2, w, h);
|
||||||
|
}
|
@ -132,6 +132,7 @@ struct Rect : public SDL_Rect
|
|||||||
w = r.w;
|
w = r.w;
|
||||||
h = r.h;
|
h = r.h;
|
||||||
}
|
}
|
||||||
|
static Rect createCentered(int w, int h);
|
||||||
bool isIn(int qx, int qy) const //determines if given point lies inside rect
|
bool isIn(int qx, int qy) const //determines if given point lies inside rect
|
||||||
{
|
{
|
||||||
if (qx > x && qx<x+w && qy>y && qy<y+h)
|
if (qx > x && qx<x+w && qy>y && qy<y+h)
|
||||||
|
@ -2428,7 +2428,7 @@ void CLevelWindow::close()
|
|||||||
CLevelWindow::CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback)
|
CLevelWindow::CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback)
|
||||||
{
|
{
|
||||||
LOCPLINT->showingDialog->setn(true);
|
LOCPLINT->showingDialog->setn(true);
|
||||||
heroType = hero->subID;
|
heroPortrait = hero->portrait;
|
||||||
cb = callback;
|
cb = callback;
|
||||||
for(int i=0;i<skills.size();i++)
|
for(int i=0;i<skills.size();i++)
|
||||||
{
|
{
|
||||||
@ -2515,7 +2515,7 @@ void CLevelWindow::deactivate()
|
|||||||
void CLevelWindow::show(SDL_Surface * to)
|
void CLevelWindow::show(SDL_Surface * to)
|
||||||
{
|
{
|
||||||
blitAt(bitmap,pos.x,pos.y,to);
|
blitAt(bitmap,pos.x,pos.y,to);
|
||||||
blitAt(graphics->portraitLarge[heroType],170+pos.x,66+pos.y,to);
|
blitAt(graphics->portraitLarge[heroPortrait],170+pos.x,66+pos.y,to);
|
||||||
ok->show(to);
|
ok->show(to);
|
||||||
for(int i=0;i<comps.size();i++)
|
for(int i=0;i<comps.size();i++)
|
||||||
comps[i]->show(to);
|
comps[i]->show(to);
|
||||||
|
@ -435,7 +435,7 @@ public:
|
|||||||
class CLevelWindow : public CIntObject
|
class CLevelWindow : public CIntObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int heroType;
|
int heroPortrait;
|
||||||
SDL_Surface *bitmap; //background
|
SDL_Surface *bitmap; //background
|
||||||
std::vector<CSelectableComponent *> comps; //skills to select
|
std::vector<CSelectableComponent *> comps; //skills to select
|
||||||
AdventureMapButton *ok;
|
AdventureMapButton *ok;
|
||||||
|
Loading…
Reference in New Issue
Block a user