1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00
- fixed spinning projectiles for some creatures
This commit is contained in:
Ivan Savenko 2011-08-31 12:11:34 +00:00
parent e5349c58cd
commit 3fc42134b7
5 changed files with 50 additions and 99 deletions

View File

@ -2340,8 +2340,9 @@ void CBattleInterface::bOptionsf()
CCS->curh->changeGraphic(0,0);
SDL_Rect temp_rect = genRect(431, 481, 160, 84);
CBattleOptionsWindow * optionsWin = new CBattleOptionsWindow(temp_rect, this);
Rect tempRect = genRect(431, 481, 160, 84);
tempRect += pos.topLeft();
CBattleOptionsWindow * optionsWin = new CBattleOptionsWindow(tempRect, this);
GH.pushInt(optionsWin);
}
@ -4523,108 +4524,56 @@ void CBattleResultWindow::bExitf()
CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface *owner): myInt(owner)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
pos = position;
SDL_Surface *hhlp = BitmapHandler::loadBitmap("comopbck.bmp", true);
graphics->blueToPlayersAdv(hhlp, owner->curInt->playerID);
background = SDL_ConvertSurface(hhlp, screen->format, 0);
SDL_SetColorKey(background, SDL_SRCCOLORKEY, SDL_MapRGB(background->format,0,255,255));
SDL_FreeSurface(hhlp);
background = new CPicture("comopbck.bmp");
background->colorize(owner->curInt->playerID);
viewGrid = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintCellBorders, owner, true), boost::bind(&CBattleInterface::setPrintCellBorders, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[427].first)(3,CGI->generaltexth->zelp[427].first), CGI->generaltexth->zelp[427].second, false, "sysopchk.def", NULL, 185, 140, false);
viewGrid = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintCellBorders, owner, true), boost::bind(&CBattleInterface::setPrintCellBorders, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[427].first)(3,CGI->generaltexth->zelp[427].first), CGI->generaltexth->zelp[427].second, false, "sysopchk.def", NULL, 25, 56, false);
viewGrid->select(owner->curInt->sysOpts.printCellBorders);
movementShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintStackRange, owner, true), boost::bind(&CBattleInterface::setPrintStackRange, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[428].first)(3,CGI->generaltexth->zelp[428].first), CGI->generaltexth->zelp[428].second, false, "sysopchk.def", NULL, 185, 173, false);
movementShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintStackRange, owner, true), boost::bind(&CBattleInterface::setPrintStackRange, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[428].first)(3,CGI->generaltexth->zelp[428].first), CGI->generaltexth->zelp[428].second, false, "sysopchk.def", NULL, 25, 89, false);
movementShadow->select(owner->curInt->sysOpts.printStackRange);
mouseShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintMouseShadow, owner, true), boost::bind(&CBattleInterface::setPrintMouseShadow, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[429].first)(3,CGI->generaltexth->zelp[429].first), CGI->generaltexth->zelp[429].second, false, "sysopchk.def", NULL, 185, 207, false);
mouseShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintMouseShadow, owner, true), boost::bind(&CBattleInterface::setPrintMouseShadow, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[429].first)(3,CGI->generaltexth->zelp[429].first), CGI->generaltexth->zelp[429].second, false, "sysopchk.def", NULL, 25, 122, false);
mouseShadow->select(owner->curInt->sysOpts.printMouseShadow);
animSpeeds = new CHighlightableButtonsGroup(0);
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[422].first),CGI->generaltexth->zelp[422].second, "sysopb9.def",188, 309, 1);
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[423].first),CGI->generaltexth->zelp[423].second, "sysob10.def",252, 309, 2);
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[424].first),CGI->generaltexth->zelp[424].second, "sysob11.def",315, 309, 4);
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[422].first),CGI->generaltexth->zelp[422].second, "sysopb9.def", 28, 225, 1);
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[423].first),CGI->generaltexth->zelp[423].second, "sysob10.def", 92, 225, 2);
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[424].first),CGI->generaltexth->zelp[424].second, "sysob11.def",156, 225, 4);
animSpeeds->select(owner->getAnimSpeed(), 1);
animSpeeds->onChange = boost::bind(&CBattleInterface::setAnimSpeed, owner, _1);
setToDefault = new AdventureMapButton (CGI->generaltexth->zelp[393], boost::bind(&CBattleOptionsWindow::bDefaultf,this), 405, 443, "codefaul.def");
setToDefault = new AdventureMapButton (CGI->generaltexth->zelp[393], boost::bind(&CBattleOptionsWindow::bDefaultf,this), 246, 359, "codefaul.def");
setToDefault->swappedImages = true;
setToDefault->update();
exit = new AdventureMapButton (CGI->generaltexth->zelp[392], boost::bind(&CBattleOptionsWindow::bExitf,this), 516, 443, "soretrn.def",SDLK_RETURN);
exit = new AdventureMapButton (CGI->generaltexth->zelp[392], boost::bind(&CBattleOptionsWindow::bExitf,this), 357, 359, "soretrn.def",SDLK_RETURN);
exit->swappedImages = true;
exit->update();
//printing texts to background
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[392], 242, 32, FONT_BIG, tytulowy, background); //window title
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[393], 122, 214, FONT_MEDIUM, tytulowy, background); //animation speed
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[394], 122, 293, FONT_MEDIUM, tytulowy, background); //music volume
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[395], 122, 359, FONT_MEDIUM, tytulowy, background); //effects' volume
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[396], 353, 66, FONT_MEDIUM, tytulowy, background); //auto - combat options
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[397], 353, 265, FONT_MEDIUM, tytulowy, background); //creature info
//creating labels
labels.push_back(new CLabel(242, 32, FONT_BIG, CENTER, tytulowy, CGI->generaltexth->allTexts[392]));//window title
labels.push_back(new CLabel(122, 214, FONT_MEDIUM, CENTER, tytulowy, CGI->generaltexth->allTexts[393]));//animation speed
labels.push_back(new CLabel(122, 293, FONT_MEDIUM, CENTER, tytulowy, CGI->generaltexth->allTexts[394]));//music volume
labels.push_back(new CLabel(122, 359, FONT_MEDIUM, CENTER, tytulowy, CGI->generaltexth->allTexts[395]));//effects' volume
labels.push_back(new CLabel(353, 66, FONT_MEDIUM, CENTER, tytulowy, CGI->generaltexth->allTexts[396]));//auto - combat options
labels.push_back(new CLabel(353, 265, FONT_MEDIUM, CENTER, tytulowy, CGI->generaltexth->allTexts[397]));//creature info
//auto - combat options
CSDL_Ext::printAt(CGI->generaltexth->allTexts[398], 283, 86, FONT_MEDIUM, zwykly, background); //creatures
CSDL_Ext::printAt(CGI->generaltexth->allTexts[399], 283, 116, FONT_MEDIUM, zwykly, background); //spells
CSDL_Ext::printAt(CGI->generaltexth->allTexts[400], 283, 146, FONT_MEDIUM, zwykly, background); //catapult
CSDL_Ext::printAt(CGI->generaltexth->allTexts[151], 283, 176, FONT_MEDIUM, zwykly, background); //ballista
CSDL_Ext::printAt(CGI->generaltexth->allTexts[401], 283, 206, FONT_MEDIUM, zwykly, background); //first aid tent
//auto - combat options
labels.push_back(new CLabel(283, 86, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[398]));//creatures
labels.push_back(new CLabel(283, 116, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[399]));//spells
labels.push_back(new CLabel(283, 146, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[400]));//catapult
labels.push_back(new CLabel(283, 176, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[151]));//ballista
labels.push_back(new CLabel(283, 206, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[401]));//first aid tent
//creature info
CSDL_Ext::printAt(CGI->generaltexth->allTexts[402], 283, 285, FONT_MEDIUM, zwykly, background); //all stats
CSDL_Ext::printAt(CGI->generaltexth->allTexts[403], 283, 315, FONT_MEDIUM, zwykly, background); //spells only
//creature info
labels.push_back(new CLabel(283, 285, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[402]));//all stats
labels.push_back(new CLabel(283, 315, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[403]));//spells only
//general options
CSDL_Ext::printAt(CGI->generaltexth->allTexts[404], 61, 57, FONT_MEDIUM, zwykly, background); //hex grid
CSDL_Ext::printAt(CGI->generaltexth->allTexts[405], 61, 90, FONT_MEDIUM, zwykly, background); //movement shadow
CSDL_Ext::printAt(CGI->generaltexth->allTexts[406], 61, 124, FONT_MEDIUM, zwykly, background); //cursor shadow
CSDL_Ext::printAt(CGI->generaltexth->allTexts[577], 61, 156, FONT_MEDIUM, zwykly, background); //spellbook animation
//texts printed
}
CBattleOptionsWindow::~CBattleOptionsWindow()
{
SDL_FreeSurface(background);
delete setToDefault;
delete exit;
delete viewGrid;
delete movementShadow;
delete animSpeeds;
delete mouseShadow;
}
void CBattleOptionsWindow::activate()
{
setToDefault->activate();
exit->activate();
viewGrid->activate();
movementShadow->activate();
animSpeeds->activate();
mouseShadow->activate();
}
void CBattleOptionsWindow::deactivate()
{
setToDefault->deactivate();
exit->deactivate();
viewGrid->deactivate();
movementShadow->deactivate();
animSpeeds->deactivate();
mouseShadow->deactivate();
}
void CBattleOptionsWindow::show(SDL_Surface *to)
{
if(!to) //"evaluating" to
to = screen;
SDL_BlitSurface(background, NULL, to, &pos);
setToDefault->showAll(to);
exit->showAll(to);
viewGrid->showAll(to);
movementShadow->showAll(to);
animSpeeds->showAll(to);
mouseShadow->showAll(to);
//general options
labels.push_back(new CLabel(61, 57, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[404]));
labels.push_back(new CLabel(61, 90, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[405]));
labels.push_back(new CLabel(61, 123, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[406]));
labels.push_back(new CLabel(61, 156, FONT_MEDIUM, TOPLEFT, zwykly, CGI->generaltexth->allTexts[407]));
}
void CBattleOptionsWindow::bDefaultf()

