mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Spell book animations.
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "../hch/CObjectHandler.h"
|
#include "../hch/CObjectHandler.h"
|
||||||
#include "../hch/CSpellHandler.h"
|
#include "../hch/CSpellHandler.h"
|
||||||
#include "../hch/CGeneralTextHandler.h"
|
#include "../hch/CGeneralTextHandler.h"
|
||||||
|
#include "../hch/CVideoHandler.h"
|
||||||
#include "CAdvmapInterface.h"
|
#include "CAdvmapInterface.h"
|
||||||
#include "CBattleInterface.h"
|
#include "CBattleInterface.h"
|
||||||
#include "CGameInfo.h"
|
#include "CGameInfo.h"
|
||||||
@@ -321,6 +322,8 @@ void CSpellWindow::fexitb()
|
|||||||
|
|
||||||
void CSpellWindow::fadvSpellsb()
|
void CSpellWindow::fadvSpellsb()
|
||||||
{
|
{
|
||||||
|
if (battleSpellsOnly == true)
|
||||||
|
turnPageRight();
|
||||||
battleSpellsOnly = false;
|
battleSpellsOnly = false;
|
||||||
spellSite = 0;
|
spellSite = 0;
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
@@ -328,6 +331,8 @@ void CSpellWindow::fadvSpellsb()
|
|||||||
|
|
||||||
void CSpellWindow::fbattleSpellsb()
|
void CSpellWindow::fbattleSpellsb()
|
||||||
{
|
{
|
||||||
|
if (battleSpellsOnly == false)
|
||||||
|
turnPageLeft();
|
||||||
battleSpellsOnly = true;
|
battleSpellsOnly = true;
|
||||||
spellSite = 0;
|
spellSite = 0;
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
@@ -339,6 +344,8 @@ void CSpellWindow::fmanaPtsb()
|
|||||||
|
|
||||||
void CSpellWindow::fspellsAb()
|
void CSpellWindow::fspellsAb()
|
||||||
{
|
{
|
||||||
|
if (selectedTab != 0)
|
||||||
|
turnPageRight();
|
||||||
selectedTab = 0;
|
selectedTab = 0;
|
||||||
spellSite = 0;
|
spellSite = 0;
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
@@ -346,6 +353,8 @@ void CSpellWindow::fspellsAb()
|
|||||||
|
|
||||||
void CSpellWindow::fspellsEb()
|
void CSpellWindow::fspellsEb()
|
||||||
{
|
{
|
||||||
|
if (selectedTab != 3)
|
||||||
|
turnPageRight();
|
||||||
selectedTab = 3;
|
selectedTab = 3;
|
||||||
spellSite = 0;
|
spellSite = 0;
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
@@ -353,6 +362,8 @@ void CSpellWindow::fspellsEb()
|
|||||||
|
|
||||||
void CSpellWindow::fspellsFb()
|
void CSpellWindow::fspellsFb()
|
||||||
{
|
{
|
||||||
|
if (selectedTab != 1)
|
||||||
|
turnPageRight();
|
||||||
selectedTab = 1;
|
selectedTab = 1;
|
||||||
spellSite = 0;
|
spellSite = 0;
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
@@ -360,6 +371,8 @@ void CSpellWindow::fspellsFb()
|
|||||||
|
|
||||||
void CSpellWindow::fspellsWb()
|
void CSpellWindow::fspellsWb()
|
||||||
{
|
{
|
||||||
|
if (selectedTab != 2)
|
||||||
|
turnPageRight();
|
||||||
selectedTab = 2;
|
selectedTab = 2;
|
||||||
spellSite = 0;
|
spellSite = 0;
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
@@ -367,6 +380,8 @@ void CSpellWindow::fspellsWb()
|
|||||||
|
|
||||||
void CSpellWindow::fspellsAllb()
|
void CSpellWindow::fspellsAllb()
|
||||||
{
|
{
|
||||||
|
if (selectedTab != 4)
|
||||||
|
turnPageRight();
|
||||||
selectedTab = 4;
|
selectedTab = 4;
|
||||||
spellSite = 0;
|
spellSite = 0;
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
@@ -374,15 +389,19 @@ void CSpellWindow::fspellsAllb()
|
|||||||
|
|
||||||
void CSpellWindow::fLcornerb()
|
void CSpellWindow::fLcornerb()
|
||||||
{
|
{
|
||||||
if(spellSite>0)
|
if(spellSite>0) {
|
||||||
|
turnPageLeft();
|
||||||
--spellSite;
|
--spellSite;
|
||||||
|
}
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpellWindow::fRcornerb()
|
void CSpellWindow::fRcornerb()
|
||||||
{
|
{
|
||||||
if((spellSite + 1) < (battleSpellsOnly ? sitesPerTabBattle[selectedTab] : sitesPerTabAdv[selectedTab]))
|
if((spellSite + 1) < (battleSpellsOnly ? sitesPerTabBattle[selectedTab] : sitesPerTabAdv[selectedTab])) {
|
||||||
|
turnPageRight();
|
||||||
++spellSite;
|
++spellSite;
|
||||||
|
}
|
||||||
computeSpellsPerArea();
|
computeSpellsPerArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,6 +629,34 @@ void CSpellWindow::deactivate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSpellWindow::turnPageLeft()
|
||||||
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
|
if (CGI->videoh->open("PGTRNLFT.SMK", pos.x+13, pos.y+14)) {
|
||||||
|
while(CGI->videoh->nextFrame()) {
|
||||||
|
SDL_framerateDelay(LOCPLINT->mainFPSmng);
|
||||||
|
SDL_framerateDelay(LOCPLINT->mainFPSmng);
|
||||||
|
SDL_framerateDelay(LOCPLINT->mainFPSmng);
|
||||||
|
}
|
||||||
|
CGI->videoh->close();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSpellWindow::turnPageRight()
|
||||||
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
|
if (CGI->videoh->open("PGTRNRGH.SMK", pos.x+13, pos.y+14)) {
|
||||||
|
while(CGI->videoh->nextFrame()) {
|
||||||
|
SDL_framerateDelay(LOCPLINT->mainFPSmng);
|
||||||
|
SDL_framerateDelay(LOCPLINT->mainFPSmng);
|
||||||
|
SDL_framerateDelay(LOCPLINT->mainFPSmng);
|
||||||
|
}
|
||||||
|
CGI->videoh->close();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
CSpellWindow::SpellArea::SpellArea(SDL_Rect pos, CSpellWindow * owner)
|
CSpellWindow::SpellArea::SpellArea(SDL_Rect pos, CSpellWindow * owner)
|
||||||
{
|
{
|
||||||
this->pos = pos;
|
this->pos = pos;
|
||||||
|
@@ -79,6 +79,9 @@ private:
|
|||||||
|
|
||||||
void computeSpellsPerArea(); //recalculates spellAreas::mySpell
|
void computeSpellsPerArea(); //recalculates spellAreas::mySpell
|
||||||
|
|
||||||
|
void turnPageLeft();
|
||||||
|
void turnPageRight();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * myHero); //c-tor
|
CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * myHero); //c-tor
|
||||||
~CSpellWindow(); //d-tor
|
~CSpellWindow(); //d-tor
|
||||||
|
Reference in New Issue
Block a user