View File

@ -17,6 +17,7 @@
*
*/
class CLabel;
class CCreatureSet;
class CGHeroInstance;
class CDefHandler;
@ -339,20 +340,17 @@ class CBattleOptionsWindow : public CIntObject
{
private:
CBattleInterface * myInt;
SDL_Surface * background;
CPicture * background;
AdventureMapButton * setToDefault, * exit;
CHighlightableButton * viewGrid, * movementShadow, * mouseShadow;
CHighlightableButtonsGroup * animSpeeds;
std::vector<CLabel*> labels;
public:
CBattleOptionsWindow(const SDL_Rect & position, CBattleInterface * owner); //c-tor
~CBattleOptionsWindow(); //d-tor
void bDefaultf(); //dafault button callback
void bExitf(); //exit button callback
void activate();
void deactivate();
void show(SDL_Surface * to = 0);
};
/// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...

View File

@ -6034,6 +6034,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 &grailPos, float discoveredRatio)
SDL_FreeSurface(puzzle);
}
CCS->soundh->playSound(soundBase::OBELISK);
}
CPuzzleWindow::~CPuzzleWindow()

View File

@ -335,6 +335,9 @@ Graphics::Graphics()
{
bigImgs[i-2] = smi2->ourImages[i].bitmap;
}
//hack for green color on big infernal troglodite image - Mantis #758
SDL_Color green = {0x30, 0x5c, 0x20, SDL_ALPHA_OPAQUE};
bigImgs[71]->format->palette->colors[7] = green;
delete smi2;
}
void Graphics::loadHeroPortraits()

View File

@ -97,7 +97,7 @@
"upgrade": 9,
"defname": "CMONKK.DEF",
"projectile_defname": "CPRZEAX.DEF",
"projectile_spin": true
"projectile_spin": false
},
{
@ -107,7 +107,7 @@
"faction": 0,
"defname": "CZEALT.DEF",
"projectile_defname": "CPRZEAX.DEF",
"projectile_spin": true
"projectile_spin": false
},
{
@ -284,7 +284,7 @@
"faction": 2,
"defname": "CGREMM.DEF",
"projectile_defname": "CPRGRE.DEF",
"projectile_spin": true
"projectile_spin": false
},
{
@ -329,7 +329,7 @@
"upgrade": 35,
"defname": "CMAGE.DEF",
"projectile_defname": "PMAGEX.DEF",
"projectile_spin": true,
"projectile_spin": false,
"turret_shooter": true
},
@ -340,7 +340,7 @@
"faction": 2,
"defname": "CAMAGE.DEF",
"projectile_defname": "PMAGEX.DEF",
"projectile_spin": true
"projectile_spin": false
},
{
@ -421,7 +421,7 @@
"upgrade": 45,
"defname": "CGOG.DEF",
"projectile_defname": "CPRGOGX.DEF",
"projectile_spin": true,
"projectile_spin": false,
"turret_shooter": true
},
@ -432,7 +432,7 @@
"faction": 3,
"defname": "CMAGOG.DEF",
"projectile_defname": "CPRGOGX.DEF",
"projectile_spin": true
"projectile_spin": false
},
{